@rightkit/release 0.6.63 → 0.6.64

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.
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+ // Runs the acceptance cases of acceptance-cases.json against an installed gate and the live broker, and prints the twelve-line verdict (GC-A27; rightkit#1514;
3
+ // Adrian, 2026-11-24: "the 7 fixture cases + 1 real build as the acceptance run").
4
+ //
5
+ // node acceptance-run.mjs --fixture <witness fixture checkout> --out <folder> --gate <installed rightkit-gate.mjs> --managed <managed data root>
6
+ // [--cases 1,2,4,3,5,6,7] [--real <repository>] [--rustright <client>] [--keep-going]
7
+ //
8
+ // What it does to set a case up, and nothing else: removes the fixture's scan store and its history for the case from nothing (both are kept under --out);
9
+ // plants an error in the fixture's working checkout and restores it; makes the case commits as unreferenced commits under refs/witness/acceptance-* and deletes
10
+ // those refs at the end; moves the `license` store files away and puts them back; kills the gate's process tree for the kill case. It hands the gate no variable
11
+ // and no flag beyond the stage. Verdicts come from acceptance-cases.mjs; this file decides nothing.
12
+ import crypto from "node:crypto";
13
+ import fs from "node:fs";
14
+ import os from "node:os";
15
+ import path from "node:path";
16
+ import { execFileSync } from "node:child_process";
17
+ import { fileURLToPath } from "node:url";
18
+ import { cacheStoreDir, launch } from "./acceptance-launch.mjs";
19
+ import { verifierArgv } from "./acceptance-lines.mjs";
20
+ import { decideAll, decideCase, decideRealBuild, factsOfRun } from "./acceptance-cases.mjs";
21
+
22
+ const here = path.dirname(fileURLToPath(import.meta.url));
23
+ const sha256 = (b) => crypto.createHash("sha256").update(b).digest("hex");
24
+ const git = (repo, args, opts = {}) => String(execFileSync("git", ["-C", repo, ...args], { encoding: "utf8", windowsHide: true, stdio: ["pipe", "pipe", "pipe"], maxBuffer: 64 * 1024 * 1024, ...opts })).trim();
25
+ const IDENT = { GIT_AUTHOR_NAME: "acceptance", GIT_AUTHOR_EMAIL: "acceptance@rightkit.invalid", GIT_COMMITTER_NAME: "acceptance", GIT_COMMITTER_EMAIL: "acceptance@rightkit.invalid", GIT_AUTHOR_DATE: "2026-11-24T00:00:00Z", GIT_COMMITTER_DATE: "2026-11-24T00:00:00Z" };
26
+
27
+ /** An unreferenced commit on `base` with the case's edits (append to a tracked file, or a new file's content), kept alive under refs/witness/acceptance-<name>. No checkout is written. */
28
+ export function caseCommit(repo, base, edits, name, scratch) {
29
+ const idx = path.join(scratch, `index-${name}`); fs.rmSync(idx, { force: true }); const env = { ...process.env, ...IDENT, GIT_INDEX_FILE: idx };
30
+ git(repo, ["read-tree", base], { env });
31
+ for (const e of edits) {
32
+ const body = typeof e.append === "string" ? execFileSync("git", ["-C", repo, "show", `${base}:${e.path}`], { windowsHide: true }).toString("utf8") + e.append : e.content;
33
+ const blob = git(repo, ["hash-object", "-w", "--stdin"], { input: body });
34
+ git(repo, ["update-index", "--add", "--cacheinfo", `100644,${blob},${e.path}`], { env });
35
+ }
36
+ const tree = git(repo, ["write-tree"], { env });
37
+ const commit = git(repo, ["commit-tree", tree, "-p", base, "-m", `acceptance case ${name}`], { env });
38
+ git(repo, ["update-ref", `refs/witness/acceptance-${name}`, commit]); fs.rmSync(idx, { force: true });
39
+ return commit;
40
+ }
41
+ /** The history file the gate keeps for a store (class-a-cache-history.mjs: named after the store's path). */
42
+ export const historyFileOf = (managed, storeDir) => path.join(managed, "runs", "rightkit-class-a-history", `${sha256(path.resolve(storeDir).toLowerCase())}.json`);
43
+ const moveAside = (from, to) => { if (!fs.existsSync(from)) return false; fs.mkdirSync(path.dirname(to), { recursive: true }); fs.renameSync(from, to); return true; };
44
+ /** Ends the gate and every program it started (Windows: the whole tree by pid; elsewhere the process group is the launcher's to signal). */
45
+ const killTree = (pid) => { try { if (process.platform === "win32") execFileSync("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, stdio: "ignore" }); else process.kill(pid, "SIGKILL"); } catch { /* already gone */ } };
46
+
47
+ async function main() {
48
+ const argv = process.argv.slice(2); const opt = (n) => { const i = argv.indexOf(n); return i < 0 ? null : argv[i + 1]; };
49
+ const fixture = opt("--fixture"); const out = opt("--out"); const gate = opt("--gate"); const managed = opt("--managed"); const real = opt("--real");
50
+ if (!out || !gate || !managed || (!fixture && !real)) { console.error("usage: acceptance-run.mjs --fixture <dir> --out <dir> --gate <rightkit-gate.mjs> --managed <data root> [--cases 1,2,...] [--real <repo>]"); process.exit(2); }
51
+ const casesFile = path.join(here, "acceptance-cases.json"); const casesBody = fs.readFileSync(casesFile); const cases = JSON.parse(casesBody.toString("utf8"));
52
+ const receiptsDir = path.join(managed, "rightkit-build-control", "receipts");
53
+ const pin = JSON.parse(fs.readFileSync(path.join(managed, "pins", `broker-${process.platform}.json`), "utf8")); const client = opt("--rustright") ?? "rustright";
54
+ const verify = (body) => {
55
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "rk-verify-")); const file = path.join(dir, "receipt.json"); fs.writeFileSync(file, body);
56
+ const a = verifierArgv({ file, body, key: pin.publicKey, keyId: pin.keyId, host: pin.host, brokerDigest: pin.brokerDigest });
57
+ try { if (!a) return { ok: false, problems: ["the receipt names no job id, nonce or request digest"] }; execFileSync(client, a, { stdio: ["ignore", "pipe", "pipe"], windowsHide: true, shell: process.platform === "win32" }); return { ok: true, problems: [] }; }
58
+ catch (e) { return { ok: false, problems: [String(e.stderr ?? e.message).trim().split(/\r?\n/).pop()] }; }
59
+ finally { fs.rmSync(dir, { recursive: true, force: true }); }
60
+ };
61
+ fs.mkdirSync(out, { recursive: true });
62
+ const record = { schema: "rightkit.acceptance-run/1", casesSha256: sha256(casesBody), gate: path.resolve(gate), startedAt: new Date().toISOString(), cases: {}, realBuild: null };
63
+ const results = {}; const refs = [];
64
+ const one = async (repo, commit, name, { args, kill = false } = {}) => {
65
+ const dir = path.join(out, name); fs.rmSync(dir, { recursive: true, force: true }); fs.mkdirSync(dir, { recursive: true });
66
+ let killed = false; let timer = null;
67
+ const onStart = kill ? ({ child, out: runDir }) => {
68
+ // 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.
69
+ 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);
70
+ } : null;
71
+ const code = await launch({ out: dir, commit, receiptsDir, repo, gate, gateArgs: args, onStart, lock: path.join(out, "acceptance-launch.lock") });
72
+ if (timer) clearInterval(timer);
73
+ let facts = factsOfRun(dir, { repo, receiptsDir, verify, killed });
74
+ // The test programs the receipts sign, hashed now: straight after the run, before anything else can build.
75
+ const imageNow = {};
76
+ for (const j of facts.jobs) for (const exe of Array.isArray(j.testExecutables) ? j.testExecutables : []) { const f = typeof exe === "string" ? exe : exe?.path; if (typeof f !== "string") continue; try { imageNow[f.replace(/^\\\\\?\\/, "").replaceAll("\\", "/").toLowerCase()] = sha256(fs.readFileSync(f.replace(/^\\\\\?\\/, ""))); } catch { /* unreadable: no hash, which fails the line */ } }
77
+ facts = { ...facts, imageNow };
78
+ console.log(` ${name}: exit ${code}${killed ? " (killed)" : ""}, ${Math.round(facts.durationMs / 1000)} s, ${facts.jobs.length} broker job(s), ${facts.starts.length} program(s), ${Array.isArray(facts.cacheWritten) ? facts.cacheWritten.length : "?"} store file(s) written`);
79
+ return facts;
80
+ };
81
+ const lite = (f) => ({ dir: f.dir, commit: f.commit, exit: f.exit, killed: f.killed, durationMs: f.durationMs, jobs: f.jobs.length, programs: f.starts.length, cacheWritten: Array.isArray(f.cacheWritten) ? f.cacheWritten.length : null, processGaps: f.processGaps });
82
+
83
+ if (fixture) {
84
+ const pinned = cases.fixture.commit; if (git(fixture, ["cat-file", "-t", pinned]) !== "commit") throw new Error(`the fixture has no commit ${pinned}`);
85
+ if (git(fixture, ["status", "--porcelain", "--untracked-files=no"])) throw new Error("the fixture's working checkout has changes to tracked files; the cases need it clean to start");
86
+ const storeDir = cacheStoreDir(fixture); const args = ["--to", cases.fixture.stage];
87
+ const wanted = (opt("--cases") ?? cases.order.join(",")).split(",").map(Number);
88
+ try {
89
+ for (const id of cases.order.filter((n) => wanted.includes(n))) {
90
+ const def = cases.cases.find((c) => c.id === id); console.log(`case ${id}: ${def.name}`);
91
+ const commit = def.commit === "fixture" ? pinned : caseCommit(fixture, pinned, def.commit.edits, String(id), out);
92
+ if (def.commit !== "fixture") refs.push(`refs/witness/acceptance-${id}`);
93
+ const runs = [];
94
+ if (id === 1) {
95
+ const aside = path.join(out, "set-aside", new Date().toISOString().replace(/[:.]/g, "-"));
96
+ moveAside(storeDir, path.join(aside, "rightkit-gate-cache")); moveAside(historyFileOf(managed, storeDir), path.join(aside, "history.json"));
97
+ const dirty = path.join(fixture, "rk", "crates", "rk-leaf", "src", "lib.rs");
98
+ fs.writeFileSync(dirty, "pub fn leaf() -> u32 { this does not compile\n");
99
+ try { runs.push(await one(fixture, commit, "case1", { args })); } finally { git(fixture, ["checkout", "--", "rk/crates/rk-leaf/src/lib.rs"]); }
100
+ } else if (id === 4) {
101
+ const held = path.join(out, "case4-held"); fs.mkdirSync(held, { recursive: true }); const moved = [];
102
+ for (const n of fs.readdirSync(storeDir).filter((x) => x.endsWith(".json"))) { let d = null; try { d = JSON.parse(fs.readFileSync(path.join(storeDir, n), "utf8")); } catch { d = null; } if (d?.row?.id === "license") { fs.renameSync(path.join(storeDir, n), path.join(held, n)); moved.push(n); } }
103
+ if (!moved.length) throw new Error("case 4: the store holds no result for the row license to delete");
104
+ try { runs.push(await one(fixture, commit, "case4", { args })); } finally { for (const n of moved) if (!fs.existsSync(path.join(storeDir, n))) fs.renameSync(path.join(held, n), path.join(storeDir, n)); }
105
+ } else if (id === 7) {
106
+ runs.push(await one(fixture, commit, "case7-killed", { args, kill: true }));
107
+ runs.push(await one(fixture, commit, "case7-after", { args }));
108
+ } else for (let i = 0; i < (def.runs ?? 1); i += 1) runs.push(await one(fixture, commit, `case${id}${(def.runs ?? 1) > 1 ? `-run${i + 1}` : ""}`, { args }));
109
+ results[id] = decideCase({ ...def, runs }, cases); record.cases[id] = { commit, runs: runs.map(lite), lines: results[id] };
110
+ for (const [line, r] of Object.entries(results[id])) console.log(` ${line} ${r.verdict}: ${r.why}`);
111
+ if (!argv.includes("--keep-going") && runs.some((r) => r.processGaps.length)) console.log(" note: the process record of a run is incomplete; lines that read it fail for that reason");
112
+ }
113
+ } finally { for (const r of refs) { try { git(fixture, ["update-ref", "-d", r]); } catch { /* reported by its absence */ } } }
114
+ }
115
+ let realLines = null;
116
+ if (real) {
117
+ console.log("the real build");
118
+ const commit = git(real, ["rev-parse", "HEAD"]); const facts = await one(real, commit, "real-build", { args: cases.realBuild.args });
119
+ realLines = decideRealBuild(facts, cases); record.realBuild = { repository: real, commit, run: lite(facts), lines: realLines };
120
+ for (const [line, r] of Object.entries(realLines)) console.log(` ${line} ${r.verdict}: ${r.why}`);
121
+ }
122
+ const all = decideAll({ cases, results, realBuild: realLines }); record.endedAt = new Date().toISOString(); record.verdict = all;
123
+ fs.writeFileSync(path.join(out, "verdict.json"), `${JSON.stringify(record, null, 2)}\n`);
124
+ console.log(`\n${all.passed} of ${all.of} lines pass${all.pass ? "; the real build passes its lines: ACCEPTED" : ""}`);
125
+ for (const l of all.lines) console.log(`${l.id} ${l.verdict}${l.verdict === "pass" ? "" : `: ${l.why}`}`.slice(0, 1200));
126
+ for (const l of all.realBuild) console.log(`real build ${l.id} ${l.verdict}${l.verdict === "pass" ? "" : `: ${l.why}`}`.slice(0, 600));
127
+ process.exit(all.pass ? 0 : 1);
128
+ }
129
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main().catch((e) => { console.error(`acceptance-run: ${e.stack ?? e.message}`); process.exit(2); });
@@ -86,7 +86,7 @@ import { FOREIGN_PRE_COMMIT, retireHooksIn } from "../hook-retirement.mjs";
86
86
  import { fileURLToPath } from "node:url";
87
87
  import { installIdentity, installStateBytes } from "../dependency-identity.mjs";
88
88
  import { pnpmVersionAnswer } from "../snapshot-dependency-reuse.mjs";
89
- import { BIOME_CONFIG_FILES, CHECKER_IDENTITY, OXLINT_CONFIG_FILES, ESLINT_CONFIG_FILES, LOCAL_CLASS_B_JOBS, WORKSPACE_RUST_FILE, ancestorConfigChanged, ancestorDirsOf, canonicalJson, defaultSpawn, defaultSpawnAsync, judgeUnitList, blockedUnitsOf, digestScanSet, fileScanCache, findRustfmt, metadataArgs, planScans, planUnitListScans, publisherRequirementScan, runScans, sidecarBoundCrate, scanToolPolicyFromPipeline, scanDeferrals, scanFailures, seamRunState } from "../deterministic-scans.mjs";
89
+ import { BIOME_CONFIG_FILES, CHECKER_IDENTITY, OXLINT_CONFIG_FILES, ESLINT_CONFIG_FILES, LOCAL_CLASS_B_JOBS, WORKSPACE_RUST_FILE, ancestorConfigChanged, ancestorDirsOf, canonicalJson, defaultSpawn, defaultSpawnAsync, rememberReads, judgeUnitList, blockedUnitsOf, digestScanSet, fileScanCache, findRustfmt, metadataArgs, planScans, planUnitListScans, publisherRequirementScan, runScans, sidecarBoundCrate, scanToolPolicyFromPipeline, scanDeferrals, scanFailures, seamRunState } from "../deterministic-scans.mjs";
90
90
  import { changedLockNames, parseLock, reach } from "../lock-graph.mjs";
91
91
  import { resolveExecutor } from "../gate-executor.mjs";
92
92
  // The gate's own executor: an outer gate's cargo wrapper on PATH is never this gate's cargo (gate-executor.mjs `gateWrappers`).
@@ -166,7 +166,7 @@ export const MOBILE_PLATFORMS = Object.freeze(new Set(["ios", "android"]));
166
166
  const CLASS_B_KEY_SCHEMA = "rightkit.class-b-key/3";
167
167
  // GC-A24: passing rule-engine verdicts (app rules, RightKit's preflight) of a snapshot, under the checkout's git common directory.
168
168
  const RULE_VERDICT_SCHEMA = "rightkit.rule-verdict/1";
169
- function ruleVerdictCache({ checkout, spawn }) {
169
+ export function ruleVerdictCache({ checkout, spawn }) {
170
170
  try {
171
171
  const common = spawn("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], { cwd: checkout });
172
172
  if (failed(common) || !text(common).trim()) return null;
@@ -175,7 +175,8 @@ function ruleVerdictCache({ checkout, spawn }) {
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
177
  passed: (k) => { try { return JSON.parse(fs.readFileSync(file(k), "utf8"))?.status === "pass"; } catch { return false; } },
178
- pass: (k) => { 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 */ } },
178
+ // 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 */ } },
179
180
  };
180
181
  } catch { return null; }
181
182
  }
@@ -4154,7 +4155,7 @@ export function cargoHomeOf(env, { realpath = fs.realpathSync, homedir = os.home
4154
4155
 
4155
4156
  export async function main(argv, io = {}) {
4156
4157
  const o = {
4157
- spawn: defaultSpawn, exists: fs.existsSync, readFile: (f) => fs.readFileSync(f, "utf8"), writeFile: fs.writeFileSync, mkdir: fs.mkdirSync, chmod: fs.chmodSync, readdir: fs.readdirSync,
4158
+ spawn: rememberReads(defaultSpawn), exists: fs.existsSync, readFile: (f) => fs.readFileSync(f, "utf8"), writeFile: fs.writeFileSync, mkdir: fs.mkdirSync, chmod: fs.chmodSync, readdir: fs.readdirSync,
4158
4159
  readStdin: () => { try { return process.stdin.isTTY ? "" : fs.readFileSync(0, "utf8"); } catch { return ""; } },
4159
4160
  out: (m) => console.log(m), err: (m) => console.error(m), cwd: process.cwd(), env: process.env, platform: process.platform,
4160
4161
  // Where this gate runs from (the door puts its own shims first on PATH when it is an installed package: doorPath).
@@ -5207,7 +5208,7 @@ export async function main(argv, io = {}) {
5207
5208
  const unit = sel?.replace(/^cargo:/, "");
5208
5209
  const quiet = sel?.startsWith("cargo:") ? config.rust?.[unit]?.quietTests === true : false;
5209
5210
  // A crate that ci/shards.json lists solo, or that is sidecar-bound, never joins another crate's invocation (planScans' own rule for its rows).
5210
- const alone = sel?.startsWith("cargo:") && (solo.includes(unit) || sidecarBoundCrate({ dir: path.join(repo, dirOf.get(sel) ?? `crates/${unit}`), exists: o.exists, readFile: o.readFile }).bound);
5211
+ const alone = sel?.startsWith("cargo:") && (sidecarBoundCrate({ dir: path.join(repo, dirOf.get(sel) ?? `crates/${unit}`), exists: o.exists, readFile: o.readFile }).bound);
5211
5212
  return publisherRequirementScan(requirement, { platform: o.platform, cargoCommand: planCargoCommand, cargoLiveRoot, targetDirs, quiet, allowIgnored: verdicts.get(sel)?.allowIgnored === true, batch: !alone });
5212
5213
  };
5213
5214
  const planned = planUnitListScans({ entries: scoped, planned: plan.scans, normalizedCwds, adapt, blocked });
@@ -5518,7 +5519,10 @@ export async function main(argv, io = {}) {
5518
5519
  ...(() => { const bt = brokerToolchainOf(o, executor); return bt ? { brokerToolchain: bt } : {}; })(),
5519
5520
  // The commit's own files (rightkit#1393): a snapshot is not a git toplevel, so the secret scan needs this list to judge tracked files only and never what a stage wrote there.
5520
5521
  ...(snapshot ? { trackedFiles: files } : {}),
5521
- classes: stageClasses, ...(classAEarlier ? { classAEarlier: true } : {}), jobs, classBJobs, classBBatching: !o[PRIVATE_SCOPED_COMPILE], groupTests: true, classBPipeline: 2, ...(brokerHost ? { brokerHost: true } : {}), ...(brokerLive ? { brokerLive } : {}), signal: ac.signal, ...(cache ? { cache } : {}),
5522
+ classes: stageClasses, ...(classAEarlier ? { classAEarlier: true } : {}), jobs, classBJobs, classBBatching: !o[PRIVATE_SCOPED_COMPILE], groupTests: true,
5523
+ // GC-A27 NN09 (acceptance case 1 on 0.6.63, 2026-11-24): every carried compile of a workspace is handed to the broker as soon as it is ready, none held until an
5524
+ // earlier job ends. The broker owns the order and runs one build per repository; with two in flight the last command of the fixture went out three minutes late.
5525
+ classBPipeline: Number.POSITIVE_INFINITY, ...(brokerHost ? { brokerHost: true } : {}), ...(brokerLive ? { brokerLive } : {}), signal: ac.signal, ...(cache ? { cache } : {}),
5522
5526
  // NN41: the installed broker runtime's identity keys every cached compile failure; null (a direct host, an unreadable manifest) means no failure is cached.
5523
5527
  ...(brokerHost && cache ? (() => { const identity = brokerRuntimeIdentityText({ clients: [brokerClient, executor?.client, cargoCommand[0]], env: { ...o.env, ...(executor.env ?? {}) }, platform: o.platform }); return identity ? { failureIdentity: identity } : {}; })() : {}),
5524
5528
  // The declared Linux broker route: the scans are planned with the logical `rustright`, which this spawn (and scanSpawn's pass-through below) starts as the
@@ -1934,7 +1934,8 @@ export function planScans({
1934
1934
  // One Clippy scan per batch (row 8.6): the independent batches first, the sidecar-bound ones after them (row 8.8; the compile lane
1935
1935
  // drains in plan order). The reason a configuration stays separate is recorded in the plan notes.
1936
1936
  const sidecarBound = new Set(clippyEntries.filter((e) => sidecarBoundCrate({ dir: path.join(contentRoot, rustDir(e.name)), exists, readFile }).bound).map((e) => e.name));
1937
- const plan = clippyBatchPlan(clippyEntries, { solo: shardSolo, separate: clippySeparate, sidecarBound, toolchain: cargoCommand.join(" ") });
1937
+ const plan = clippyBatchPlan(clippyEntries, { solo: [], separate: clippySeparate, // ci/shards.json `solo` sizes CI jobs; it is no reason to split a compile here (GC-A27 NN09)
1938
+ sidecarBound, toolchain: cargoCommand.join(" ") });
1938
1939
  for (const b of plan.batches) add({ id: b.id, class: B, batch: { units: b.units, order: b.order, reason: b.reason }, ...cargoIn(b.ws, ...clippyArgs(b.crates, { features: b.set, locked: true })) });
1939
1940
  notes.push(...plan.notes);
1940
1941
  }
@@ -2177,7 +2178,6 @@ export function planScans({
2177
2178
  let why = null;
2178
2179
  if (at < 0 || typeof crate !== "string" || x.args.indexOf("-p", at + 1) >= 0) why = "it does not name exactly one `-p <crate>`";
2179
2180
  else if (rest.some((w) => /^(?:--features(?:=.*)?|-F.*)$/.test(w))) why = "its feature set names crate-specific features";
2180
- else if (shardSolo.includes(unit) || shardSolo.includes(crateOf(unit))) why = "ci/shards.json solo";
2181
2181
  else if (clippySeparate instanceof Map && clippySeparate.has(unit)) why = String(clippySeparate.get(unit));
2182
2182
  else if (sidecarBoundCrate({ dir: path.join(contentRoot, rustDir(unit)), exists, readFile }).bound) why = "sidecar-bound";
2183
2183
  // NN42 (LOCKED 2026-11-06): one check/clippy per stage names every --target. The target is not part of the group key: rows that differ only
@@ -2293,6 +2293,36 @@ export function defaultSpawn(command, args, options = {}) {
2293
2293
  return spawnSync(inv.file, inv.args, { encoding: "utf8", windowsHide: true, maxBuffer: 64 * 1024 * 1024, windowsVerbatimArguments: inv.verbatim, ...options, shell: false });
2294
2294
  }
2295
2295
 
2296
+ /**
2297
+ * GC-A27 NN08 (no repeat calls): the answers of three read-only commands are kept for the life of the gate process and never asked for twice. Each is a read
2298
+ * whose answer cannot change during a run for the same folder and environment: a file of a commit named by its full sha (`git show <sha>:<path>`), the top
2299
+ * of a checkout (`git rev-parse --show-toplevel`), and `pnpm --version`. Found by the acceptance cases on gate 0.6.63 (2026-11-24): each was started two to
2300
+ * four times in one run. Only a successful answer is kept; anything else is asked again. `store` is injectable for tests.
2301
+ */
2302
+ const READ_MEMO = new Map();
2303
+ export function isRememberedRead(command, args) {
2304
+ const name = String(command).replaceAll("\\", "/").split("/").pop().replace(/\.(exe|cmd|bat)$/i, "").toLowerCase();
2305
+ const a = (args ?? []).map(String);
2306
+ if (name === "pnpm") return a.length === 1 && a[0] === "--version";
2307
+ if (name !== "git") return false;
2308
+ // git's own leading options (-c key=value, -C dir) are part of the key; the subcommand is what is judged.
2309
+ let i = 0; while (i < a.length && (a[i] === "-c" || a[i] === "-C")) i += 2;
2310
+ const sub = a.slice(i);
2311
+ if (sub.length === 2 && sub[0] === "show" && /^[0-9a-f]{40}:.+/.test(sub[1])) return true;
2312
+ return sub.length === 2 && sub[0] === "rev-parse" && sub[1] === "--show-toplevel";
2313
+ }
2314
+ export function rememberReads(spawn, { store = READ_MEMO } = {}) {
2315
+ return (command, args, options = {}) => {
2316
+ if (!isRememberedRead(command, args) || options.input !== undefined || options.stdio !== undefined) return spawn(command, args, options);
2317
+ const env = options.env ? Object.keys(options.env).sort().map((k) => `${k}=${options.env[k]}`).join("\0") : "";
2318
+ const key = sha256(JSON.stringify([String(command), args, path.resolve(options.cwd ?? process.cwd()), options.encoding ?? null, env]));
2319
+ if (store.has(key)) return { ...store.get(key) };
2320
+ const r = spawn(command, args, options);
2321
+ if (r && r.status === 0 && !r.error) store.set(key, { status: 0, signal: null, stdout: r.stdout, stderr: r.stderr });
2322
+ return r;
2323
+ };
2324
+ }
2325
+
2296
2326
  const OUTPUT_KEEP = 4 * 1024 * 1024;
2297
2327
  /**
2298
2328
  * defaultSpawn with a deadline (`options.boundedMs`), for short identity probes that must never hang the caller: the command runs
package/gate-seam.mjs CHANGED
@@ -106,14 +106,20 @@ export function classAVerdict({ commit, tree, repoKey, workspace, scans, scope =
106
106
  return { schema: CLASS_A_VERDICT_SCHEMA, commit, tree, repoKey, workspace: ws, scope: normalizeScope(scope), status: "pass", scans: rows };
107
107
  }
108
108
 
109
+ /** When this gate process started, a second early: a verdict file written at or after it is this run's own. */
110
+ const RUN_STARTED_MS = Date.now() - Math.ceil(process.uptime() * 1000) - 1000;
109
111
  /** Writes a verdict atomically (temp file, rename) with mode 0600 and returns its absolute path. Refuses a relative directory. */
110
- export function writeClassAVerdict(dir, verdict, { fsApi = fs } = {}) {
112
+ export function writeClassAVerdict(dir, verdict, { fsApi = fs, since = RUN_STARTED_MS } = {}) {
111
113
  if (!path.isAbsolute(dir)) throw new SeamError("VERDICT", `verdict directory ${dir} must be absolute`);
112
114
  if (verdict?.schema !== CLASS_A_VERDICT_SCHEMA || verdict.status !== "pass") throw new SeamError("VERDICT", "only a passing verdict of the current schema is written");
113
115
  fsApi.mkdirSync(dir, { recursive: true, mode: 0o700 });
114
116
  const file = path.join(dir, verdictFileName({ commit: verdict.commit, scope: verdict.scope ?? "full", workspace: verdict.workspace }));
117
+ const body = `${JSON.stringify(verdict)}\n`;
118
+ // The same verdict this run already wrote is not written again (GC-A27 NN02, NN08): a second write moved the file's time past the submission of a job that
119
+ // named it, so the file no longer showed it was there first (acceptance case 1 on 0.6.63, 2026-11-24). A file an earlier run left is always written afresh.
120
+ try { const st = fsApi.statSync(file); if (st.mtimeMs >= since && fsApi.readFileSync(file, "utf8") === body) return file; } catch { /* not there yet */ }
115
121
  const tmp = `${file}.${process.pid}.${crypto.randomBytes(4).toString("hex")}.tmp`;
116
- fsApi.writeFileSync(tmp, `${JSON.stringify(verdict)}\n`, { mode: 0o600 });
122
+ fsApi.writeFileSync(tmp, body, { mode: 0o600 });
117
123
  fsApi.renameSync(tmp, file);
118
124
  return file;
119
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.63",
3
+ "version": "0.6.64",
4
4
  "description": "Portable release CLI/SDK with fail-closed public GitHub Releases and private R2 + RightApps distribution.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -91,7 +91,7 @@
91
91
  ],
92
92
  "sideEffects": false,
93
93
  "scripts": {
94
- "test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs class-a-cache-history.test.mjs gate-fixed-levers.test.mjs broker-toolchain.test.mjs snapshot-changes.test.mjs gate-serve-changes.test.mjs gate-serve-helper.test.mjs resident-answers.test.mjs probe-memo-kept.test.mjs class-a-lanes.test.mjs feature-partition-targets.test.mjs class-b-target-groups.test.mjs unit-list-lock.test.mjs cargo-profile-check.test.mjs cargo-home-real-path.test.mjs class-a-cache-admission.test.mjs class-b-cache-admission.test.mjs shellcheck-cache-inputs.test.mjs implicit-features.test.mjs test-group-failure-cache.test.mjs sealed-listing-store.test.mjs gate/gate.test.mjs package-files.test.mjs host-gate.test.mjs publish-local-cargo.test.mjs affected-units.test.mjs batch-workspace.test.mjs unit-list-plan.test.mjs compile-inputs.test.mjs snapshot-dependency-reuse.test.mjs publisher-requirement-scan.test.mjs node-check-cache.test.mjs preparation-diagnostics.test.mjs gate-coverage-timing.test.mjs ci-compile-admission.test.mjs qualification-verify.test.mjs test-run-output.test.mjs feature-partition.test.mjs feature-sets.test.mjs gate-seam.test.mjs serial-row.test.mjs seam-repairs.test.mjs snapshot-lock.test.mjs lock-identity.test.mjs stamp-relay.test.mjs install-tauri-authenticode.test.mjs gate-stage-binding.test.mjs tool-output.test.mjs publication-gate.test.mjs gate-release-admission.test.mjs cache-key-explain.test.mjs external-inputs.test.mjs built-bins.test.mjs probe-memo.test.mjs gate-serve-ask.test.mjs double-pass.test.mjs tool-version-memo.test.mjs workspace-manifests.test.mjs test-failure-cache.test.mjs served-metadata.test.mjs windows-pnpm-identity.test.mjs",
94
+ "test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs acceptance-cases.test.mjs rule-verdict-cache.test.mjs class-b-dispatch.test.mjs remember-reads.test.mjs class-a-cache-history.test.mjs gate-fixed-levers.test.mjs broker-toolchain.test.mjs snapshot-changes.test.mjs gate-serve-changes.test.mjs gate-serve-helper.test.mjs resident-answers.test.mjs probe-memo-kept.test.mjs class-a-lanes.test.mjs feature-partition-targets.test.mjs class-b-target-groups.test.mjs unit-list-lock.test.mjs cargo-profile-check.test.mjs cargo-home-real-path.test.mjs class-a-cache-admission.test.mjs class-b-cache-admission.test.mjs shellcheck-cache-inputs.test.mjs implicit-features.test.mjs test-group-failure-cache.test.mjs sealed-listing-store.test.mjs gate/gate.test.mjs package-files.test.mjs host-gate.test.mjs publish-local-cargo.test.mjs affected-units.test.mjs batch-workspace.test.mjs unit-list-plan.test.mjs compile-inputs.test.mjs snapshot-dependency-reuse.test.mjs publisher-requirement-scan.test.mjs node-check-cache.test.mjs preparation-diagnostics.test.mjs gate-coverage-timing.test.mjs ci-compile-admission.test.mjs qualification-verify.test.mjs test-run-output.test.mjs feature-partition.test.mjs feature-sets.test.mjs gate-seam.test.mjs serial-row.test.mjs seam-repairs.test.mjs snapshot-lock.test.mjs lock-identity.test.mjs stamp-relay.test.mjs install-tauri-authenticode.test.mjs gate-stage-binding.test.mjs tool-output.test.mjs publication-gate.test.mjs gate-release-admission.test.mjs cache-key-explain.test.mjs external-inputs.test.mjs built-bins.test.mjs probe-memo.test.mjs gate-serve-ask.test.mjs double-pass.test.mjs tool-version-memo.test.mjs workspace-manifests.test.mjs test-failure-cache.test.mjs served-metadata.test.mjs windows-pnpm-identity.test.mjs",
95
95
  "test:registry-parity": "node registry-parity.mjs --allow-unpublished",
96
96
  "test:signer:windows": "node sign-release-manifest.integration.mjs",
97
97
  "prepublishOnly": "pnpm test:signer:windows && pnpm test:registry-parity",
@@ -49,7 +49,7 @@
49
49
  "@rightkit/qa": "0.7.0",
50
50
  "@rightkit/qa-chrome": "0.1.12",
51
51
  "@rightkit/react-shell": "0.7.6",
52
- "@rightkit/release": "0.6.63",
52
+ "@rightkit/release": "0.6.64",
53
53
  "@rightkit/send-ui": "0.1.0",
54
54
  "@rightkit/settings-ui": "0.7.5",
55
55
  "@rightkit/social-ui": "0.2.1",
@@ -755,6 +755,7 @@
755
755
  },
756
756
  "registry": {
757
757
  "cargo": {
758
+ "rightkit-agent-engine-attention": "0.2.0",
758
759
  "rightkit-agent-tools": "0.4.3",
759
760
  "rightkit-agents": "0.2.0",
760
761
  "rightkit-ai-keys": "0.1.1",
@@ -764,7 +765,7 @@
764
765
  "rightkit-app-settings": "0.4.2",
765
766
  "rightkit-asr": "0.5.2",
766
767
  "rightkit-audio": "0.4.1",
767
- "rightkit-automation": "0.7.3",
768
+ "rightkit-automation": "0.7.4",
768
769
  "rightkit-browser": "0.3.6",
769
770
  "rightkit-cache": "0.2.3",
770
771
  "rightkit-channel-memory": "0.2.1",
@@ -796,6 +797,7 @@
796
797
  "rightkit-framed-sidecar": "0.2.0",
797
798
  "rightkit-fs": "0.5.0",
798
799
  "rightkit-fsindex": "0.5.0",
800
+ "rightkit-google-apis": "0.2.1",
799
801
  "rightkit-google-identity": "0.2.0",
800
802
  "rightkit-hooks": "0.2.0",
801
803
  "rightkit-hotkeys": "0.1.6",
@@ -810,10 +812,11 @@
810
812
  "rightkit-media": "0.2.6",
811
813
  "rightkit-media-control": "0.1.1",
812
814
  "rightkit-media-gen-approvals": "0.1.1",
813
- "rightkit-memory-store": "0.2.0",
815
+ "rightkit-memory": "0.3.1",
816
+ "rightkit-memory-store": "0.2.1",
814
817
  "rightkit-models": "0.7.2",
815
818
  "rightkit-motion": "0.2.0",
816
- "rightkit-oauth": "0.10.0",
819
+ "rightkit-oauth": "0.11.1",
817
820
  "rightkit-ocr": "0.2.3",
818
821
  "rightkit-onnx": "0.2.7",
819
822
  "rightkit-ort": "0.2.3",
@@ -831,7 +834,7 @@
831
834
  "rightkit-qts-ggml-sys": "0.1.2",
832
835
  "rightkit-record": "0.3.3",
833
836
  "rightkit-review": "0.4.0",
834
- "rightkit-roots": "0.2.1",
837
+ "rightkit-roots": "0.3.0",
835
838
  "rightkit-sandbox": "0.6.1",
836
839
  "rightkit-search": "0.4.0",
837
840
  "rightkit-secrets": "0.2.0",
@@ -846,7 +849,7 @@
846
849
  "rightkit-tauri": "0.1.3",
847
850
  "rightkit-tauri-shell": "0.8.2",
848
851
  "rightkit-text-polish": "0.1.3",
849
- "rightkit-time": "0.1.0",
852
+ "rightkit-time": "0.1.5",
850
853
  "rightkit-transcript": "0.4.0",
851
854
  "rightkit-transcript-library": "0.1.7",
852
855
  "rightkit-tts": "0.2.3",