@rightkit/release 0.6.75 → 0.6.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -415,7 +415,7 @@ The `security-policy` row reads `src-tauri/tauri.conf.json` (`app.security.csp`,
415
415
 
416
416
  ### `directRelease`: finalize a direct (non-store) release (#1142)
417
417
 
418
- `right-release direct-release finalize [--config <file>] [--output-dir <dir>] [--dry-run]` zips each payload (`createPortableArchive`), binds each archive to its SLSA provenance and CycloneDX SBOM (`collectReleaseAsset`), writes `checksums.json`, the release manifest and its detached Azure-signed catalog (`materializeDirectRelease`; the signing host is Windows), renders and validates `install.ps1` (`renderPowerShellBootstrap`, `validatePowerShellBootstrap`, accepting the signer the manifest was just signed with) and writes the bootstrap publication plan (`planBootstrapPublication`). It runs from a clean checkout at HEAD, is a checked, release-tier command, and uploads nothing: the R2 upload of the bootstrap is its own step. The config block is documented at the top of `direct-release-command.mjs` (`product`, `repository`, `minimumBootstrapVersion`, `bootstrapVersion`, `assets[]`, `bootstrap`).
418
+ `right-release direct-release finalize [--config <file>] [--output-dir <dir>] [--dry-run]` zips each payload (`createPortableArchive`), binds each archive to its SLSA provenance and CycloneDX SBOM (`collectReleaseAsset`; an asset that omits `provenance` and `sbom` gets them written first with `materializeInTotoSlsaProvenance` and `materializeCycloneDxSbom` as `provenance-<target>.intoto.jsonl` and `sbom-<target>.cdx.json` in the output directory, from the archive's sha256, the source commit and the repository; files the config names are used as given), writes `checksums.json`, the release manifest and its detached Azure-signed catalog (`materializeDirectRelease`; the signing host is Windows), renders and validates `install.ps1` (`renderPowerShellBootstrap`, `validatePowerShellBootstrap`, accepting the signer the manifest was just signed with) and writes the bootstrap publication plan (`planBootstrapPublication`). It runs from a clean checkout at HEAD, is a checked, release-tier command, and uploads nothing: the R2 upload of the bootstrap is its own step. The config block is documented at the top of `direct-release-command.mjs` (`product`, `repository`, `minimumBootstrapVersion`, `bootstrapVersion`, `assets[]`, `bootstrap`).
419
419
 
420
420
  ### `modelBundles`: pinned, verified model provisioning (#993)
421
421
 
@@ -0,0 +1,68 @@
1
+ // GC-A27 NN13: every caller of `rightkit-gate check` in RightKit takes the installed gate's answer the way it is written (rightkit#1695: gate 0.6.67
2
+ // made a content-only check exit 3; CI, publish admission, publish-app and every consumer app's check job read exit 0 and broke, while the twelve
3
+ // lines stayed green because the acceptance run only ever called `--to compile`).
4
+ //
5
+ // Three parts, all decided here, none by the runner:
6
+ // 1. discovery: every file of RightKit that names `rightkit-gate` outside the gate's own package is listed in the cases file, either as a caller or as
7
+ // a file that only names it (with the reason). A new file that names the gate fails NN13 until someone decides which it is.
8
+ // 2. drift: each caller's file still contains the exact command text the cases file records, so a caller that changed its call is looked at again.
9
+ // 3. the answer: each caller's command runs against the fixture's pinned commit with the installed gate, and the caller's own rule is applied to the
10
+ // result: "exit0" callers (a shell step under set -e, an npm script, the rendered check job) need exit 0; "admission" callers apply their own
11
+ // exported verdict function, which must accept the full run and refuse the content-only run (the PARTIAL output).
12
+ import { execFileSync, spawnSync } from "node:child_process";
13
+ import fs from "node:fs";
14
+ import path from "node:path";
15
+ import { pathToFileURL } from "node:url";
16
+
17
+ export const PASS = "pass", FAIL = "fail";
18
+
19
+ /** Files of `repo` (git-tracked) that name `rightkit-gate`, outside the gate's own package, its tests and the docs. */
20
+ export function filesNamingGate(repo, { git = (args) => execFileSync("git", ["-C", repo, ...args], { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }) } = {}) {
21
+ let out = "";
22
+ try { out = git(["grep", "-l", "rightkit-gate", "--", ".", ":!packages/release/**", ":!docs/**", ":!**/*.md", ":!**/*.test.mjs", ":!**/CHANGELOG*"]); } catch (e) { if (e.status !== 1) throw e; }
23
+ return out.split(/\r?\n/).filter(Boolean).map((f) => f.replaceAll("\\", "/")).sort();
24
+ }
25
+
26
+ /** Discovery and drift: the problems with the cases file's caller list against the repository's files. */
27
+ export function callerListProblems(defs, repo, { files = filesNamingGate(repo), read = (f) => fs.readFileSync(path.join(repo, f), "utf8") } = {}) {
28
+ const problems = [];
29
+ const listed = new Set([...(defs.callers ?? []).map((c) => c.file), ...Object.keys(defs.namesOnly ?? {})]);
30
+ for (const f of files) if (!listed.has(f)) problems.push(`${f} names rightkit-gate and is in neither callers nor namesOnly of the cases file: decide whether it calls the gate`);
31
+ for (const c of defs.callers ?? []) {
32
+ let text = null; try { text = read(c.file); } catch { problems.push(`caller ${c.id}: ${c.file} is gone`); continue; }
33
+ if (!text.includes(c.marker)) problems.push(`caller ${c.id}: ${c.file} no longer contains its recorded call \`${c.marker}\`; the call changed and must be judged again`);
34
+ }
35
+ return problems;
36
+ }
37
+
38
+ /** Runs one gate invocation in the fixture; `{sha}` in an argument becomes the pinned commit. */
39
+ /** Runs one gate invocation in `dir`; `{sha}` in an argument becomes `sha`. */
40
+ export function runGateFor(gate, dir, args, sha, { env = process.env, spawn = spawnSync } = {}) {
41
+ const argv = args.map((a) => a.replaceAll("{sha}", sha));
42
+ const r = spawn(process.execPath, [gate, ...argv], { cwd: dir, env, encoding: "utf8", maxBuffer: 256 * 1024 * 1024, windowsHide: true });
43
+ return { sha, args: argv, status: r.status, stdout: String(r.stdout ?? ""), stderr: String(r.stderr ?? ""), error: r.error ?? null };
44
+ }
45
+
46
+ const tail = (r) => `${r.stderr}\n${r.stdout}`.trim().split(/\r?\n/).slice(-3).join(" / ").slice(0, 400);
47
+
48
+ /** Judges every caller. `run(caller, args)` runs the gate where that caller runs and returns the result with the commit it judged (`sha`);
49
+ * `verdictOf(c)` loads an admission caller's verdict function. */
50
+ export async function judgeCallers(defs, repo, { run, verdictOf = async (c) => (await import(pathToFileURL(path.join(repo, c.file)).href))[c.verdictExport], listProblems = callerListProblems(defs, repo) } = {}) {
51
+ const fails = [...listProblems]; const seen = [];
52
+ for (const c of defs.callers ?? []) {
53
+ if (c.kind === "exit0") {
54
+ const r = run(c, c.args);
55
+ if (r.error || r.status !== 0) fails.push(`caller ${c.id} (${c.file}) needs exit 0 for the clean commit ${r.sha?.slice(0, 12)} of ${c.repo}; \`rightkit-gate ${r.args.join(" ")}\` exited ${r.error ? r.error.code ?? r.error.message : r.status}: ${tail(r)}`);
56
+ else seen.push(c.id);
57
+ } else if (c.kind === "admission") {
58
+ let decide; try { decide = await verdictOf(c); } catch (e) { fails.push(`caller ${c.id}: cannot load ${c.verdictExport} from ${c.file}: ${e.message}`); continue; }
59
+ if (typeof decide !== "function") { fails.push(`caller ${c.id}: ${c.file} exports no function ${c.verdictExport}`); continue; }
60
+ const full = run(c, c.args);
61
+ try { decide(full, full.sha, c.scope ?? []); seen.push(c.id); } catch (e) { fails.push(`caller ${c.id} (${c.file}) refused the full gate run of the clean commit ${full.sha?.slice(0, 12)} of ${c.repo}: ${e.message}`); }
62
+ const partial = run(c, c.refuseArgs);
63
+ let admitted = false; try { decide(partial, partial.sha, c.scope ?? []); admitted = true; } catch { /* refused, as it must */ }
64
+ if (admitted) fails.push(`caller ${c.id} (${c.file}) admitted the content-only run \`rightkit-gate ${partial.args.join(" ")}\` (exit ${partial.status}), which skipped the checks that execute repository code`);
65
+ } else fails.push(`caller ${c.id}: unknown kind ${c.kind}`);
66
+ }
67
+ return fails.length ? { verdict: FAIL, why: fails.join("; ") } : { verdict: PASS, why: `${seen.length} caller(s) of rightkit-gate check take the installed gate's answer as written: ${seen.join(", ")}; every file naming the gate is listed` };
68
+ }
@@ -543,16 +543,16 @@
543
543
  ]
544
544
  },
545
545
  "limitsMs": {
546
- "case1": null,
547
- "case2": null,
548
- "case3": null,
549
- "case4": null,
550
- "case5": null,
551
- "case6": null,
552
- "case7": null,
546
+ "case1": 977000,
547
+ "case2": 34000,
548
+ "case3": 41000,
549
+ "case4": 31000,
550
+ "case5": 24000,
551
+ "case6": 41000,
552
+ "case7": 103000,
553
553
  "realBuild": null
554
554
  },
555
- "limitsRule": "first clean measured time x 1.25, filled once; null means not yet measured, and NN11 fails while it is null",
555
+ "limitsRule": "first clean measured time x 1.25, at least the measured time + 15 s (Gemini for Adrian, 2026-11-25: the gate must pass under normal working load, so a short case keeps 15 s of headroom), filled once from the 0.6.75 run of 2026-11-25 (accept-0675b); one limit per case covers each of its unkilled runs; null means not yet measured, and NN11 fails while it is null",
556
556
  "corrections": {
557
557
  "approved": "Adrian, 2026-11-24: \"Approve, keep going\" (to: C1, C4, the sidecar-build half of C2, and C3 tightened to an exact command list). Reviewed first by Gemini, which rejected C3 as first worded (\"in one command or split by target\" lets a gate always split) and the rk-sidecar half of C2.",
558
558
  "previousSha256": "e41bba2b2331adc866ed602f3ab3ecda27adb615d296e981f9a2310479b06bdc",
@@ -562,5 +562,139 @@
562
562
  "C3: the broker commands are an exact list. A workspace whose crates resolve alike for every target is one clippy command naming all three targets; the Tauri shell, whose dependency graph differs by target, is one command per target.",
563
563
  "C4: case 3's edit puts the new function above the test module (clippy rejects an item after a test module)."
564
564
  ]
565
- }
565
+ },
566
+ "callers": [
567
+ {
568
+ "id": "ci",
569
+ "file": ".github/workflows/ci.yml",
570
+ "kind": "exit0",
571
+ "marker": "pnpm exec rightkit-gate check --repo . --commit \"${{ github.sha }}\" --rule-tier release",
572
+ "args": [
573
+ "check",
574
+ "--repo",
575
+ ".",
576
+ "--commit",
577
+ "{sha}"
578
+ ],
579
+ "why": "a bash step under set -euo pipefail: anything but 0 fails CI and skips every native shard",
580
+ "repo": "fixture",
581
+ "note": "Run on the fixture without --rule-tier release: the exit contract of a content-only check is what this caller depends on. On RightKit itself at release tier it needs CI's own install steps first (the import check reads installed dependencies), so the CI run after each push is the proof there."
582
+ },
583
+ {
584
+ "id": "publish-app",
585
+ "file": ".github/workflows/publish-app.yml",
586
+ "kind": "exit0",
587
+ "marker": "run: pnpm exec rightkit-gate check --commit HEAD",
588
+ "args": [
589
+ "check",
590
+ "--commit",
591
+ "{sha}"
592
+ ],
593
+ "why": "a workflow step: anything but 0 stops the app publish",
594
+ "repo": "fixture"
595
+ },
596
+ {
597
+ "id": "consumer-check-job",
598
+ "file": "packages/ci/manifest.mjs",
599
+ "kind": "exit0",
600
+ "marker": "` - run: ${gate} check --commit HEAD`",
601
+ "args": [
602
+ "check",
603
+ "--commit",
604
+ "{sha}"
605
+ ],
606
+ "why": "the check job rendered into every consumer app's ci, qualification, package-smoke, release-candidate, swift-check and publish-npm lanes",
607
+ "repo": "fixture"
608
+ },
609
+ {
610
+ "id": "desktop-app-template",
611
+ "file": "desktop-app-template/package.json",
612
+ "kind": "exit0",
613
+ "marker": "\"check\": \"rightkit-gate check\"",
614
+ "args": [
615
+ "check"
616
+ ],
617
+ "why": "the template's npm check script",
618
+ "repo": "fixture"
619
+ },
620
+ {
621
+ "id": "e2e-app",
622
+ "file": "e2e-app/package.json",
623
+ "kind": "exit0",
624
+ "marker": "\"check\": \"rightkit-gate check\"",
625
+ "args": [
626
+ "check"
627
+ ],
628
+ "why": "the e2e app's npm check script",
629
+ "repo": "fixture"
630
+ },
631
+ {
632
+ "id": "publish-admission",
633
+ "file": "scripts/ci/publish-admission.mjs",
634
+ "kind": "admission",
635
+ "marker": "rightkit-gate check --commit ${sha} --full-a --rule-tier release",
636
+ "verdictExport": "gateVerdict",
637
+ "args": [
638
+ "check",
639
+ "--repo",
640
+ ".",
641
+ "--commit",
642
+ "{sha}",
643
+ "--full-a",
644
+ "--rule-tier",
645
+ "release",
646
+ "--scope",
647
+ "packages/theme"
648
+ ],
649
+ "refuseArgs": [
650
+ "check",
651
+ "--repo",
652
+ ".",
653
+ "--commit",
654
+ "{sha}",
655
+ "--rule-tier",
656
+ "release",
657
+ "--scope",
658
+ "packages/theme"
659
+ ],
660
+ "why": "admits an npm or crate publish: it must accept the full run and refuse a run that skipped the checks that execute code",
661
+ "repo": "rightkit",
662
+ "scope": [
663
+ "packages/theme"
664
+ ]
665
+ }
666
+ ],
667
+ "namesOnly": {
668
+ ".gitattributes": "attributes only",
669
+ "INDEX.md": "the index names the package",
670
+ "decisions.md": "a record",
671
+ "ci/consumer-recipes.json": "consumer recipe data",
672
+ "ci/consumers/npm/ci/consumer.mjs": "asserts the rendered --to compile door text; the rendered check job is the consumer-check-job caller",
673
+ "ci/consumers/npm/outdated/consumer.mjs": "a stand-in gate script in a test of @rightkit/outdated",
674
+ "ci/consumers/npm/release/consumer.mjs": "asserts the package's bin names",
675
+ "desktop-app-template/deny.toml": "a comment",
676
+ "e2e-app/deny.toml": "a comment",
677
+ "packages/build-control-policy/src/host-gate.mjs": "locates the gate entry for the host hook; calls nothing",
678
+ "packages/build-control-policy/src/index.mjs": "recognises a gate command line in the host hook; calls nothing",
679
+ "packages/ci/sync.mjs": "the version floor of the rendered check job (consumer-check-job)",
680
+ "packages/outdated/src/gate.ts": "runs the gate commands an app configures (exit 0 needed); the same plain check the exit0 callers prove",
681
+ "packages/outdated/update.schema.json": "schema text",
682
+ ".github/workflows/publish.yml": "reads the gate's qualification receipt and the admission receipt; publish-admission is the caller",
683
+ ".github/workflows/qualify-direct.yml": "runs --to release --unit and keeps its exit with `|| true` (not a check caller; open review item: its exit is swallowed)",
684
+ "scripts/ci/crate-scan-workspaces.mjs": "a comment",
685
+ "scripts/ci/gate.mjs": "a coverage note",
686
+ "scripts/ci/publish.mjs": "a comment",
687
+ "scripts/ci/rightkit-dispatch.mjs": "reads the qualification receipt the gate writes",
688
+ "scripts/ci/rk-pipeline.mjs": "reads the qualification receipt the gate writes",
689
+ "scripts/ci/rk-release-canary-leg.mjs": "asks --route and --help (open review item: the route probe is not in the acceptance run)",
690
+ "scripts/ci/rk-release-canary.mjs": "judges --route answers",
691
+ "scripts/ci/run-deterministic-scans.mjs": "imports externalInputs from the gate",
692
+ "scripts/ci/workflow-contract.mjs": "workflow text checks",
693
+ "scripts/ci/workflow-yaml.mjs": "a comment",
694
+ "scripts/linux-cloud-setup.sh": "a usage comment",
695
+ "scripts/preflight.mjs": "comments",
696
+ "scripts/sim/door-lifecycle.mjs": "a simulation importing main",
697
+ "scripts/sim/door-policy.mjs": "hook policy simulation"
698
+ },
699
+ "callersRule": "NN13 (rightkit#1695, Adrian 2026-11-25: 'fix the acceptance test'): every file outside packages/release naming rightkit-gate is listed here as a caller or in namesOnly; each caller's recorded call is still in its file; each caller's command, run against the pinned fixture commit with the installed gate, gets the answer its own rule needs. A caller runs where it really runs: RightKit's own CI and publish admission on RightKit at origin/main (the fixture is not a release-ready app, so release-tier rules refuse it on any gate); the apps' check jobs and scripts on the fixture's pinned commit. GITHUB_ACTIONS is not set: the gate refuses the hosted route off a GitHub runner, so CI's own run is the proof of that route."
566
700
  }
@@ -24,7 +24,9 @@ const plain = (p) => dirKey(String(p ?? "").replace(/^\\\\\?\\/, ""));
24
24
  // The lines the evidence table holds every case to, whatever the case lists: every receipt names the commit (NN01), a run that reached the broker did so after
25
25
  // Class A (NN02), nothing repeats (NN08), the run is inside its limit (NN11) and ends clean (NN12).
26
26
  const ALWAYS = Object.freeze(["NN01", "NN02", "NN08", "NN11", "NN12"]);
27
- export const LINE_IDS = Object.freeze(["NN01", "NN02", "NN03", "NN04", "NN05", "NN06", "NN07", "NN08", "NN09", "NN10", "NN11", "NN12"]);
27
+ export const LINE_IDS = Object.freeze(["NN01", "NN02", "NN03", "NN04", "NN05", "NN06", "NN07", "NN08", "NN09", "NN10", "NN11", "NN12", "NN13"]);
28
+ // NN13 is decided once per run by acceptance-callers.mjs (every caller of `rightkit-gate check`), not by a fixture case (rightkit#1695).
29
+ export const RUN_LINES = Object.freeze(["NN13"]);
28
30
 
29
31
  // ---- reading a run's facts ------------------------------------------------------------------------------------------------------------------------------
30
32
  /** A Class A row's own program: a tool the gate starts for a row, not a version probe. Rows that run inside the gate start none (limit 1). */
@@ -62,7 +64,7 @@ const firstSubmission = (run) => Math.min(...run.jobs.map((j) => j.submitted).fi
62
64
  /** A job the broker refused before it started (no signed start, not a success) built nothing: a run killed under it leaves one (case 7 on 0.6.67). Skipped in the kill case only: anywhere else an unstarted refusal may be a job sent before Class A, which NN02 must see. */
63
65
  export const neverRan = (j) => !Number.isFinite(j.started) && j.status !== "SUCCEEDED";
64
66
  export function receiptsNameTheCommit(run, { skipNeverRan = false } = {}) {
65
- const fails = [];
67
+ const fails = (run.foreignJobs ?? []).filter((x) => !(skipNeverRan && neverRan(x))).map((j) => `${jobName(j)} ran for this repository during the run but not from its snapshot of the selected commit (cwd ${j.cwd})`);
66
68
  for (const j of run.jobs.filter((x) => !(skipNeverRan && neverRan(x)))) {
67
69
  if (!j.verified) { fails.push(`${jobName(j)}: its receipt does not verify (${(j.problems ?? []).join("; ") || "no reason given"})`); continue; }
68
70
  if (j.gate?.commit !== run.commit) fails.push(`${jobName(j)} is signed for commit ${String(j.gate?.commit).slice(0, 12)}, not the selected ${String(run.commit).slice(0, 12)}`);
@@ -167,6 +169,13 @@ export function endsClean(run, label) {
167
169
  }
168
170
  const exited = (run) => Number.isInteger(run.exit) && !run.killed;
169
171
  const failedRun = (run, label) => (exited(run) && run.exit !== 0 ? [] : [`${label} did not end with a failing exit (exit ${run.exit}${run.killed ? ", killed" : ""})`]);
172
+ // A failing run counts only when the gate failed it for the case's own reason: any non-zero exit (a crash at start, a usage error) passed before
173
+ // (review 2026-11-25 #3). The row must be in the gate's own verdict line, `verdict deterministic failed=<ids>`.
174
+ const failedOn = (run, row, label) => {
175
+ const f = failedRun(run, label); if (f.length || !row) return f;
176
+ const m = /verdict deterministic failed=(\S+)/.exec(String(run.log ?? ""));
177
+ return m && m[1].split(",").includes(row) ? [] : [`${label} failed, but not on ${row}: the gate's verdict line ${m ? `names ${m[1]}` : "is missing"}`];
178
+ };
170
179
  const passedRun = (run, label) => (exited(run) && run.exit === 0 ? [] : [`${label} did not pass (exit ${run.exit}${run.killed ? ", killed" : ""})`]);
171
180
  const noReceipt = (run, label) => (run.jobs.length ? [`${label} left ${run.jobs.length} broker receipt(s)`] : []);
172
181
  const noClassAProgram = (run, label) => { const a = run.starts.filter(isClassAProgram); return [...(a.length ? [`${label} started ${a.length} Class A program(s) (first: ${programName(a[0].program)})`] : []), ...(run.processGaps.length ? [`${label}: the process record is incomplete (${run.processGaps[0]})`] : [])]; };
@@ -178,12 +187,12 @@ const LINES = {
178
187
  NN01(c, cases) {
179
188
  const fails = c.runs.flatMap((r) => receiptsNameTheCommit(r, { skipNeverRan: c.id === 7 }));
180
189
  if (c.id === 1) fails.push(...passedRun(c.runs[0], "the run with an error planted in the checkout that the commit does not hold"));
181
- if (c.id === 5) c.runs.forEach((r, i) => fails.push(...failedRun(r, `run ${i + 1} of the commit that holds the error, with a clean checkout`)));
190
+ if (c.id === 5) c.runs.forEach((r, i) => fails.push(...failedOn(r, c.expect?.outputNames?.[0], `run ${i + 1} of the commit that holds the error, with a clean checkout`)));
182
191
  return verdict(fails, c.id === 1 ? "an error in the checkout that is not in the commit did not fail the run, and every receipt names the selected commit and tree with the snapshot unchanged" : c.id === 5 ? "an error in the commit failed the run with a clean checkout" : `${c.runs.reduce((n, r) => n + r.jobs.length, 0)} receipt(s), each naming the selected commit and tree with the snapshot unchanged`);
183
192
  },
184
193
  // Class A finishes before anything goes to the broker. If it fails, nothing goes.
185
194
  NN02(c) {
186
- if (c.id === 5) return verdict(c.runs.flatMap((r, i) => [...failedRun(r, `run ${i + 1}`), ...noReceipt(r, `run ${i + 1}`)]), "a failing Class A check ended the run with a failing exit and no broker receipt, twice");
195
+ if (c.id === 5) return verdict(c.runs.flatMap((r, i) => [...failedOn(r, c.expect?.outputNames?.[0], `run ${i + 1}`), ...noReceipt(r, `run ${i + 1}`)]), "a failing Class A check ended the run with a failing exit and no broker receipt, twice");
187
196
  return verdict(c.runs.filter((r) => r.jobs.length).flatMap((r) => classABeforeBroker(r, { skipNeverRan: c.id === 7 })), "the Class A verdict file is older than the first signed submission, and every Class A program had ended by then");
188
197
  },
189
198
  // Class A starts ready, independent work whenever an eligible lane is free.
@@ -224,9 +233,11 @@ const LINES = {
224
233
  if (c.id === 4) {
225
234
  const row = c.expect?.outputNames?.[0] ?? "license";
226
235
  const fails = [...failedRun(run, "the run with one cache file deleted"), ...noReceipt(run, "it"), ...noClassAProgram(run, "it")];
227
- const lines = String(run.log ?? "").split(/\r?\n/).filter((l) => l.includes(row));
228
- if (!lines.length) fails.push(`the gate's output does not name the row ${row}`);
229
- else if (!lines.some((l) => /expected|forecast|missing|absent|lost|no longer|not in the store|deleted/i.test(l))) fails.push(`the gate's output names ${row} with no cause`);
236
+ // The gate's own stop record for the row, not any line that mentions it beside a likely word (review 2026-11-25 #3).
237
+ const stops = String(run.log ?? "").split(/\r?\n/).map((l) => /RK_CACHE_DIVERGENCE (\{.*\})/.exec(l)).filter(Boolean).map((m) => { try { return JSON.parse(m[1]); } catch { return null; } });
238
+ const stop = stops.find((d) => d?.id === row);
239
+ if (!stop) fails.push(`the gate did not stop with RK_CACHE_DIVERGENCE naming the row ${row}`);
240
+ else if (stop.expected !== "hit" || !stop.reason) fails.push(`the gate's stop for ${row} expected ${stop.expected} with reason ${stop.reason ?? "none"}`);
230
241
  return verdict(fails, `the run stopped with a failing exit, no receipt and no Class A program, and its output names ${row} and the cause`);
231
242
  }
232
243
  return verdict(workMatches(c, cases), "the broker commands and the scan store files written are exactly the rows the cases file expects");
@@ -284,7 +295,8 @@ const LINES = {
284
295
  const fails = [];
285
296
  if (c.id === 7) {
286
297
  const [first, second] = c.runs;
287
- if (!first?.killed) fails.push("the first run was not killed midway");
298
+ if (!first?.killed) fails.push("the first run was not killed midway (it had ended before the kill, or no kill was sent)");
299
+ else if (first.exit === 0) fails.push("the first run is marked killed but ended with exit 0: it finished before the kill landed");
288
300
  if (!second) fails.push("no ordinary run followed the killed one");
289
301
  else fails.push(...passedRun(second, "the ordinary run after the kill"), ...endsClean(second, "the ordinary run after the kill"));
290
302
  return verdict(fails, "the run was killed midway; the next ordinary run started by itself, passed, and left no lock and no program");
@@ -358,8 +370,9 @@ export function decideRealBuild(run, cases) {
358
370
  * The counting rule: a line passes when every case that is judged on it passes it, and every line must be judged by at least one case. Twelve of twelve is all twelve
359
371
  * passing by that rule and the real build passing its lines. A case that was not run fails every line it lists.
360
372
  */
361
- export function decideAll({ cases, results, realBuild = null }) {
373
+ export function decideAll({ cases, results, realBuild = null, callers = null }) {
362
374
  const lines = LINE_IDS.map((id) => {
375
+ if (RUN_LINES.includes(id)) return { id, verdict: callers?.verdict === PASS ? PASS : FAIL, why: callers?.why ?? "the callers of rightkit-gate check were not run", cases: [] };
363
376
  const from = [];
364
377
  for (const def of cases.cases) { if (!linesOf(def).includes(id)) continue; const r = results[def.id]?.[id]; from.push({ case: def.id, verdict: r?.verdict ?? FAIL, why: r?.why ?? "the case was not run" }); }
365
378
  const failed = from.filter((f) => f.verdict !== PASS);
@@ -386,7 +399,12 @@ export function factsOfRun(dir, { repo, receiptsDir, verify = null, killed = fal
386
399
  const logSnap = snapshotIn(log) ? plain(snapshotIn(log)) : null;
387
400
  const mine = inRun.filter((j) => j.gate?.commit === launch.commit || (logSnap !== null && (plain(j.gate?.snapshot) === logSnap || plain(j.cwd).startsWith(logSnap))));
388
401
  const snapshot = mine.map((j) => j.gate?.snapshot).find(Boolean) ?? snapshotIn(log);
402
+ // Jobs of THIS repository in the run's window that are not this run's: built from the working checkout, or in the snapshot under another commit. They
403
+ // were dropped before NN01 looked (review 2026-11-25 #7). Other repositories' jobs share the broker under normal load and are not counted (Gemini, 2026-11-25).
404
+ const repoKey = repo ? plain(repo) : null;
405
+ const foreignJobs = inRun.filter((j) => !mine.includes(j) && ((repoKey && plain(j.cwd).startsWith(repoKey)) || (logSnap !== null && (plain(j.gate?.snapshot) === logSnap || plain(j.cwd).startsWith(logSnap)))));
389
406
  return {
407
+ foreignJobs,
390
408
  dir, commit: launch.commit ?? null, tree: read.git?.tree ?? null, exit: launch.exit ?? null, signal: launch.signal ?? null, killed: killed || !!launch.signal,
391
409
  durationMs: Number.isFinite(start) && Number.isFinite(end) ? end - start : NaN, lanes: launch.lanes ?? null, log,
392
410
  jobs: mine, starts: f.starts, rootPid: f.root?.pid ?? null, processGaps: f.gaps, cacheWritten: json(path.join(dir, "cache-written.json")), verdicts, decisions,
@@ -1027,7 +1027,10 @@ function nn09(ctx) {
1027
1027
  }
1028
1028
 
1029
1029
 
1030
- const JUDGES = Object.freeze({ NN01: nn01, NN02: nn02, NN03: nn03, NN04: nn04, NN05: nn05, NN06: nn06, NN07: nn07, NN08: nn08, NN09: nn09, NN10: nn10, NN11: nn11, NN12: nn12 });
1030
+ // NN13 is about the gate's callers, not about one run: acceptance-run.mjs decides it once per acceptance run (acceptance-callers.mjs, rightkit#1695).
1031
+ // One run folder cannot show it, so here it is never a pass.
1032
+ function nn13() { return result(NOT_MEASURED, "decided once per acceptance run by acceptance-callers.mjs (every caller of rightkit-gate check), not by one run's record"); }
1033
+ const JUDGES = Object.freeze({ NN01: nn01, NN02: nn02, NN03: nn03, NN04: nn04, NN05: nn05, NN06: nn06, NN07: nn07, NN08: nn08, NN09: nn09, NN10: nn10, NN11: nn11, NN12: nn12, NN13: nn13 });
1031
1034
  export const CHECK_IDS = Object.freeze(Object.keys(JUDGES));
1032
1035
 
1033
1036
  /**
@@ -92,7 +92,10 @@ async function main() {
92
92
  let killed = false; let timer = null;
93
93
  const onStart = kill ? ({ child, out: runDir }) => {
94
94
  // Killed midway: once the gate says Class A's verdict is written the compile is under way; a little later the whole tree is ended.
95
- timer = setInterval(() => { let log = ""; try { log = fs.readFileSync(path.join(runDir, "gate.log"), "utf8"); } catch { log = ""; } if (/class A verdict written/i.test(log)) { clearInterval(timer); setTimeout(() => { killed = true; killTree(child.pid); }, 8000); } }, 500);
95
+ timer = setInterval(() => { let log = ""; try { log = fs.readFileSync(path.join(runDir, "gate.log"), "utf8"); } catch { log = ""; } if (/class A verdict written/i.test(log)) { clearInterval(timer); setTimeout(() => {
96
+ // Killed only if it was still running: a gate that had already ended was not killed midway (review 2026-11-25 #4).
97
+ if (child.exitCode === null && child.signalCode === null) { killed = true; killTree(child.pid); }
98
+ }, 8000); } }, 500);
96
99
  } : null;
97
100
  const code = await launch({ out: dir, commit, receiptsDir, repo, gate, gateArgs: args, onStart, lock: path.join(out, "acceptance-launch.lock") });
98
101
  if (timer) clearInterval(timer);
@@ -124,6 +127,15 @@ async function main() {
124
127
  const commit = def.commit === "fixture" ? pinned : caseCommit(fixture, pinned, def.commit.edits, String(id), out);
125
128
  if (def.commit !== "fixture") refs.push(`refs/witness/acceptance-${id}`);
126
129
  const runs = [];
130
+ // The gate's stage receipts for this case's commit (every app's) are set aside before every case but case 2, the one whose point is reuse: a passed
131
+ // compile recorded by an earlier run on the same gate stands, so case 1 skipped its compile and case 3 did it instead (0.6.75 run, 2026-11-25), and the
132
+ // case commits are the same every run (fixed identity and date), so cases 3, 5, 6 and 7 can short-circuit the same way (review 2026-11-25 #6).
133
+ if (id !== 2) {
134
+ const { gateStateDir } = await import("./gate-stages.mjs");
135
+ const receipts = path.join(gateStateDir(path.resolve(fixture, git(fixture, ["rev-parse", "--git-common-dir"]))), "receipts");
136
+ const asideReceipts = path.join(out, "set-aside", `case${id}-${new Date().toISOString().replace(/[:.]/g, "-")}`, "stage-receipts");
137
+ for (const f of fs.existsSync(receipts) ? fs.readdirSync(receipts) : []) if (f === `${commit}.json` || f.startsWith(`${commit}--`)) moveAside(path.join(receipts, f), path.join(asideReceipts, f));
138
+ }
127
139
  if (id === 1) {
128
140
  const aside = path.join(out, "set-aside", new Date().toISOString().replace(/[:.]/g, "-"));
129
141
  moveAside(storeDir, path.join(aside, "rightkit-gate-cache")); moveAside(historyFileOf(managed, storeDir), path.join(aside, "history.json"));
@@ -148,6 +160,18 @@ async function main() {
148
160
  }
149
161
  } finally { for (const r of refs) { try { git(fixture, ["update-ref", "-d", r]); } catch { /* reported by its absence */ } } }
150
162
  }
163
+ // NN13: every caller of `rightkit-gate check` in RightKit, run as written against the pinned fixture commit with the installed gate (acceptance-callers.mjs).
164
+ let callers = null;
165
+ if (fixture && (opt("--cases") === null || argv.includes("--callers"))) {
166
+ console.log("the callers of rightkit-gate check (NN13)");
167
+ const { judgeCallers, runGateFor } = await import("./acceptance-callers.mjs");
168
+ const rightkit = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
169
+ // A caller runs where it really runs: RightKit's own callers on RightKit at origin/main, the apps' callers on the fixture's pinned commit.
170
+ const rightkitSha = git(rightkit, ["rev-parse", "origin/main"]);
171
+ const where = (c) => (c.repo === "rightkit" ? { dir: rightkit, sha: rightkitSha } : { dir: fixture, sha: cases.fixture.commit });
172
+ callers = await judgeCallers(cases, rightkit, { run: (c, args) => { const w = where(c); return runGateFor(gate, w.dir, args, w.sha); } });
173
+ record.callers = callers; console.log(` NN13 ${callers.verdict}: ${callers.why}`.slice(0, 1500));
174
+ }
151
175
  let realLines = null;
152
176
  if (real) {
153
177
  console.log("the real build");
@@ -155,9 +179,11 @@ async function main() {
155
179
  realLines = decideRealBuild(facts, cases); record.realBuild = { repository: real, commit, run: lite(facts), lines: realLines };
156
180
  for (const [line, r] of Object.entries(realLines)) console.log(` ${line} ${r.verdict}: ${r.why}`);
157
181
  }
158
- const all = decideAll({ cases, results, realBuild: realLines }); record.endedAt = new Date().toISOString(); record.verdict = all;
182
+ const all = decideAll({ cases, results, realBuild: realLines, callers }); record.endedAt = new Date().toISOString(); record.verdict = all;
159
183
  fs.writeFileSync(path.join(out, "verdict.json"), `${JSON.stringify(record, null, 2)}\n`);
160
- console.log(`\n${all.passed} of ${all.of} lines pass${all.pass ? "; the real build passes its lines: ACCEPTED" : ""}`);
184
+ // The headline names the real build and the cases file it judged against, so "N of 13" is never read as acceptance without them (review 2026-11-25 #5, #11).
185
+ const realState = !all.realBuild.length ? "the real build: not part of this cases file" : !realLines ? "the real build: NOT RUN" : all.realBuild.every((l) => l.verdict === "pass") ? "the real build: passes its lines" : "the real build: FAILS";
186
+ console.log(`\n${all.passed} of ${all.of} lines pass; ${realState}; cases file sha256 ${record.casesSha256}${all.pass ? ": ACCEPTED" : ": NOT ACCEPTED"}`);
161
187
  for (const l of all.lines) console.log(`${l.id} ${l.verdict}${l.verdict === "pass" ? "" : `: ${l.why}`}`.slice(0, 1200));
162
188
  for (const l of all.realBuild) console.log(`real build ${l.id} ${l.verdict}${l.verdict === "pass" ? "" : `: ${l.why}`}`.slice(0, 600));
163
189
  process.exit(all.pass ? 0 : 1);
@@ -174,9 +174,11 @@ export function ruleVerdictCache({ checkout, spawn }) {
174
174
  const file = (k) => path.join(dir, `${k}.json`);
175
175
  return {
176
176
  key: (parts) => createHash("sha256").update(canonicalJson({ schema: RULE_VERDICT_SCHEMA, node: process.version, platform: `${process.platform}-${process.arch}`, ...parts })).digest("hex"),
177
- passed: (k) => { try { return JSON.parse(fs.readFileSync(file(k), "utf8"))?.status === "pass"; } catch { return false; } },
177
+ // A stored pass names how many rules passed, so a reused verdict prints the same `passed N rules` line a fresh one does (publish admission reads it,
178
+ // rightkit#1695); a pass stored without the count is not reused, so it runs once more and is stored with it.
179
+ passed: (k, { needRules = false } = {}) => { try { const r = JSON.parse(fs.readFileSync(file(k), "utf8")); return r?.status === "pass" && (!needRules || (Number.isInteger(r.rules) && r.rules > 0)) ? r : null; } catch { return null; } },
178
180
  // A pass that is already stored is not written back (GC-A27 NN06: nothing is written for a row whose inputs did not change).
179
- pass: (k) => { try { if (JSON.parse(fs.readFileSync(file(k), "utf8"))?.status === "pass") return; } catch { /* not stored yet */ } try { fs.mkdirSync(dir, { recursive: true }); const tmp = `${file(k)}.${process.pid}.tmp`; fs.writeFileSync(tmp, JSON.stringify({ schema: RULE_VERDICT_SCHEMA, status: "pass", at: new Date().toISOString() })); fs.renameSync(tmp, file(k)); } catch { /* a cache */ } },
181
+ pass: (k, rules = null) => { try { const r = JSON.parse(fs.readFileSync(file(k), "utf8")); if (r?.status === "pass" && (Number.isInteger(r.rules) || !Number.isInteger(rules))) return; } catch { /* not stored yet */ } try { fs.mkdirSync(dir, { recursive: true }); const tmp = `${file(k)}.${process.pid}.tmp`; fs.writeFileSync(tmp, JSON.stringify({ schema: RULE_VERDICT_SCHEMA, status: "pass", ...(Number.isInteger(rules) ? { rules } : {}), at: new Date().toISOString() })); fs.renameSync(tmp, file(k)); } catch { /* a cache */ } },
180
182
  };
181
183
  } catch { return null; }
182
184
  }
@@ -4477,10 +4479,14 @@ export async function main(argv, io = {}) {
4477
4479
  }
4478
4480
  const ruleCache = snapshotDir && snapshotCommit && !args.includes("--worktree") && !o.appCheck ? ruleVerdictCache({ checkout: snapshotCheckout, spawn: o.spawn }) : null;
4479
4481
  const appKey = ruleCache ? ruleCache.key({ rule: "app-check", tree: snapshotCommit.tree, args: appArgs, gate: gatePackageIdentity(o.gatePackage) }) : null;
4480
- const appCached = Boolean(appKey && ruleCache.passed(appKey));
4482
+ const appStored = appKey ? ruleCache.passed(appKey, { needRules: true }) : null; const appCached = Boolean(appStored);
4483
+ // A reused verdict prints the same pass line a fresh run prints, with the stored rule count, so a caller that reads it (publish admission's
4484
+ // gateVerdict) takes a cached pass and a fresh one alike (rightkit#1695). The fresh run's count is read from its own pass line and stored with the pass.
4485
+ let appRules = null;
4486
+ const appOut = (m) => { const hit = /^(?:\S+Z )?check: [0-9a-f]{12} passed (\d+) rules \(/m.exec(String(m)); if (hit) appRules = Number(hit[1]); return o.out(m); };
4481
4487
  let appCheck = appCached
4482
- ? (o.out(`check: ${snapshotCommit.commit.slice(0, 12)} app rules: cached pass (tree ${snapshotCommit.tree.slice(0, 12)})`), 0)
4483
- : await (o.appCheck ?? (await import("../app-check.mjs")).main)(appArgs, { out: o.out, err: o.err, label: "check", cwd: o.cwd, ...(snapshotDir && !args.includes("--worktree") ? { snapshot: snapshotDir } : {}) });
4488
+ ? (o.out(`check: ${snapshotCommit.commit.slice(0, 12)} passed ${appStored.rules} rules (${option("--rule-tier") ?? "compile"} tier) in 0s (cached pass, tree ${snapshotCommit.tree.slice(0, 12)})`), 0)
4489
+ : await (o.appCheck ?? (await import("../app-check.mjs")).main)(appArgs, { out: appOut, err: o.err, label: "check", cwd: o.cwd, ...(snapshotDir && !args.includes("--worktree") ? { snapshot: snapshotDir } : {}) });
4484
4490
  // GC-A15 ("An app carries no Cargo profile table but [profile.release]"; Adrian 2026-11-03: "hard block"). The rule lived only in the release
4485
4491
  // tool (release.mjs cargo-profile-contract), so a commit that adds [profile.dev] to an app passed check and compile (contract test N15, failed
4486
4492
  // on sealed 0.6.58 and on the Dell copy 2026-11-19). It is judged here with the app rules, by the release tool's own scan (same workspace
@@ -4494,7 +4500,7 @@ export async function main(argv, io = {}) {
4494
4500
  if (lines.length) { for (const line of lines) o.err(`check: ${line}`); appCheck = 1; }
4495
4501
  } catch (error) { o.err(`rightkit-gate: BLOCKED: the Cargo profile rule (GC-A15) could not be judged: ${error.message}`); return 1; }
4496
4502
  }
4497
- if (appKey && appCheck === 0) ruleCache.pass(appKey);
4503
+ if (appKey && appCheck === 0) ruleCache.pass(appKey, appRules);
4498
4504
  if (args.includes("--list") || args.includes("--print-baseline") || args.includes("--only") || o.classA === false) {
4499
4505
  // A view of the app rules, never a class A verdict: say so, so no caller can take its exit 0 for a full check.
4500
4506
  // A green partial view exits PARTIAL_EXIT (3), never 0, so a caller that admits only exit 0 rejects it by status alone.
@@ -5953,8 +5959,11 @@ export async function main(argv, io = {}) {
5953
5959
  if (notRun.length) o.out(`${tag} class A partial: ${notRun.length} check(s) that execute repository code (tests, typecheck, lint, generated docs) run in the full gate, not in check: ${notRun.slice(0, 8).join(", ")}${notRun.length > 8 ? ", …" : ""}`);
5954
5960
  if (!recordHistory()) return 1;
5955
5961
  o.out(`${tag} class A content pass: ${scanResult.scans.length} deterministic scan(s) over ${changed.length} file(s) of ${base}`);
5956
- // F4 (step F, 2026-11-24): a check that skipped the scans that execute repository code is not a pass. Exit 3, as --only's partial run does.
5957
- if (notRun.length) { o.out(`${tag} PARTIAL: ${notRun.length} executing check(s) did not run; run it with --full-a, or run the stage with --to`); return 3; }
5962
+ // F4 (step F, 2026-11-24): a check that skipped the scans that execute repository code is not a full pass, and says so. It exits 0: CI,
5963
+ // publish-app, every consumer app's check job and the templates call `check` and need 0 for a clean commit (exit 3 broke them all,
5964
+ // rightkit#1695). What admits something reads the full pass line instead: publish admission runs `check --full-a` and requires
5965
+ // "class A scoped pass" / "class A full pass", which this content-only run never prints.
5966
+ if (notRun.length) o.out(`${tag} PARTIAL: ${notRun.length} executing check(s) did not run; run it with --full-a, or run the stage with --to`);
5958
5967
  return 0;
5959
5968
  }
5960
5969
  if (!recordHistory()) return 1;
@@ -413,7 +413,7 @@ Commands:
413
413
  Sign and promote one runtime/model artifact
414
414
  addon doctor|build|upload|adopt <options> Manage a signed headless add-on
415
415
  provision-model [--config <file>] [--id <bundle>] [--dry-run] Fetch each modelBundles entry's pinned files into its dest, verifying size and sha256 (resumable; nothing unpinned)
416
- direct-release finalize [--config <file>] [--output-dir <dir>] [--dry-run] Zip, signed release manifest, install.ps1 bootstrap, publication plan for a direct (non-store) release, from the config's directRelease block (checked; uploads nothing)
416
+ direct-release finalize [--config <file>] [--output-dir <dir>] [--dry-run] Zip, SLSA provenance and CycloneDX SBOM when the asset names none, signed release manifest, install.ps1 bootstrap, publication plan for a direct (non-store) release, from the config's directRelease block (checked; uploads nothing)
417
417
  apple profile renew [--config <file>] [--profile <file>] [--dry-run]
418
418
  Renew macOS profile for current Keychain signer
419
419
  signing-agent install|uninstall|status Manage invisible Aqua-session signing service
package/contract-nn.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "rightkit.contract-nn/1",
3
- "contractSha256": "591d4ba2c8f6ec5d82daac6074f7a81b606b3c574e0d40e0ba146336f7fe109a",
3
+ "contractSha256": "08344cbc66ffb802c7e069760317a31424135925d3af3c3ce703a6a6a0e6fbf8",
4
4
  "runnerFiles": [
5
5
  "acceptance-launch.mjs",
6
6
  "acceptance-lines.mjs",
@@ -18,7 +18,8 @@
18
18
  "NN09",
19
19
  "NN10",
20
20
  "NN11",
21
- "NN12"
21
+ "NN12",
22
+ "NN13"
22
23
  ],
23
24
  "retiredRunner": {
24
25
  "retiredIn": "rightkit#1514 step 9",