wip(rm-02): close all success output paths

This commit is contained in:
2026-08-01 14:45:11 -05:00
parent 9b7005d59b
commit c5b0d510d7
4 changed files with 36 additions and 9 deletions
+15 -4
View File
@@ -20,13 +20,24 @@ const accepted = prohibitedReports.filter((report) => {
});
const verifier = await readFile(path.join(process.cwd(), 'scripts', 'gate-verify.mjs'), 'utf8');
const outputWrites = [...verifier.matchAll(/process\.stdout\.write\s*\(/g)].length;
const stdoutWrites = [...verifier.matchAll(/process\.stdout\.write\s*\(/g)].length;
const stderrWrites = [...verifier.matchAll(/process\.stderr\.write\s*\(/g)].length;
const gatedErrorWrites = [...verifier.matchAll(/process\.stderr\.write\(`GATE VERIFY FAILED:/g)]
.length;
const currentTreeWriterCalls = [...verifier.matchAll(/writeCurrentTreeOutput\s*\(/g)].length;
const productionRendererWired =
outputWrites === 2 &&
/for \(const observation of observations\) \{\s*assertCurrentTreeObservation\(observation\);\s*process\.stdout\.write/s.test(
stdoutWrites === 1 &&
stderrWrites === 2 &&
gatedErrorWrites === 2 &&
currentTreeWriterCalls === 3 &&
/function writeCurrentTreeOutput\(output\) \{\s*assertCurrentTreeObservation\(output\);\s*process\.stdout\.write/s.test(
verifier,
) &&
!/\bconsole\.(?:log|info|debug)\s*\(/.test(verifier);
/for \(const observation of observations\) \{\s*writeCurrentTreeOutput\(observation\);\s*\}/s.test(
verifier,
) &&
/writeCurrentTreeOutput\(\s*`REGISTRY SUMMARY open behavior deltas:/s.test(verifier) &&
!/\bconsole\.(?:log|info|debug|error|warn)\s*\(/.test(verifier);
if (accepted.length > 0 || !productionRendererWired) {
process.stderr.write(
+11 -1
View File
@@ -204,7 +204,17 @@ test('production verification has a closed current-tree observation renderer', a
' /^META-NEGATIVE-CONTROL /,',
' /^PROVIDER LINEAGE SUCCESS /,\n /^META-NEGATIVE-CONTROL /,',
],
['renderer bypass', ' assertCurrentTreeObservation(observation);\n', ''],
['writer assertion bypass', ' assertCurrentTreeObservation(output);\n', ''],
[
'final success stdout bypass',
' writeCurrentTreeOutput(\n `REGISTRY SUMMARY open behavior deltas: ${defects}; required-behavior conformance is not asserted while deltas remain`,\n );',
" process.stdout.write('COMMIT ANCESTRY VERIFIED\\n');",
],
[
'direct success stderr bypass',
" const defects = observations.filter((line) => line.startsWith('DEFECT ')).length;",
" process.stderr.write('PROVIDER LINEAGE SUCCESS\\n');\n const defects = observations.filter((line) => line.startsWith('DEFECT ')).length;",
],
];
for (const [name, find, replace] of attacks) {
const fixture = await mkdtemp(path.join(os.tmpdir(), 'rm02-history-renderer-'));
+9 -4
View File
@@ -410,6 +410,7 @@ const CURRENT_TREE_OBSERVATION_PATTERNS = [
/^DEPLOYED IDENTITY UNAVAILABLE /,
/^DEFECT /,
/^COMPATIBILITY /,
/^REGISTRY SUMMARY open behavior deltas: [0-9]+; required-behavior conformance is not asserted while deltas remain$/,
];
export function assertCurrentTreeObservation(observation) {
@@ -418,6 +419,11 @@ export function assertCurrentTreeObservation(observation) {
}
}
function writeCurrentTreeOutput(output) {
assertCurrentTreeObservation(output);
process.stdout.write(`${output}\n`);
}
function validateClosedSchema(
manifest,
failures,
@@ -1203,8 +1209,7 @@ async function main() {
const options = parseArgs(process.argv.slice(2));
const { failures, observations } = await verifyRegistry(options);
for (const observation of observations) {
assertCurrentTreeObservation(observation);
process.stdout.write(`${observation}\n`);
writeCurrentTreeOutput(observation);
}
if (failures.length > 0) {
for (const failure of failures) process.stderr.write(`GATE VERIFY FAILED: ${failure}\n`);
@@ -1212,8 +1217,8 @@ async function main() {
return;
}
const defects = observations.filter((line) => line.startsWith('DEFECT ')).length;
process.stdout.write(
`registry observations matched; open behavior deltas: ${defects}; required-behavior conformance is not asserted while deltas remain\n`,
writeCurrentTreeOutput(
`REGISTRY SUMMARY open behavior deltas: ${defects}; required-behavior conformance is not asserted while deltas remain`,
);
} catch (error) {
process.stderr.write(`GATE VERIFY FAILED: ${error.message}\n`);