@@ -90,6 +90,9 @@ try {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ImportLegalRulesTest.php', 'tests/Feature/ImportTariffCodesTest.php',
|
||||
'tests/Feature/ImportReadinessTest.php', 'tests/Feature/ImportBankSupportTest.php', 'tests/Feature/OperationalHealthTest.php', 'tests/Feature/ImportDossierTest.php']];
|
||||
}
|
||||
if (in_array('--legal-reference-focused', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ImportLegalReferenceDraftsTest.php', 'tests/Feature/ImportLegalRulesTest.php']];
|
||||
}
|
||||
if (in_array('--legal-amounts-focused', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ImportLegalEstimatesTest.php', 'tests/Feature/ImportLegalRulesTest.php',
|
||||
'tests/Feature/ImportEstimatesTest.php', 'tests/Feature/ImportEstimatePlanTest.php', 'tests/Feature/InternalRequisitionCandidateTest.php', 'tests/Feature/RequisitionApprovalLevelsTest.php']];
|
||||
@@ -123,6 +126,9 @@ try {
|
||||
if (in_array('--urgent-review-focused', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/RequisitionBudgetCyclesTest.php', '--filter=posterior urgent review|urgent review keeps indeterminate']];
|
||||
}
|
||||
if (in_array('--conflict-release-focused', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ConflictDeclarationTest.php']];
|
||||
}
|
||||
if (in_array('--cycle-history-focused', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/RequisitionBudgetCyclesTest.php', 'tests/Feature/ImportEstimatesTest.php',
|
||||
'--filter=native expiry returns the same request|expired import cycle preserves']];
|
||||
@@ -152,6 +158,24 @@ try {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/RequisitionBudgetCyclesTest.php',
|
||||
'tests/Feature/InternalRequisitionCandidateTest.php', 'tests/Feature/BudgetTest.php']];
|
||||
}
|
||||
if (in_array('--operational-orders-focused', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/OperationalOrdersTest.php', 'tests/Feature/PurchaseAwardOrderTest.php',
|
||||
'--filter=operational register|utilisation mode|request links preserve|policy versions and company department|native orders freeze their production origin|metadata authority never opens']];
|
||||
}
|
||||
if (in_array('--operational-orders-access-only', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/OperationalOrdersTest.php', '--filter=metadata authority never opens']];
|
||||
}
|
||||
if (in_array('--stock-use-minimum-focused', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/SupplyPlanningTest.php',
|
||||
'--filter=minimum stock is explicitly configured']];
|
||||
}
|
||||
if (in_array('--urgent-quotation-focused', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/UrgentQuotationBasisTest.php', 'tests/Feature/PurchaseAwardOrderTest.php', 'tests/Feature/OrganizationConfigurationTest.php',
|
||||
'--filter=urgent reduction|unmet minimum|urgent minimum is|native urgent order|comparison policy requires valid weights']];
|
||||
}
|
||||
if (in_array('--private-audit-focused', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/PrivateAuditExporterTest.php', 'tests/Feature/PrivateAuditSourcesTest.php', 'tests/Feature/PrivateAuditAccessTest.php']];
|
||||
}
|
||||
if (in_array('--requisition-cycles-import-regression', $argv, true)) {
|
||||
$commands = [[PHP_BINARY, 'vendor/bin/pest', '--compact', 'tests/Feature/ImportEstimatesTest.php', 'tests/Feature/ImportLandedCostsTest.php']];
|
||||
}
|
||||
|
||||
@@ -117,10 +117,11 @@ try {
|
||||
}
|
||||
const raceOnly = process.argv.includes('--race-only');
|
||||
const recoveryOnly = process.argv.includes('--recovery-only');
|
||||
const nativeAuditSchemaOnly = process.argv.includes('--audit-schema-only');
|
||||
const nativeFixtureOnly = process.argv.includes('--native-review-fixture-only');
|
||||
const nativeHttpOnly = process.argv.includes('--native-review-http-only');
|
||||
const nativeOfficeOnly = process.argv.includes('--native-office-http-only');
|
||||
const nativeReview = process.argv.includes('--native-review') || nativeFixtureOnly || nativeHttpOnly || nativeOfficeOnly;
|
||||
const nativeReview = process.argv.includes('--native-review') || nativeFixtureOnly || nativeHttpOnly || nativeOfficeOnly || nativeAuditSchemaOnly;
|
||||
const setupOnly = raceOnly || recoveryOnly || nativeReview;
|
||||
const args = setupOnly ? ['artisan', 'migrate', '--force', '--no-interaction'] : process.argv.includes('--integrated-release-journeys') ? ['vendor/bin/pest', '--compact', 'tests/Feature/RequisitionLedgerAccountsTest.php', 'tests/Feature/RequisitionBudgetCyclesTest.php', 'tests/Feature/PurchaseAwardOrderTest.php', 'tests/Feature/ImportLandedCostsTest.php', '--filter=RequisitionBudgetCyclesTest|ImportLandedCostsTest|native office purchase|native partial-order|native consolidated order|native delivery analysis'] : process.argv.includes('--integrated-import-costs-only') ? ['vendor/bin/pest', '--compact', 'tests/Feature/ImportLandedCostsTest.php'] : process.argv.includes('--integrated-orders-only') ? ['vendor/bin/pest', '--compact', 'tests/Feature/PurchaseAwardOrderTest.php', '--filter=native partial-order|native consolidated order|native delivery analysis'] : process.argv.includes('--integrated-cycles-only') ? ['vendor/bin/pest', '--compact', 'tests/Feature/RequisitionBudgetCyclesTest.php'] : process.argv.includes('--office-process-only') ? ['vendor/bin/pest', '--compact', 'tests/Feature/RequisitionLedgerAccountsTest.php', '--filter=native office purchase'] : ['vendor/bin/pest', '--compact', 'tests/Feature/RequisitionLedgerAccountsTest.php', 'tests/Feature/PurchaseAwardOrderTest.php',
|
||||
'--filter=minimal purchasing catalogue|chart references reject|native line account assignment|classified line requires|native submission requires account|zero monetary line retains|native order preserves common ledger|native office purchase'];
|
||||
@@ -190,15 +191,29 @@ try {
|
||||
if (seed.status !== 0) throw Error('Native review fixture failed: '+(seed.stderr || seed.stdout || '').replaceAll(password, '[private]'));
|
||||
const fixture = JSON.parse(seed.stdout);
|
||||
fs.writeFileSync(path.join(root, 'native-review.json'), JSON.stringify(fixture));
|
||||
const assets = path.join(privateParent, 'sgc-company-preparation-final-qa-20261128');
|
||||
const assets = path.join(privateParent, 'sgc-private-audit-help-qa-20261128');
|
||||
const manifest = fs.readFileSync(path.join(assets, 'manifest.json'));
|
||||
const manifestHash = crypto.createHash('sha256').update(manifest).digest('hex');
|
||||
if (manifestHash !== 'df4e07d422af16897581371283d9730f41076ad2888d1e4911bdd7cadbb92c5f') throw Error('Unexpected private review manifest');
|
||||
if (manifestHash !== 'fa87e37a3626ef75d22b5248dce9a0af2bad68c967e6f99bb64bc426a68f6aaf') throw Error('Unexpected private review manifest');
|
||||
for (const entry of Object.values(JSON.parse(manifest))) {
|
||||
if (!fs.existsSync(path.join(assets, entry.file))) throw Error('Private review asset missing');
|
||||
}
|
||||
fs.cpSync(assets, path.join(root, 'public/build'), { recursive: true });
|
||||
if (nativeFixtureOnly) {
|
||||
if (nativeAuditSchemaOnly) {
|
||||
if (!frozenRuntime || !process.argv.includes('--integrated-schema')) throw Error('Audit schema inventory requires the pinned private composition');
|
||||
const schema = spawnSync('php', ['tests/Concurrency/requisition-account-worker.php', database, 'describe-private-audit-schema'], {
|
||||
cwd: workspace, windowsHide: true, encoding: 'utf8', maxBuffer: 4 * 1024 * 1024,
|
||||
env: { ...environment, SGC_REQUISITION_QA_ROOT: root },
|
||||
});
|
||||
if (schema.status !== 0) throw Error('Private audit schema inventory failed');
|
||||
const inventory = JSON.parse(schema.stdout);
|
||||
if (inventory.schema_only !== true || inventory.no_business_values !== true) throw Error('Schema-only contract refused');
|
||||
const target = path.join(privateParent, 'private-audit-source-schema-20261128.json');
|
||||
const bytes = JSON.stringify(inventory, null, 2)+'\n';
|
||||
if (fs.existsSync(target) && fs.readFileSync(target, 'utf8') !== bytes) throw Error('Preserve the previous private schema inventory before replacing it');
|
||||
fs.writeFileSync(target, bytes);
|
||||
console.log(JSON.stringify({ private_audit_schema_inventory: true, tables: Object.keys(inventory.tables).length, business_values_exported: false, target }));
|
||||
} else if (nativeFixtureOnly) {
|
||||
console.log(JSON.stringify({ private_native_fixture_verified: true, ...fixture, private_manifest_sha256: manifestHash }));
|
||||
} else {
|
||||
const port = await new Promise((resolve, reject) => {
|
||||
@@ -243,7 +258,7 @@ try {
|
||||
console.log(JSON.stringify({ private_native_office_http_verified: true, ...result, private_manifest_sha256: manifestHash }));
|
||||
} else if (nativeHttpOnly) {
|
||||
const { verifyNativeReviewHttp } = await import('./requisition-native-http-check.mjs');
|
||||
const pageAssets = ['resources/js/pages/supply/index.tsx', 'resources/js/pages/purchase-controls/index.tsx', 'resources/js/pages/purchase-controls/orders.tsx', 'resources/js/pages/budgets/index.tsx', 'resources/js/pages/conflicts/index.tsx', 'resources/js/pages/conflicts/show.tsx', 'resources/js/pages/payments/index.tsx', 'resources/js/pages/stock/index.tsx', 'resources/js/pages/stock/operations.tsx', 'resources/js/pages/stock/lots.tsx', 'resources/js/pages/stock/reversals.tsx', 'resources/js/pages/stock/dispositions.tsx', 'resources/js/pages/equipment/index.tsx', 'resources/js/pages/investment/index.tsx', 'resources/js/pages/company/parameters.tsx', 'resources/js/pages/company/index.tsx', 'resources/js/pages/company/setup.tsx']
|
||||
const pageAssets = ['resources/js/pages/audit/private.tsx', 'resources/js/pages/supply/index.tsx', 'resources/js/pages/purchase-controls/index.tsx', 'resources/js/pages/purchase-controls/orders.tsx', 'resources/js/pages/budgets/index.tsx', 'resources/js/pages/conflicts/index.tsx', 'resources/js/pages/conflicts/show.tsx', 'resources/js/pages/payments/index.tsx', 'resources/js/pages/stock/index.tsx', 'resources/js/pages/stock/operations.tsx', 'resources/js/pages/stock/lots.tsx', 'resources/js/pages/stock/reversals.tsx', 'resources/js/pages/stock/dispositions.tsx', 'resources/js/pages/equipment/index.tsx', 'resources/js/pages/investment/index.tsx', 'resources/js/pages/company/parameters.tsx', 'resources/js/pages/company/index.tsx', 'resources/js/pages/company/setup.tsx', 'resources/js/pages/requisitions/operational-orders.tsx', 'resources/js/pages/requisitions/urgent-stock.tsx']
|
||||
.map(key => JSON.parse(manifest)[key]);
|
||||
const result = await verifyNativeReviewHttp(url, fixture, {
|
||||
assets: pageAssets.map(entry => ({ file: entry.file, sha256: crypto.createHash('sha256').update(fs.readFileSync(path.join(assets, entry.file))).digest('hex') })),
|
||||
|
||||
@@ -19,11 +19,25 @@ export async function verifyNativeReviewHttp(origin, fixture, { assets, snapshot
|
||||
const reviewer = client();
|
||||
const auditor = client();
|
||||
const requester = client();
|
||||
const privateAuditor = client();
|
||||
await reviewer.login(fixture.synthetic_login);
|
||||
await auditor.login(fixture.synthetic_metadata_login);
|
||||
await requester.login(fixture.synthetic_requester_login);
|
||||
await privateAuditor.login(fixture.synthetic_private_audit_login);
|
||||
// Login/logout may legitimately rotate native authentication fields. Compare the read window only.
|
||||
const before = await snapshot();
|
||||
const privateAudit = await privateAuditor.page('/auditoria/privada', 'audit/private');
|
||||
check(privateAudit.props.families.length === 4 && privateAudit.props.exports.data.length === 0, 'dedicated private authority opens approved families without generating a package');
|
||||
for (const actor of [reviewer, auditor, requester]) check((await actor.request('/auditoria/privada')).status === 403, 'other authorities cannot open private audit');
|
||||
check((await privateAuditor.request('/orcamentos')).status === 403, 'private audit never grants native financial workspace');
|
||||
const operationalOrders = await reviewer.page('/ordens-operacionais', 'requisitions/operational-orders');
|
||||
check((await auditor.request('/ordens-operacionais')).status === 403, 'metadata authority never grants operational order register access');
|
||||
check(operationalOrders.props.canConfigure === true && operationalOrders.props.policy === null, 'native admin can configure origin but a GET does not select an origin');
|
||||
const ownOperationalOrders = await requester.page('/ordens-operacionais', 'requisitions/operational-orders');
|
||||
check(ownOperationalOrders.props.canConfigure === false && ownOperationalOrders.props.allowedTypes.length === 0, 'requester receives no production workshop or procurement order creation grant');
|
||||
const urgentStock = await reviewer.page(`/requisicoes/${fixture.historical_decision_request}/urgencia-stock`, 'requisitions/urgent-stock');
|
||||
check(urgentStock.props.eligible.length === 0, 'ordinary historical source receives no implicit urgent reduction');
|
||||
check((await requester.request(`/requisicoes/${fixture.historical_decision_request}/urgencia-stock`)).status === 403, 'request ownership does not grant stock threshold preparation or quotation oversight');
|
||||
const budgets = await reviewer.page('/orcamentos', 'budgets/index');
|
||||
check(budgets.props.budgets.length > 0, 'native synthetic budget is visible to its authorised reader');
|
||||
const budgetHeaders = await reviewer.request('/orcamentos');
|
||||
@@ -93,10 +107,24 @@ export async function verifyNativeReviewHttp(origin, fixture, { assets, snapshot
|
||||
check(await csv(reviewer) === await csv(auditor), 'both metadata grants export the same scoped metadata without private context');
|
||||
const after = await snapshot();
|
||||
check(JSON.stringify(before) === JSON.stringify(after), 'all native table rows and columns unchanged during read window');
|
||||
const auditInput = {operation_key: crypto.randomUUID(), families: ['purchasing', 'stock', 'finance', 'configuration'], purpose: 'Owned synthetic native QA export'};
|
||||
await privateAuditor.post('/auditoria/privada', auditInput);
|
||||
const prepared = await privateAuditor.page('/auditoria/privada', 'audit/private');
|
||||
check(prepared.props.exports.data.length === 1, 'one private package prepared after the unchanged read window');
|
||||
const packageRow = prepared.props.exports.data[0];
|
||||
const download = await privateAuditor.request(packageRow.download_url);
|
||||
check(download.status === 200 && download.headers.get('Cache-Control')?.includes('no-store'), 'authenticated private package download');
|
||||
const bytes = Buffer.from(await download.arrayBuffer());
|
||||
check(bytes.length === packageRow.size && crypto.createHash('sha256').update(bytes).digest('hex') === packageRow.sha256, 'native download bytes match immutable package size and SHA256');
|
||||
await privateAuditor.post('/auditoria/privada', auditInput);
|
||||
const replay = await privateAuditor.page('/auditoria/privada', 'audit/private');
|
||||
check(replay.props.exports.data.length === 1 && replay.props.exports.data[0].sha256 === packageRow.sha256, 'replay preserves the same archive');
|
||||
check((await auditor.request(packageRow.download_url)).status === 403, 'metadata cannot download private package');
|
||||
await reviewer.logout();
|
||||
await auditor.logout();
|
||||
await requester.logout();
|
||||
return { checks, fortify_sessions: 3, missing_csrf_refused: true, stale_inertia_version_refused: true, supply_views: 9, purchase_control_views: 2, requester_scope_verified: true, encrypted_history_verified: true,
|
||||
budget_view_verified: true, conflict_index_verified: true, stock_views_verified: 2, equipment_view_verified: true, investment_view_verified: true, company_configuration_verified: true, metadata_scope_isolation_verified: true, readonly_tables_equal: Object.keys(before).length,
|
||||
private_asset_verified: true, private_assets_verified: assets.length, business_commands_sent: 0, browser_visual_acceptance: false };
|
||||
await privateAuditor.logout();
|
||||
return { checks, fortify_sessions: 4, missing_csrf_refused: true, stale_inertia_version_refused: true, supply_views: 9, purchase_control_views: 2, requester_scope_verified: true, encrypted_history_verified: true,
|
||||
budget_view_verified: true, conflict_index_verified: true, stock_views_verified: 2, equipment_view_verified: true, investment_view_verified: true, company_configuration_verified: true, operational_orders_verified: true, urgent_stock_verified: true, metadata_scope_isolation_verified: true, readonly_tables_equal: Object.keys(before).length,
|
||||
private_asset_verified: true, private_assets_verified: assets.length, business_commands_sent: 0, audit_export_commands_sent: 2, private_audit_download_verified: true, browser_visual_acceptance: false };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user