Files
SGF/scripts/summarize-payable-evidence.mjs
2026-11-04 09:37:20 +02:00

33 lines
3.8 KiB
JavaScript

import fs from 'node:fs';
import path from 'node:path';
import crypto from 'node:crypto';
const read = p => JSON.parse(fs.readFileSync(p, 'utf8').replace(/^\uFEFF/, ''));
const hash = p => crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');
const state = read('C:/laragon/data/sgf-tempo/run/modular-regression-current.json');
const tag = process.argv[2];
if (state.port !== 55439 || !/^[a-f0-9]{12}$/.test(tag ?? '')) throw Error('Owned regression context required');
const root = path.join(state.root, 'private/payable-history-' + tag);
const settings = read(path.join(root, 'settings.json'));
if (settings.tag !== tag || settings.cluster !== 'sgf_modular_regression_' + state.id) throw Error('Owned cluster mismatch');
const cases = read(path.join(root, 'evidence-cases.json'));
const integration = read(path.join(root, 'evidence-settlements.json'));
const http = read(path.join(root, 'evidence-http.json'));
const post = read(path.join(root, 'evidence-post.json'));
if (!cases.passed || cases.cases.some(c => !c.passed) || !integration.passed || !http.passed || !post.passed || !post.previous_scoped_business_fingerprint_equal || !integration.schema_and_test_rows_rolled_back) throw Error('Evidence incomplete');
if (hash(path.join(root, 'page-post.json')) !== post.previous_post_proof_sha256) throw Error('Prior final proof changed');
const previousFiles = ['docs/proofs/sgf-payable-paged-read-20261102.json', 'docs/proofs/native-payable-paged-read-20261102.json', 'docs/proofs/module-association-http-lock-summary-20261102.json'];
for (const proof of read(previousFiles[1]).previous) if (hash(proof.file) !== proof.sha256) throw Error('Prior proof chain changed');
const files = ['app/Modules/Purchasing/SupplierPayables.php', 'app/Modules/Purchasing/SupplierPayablesController.php', 'app/Modules/Purchasing/SupplierPaymentsController.php', 'packages/payables/src/SettlementHttp.php', 'packages/payables/ui/page.php', 'packages/payables/ui/settlements.php', 'scripts/payable-history-sgf-proof.php', 'scripts/payable-evidence-cases.php', 'scripts/payable-evidence-settlements.php', 'scripts/payable-evidence-http.mjs', 'scripts/payable-evidence-post.php', 'scripts/summarize-payable-evidence.mjs'];
const result = {
increment: 'SGF-PAYABLE-EVIDENCE-FOCUS-SIM-v1', date: '2026-11-02', synthetic_only: true,
cases, integration, http, preservation: post,
sources: files.map(file => ({file, sha256: hash(file)})),
prior_proofs_preserved: previousFiles.map(file => ({file, sha256: hash(file)})),
evidence: ['evidence-cases.json', 'evidence-settlements.json', 'evidence-http.json', 'evidence-post.json'].map(file => ({file: 'private/payable-history-' + tag + '/' + file, sha256: hash(path.join(root, file))})),
limits: ['Source means the SGF local receipt mapping, not a native invoice ID or a cross-application ID match.', 'Financial origins remain synthetic historical receipts; no live SGF provenance authentication or financial-responsibility cutover.', 'Obligation selection follows server-paged documents; payment/allocation history retains its existing full scoped listing and writer authorization.', 'No new payment or allocation execution, native package activation, operational migration, rights, index, publication or checkpoint.', 'Existing load evidence reused without new throughput or deployment-capacity claims.'],
six_pending_associations_untouched: true, blocked_cache_untouched: true, visual_review_pending: true, deployment_capacity_validated: false,
};
fs.writeFileSync('docs/proofs/sgf-payable-evidence-focus-20261102.json', JSON.stringify(result, null, 2) + '\n');
console.log(JSON.stringify({focused_cases: cases.cases.length, focused_assertions: cases.assertions, integration_assertions: integration.assertions, http_checks: http.checks, earlier_business_fingerprint_preserved: true}));