Skip to content

Commit abab914

Browse files
docs(intake): reviewer-commands table for the intake kit, wired to a live contract test
Rows parsed from the README and executed against the real tools in procedure order — the contract caught and fixed a broken documented one-liner (bare 'packages/…' ESM import) on its first day. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent 6c15b12 commit abab914

3 files changed

Lines changed: 135 additions & 3 deletions

File tree

‎examples/real-fixture-intake/README.md‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ archive is hand-built with Node's stdlib only (no zip dependency):
153153
Independent re-verification of the output (same gate a reviewer runs):
154154

155155
```bash
156-
node -e "import('packages/delivery/sdk.js').then(m => m.verifyFixture({ fixtureDir: '<out-dir>' })).then(r => console.log(r.status, r.decision))"
156+
node -e "import('./packages/delivery/sdk.js').then(m => m.verifyFixture({ fixtureDir: '<out-dir>' })).then(r => console.log(r.status, r.decision))"
157157
```
158158

159159
The converter's success report already quotes the decision with every
@@ -176,6 +176,22 @@ acceptance/rejection record, both positions and requested remedies, and
176176
the retention limits. That list is People's Court's own checklist,
177177
verbatim in substance.
178178

179+
## Reviewer commands — what each one proves
180+
181+
| Command | Proves | Expected verdict (exit 0) |
182+
|---|---|---|
183+
| `make-intake-candidate.mjs <candidate-dir>` | the modeled REAL candidate: ten records + signed disclosure scope + pins — the same builder CI's surveillance run and the contract tests use | `next : node examples/real-fixture-intake/prelude.mjs <candidate-dir>` |
184+
| `prelude.mjs <candidate-dir>` | the fail-closed machine gate: secret scan, origin truth, both-party consent replay, pin integrity | `GATE GREEN — proceed to fixture conversion` |
185+
| `convert-to-fixture.mjs <candidate-dir> <out-dir>` | green gate → ten records + `hashes.json` from the written bytes → engine gate on the result | `decision : EXECUTION_EVIDENCE_ADMISSIBLE — CONFORMITY_UNDECIDED_BY_ENGINE` |
186+
| `convert-to-fixture.mjs <candidate-dir> --out-zip <archive.zip>` | same flow as one attachment-ready archive — fixed-timestamp bytes, two runs are `cmp`-equal | `archive : sha256 0x… — paste THIS hash into the submission note (the manifest cannot self-hash)` |
187+
| `verifyFixture({ fixtureDir: '<out-dir>' })` | independent re-verification with the same engine a reviewer runs (the step-5 one-liner) | `VERIFIED EXECUTION_EVIDENCE_ADMISSIBLE — CONFORMITY_UNDECIDED_BY_ENGINE` |
188+
| `convert-to-fixture.mjs <red candidate> <out-dir>` | a candidate that failed the gate refuses to convert — nothing is written | `convert: GATE RED — nothing converts without a green gate (gate exit 1)` — exit `1`, no output dir (expected!) |
189+
190+
Every row here also runs against the live tools in
191+
`test/delivery/reviewer-table.test.js` on every push — the same contract that
192+
pins the synthetic fixture's reviewer table. The table is the expectation;
193+
the tools are the truth.
194+
179195
## What CoreGuard claims — and what it never claims
180196

181197
- `REAL` records carry real signatures over real facts; the engine

‎examples/real-fixture-intake/convert-to-fixture.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ if (zipMode) {
238238
}
239239
console.log(line);
240240
console.log("Ready for submission. Re-verify any time (same engine, any directory):");
241-
console.log(" node -e \"import('packages/delivery/sdk.js').then(m => m.verifyFixture({ fixtureDir: process.argv[1] })).then(r => { console.log(r.status, r.decision); process.exit(r.status === 'VERIFIED' ? 0 : 1); })\" -- <fixture-dir>");
241+
console.log(" node -e \"import('./packages/delivery/sdk.js').then(m => m.verifyFixture({ fixtureDir: process.argv[1] })).then(r => { console.log(r.status, r.decision); process.exit(r.status === 'VERIFIED' ? 0 : 1); })\" -- <fixture-dir>");
242242
console.log("boundary: Execution verification does not decide delivery conformity.");
243243
process.exit(0);
244244

‎test/delivery/reviewer-table.test.js‎

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
import { test } from "node:test";
2222
import assert from "node:assert/strict";
2323
import { spawnSync } from "node:child_process";
24-
import { readFileSync } from "node:fs";
24+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
25+
import { tmpdir } from "node:os";
2526
import { join, dirname } from "node:path";
2627
import { fileURLToPath } from "node:url";
2728

@@ -99,3 +100,118 @@ test("reviewer table: adversarial-runner verdict lines match live runner output"
99100
}
100101
}
101102
});
103+
104+
// ---------------------------------------------------------------------------
105+
// real-fixture-intake kit — the same contract, second table.
106+
//
107+
// The intake README documents the operator path a REAL case travels
108+
// (build → gate → convert → verify → red refusal). Its rows are parsed from
109+
// that table, executed live against the real tools in a temp workspace in
110+
// procedure order, and matched verbatim after folding only per-run variable
111+
// values (workspace paths, the archive hash) into the table's placeholders.
112+
// A reworded gate line, a changed exit contract, or a converter that starts
113+
// overwriting outputs goes red here, naming the row.
114+
115+
const INTAKE_DIR = join(REPO, "examples", "real-fixture-intake");
116+
const INTAKE_README = join(INTAKE_DIR, "README.md");
117+
const MAKE = join(INTAKE_DIR, "make-intake-candidate.mjs");
118+
const PRELUDE = join(INTAKE_DIR, "prelude.mjs");
119+
const CONVERT = join(INTAKE_DIR, "convert-to-fixture.mjs");
120+
121+
function parseIntakeRows() {
122+
const md = readFileSync(INTAKE_README, "utf8").replaceAll("\r\n", "\n");
123+
const lines = md.split("\n");
124+
const header = lines.findIndex((l) => l.startsWith("| Command | Proves | Expected verdict"));
125+
assert.ok(header !== -1, "intake README lost its reviewer-commands table");
126+
const rows = [];
127+
for (let i = header + 2; i < lines.length && lines[i].startsWith("|"); i++) {
128+
const cells = lines[i].split("|");
129+
rows.push({
130+
cmd: (cells[1].match(/`([^`]+)`/) || [])[1],
131+
expected: (cells[3].match(/`([^`]+)`/) || [])[1],
132+
});
133+
}
134+
return rows;
135+
}
136+
137+
test("intake kit reviewer table: documented verdict lines match the live tools", () => {
138+
const rows = parseIntakeRows();
139+
assert.ok(rows.length >= 6, `expected >=6 intake rows in the reviewer table, found ${rows.length} — the table lost coverage`);
140+
141+
const groups = new Map();
142+
for (const row of rows) {
143+
if (!groups.has(row.cmd)) groups.set(row.cmd, []);
144+
groups.get(row.cmd).push(row);
145+
}
146+
147+
// One workspace shared by the whole documented procedure, in row order.
148+
const ws = mkdtempSync(join(tmpdir(), "intake-reviewer-table-"));
149+
const candidate = join(ws, "candidate");
150+
const outDir = join(ws, "fixture-dir");
151+
const zipPath = join(ws, "attachment.zip");
152+
const redCandidate = join(ws, "red-candidate");
153+
const redOut = join(ws, "never");
154+
mkdirSync(redCandidate); // empty candidate → the gate must refuse it
155+
156+
try {
157+
const run = (args) => spawnSync(process.execPath, args, { cwd: REPO, encoding: "utf8" });
158+
const sdkSnippet =
159+
"import('./packages/delivery/sdk.js').then(m => m.verifyFixture({ fixtureDir: process.argv[1] })).then(r => { console.log(r.status, r.decision); process.exit(r.status === 'VERIFIED' ? 0 : 1); })";
160+
161+
// Per documented command: the live invocation, its expected exit, and
162+
// the normalizer folding variable values into the table's placeholders.
163+
const cases = {
164+
"make-intake-candidate.mjs <candidate-dir>": { args: [MAKE, candidate], status: 0 },
165+
"prelude.mjs <candidate-dir>": { args: [PRELUDE, candidate], status: 0 },
166+
"convert-to-fixture.mjs <candidate-dir> <out-dir>": { args: [CONVERT, candidate, outDir], status: 0 },
167+
"convert-to-fixture.mjs <candidate-dir> --out-zip <archive.zip>": { args: [CONVERT, candidate, "--out-zip", zipPath], status: 0 },
168+
"verifyFixture({ fixtureDir: '<out-dir>' })": {
169+
args: ["--input-type=module", "-e", sdkSnippet, outDir], status: 0,
170+
},
171+
"convert-to-fixture.mjs <red candidate> <out-dir>": {
172+
args: [CONVERT, redCandidate, redOut], status: 1, outDirMustStayAbsent: true,
173+
},
174+
};
175+
176+
assert.deepEqual(
177+
[...groups.keys()].sort(),
178+
Object.keys(cases).sort(),
179+
"intake table commands and live handlers must correspond 1:1 — a new row needs a live handler, a removed row needs its handler dropped",
180+
);
181+
182+
for (const [cmd, rowsForCmd] of groups) {
183+
const spec = cases[cmd];
184+
const r = run(spec.args);
185+
assert.equal(
186+
r.status,
187+
spec.status,
188+
`live run for "${cmd}" must exit ${spec.status}:\n${r.stdout}\n${r.stderr}`,
189+
);
190+
if (spec.outDirMustStayAbsent) {
191+
assert.ok(!existsSync(redOut), `red candidate must not create ${redOut} — the converter wrote something`);
192+
}
193+
const lines = ((r.stdout ?? "") + (r.stderr ?? ""))
194+
.split("\n")
195+
.map((l) =>
196+
l
197+
.replaceAll("\\", "/")
198+
.replaceAll(join(ws, "candidate").replaceAll("\\", "/"), "<candidate-dir>")
199+
.replaceAll(join(ws, "fixture-dir").replaceAll("\\", "/"), "<out-dir>")
200+
.replaceAll(join(ws, "never").replaceAll("\\", "/"), "<out-dir>")
201+
.replace(/sha256 0x[0-9a-f]+/, "sha256 0x…")
202+
.trim(),
203+
);
204+
for (const row of rowsForCmd) {
205+
assert.ok(
206+
lines.includes(row.expected),
207+
`intake reviewer table drifted from live behavior:\n` +
208+
` command : ${cmd}\n` +
209+
` table says : ${row.expected}\n` +
210+
` live output: ${lines.filter((l) => l.length > 0).slice(-8).join(" ⏎ ")}`,
211+
);
212+
}
213+
}
214+
} finally {
215+
rmSync(ws, { recursive: true, force: true });
216+
}
217+
});

0 commit comments

Comments
 (0)