You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cf058cc
Browse filesBrowse the repository at this point in the historyBrowse files
fix(delivery): natural stdout exit for the adversarial runner — Linux piped reports kept their tail
process.exit() after the report truncated the perf/verdict lines on Linux
(review-table contract red on CI); exitCode now drains the queue. Plus
index-safe row parsing and the [C14] lesson in AGENTS.md.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,7 @@ title to jump.
53
53
| C11 | NegativeSuite premise path | contained: the suite fails correctly — just run it from the platform dir |
54
54
| C12 | Stale GREEN — session-persisted candidates mutate between verdict and use | near-miss class: defensive re-reading made it contained |
55
55
| C13 | Hand-built ZIP without unix external attrs extracts mode-0000 on Linux | real red CI run (EACCES); invisible on Windows — CI caught it |
56
+
| C14 |`process.exit()` after a big stdout report truncates its tail on Linux | real red CI run (reviewer-table contract lost the perf/verdict tail); invisible on Windows |
56
57
57
58
- [C1] **Multi-line plain scalar with `": "` kills the whole workflow (zero jobs)**: a `run:` value written as a plain (non-block) multi-line YAML scalar containing a JS literal like `console.error('health check failed: ...')` — the `": "` inside a plain scalar is unparseable → GitHub marks the run `failure` with **zero jobs built**. That zero-jobs conclusion IS the signature of an unparseable workflow file (not a failing step). Fix: any multi-line `run:` must be a real block scalar (`run: |` on its own line). Trap within the trap: a string-matching "validator" whose `||` fallback jumped to a fake parser reported PASS — only a real YAML parser or GitHub itself building the job proves the file parses (cost a push + a red run). Now enforced mechanically: `test/ci/workflow-yaml-contract.test.js` parses every `.github/workflows` file and the composite action with the real `yaml` parser (dev dep) plus an Actions schema walk — an unparseable or schema-deviant file fails the push locally with file+line naming, before GitHub ever sees it. Runs inside `npm run prepush` too (scripts/pre-push-check.mjs), the mechanical pre-push checklist built from the YAML/workflow lessons: workflows-parse [C1] · freeze-integrity [C2] · pin-eol-cover [C3] · no-skip-ci (the skip-token vortex) · repin-reachable (the rebase rewrite trap) · remote-fresh (the bot race, with the autostash remedy named).
58
59
-[C2]**Commit-anchored verification (4.2.6+)**: `validate-freeze.mjs` hashes `git show <gitCommit>:<path>` blobs, not disk bytes. Disk mode (`--disk`) is triage-only, prints "not evidence". Records without `gitCommit` fail COMMIT-UNANCHORED (historical included — correct). Editing a file whose bytes exist only in a future commit requires a **two-phase re-anchor**: commit phase 1, then point `gitCommit`/`postCommitRePins` at that hash in phase 2. Release entries are platform-dir relative; quarantine entries repo-root relative; repo-root files outside the platform dir use `../` prefixes (stripped by `treePath`/`repoRelPath` — the honesty test must mirror this or bare-name pins hash the wrong file).
@@ -67,6 +68,7 @@ title to jump.
67
68
-[C11]**NegativeSuite premise path**: `-Manifest` is resolved via `Test-Path -LiteralPath` from the CWD — run the suite from the platform dir, not the repo root, or the manifest premise becomes PRECONDITION_FAILURE and fails the whole cycle (correctly). It rewrites frozen `negative-tests.json`; determinism proof = git diff empty after rerun.
68
69
-[C12]**Stale GREEN: session-persisted candidates mutate between verdict and use (read scope consent defensively)**: a candidate directory that survives across steps or sessions is a mutable surface — the consent/disclosure scope (and any record) can change between the gate's GREEN verdict and the moment a consumer (e.g. `convert-to-fixture.mjs`) reads the files, so a **remembered** GREEN from an earlier step would package records the gate never saw. Defensive reading: a verdict binds to exact bytes (pins), and every consumer re-runs the gate on the same tree it reads — never trust a verdict carried across steps. The intake pipeline does exactly this: `convert-to-fixture.mjs` re-runs the gate as its first act on the directory it then reads, and re-verifies pins against disk after write — the reason the pipeline never converts on stale consent.
69
70
-[C13]**Hand-built ZIP needs unix external attrs or Linux extracts mode-0000**: writing only the local headers/CRC leaves the central-directory external-attributes field zero; `made-by: unix (0x031e)` makes Info-ZIP derive the mode from it → every extracted file is 0000 and reads EACCES on Linux (red CI run on `1a49d16`). Windows masks this entirely — always write `(0o100644 << 16)` at offset 38 when made-by is unix. The archive's determinism tests stay green on Windows either way, so only a Linux runner catches it.
71
+
-[C14]**`process.exit()` right after a large piped stdout report truncates the tail on Linux**: stdout writes to a pipe are asynchronous — exit before the queue drains silently drops whatever is still buffered (the new reviewer-table contract on `09b4aae` lost exactly the `perf` and `verdict` lines from a ~300-line runner report; local Windows runs are synchronous and always green, so only Linux CI showed it). Rule: CLIs that print a report set `process.exitCode` and let the event loop drain — reserve `process.exit()` for usage-error exits where the (tiny) stderr message going missing is harmless. The runner now uses `process.exitCode` in both its text and JSON branches, with the drain rule commented at each site.
Copy file name to clipboardExpand all lines: examples/delivery-fixture/adversarial-runner.mjs
+14-2Lines changed: 14 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -470,9 +470,16 @@ if (jsonMode) {
470
470
: "ALL MUTATIONS CAUGHT (single + compound) — the gate bites where it claims to")
471
471
: "GATE HOLE — see results",
472
472
},null,2));
473
-
process.exit(allClear ? 0 : 1);
473
+
// Exit naturally (process.exitCode, NOT process.exit): after a big report,
474
+
// piped stdout is still draining asynchronously — process.exit() would
475
+
// truncate the report tail on Linux. Set the code and let the loop drain.
476
+
process.exitCode=allClear ? 0 : 1;
474
477
}
475
478
479
+
// The text report lives in a labeled block: --json mode set its exit code
480
+
// above and breaks straight past it (top-level ESM cannot `return`).
481
+
textReport: {
482
+
if(jsonMode)break textReport;
476
483
console.log(line);
477
484
console.log("CoreGuard DDE — Adversarial Runner (one mutation per fail-closed check)");
478
485
console.log(line);
@@ -536,4 +543,9 @@ if (perf.overBudget.length) {
536
543
console.log(`perf verdict: ${perf.overBudget.length} cycle(s) over the ${perf.budgetMs}ms per-cycle budget — engine slowdown under combinational load (correctness verdict above is unaffected)`);
0 commit comments