@rightkit/release 0.6.89 → 0.6.91

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/app-check.mjs CHANGED
@@ -34,6 +34,8 @@
34
34
  // (a per-version or hand-written entry; rightkit#1476)
35
35
  // commit-citations G28 (release tier) a commit this push adds that cites no issue, or changes code without a `Contract: <file>#<section>`
36
36
  // line (rightkit#1268); no baseline excuses it
37
+ // lint-waiver-added G30 (compile tier) a Rust file holding more lint waivers (allow/expect attributes, cfg_attr waivers, [lints] "allow",
38
+ // lint-disabling rustflags) than at the merge-base with origin/main (first parent for a commit already there); rightkit#1830
37
39
  //
38
40
  // Suite trust roots (lane C3; logic in suite-trust-roots.mjs). The licence and updater public keys have one owner,
39
41
  // contracts/right-suite-api.v1.json (generated into suite-api.generated.mjs):
@@ -111,6 +113,7 @@ import { OWNERSHIP_CLASS_RULES } from "./ownership-class-rules.mjs";
111
113
  import { SOURCE_CLOSURE_RULES } from "./source-closure-rules.mjs";
112
114
  import { SHELL_CONTRACT_RULES } from "./shell-contract.mjs";
113
115
  import { neutralIgnored } from "./stage-ledger.mjs";
116
+ import { waiverKindOf, waiversIn } from "./lint-waivers.mjs";
114
117
  import { CONSUMER_SOURCE_RULES } from "./consumer-source-contracts.mjs";
115
118
  import { CONSUMER_POLICY_RULES } from "./consumer-policy.mjs";
116
119
  import { engineRecordStore, suiteKeyLiteral, suiteUpdaterKey } from "./suite-trust-roots.mjs";
@@ -130,6 +133,19 @@ function git(args, { cwd, input, env = gitEnv(), encoding = "utf8", maxBuffer =
130
133
  return r.stdout;
131
134
  }
132
135
 
136
+ // Read-only git lookups that several rules ask with the same words in the same folder (the object type of the checked commit, its merge-base with
137
+ // origin/main) start once per process: the answer, or the error, is remembered. GATE-CONTRACT GC-A27 NN08 refuses a run that starts the same program
138
+ // with the same arguments in the same folder twice (0.6.91 acceptance, 27 Nov: `git merge-base <commit> origin/main` from baselineAtMergeBase and
139
+ // lint-waiver-added's anchor). Only these two lookups are remembered; nothing that writes or depends on the working files is.
140
+ const gitLookups = new Map();
141
+ function gitLookup(args, { cwd }) {
142
+ const key = JSON.stringify([cwd, args]);
143
+ if (!gitLookups.has(key)) { try { gitLookups.set(key, { out: git(args, { cwd }) }); } catch (error) { gitLookups.set(key, { error }); } }
144
+ const hit = gitLookups.get(key);
145
+ if (hit.error) throw hit.error;
146
+ return hit.out;
147
+ }
148
+
133
149
  /** The git top-level directory of `dir`, or null when it is not inside a work tree. */
134
150
  export function repoRoot(dir) {
135
151
  const r = spawnSync("git", ["rev-parse", "--show-toplevel"], { cwd: dir, env: gitEnv(), encoding: "utf8" });
@@ -1162,11 +1178,11 @@ const NOT_CODE = /(?:\.(?:md|mdx|txt|lock|svg|png|jpe?g|gif|ico|webp|pdf)$|(?:^|
1162
1178
  /** The non-merge commits this push adds (oldest first), or [] when none are pending or there is no anchor. */
1163
1179
  function pendingCommits(repo, commit, env = process.env) {
1164
1180
  try {
1165
- if (git(["cat-file", "-t", commit], { cwd: repo }).trim() !== "commit") return [];
1181
+ if (gitLookup(["cat-file", "-t", commit], { cwd: repo }).trim() !== "commit") return [];
1166
1182
  const named = String(env.RK_PUSH_BEFORE ?? "").trim();
1167
1183
  let base = null;
1168
1184
  if (/^[0-9a-f]{40,64}$/.test(named) && !/^0+$/.test(named)) { try { git(["cat-file", "-e", `${named}^{commit}`], { cwd: repo }); base = named; } catch { base = null; } }
1169
- base ??= git(["merge-base", commit, "origin/main"], { cwd: repo }).trim();
1185
+ base ??= gitLookup(["merge-base", commit, "origin/main"], { cwd: repo }).trim();
1170
1186
  if (!base) return [];
1171
1187
  return git(["rev-list", "--no-merges", "--reverse", `${base}..${commit}`], { cwd: repo }).split("\n").filter(Boolean);
1172
1188
  } catch { return []; }
@@ -1332,7 +1348,38 @@ function qaStashIgnored({ root, files }) {
1332
1348
  return out;
1333
1349
  }
1334
1350
 
1351
+ // G30 (bogusyogi/rightkit#1830, first slice; Adrian 2026-11-27: "Where's The fucking Rk enforcement I clearly asked for"): Rust lint waivers
1352
+ // (lint-waivers.mjs, ported from Legion's check-waivers; self-contained, no gate internals, so it can move to a dedicated lint package). One rule over every tracked .rs, Cargo.toml and .cargo/config(.toml) outside fixture trees:
1353
+ // lint-waiver-added (compile tier) a file holds more waivers than it did at the anchor: the merge-base with origin/main, or, for a commit already on
1354
+ // origin/main, its first parent. No file is stored or approved; a new file counts from zero. Moving a waiver to another file is adding one.
1355
+ // With no anchor (no origin/main, no common history) it fails: it cannot tell what was added.
1356
+ // A release-tier rule refusing any waiver at all follows once each repository reports zero (Neon, 27 Nov: option B; Pulse's Mac qualify is not stopped meanwhile).
1357
+ const waiverFiles = (files) => files.filter((f) => scanned(f) && waiverKindOf(f));
1358
+ function waiverAnchor(repo, commit) {
1359
+ try {
1360
+ const tip = gitLookup(["cat-file", "-t", commit], { cwd: repo }).trim() === "commit" ? commit : git(["rev-parse", "HEAD"], { cwd: repo }).trim();
1361
+ const base = gitLookup(["merge-base", tip, "origin/main"], { cwd: repo }).trim();
1362
+ if (!base) return { anchor: null, why: "git merge-base with origin/main printed nothing" };
1363
+ if (base !== tip) return { anchor: base, how: "the merge-base with origin/main" };
1364
+ try { return { anchor: gitLookup(["rev-parse", tip + "^1"], { cwd: repo }).trim(), how: "its first parent (the commit is already on origin/main)" }; } catch { return { anchor: null, why: "the commit is on origin/main and has no parent" }; }
1365
+ } catch (error) { return { anchor: null, why: String(error.message).split("\n")[0] }; }
1366
+ }
1367
+ function lintWaiversAdded({ root, commit, files, repo }) {
1368
+ const at = waiverAnchor(repo, commit);
1369
+ if (!at.anchor) return [{ subject: "anchor", problem: "cannot tell which lint waivers this commit adds: " + at.why, fix: "fetch origin/main into this repository, then check again" }];
1370
+ const out = [];
1371
+ for (const file of waiverFiles(files)) {
1372
+ const now = waiversIn(readText(root, file) ?? "", waiverKindOf(file));
1373
+ if (!now.length) continue;
1374
+ let before = 0;
1375
+ try { before = waiversIn(git(["cat-file", "blob", at.anchor + ":" + file], { cwd: repo }), waiverKindOf(file)).length; } catch { before = 0; }
1376
+ if (now.length > before) out.push({ file, subject: file, problem: file + " holds " + now.length + " lint waiver(s), " + before + " at " + at.anchor.slice(0, 12) + " (" + at.how + "): " + (now.length - before) + " added (" + now.map((w) => "line " + w.line + ": " + w.reason).join("; ") + ")", fix: "remove the added waiver and fix what the lint points at; existing waivers are cleaned up by the repository's own chat and none may be added meanwhile" });
1377
+ }
1378
+ return out;
1379
+ }
1380
+
1335
1381
  export const RULES = Object.freeze([
1382
+ { id: "lint-waiver-added", gap: "G30", run: lintWaiversAdded },
1336
1383
  { id: "eol-policy", gap: "G04", run: eolPolicy },
1337
1384
  { id: "qa-stash-ignored", gap: "G29", run: qaStashIgnored },
1338
1385
  { id: "file-url", gap: "G12", run: fileUrls },
@@ -1377,6 +1424,8 @@ export const COMPILE_TIER_IDS = Object.freeze(new Set([
1377
1424
  "qa-dev-server", "ffmpeg-release-escape", "switches-inventory", "speech-link", "e2e-under-cargo-test",
1378
1425
  // rightkit#1221 asks for a compile-tier rule: the primary-checkout rule is Adrian's standing one, and a script that clones is refused before any compile.
1379
1426
  "scratch-checkout",
1427
+ // bogusyogi/rightkit#1830: no new lint waiver from the first compile on. It is true in every app on the day it ships (it judges only what a commit adds).
1428
+ "lint-waiver-added",
1380
1429
  ]));
1381
1430
  /** The tier a rule runs from: compile for the 0.6.6 set, release for everything added since. */
1382
1431
  export const tierOf = (rule) => (COMPILE_TIER_IDS.has(rule.id) ? "compile" : "release");
@@ -1540,8 +1589,8 @@ export const BASELINE_GROWTH_RULE = "a baseline entry added since the merge-base
1540
1589
  */
1541
1590
  export function baselineAtMergeBase(dir, rev, file) {
1542
1591
  try {
1543
- const tip = git(["cat-file", "-t", rev], { cwd: dir }).trim() === "commit" ? rev : "HEAD";
1544
- const anchor = git(["merge-base", tip, "origin/main"], { cwd: dir }).trim();
1592
+ const tip = gitLookup(["cat-file", "-t", rev], { cwd: dir }).trim() === "commit" ? rev : "HEAD";
1593
+ const anchor = gitLookup(["merge-base", tip, "origin/main"], { cwd: dir }).trim();
1545
1594
  if (!anchor) return { anchor: null, why: "git merge-base printed nothing" };
1546
1595
  let text = null;
1547
1596
  try { text = git(["cat-file", "blob", `${anchor}:${file}`], { cwd: dir }); } catch { text = null; }
@@ -125,7 +125,7 @@ import { buildDirectReceipt, directVerdict, resolveTargetDirectory, verifyDirect
125
125
  import { platformDirOf } from "../platform-dir.mjs";
126
126
  import { buildInventory, classifyUnitResults, dependencyFirstOrder, selectAffectedAcrossInventories, classifyUnitRows, unitListReport } from "../affected-units.mjs";
127
127
  import { createRequire } from "node:module";
128
- import { BUILD_CONTROL_PROTOCOL, HANDSHAKE_PROBE_ID, RUNTIME_MANIFEST_FILE, brokerControlTarget, parseRuntimeIdentity } from "../seam-broker.mjs";
128
+ import { BUILD_CONTROL_PROTOCOL, HANDSHAKE_PROBE_ID, RUNTIME_MANIFEST_FILE, brokerControlTarget, parseRuntimeIdentity, runtimeManifestPathOf } from "../seam-broker.mjs";
129
129
  import { snapshotReclaimJudge } from "../seam-broker.mjs";
130
130
  import net from "node:net";
131
131
  import { installSpawnLedger } from "../spawn-ledger.mjs";
@@ -2113,7 +2113,8 @@ async function runStages(o, args, root, git, io) {
2113
2113
  try { decided = routePlan(o, { to, stages: devTest ? [] : stages, devTest, executor: routeExecutor, stagePlatform: platform, appConfig: selected && to !== "check" ? routeAppConfig({ git, commit: selected.commit, appDir, platform: devTestPlatform(args) }) : null }); }
2114
2114
  catch (e) { o.err(`${tag} ${e.message}`); return 2; }
2115
2115
  if (decided.refusal) { o.err(`${tag} BLOCKED: ${decided.refusal.code}: ${decided.refusal.message}; nothing ran${decided.route === "snapshot" ? " and the checkout is never built" : ""}`); return 1; }
2116
- const notPublisher = decided.route === "snapshot" ? releaseRouteRefusal(o, { stages, platform }) : null;
2116
+ const sealedProvider = () => (selected?.commit ? sealedProviderOf((o.sealedFor ?? sealedFor)({ root, commit: selected.commit, platform })) : null);
2117
+ const notPublisher = decided.route === "snapshot" ? releaseRouteRefusal(o, { stages, platform, sealedProvider }) : null;
2117
2118
  if (notPublisher) { o.err(`${tag} BLOCKED: ${notPublisher.code}: ${notPublisher.message}; nothing ran and the checkout is never built`); return 1; }
2118
2119
  // The declared Linux broker admits snapshots only under its own data root: refused before any ownership or sync when the gate's root is elsewhere.
2119
2120
  if (decided.route === "snapshot" && !hosted) {
@@ -2182,7 +2183,10 @@ async function runStages(o, args, root, git, io) {
2182
2183
  // Release writes to R2. The write credential lives only in the trusted publisher: a GitHub Actions job in the protected
2183
2184
  // publication environment, which sets RIGHTKIT_PUBLISHER=github-environment. Hosts and agents never hold it, so the door refuses the
2184
2185
  // stage anywhere else rather than fail half way through an upload.
2185
- if (stages.includes("release") && !mobile && !(o.env.GITHUB_ACTIONS === "true" && o.env.RIGHTKIT_PUBLISHER === "github-environment")) {
2186
+ // rightkit#1754: an app whose sealed set declares r2-rightapps publishes from this host through publish-update (the release stage re-reads
2187
+ // the provider from the manifest bytes the receipt vouches for); a github-releases app still publishes only from the trusted publisher.
2188
+ const r2LocalRelease = stages.includes("release") && !mobile && sealedProviderOf((o.sealedFor ?? sealedFor)({ root, commit, platform })) === "r2-rightapps";
2189
+ if (stages.includes("release") && !mobile && !r2LocalRelease && !(o.env.GITHUB_ACTIONS === "true" && o.env.RIGHTKIT_PUBLISHER === "github-environment")) {
2186
2190
  o.err(`${tag} BLOCKED: --to release runs only in the trusted publisher (the release workflow's protected publication job). Run --to qualify here, then dispatch the release workflow for ${commit.slice(0, 12)}`);
2187
2191
  return 1;
2188
2192
  }
@@ -2236,6 +2240,22 @@ async function runStages(o, args, root, git, io) {
2236
2240
  const carriedOk = await carrier.finish({ stage });
2237
2241
  return childOk && carriedOk;
2238
2242
  };
2243
+ // rightkit#1754: publish-update runs from the primary checkout, never the snapshot: it reads the checkout's clean HEAD (assertPrimaryReleaseCheckout,
2244
+ // assertCleanSource), so its door run carries no source split and the CLI's checkout guard applies (HEAD must be the sealed commit). It stays out
2245
+ // of SPLIT_COMMANDS. It uploads in process (r2-verified-upload.mjs), so no credential is carried to a broker job.
2246
+ const rightReleaseFromCheckout = async (stage, cliArgs) => {
2247
+ const carrier = await carrierForChildren({ o, ds, root, git, executor, stage, tag, appDir });
2248
+ if (carrier.refusal) { o.err(`${tag} BLOCKED: ${carrier.refusal}; nothing ran`); return false; }
2249
+ const run = startRun({ commonDir, commit, tree, stage });
2250
+ let childOk = false;
2251
+ try {
2252
+ o.out(`${tag} [${stage}] right-release ${cliArgs.join(" ")} (from the primary checkout ${appRoot})`);
2253
+ const r = (o.spawnInherit ?? inheritLaunch)(process.execPath, [cli, ...cliArgs], { cwd: appRoot, env: carriedEnv(carrier, { ...o.env, ...run.env }) });
2254
+ childOk = r.status === 0;
2255
+ } finally { endRun(run); }
2256
+ const carriedOk = await carrier.finish({ stage });
2257
+ return childOk && carriedOk;
2258
+ };
2239
2259
 
2240
2260
  o.out(`${tag} --to ${to} for ${commit.slice(0, 12)}${appDir === "." ? "" : ` (app ${appDir})`}: ${stages.join(" -> ")}; executor ${executor.kind}`);
2241
2261
  // A later stage on the sealed bytes: check, compile and package already passed for them (in this receipt) and the bytes on disk are
@@ -2459,7 +2479,9 @@ async function runStages(o, args, root, git, io) {
2459
2479
  else if (packageMulti.note) o.out(`${tag} [package] ${packageMulti.note}`);
2460
2480
  }
2461
2481
  const packageEnv = packagePin.dir ? { CARGO_TARGET_DIR: packagePin.dir } : (packageMulti?.env ?? {});
2462
- ok = ok && await rightRelease(stage, ["build", "--platform", platform], { ...packageEnv, ...(doorRegistryAdmissionFile ? { RK_DOOR_REGISTRY_ADMISSION: doorRegistryAdmissionFile } : {}) });
2482
+ // GC-A28 for the package stage: right-release runs inside the snapshot, whose `.git` stub cannot count commits (assemble-app stamps CFBundleVersion).
2483
+ const packageBuildNumber = ok && ds ? buildNumberOf({ o, git, commit, tag }) : {};
2484
+ ok = ok && await rightRelease(stage, ["build", "--platform", platform], { ...packageEnv, ...packageBuildNumber, ...(doorRegistryAdmissionFile ? { RK_DOOR_REGISTRY_ADMISSION: doorRegistryAdmissionFile } : {}) });
2463
2485
  const sealed = ok ? (o.sealedFor ?? sealedFor)({ root: releaseRoot, commit, platform }) : null;
2464
2486
  if (ok && !sealed) { o.err(`${tag} [package] the build reported success but sealed nothing for ${commit.slice(0, 8)} on ${platform}`); ok = false; }
2465
2487
  if (sealed) extra = { platform, sealed: sealed.id, manifestSha256: sealed.digest };
@@ -2549,6 +2571,10 @@ async function runStages(o, args, root, git, io) {
2549
2571
  } else {
2550
2572
  if (!receipt.stages.qualify?.ok || receipt.stages.qualify.manifestSha256 !== sealed.manifestSha256) { o.err(`${tag} BLOCKED: [release] the sealed set was not qualified (installed QA) in this door run's receipt`); ok = false; }
2551
2573
  else if (qualifyRecordProblem(receipt.stages.qualify)) { o.err(`${tag} BLOCKED: [release] the recorded qualification no longer stands: ${qualifyRecordProblem(receipt.stages.qualify)}; nothing was uploaded`); ok = false; }
2574
+ else if (sealedProviderOf(sealedNow) === "r2-rightapps" && sealedNow?.digest === sealed.manifestSha256 && !(o.env.GITHUB_ACTIONS === "true" && o.env.RIGHTKIT_PUBLISHER === "github-environment")) {
2575
+ // rightkit#1754: the provider is re-read from the manifest bytes this receipt vouches for; GC-T22 still needs Adrian's words for the build.
2576
+ ok = await rightReleaseFromCheckout(stage, ["publish-update", "--release", sealed.sealed, "--platform", platform, "--tier", tier]); extra = { sealed: sealed.sealed, manifestSha256: sealed.manifestSha256, tier, route: "r2-local" };
2577
+ }
2552
2578
  else { ok = await rightRelease(stage, ["upload", "--release", sealed.sealed, "--platform", platform, "--tier", tier]); extra = { sealed: sealed.sealed, manifestSha256: sealed.manifestSha256, tier }; }
2553
2579
  }
2554
2580
  }
@@ -3705,12 +3731,27 @@ export const ROUTE_SCHEMA = "rightkit-gate.route/1";
3705
3731
  * protected publication job (GITHUB_ACTIONS with RIGHTKIT_PUBLISHER=github-environment); a mobile platform's store upload has its own tier-less route. Asked by a real
3706
3732
  * run before it takes ownership or syncs the snapshot (E2E L3-03); the probe has no release route, so this is not a probe code.
3707
3733
  */
3708
- export function releaseRouteRefusal(o, { stages, platform }) {
3734
+ export function releaseRouteRefusal(o, { stages, platform, sealedProvider = () => null }) {
3709
3735
  if (!stages.includes("release") || MOBILE_PLATFORMS.has(platform)) return null;
3710
3736
  if (o.env.GITHUB_ACTIONS === "true" && o.env.RIGHTKIT_PUBLISHER === "github-environment") return null;
3737
+ // rightkit#1754: an app whose sealed manifest declares r2-rightapps publishes from the host through publish-update; the release stage
3738
+ // re-reads the provider from the manifest bytes the receipt vouches for before anything is uploaded.
3739
+ if (sealedProvider() === "r2-rightapps") return null;
3711
3740
  return { code: "RK_RELEASE_PUBLISHER_ONLY", message: "--to release runs only in the trusted publisher (the release workflow's protected publication job). Run --to qualify on the native host, then dispatch the release workflow for the commit" };
3712
3741
  }
3713
3742
 
3743
+ /** The distribution provider a sealed set declares (`manifest.distribution.provider`), read from the manifest bytes whose sha256 is `sealed.digest`;
3744
+ * null for no sealed set, unreadable or changed bytes, or a manifest sealed before the field existed. */
3745
+ export function sealedProviderOf(sealed, { readFile = (f) => fs.readFileSync(f) } = {}) {
3746
+ if (!sealed?.manifest) return null;
3747
+ try {
3748
+ const bytes = readFile(sealed.manifest);
3749
+ if (createHash("sha256").update(bytes).digest("hex") !== sealed.digest) return null;
3750
+ const provider = JSON.parse(String(bytes)).distribution?.provider;
3751
+ return typeof provider === "string" ? provider : null;
3752
+ } catch { return null; }
3753
+ }
3754
+
3714
3755
  /**
3715
3756
  * Which route this host's door takes for `--to <stage>` and whether it refuses, WITHOUT running anything: the decisions of `runStages`
3716
3757
  * in the order it makes them. `runStages` takes its own pre-ownership route and refusal from this very function (rightkit#1297 L1), so
@@ -3905,8 +3946,8 @@ export function brokerRuntimeIdentityText({ clients, env = {}, platform = proces
3905
3946
  if (!exists(candidate)) continue;
3906
3947
  let file = candidate;
3907
3948
  try { file = resolveBrokerClient(candidate, { platform, readFile }).file; } catch { continue; }
3908
- let real = file; try { real = realpath(file); } catch { real = file; }
3909
- const identity = parseRuntimeIdentity(readFile(path.join(path.dirname(real), RUNTIME_MANIFEST_FILE)));
3949
+ // The POSIX agent shim is followed to the client it starts (seam-broker.mjs runtimeManifestPathOf): on the Mac the manifest was looked for in agent-bin.
3950
+ const identity = parseRuntimeIdentity(readFile(runtimeManifestPathOf(file, { platform, read: readFile, realpath })));
3910
3951
  if (identity.ok) return `${identity.identity.version}:${identity.identity.brokerDigest}:${identity.identity.clientDigest}`;
3911
3952
  } catch { /* the next candidate */ }
3912
3953
  }
@@ -4125,6 +4166,20 @@ export async function runRenderStage({ o, ds, root, appDir, commit, tree, env, p
4125
4166
  return 0;
4126
4167
  }
4127
4168
 
4169
+ /**
4170
+ * The build number a snapshot child cannot count itself (docs/GATE-CONTRACT.md [GC-A28]): the snapshot's `.git` is a config-only stub, so
4171
+ * assembled-app.mjs commitCount refuses ASSEMBLY_VERSION_UNAVAILABLE there unless RIGHT_BUILD_NUMBER is handed down. Counted in the checkout for the
4172
+ * selected commit. A shallow history or an unreadable count hands down nothing and says so. Used by the dev/test route and, since rightkit#1754
4173
+ * (Pulse Mac feb5769f, package stage), by the door's package stage.
4174
+ */
4175
+ function buildNumberOf({ o, git, commit, tag }) {
4176
+ const shallow = git("rev-parse", "--is-shallow-repository");
4177
+ const count = failed(shallow) || text(shallow).trim() === "true" ? null : git("rev-list", "--count", commit);
4178
+ if (count && !failed(count) && /^[1-9][0-9]*$/.test(text(count).trim())) return { RIGHT_BUILD_NUMBER: text(count).trim() };
4179
+ o.out(`${tag} note: no build number for ${commit.slice(0, 12)} (the checkout is shallow or cannot count its history); an app that stamps CFBundleVersion will refuse with ASSEMBLY_VERSION_UNAVAILABLE`);
4180
+ return {};
4181
+ }
4182
+
4128
4183
  /**
4129
4184
  * rightkit-gate --to dev|test [--commit <rev>] [-- <right-release dev|test arguments>]: the local compiles, on a commit like every other
4130
4185
  * stage (docs/GATE-CONTRACT.md "Commit-only build": `--to dev` and `--to test` build a commit; `--worktree` never admits a build). The
@@ -4189,13 +4244,7 @@ async function runDevTest(o, args, root, git, io, to, appRoot, appDir) {
4189
4244
  // The snapshot's `.git` is a config-only stub, so right-release cannot count commits there (assembled-app.mjs commitCount, ASSEMBLY_VERSION_UNAVAILABLE): the gate
4190
4245
  // counts the commit in the checkout and hands the number down (docs/GATE-CONTRACT.md [GC-A28]). A shallow history or an unreadable count hands down nothing and says
4191
4246
  // so; only an app whose build stamps CFBundleVersion needs the number, and right-release refuses there (it cannot count in the stub either).
4192
- let buildNumber = {};
4193
- if (ds) {
4194
- const shallow = git("rev-parse", "--is-shallow-repository");
4195
- const count = failed(shallow) || text(shallow).trim() === "true" ? null : git("rev-list", "--count", commit);
4196
- if (count && !failed(count) && /^[1-9][0-9]*$/.test(text(count).trim())) buildNumber = { RIGHT_BUILD_NUMBER: text(count).trim() };
4197
- else o.out(`${tag} note: no build number for ${commit.slice(0, 12)} (the checkout is shallow or cannot count its history); an app that stamps CFBundleVersion will refuse with ASSEMBLY_VERSION_UNAVAILABLE`);
4198
- }
4247
+ const buildNumber = ds ? buildNumberOf({ o, git, commit, tag }) : {};
4199
4248
  // GB-58 (GATE dev/test exact stage; E19): the selected app's declared sidecars are staged ONCE under this snapshot's ownership before the dependent
4200
4249
  // build, through the same planner and ledger as the compile and package stages (a Tauri crate with externalBin refuses to build without them). The
4201
4250
  // app's own prepare step may stage them too; the ledger's attribution check, not an environment marker, is what keeps that single and exact.
@@ -4418,7 +4467,7 @@ export async function main(argv, io = {}) {
4418
4467
  // flags below because everything after `clippy` is cargo's own argv, verbatim (`-v`, `-h` and `--version` are cargo's).
4419
4468
  // `candidate-receipt` (GB-73): the candidate build receipt the RustRight installer takes in place of a clean primary checkout.
4420
4469
  if (args[0] === "candidate-receipt") return (await import("../candidate-receipt-command.mjs")).candidateReceiptCommand(o, args.slice(1));
4421
- if (args[0] === "clippy") return (await import("../clippy-route.mjs")).clippyCommand(o, args.slice(1), { main, io, absoluteEnv: SNAPSHOT_ABSOLUTE_ENV });
4470
+ if (args[0] === "clippy") return (await import("../clippy-route.mjs")).clippyCommand(o, args.slice(1), { main, io, absoluteEnv: SNAPSHOT_ABSOLUTE_ENV, seamLockFor });
4422
4471
  if (args.includes("--version") || args.includes("-v")) {
4423
4472
  o.out(JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")).version);
4424
4473
  return 0;
package/build-release.mjs CHANGED
@@ -942,6 +942,9 @@ function sealRelease({ configRoot, managedCargoTarget, artifactPaths = null, and
942
942
  // DevTools allowance (owner's fixed design): { mode: "denied" } for every app; content-only only for an allow-listed app.
943
943
  devtools: devtoolsEvidence(resolveDevtoolsAllowance({ config, root: configRoot })),
944
944
  platform,
945
+ // The app's distribution provider, sealed with the bytes (rightkit#1754): the door decides a desktop release's route from the verified sealed
946
+ // manifest (r2-rightapps may publish from a broker host; github-releases only from the trusted publisher), never by executing app code.
947
+ ...(typeof config.distribution?.provider === "string" ? { distribution: { provider: config.distribution.provider } } : {}),
945
948
  ...(mediaSidecars ? { mediaSidecars } : {}),
946
949
  cacheKey,
947
950
  // Portable contracts sign only raw executables — installer/embedding
package/clippy-route.mjs CHANGED
@@ -16,10 +16,10 @@
16
16
  // from a snapshot. The request is never rewritten to leave such a package out (signed D8-1: three additions only).
17
17
  // Linux direct, through the item 7 cargo wrapper (cargo-target-shim.mjs): every cargo launch is bound to the checkout's own
18
18
  // target directory or refused, so nothing is written under the snapshot (row 8.12).
19
- // Mac and Dell the broker carrier (item 7 row 7.12) is not wired into the gate yet. The route refuses BEFORE class A, the sync and
20
- // any compile with a BLOCKED code naming 7.12, and never falls back to direct cargo on a broker-managed host
21
- // (rows 8.3, 8.10, 8.13). The gate's half of the broker receipt (attribution and toolchain, rows 8.9 and 8.16) is
22
- // `routeFromBrokerReceipt` below, unwired until the carrier is.
19
+ // Mac and Dell through the seam (rightkit#1811): `rustright cargo clippy ...` from the snapshot with RUSTRIGHT_GATE_COMMIT and RUSTRIGHT_CLASS_A naming
20
+ // this run's class A verdict, as the door's class B clippy rows run. The broker pins the output directory and adds --keep-going
21
+ // itself, so the gate adds neither there; non-compiling reads use the real toolchain cargo (GC-A11). Never direct cargo for the
22
+ // compile. `routeFromBrokerReceipt` below (the signed attribution detail) is not wired yet: results come from cargo's JSON stream.
23
23
  // result FAILED when any unit failed; diagnostics by package and target from cargo's JSON messages; a unit that never ran
24
24
  // because a dependency failed is reported blocked and the result claims no completeness (row 8.4).
25
25
  // exit 0 PASSED, 1 FAILED or BLOCKED, 2 refused or could not run (RK_CHECK_ERROR: the snapshot moved).
@@ -32,6 +32,9 @@ import { directPlatform, realCargoOf } from "./managed-cargo.mjs";
32
32
  import { defaultSpawnAsync, sidecarBoundCrate } from "./deterministic-scans.mjs";
33
33
  import { gateStateDir } from "./gate-stages.mjs";
34
34
  import { ProvenanceError } from "./receipt-signature.mjs";
35
+ import { resolveBrokerClient as defaultResolveBrokerClient } from "./broker-client.mjs";
36
+ import { directCargoPath } from "./managed-cargo.mjs";
37
+ import { seamEnv, verdictForRun } from "./gate-seam.mjs";
35
38
 
36
39
  export const ROUTE_RECEIPT_SCHEMA = "rightkit.gate-clippy-route-receipt/1";
37
40
  export const ROUTE_DIAGNOSTICS_SCHEMA = "rightkit.gate-clippy-route-diagnostics/1";
@@ -40,7 +43,7 @@ export const CLIPPY_USAGE = "usage: rightkit-gate clippy [<cargo clippy args>]
40
43
  export const ROUTE_CODES = Object.freeze({
41
44
  notClippy: "RK_CLIPPY_NOT_CLIPPY", messageFormat: "RK_CLIPPY_MESSAGE_FORMAT", targetDir: "RK_CLIPPY_TARGET_DIR", config: "RK_CLIPPY_CONFIG", toolchain: "RK_CLIPPY_TOOLCHAIN_OVERRIDE",
42
45
  fix: "RK_CLIPPY_FIX", unstable: "RK_CLIPPY_UNSTABLE", chdir: "RK_CLIPPY_CHDIR", manifestAbsolute: "RK_CLIPPY_MANIFEST_ABSOLUTE", manifestEscapes: "RK_CLIPPY_MANIFEST_ESCAPES",
43
- outputInSnapshot: "RK_CLIPPY_OUTPUT_IN_SNAPSHOT", brokerCarrier: "RK_CLIPPY_BROKER_CARRIER_NOT_WIRED", brokerUnavailable: "RK_CLIPPY_BROKER_UNAVAILABLE", hostUnsupported: "RK_CLIPPY_HOST_UNSUPPORTED",
46
+ outputInSnapshot: "RK_CLIPPY_OUTPUT_IN_SNAPSHOT", brokerUnavailable: "RK_CLIPPY_BROKER_UNAVAILABLE", hostUnsupported: "RK_CLIPPY_HOST_UNSUPPORTED",
44
47
  sidecarBound: "RK_CLIPPY_SIDECAR_BOUND", receiptEvidence: "RK_CLIPPY_RECEIPT_EVIDENCE", toolchainUnreadable: "RK_CLIPPY_TOOLCHAIN_UNREADABLE",
45
48
  });
46
49
 
@@ -316,7 +319,7 @@ export function summarizeRun({ messages, stderr = "", exit = null, signal = null
316
319
  * this receipt's, it is available and not truncated, every row is well formed and the compact counts equal the rows. Counts alone never pass (`units: 2` with exit 0
317
320
  * and no matching detail is FAILED). Missing or unverifiable evidence makes the route result FAILED, never a partial success:
318
321
  * `{ aggregate, code, units, failedUnits, problems, toolchain, complete }`. A unit with errors, or a nonzero exit, is a failure.
319
- * The Clippy carrier stays explicitly refused (RK_CLIPPY_BROKER_CARRIER_NOT_WIRED) until the whole route is wired.
322
+ * Not wired yet: on a broker host the route's per-unit results come from cargo's own JSON stream (rightkit#1811), not from this signed detail.
320
323
  */
321
324
  export function routeFromBrokerReceipt(receipt, detailBytes = null) {
322
325
  const problems = [];
@@ -395,12 +398,22 @@ export async function clippyCommand(o, args, deps = {}) {
395
398
  resultLine(o, tag, { result: "BLOCKED", code: ROUTE_CODES.brokerUnavailable, launched: false });
396
399
  return BLOCKED;
397
400
  }
398
- if (executor.kind === "broker") {
399
- o.err(`${tag} BLOCKED: ${ROUTE_CODES.brokerCarrier}: on this broker host a Clippy route compiles the commit snapshot only through the RustRight snapshot carrier (item 7 row 7.12), which the gate does not wire yet; nothing ran and cargo is never run directly here (rows 8.3, 8.10, 8.13)`);
400
- resultLine(o, tag, { result: "BLOCKED", code: ROUTE_CODES.brokerCarrier, blockedOn: ["item7:7.12"], launched: false });
401
- return BLOCKED;
402
- }
403
- if (!directPlatform(o.platform) || o.env.GITHUB_ACTIONS === "true") {
401
+ // Mac and Dell (rightkit#1811): the Clippy request is carried by the broker through the seam, as the door's class B clippy rows are
402
+ // (`rustright cargo clippy ...` from the snapshot with RUSTRIGHT_GATE_COMMIT and RUSTRIGHT_CLASS_A naming this run's class A verdict). The broker pins the
403
+ // output directory, adds --keep-going itself (BR29) and keeps everything from `--` on verbatim. Non-compiling reads (locate-project, metadata, -vV) use the
404
+ // real toolchain cargo (GC-A11). The client and that cargo are resolved here, before the lock: a host missing either runs nothing.
405
+ const brokerHost = executor.kind === "broker";
406
+ let brokerClient = null; let readCargo = "cargo"; let readRustc = "rustc";
407
+ if (brokerHost) {
408
+ const found = executor.route && executor.client ? executor.client : which("rustright").find((c) => path.isAbsolute(c));
409
+ try { brokerClient = found ? (deps.resolveBrokerClient ?? defaultResolveBrokerClient)(found, { platform: o.platform }).file : null; } catch (e) { brokerClient = null; o.err(`${tag} ${e.message}`); }
410
+ if (!brokerClient) { o.err(`${tag} BLOCKED: ${ROUTE_CODES.brokerUnavailable}: no RustRight client by absolute path on this broker host; nothing ran`); resultLine(o, tag, { result: "BLOCKED", code: ROUTE_CODES.brokerUnavailable, launched: false }); return BLOCKED; }
411
+ const direct = (deps.directCargo ?? directToolchainCargo)(o);
412
+ if (!direct) { o.err(`${tag} BLOCKED: no real toolchain cargo for the non-compiling reads on this broker host (GC-A11); nothing ran`); return BLOCKED; }
413
+ readCargo = direct;
414
+ readRustc = path.join(path.dirname(direct), o.platform === "win32" ? "rustc.exe" : "rustc");
415
+ o.out(`${tag} broker host: Clippy is carried by the broker through the seam (client ${brokerClient}); non-compiling reads use ${readCargo}`);
416
+ } else if (!directPlatform(o.platform) || o.env.GITHUB_ACTIONS === "true") {
404
417
  o.err(`${tag} BLOCKED: ${ROUTE_CODES.hostUnsupported}: the route builds a gate-owned commit snapshot on a Linux execution host; hosted CI runs Clippy through its own workflow; nothing ran`);
405
418
  return BLOCKED;
406
419
  }
@@ -437,7 +450,7 @@ export async function clippyCommand(o, args, deps = {}) {
437
450
  const commitDeclaresSidecars = confDirs.some((d) => d === "" || sidecarBoundCrate({ dir: d, exists: commitExists, readFile: commitRead }).bound);
438
451
  let preBound = [];
439
452
  if (commitDeclaresSidecars) {
440
- const preMeta = o.spawn("cargo", ["metadata", "--no-deps", "--offline", "--locked", "--format-version", "1", ...(parsed.manifestPath ? ["--manifest-path", parsed.manifestPath] : [])], { cwd: cwdReal, env: o.env });
453
+ const preMeta = o.spawn(readCargo, ["metadata", "--no-deps", "--offline", "--locked", "--format-version", "1", ...(parsed.manifestPath ? ["--manifest-path", parsed.manifestPath] : [])], { cwd: cwdReal, env: o.env });
441
454
  let preScope = null;
442
455
  try { if (!failed(preMeta)) preScope = resolveScope({ before: parsed.before, metadata: JSON.parse(text(preMeta)), directory: parsed.manifestPath ? path.dirname(path.resolve(cwdReal, parsed.manifestPath)) : cwdReal }); } catch { preScope = null; }
443
456
  preBound = sidecarBoundMembers({ scope: preScope, dirOf: (p) => posix(path.relative(root, path.dirname(p.manifest_path))) || ".", exists: commitExists, readFile: commitRead });
@@ -445,15 +458,22 @@ export async function clippyCommand(o, args, deps = {}) {
445
458
  if (preBound.length) { o.err(sidecarRefusal(tag, preBound, "read from the commit")); resultLine(o, tag, { result: "BLOCKED", code: ROUTE_CODES.sidecarBound, blockedOn: ["item7:7.05"], bound: preBound, launched: false }); return BLOCKED; }
446
459
 
447
460
  const timings = {}; const lap = (name, since) => { timings[name] = Date.now() - since; };
448
- // The snapshot lock first (E6, reset plan section 3): held from before the sync until the diagnostics are written. This route runs only on a host with no broker, so it is
461
+ // The snapshot lock first (E6, reset plan section 3): held from before the sync until the diagnostics are written. The same lock on every host (the door's own snapshot routes take it too), so it is
449
462
  // the legacy lock, reclaimed when its holder is proven gone. A busy repository runs nothing and syncs nothing.
450
463
  let lock;
451
- try { lock = (deps.takeSnapshotLock ?? snap.takeSnapshotLock)({ checkout: root, root: snapshotsAt }); }
464
+ // A broker host's lock carries the seam body (this process's identity and the commit) the broker reads before it carries a request, and a dead holder's lock is
465
+ // reclaimed only on the broker's proof (rightkit-gate.mjs seamLockFor, the same lock the door takes). No body on a broker host: nothing runs.
466
+ let seamLock = { lock: {}, body: null };
467
+ if (brokerHost) {
468
+ seamLock = deps.seamLockFor ? deps.seamLockFor({ o, root, snapshotsAt, commit: selected.commit, snap, tag }) : { refusal: `${tag} BLOCKED: RK_SEAM: the gate gave the route no seam lock; nothing ran` };
469
+ if (seamLock.refusal) { o.err(seamLock.refusal); return BLOCKED; }
470
+ }
471
+ try { lock = (deps.takeSnapshotLock ?? snap.takeSnapshotLock)({ checkout: root, root: snapshotsAt, ...(brokerHost ? { lock: seamLock.lock } : {}) }); }
452
472
  catch (e) { if (e.code !== "busy" && e.code !== "refused") throw e; o.err(`${tag} BLOCKED: ${e.message}; ${e.code === "refused" ? "nothing ran, nothing created" : "the route never re-syncs a snapshot another request holds; nothing ran"}`); return BLOCKED; }
453
473
  o.out(`${tag} snapshot lock held ${lock.token}${lock.reclaimed ? ` (reclaimed from ${lock.reclaimed.from}: ${lock.reclaimed.proof})` : ""}`);
454
474
  const lockView = snap.lockView(lock);
455
475
  const abort = o.abort ?? new AbortController();
456
- let shimDir = null; let messagesFile = null;
476
+ let shimDir = null; let messagesFile = null; let carriedSettled = true;
457
477
  const stopped = []; const onSignal = (sig) => () => { stopped.push(sig); abort.abort(); };
458
478
  const handlers = o.abort ? [] : [["SIGINT", onSignal("SIGINT")], ["SIGTERM", onSignal("SIGTERM")]];
459
479
  for (const [sig, h] of handlers) process.on(sig, h);
@@ -480,39 +500,43 @@ export async function clippyCommand(o, args, deps = {}) {
480
500
  // The snapshot's working directory for the request, and the Cargo workspace it names, resolved from the commit's own manifests.
481
501
  const snapCwd = relCwd ? path.join(synced.path, ...relCwd.split("/")) : synced.path;
482
502
  if (!fs.existsSync(snapCwd)) { o.err(`${tag} BLOCKED: the working directory ${relCwd} is not in commit ${synced.commit.slice(0, 12)}; run from a directory the commit holds; nothing compiled`); return BLOCKED; }
483
- const realCargo = realCargoOf(which("cargo"));
484
- if (!realCargo) { o.err(`${tag} BLOCKED: no cargo on PATH to wrap for the snapshot compile; nothing compiled`); return BLOCKED; }
485
- const located = o.spawn("cargo", ["locate-project", "--workspace", "--message-format", "plain", ...(parsed.manifestPath ? ["--manifest-path", parsed.manifestPath] : [])], { cwd: snapCwd, env: o.env });
503
+ const realCargo = brokerHost ? null : realCargoOf(which("cargo"));
504
+ if (!brokerHost && !realCargo) { o.err(`${tag} BLOCKED: no cargo on PATH to wrap for the snapshot compile; nothing compiled`); return BLOCKED; }
505
+ const located = o.spawn(readCargo, ["locate-project", "--workspace", "--message-format", "plain", ...(parsed.manifestPath ? ["--manifest-path", parsed.manifestPath] : [])], { cwd: snapCwd, env: o.env });
486
506
  if (failed(located) || !path.isAbsolute(text(located).trim())) { o.err(`${tag} BLOCKED: the request's Cargo workspace cannot be resolved in the snapshot (${why(located) || "no manifest"}); nothing compiled`); return BLOCKED; }
487
507
  const workspaceDir = fs.realpathSync.native(path.dirname(text(located).trim()));
488
508
  if (!inside(workspaceDir, realSnapshot)) { o.err(`${tag} BLOCKED: the Cargo workspace ${workspaceDir} is outside the snapshot; nothing compiled`); return BLOCKED; }
489
509
  const cargoDir = posix(path.relative(realSnapshot, workspaceDir)) || ".";
490
- const checkoutManifest = path.join(root, ...(cargoDir === "." ? [] : cargoDir.split("/")), "Cargo.toml");
491
- if (!(o.exists ?? fs.existsSync)(checkoutManifest)) { o.err(`${tag} BLOCKED: the checkout has no ${posix(path.relative(root, checkoutManifest))}, so the output directory of workspace ${cargoDir} cannot be resolved; nothing compiled`); return BLOCKED; }
492
- // The same resolution the door's snapshot compile makes (bin/rightkit-gate.mjs, "output directory for workspace").
493
- const metaOut = o.spawn("cargo", ["metadata", "--offline", "--format-version", "1", "--no-deps", "--manifest-path", checkoutManifest], { cwd: path.dirname(checkoutManifest), env: o.env });
494
- let outputDir = null;
495
- try { outputDir = failed(metaOut) ? null : JSON.parse(text(metaOut)).target_directory; } catch { outputDir = null; }
496
- if (typeof outputDir !== "string" || !path.isAbsolute(outputDir)) { o.err(`${tag} BLOCKED: cargo metadata in the checkout reported no absolute target_directory for ${cargoDir}${failed(metaOut) ? ` (${why(metaOut)})` : ""}; nothing compiled`); return BLOCKED; }
497
- outputDir = path.resolve(outputDir);
498
- if (inside(outputDir, realSnapshot)) { o.err(`${tag} ${ROUTE_CODES.outputInSnapshot}: the resolved output directory ${outputDir} is inside the snapshot; nothing compiled`); return REFUSED_EXIT; }
499
- o.out(`${tag} output directory for workspace ${cargoDir}: ${outputDir} (the checkout's)`);
500
-
501
- // The item 7 cargo wrapper binds every cargo launch to that directory or refuses it.
502
- const shimApi = deps.shim ?? await import("./cargo-target-shim.mjs");
503
- let shim;
504
- try { shim = shimApi.installCargoShim({ base: os.tmpdir(), snapshotRoot: synced.path, targetDirs: { [cargoDir]: outputDir }, realCargo, platform: o.platform, onDir: (dir) => { shimDir = dir; } }); }
505
- catch (e) { o.err(`${tag} BLOCKED: the runtime cargo wrapper cannot be installed (${e.message}); nothing compiled`); return BLOCKED; }
506
- const scanEnv = shimApi.shimScanEnv(o.env, shim);
507
- o.out(`${tag} runtime cargo wrapper ${shim.shim} (identity ${shim.identity.slice(0, 16)}) -> ${realCargo}`);
510
+ // Direct (Linux) host: the checkout's output directory and the item 7 cargo wrapper. A broker host has neither: the broker pins its outputs.
511
+ let outputDir = null; let shim = null; let scanEnv = o.env;
512
+ if (!brokerHost) {
513
+ const checkoutManifest = path.join(root, ...(cargoDir === "." ? [] : cargoDir.split("/")), "Cargo.toml");
514
+ if (!(o.exists ?? fs.existsSync)(checkoutManifest)) { o.err(`${tag} BLOCKED: the checkout has no ${posix(path.relative(root, checkoutManifest))}, so the output directory of workspace ${cargoDir} cannot be resolved; nothing compiled`); return BLOCKED; }
515
+ // The same resolution the door's snapshot compile makes (bin/rightkit-gate.mjs, "output directory for workspace").
516
+ const metaOut = o.spawn("cargo", ["metadata", "--offline", "--format-version", "1", "--no-deps", "--manifest-path", checkoutManifest], { cwd: path.dirname(checkoutManifest), env: o.env });
517
+ outputDir = null;
518
+ try { outputDir = failed(metaOut) ? null : JSON.parse(text(metaOut)).target_directory; } catch { outputDir = null; }
519
+ if (typeof outputDir !== "string" || !path.isAbsolute(outputDir)) { o.err(`${tag} BLOCKED: cargo metadata in the checkout reported no absolute target_directory for ${cargoDir}${failed(metaOut) ? ` (${why(metaOut)})` : ""}; nothing compiled`); return BLOCKED; }
520
+ outputDir = path.resolve(outputDir);
521
+ if (inside(outputDir, realSnapshot)) { o.err(`${tag} ${ROUTE_CODES.outputInSnapshot}: the resolved output directory ${outputDir} is inside the snapshot; nothing compiled`); return REFUSED_EXIT; }
522
+ o.out(`${tag} output directory for workspace ${cargoDir}: ${outputDir} (the checkout's)`);
523
+
524
+ // The item 7 cargo wrapper binds every cargo launch to that directory or refuses it.
525
+ const shimApi = deps.shim ?? await import("./cargo-target-shim.mjs");
526
+
527
+ try { shim = shimApi.installCargoShim({ base: os.tmpdir(), snapshotRoot: synced.path, targetDirs: { [cargoDir]: outputDir }, realCargo, platform: o.platform, onDir: (dir) => { shimDir = dir; } }); }
528
+ catch (e) { o.err(`${tag} BLOCKED: the runtime cargo wrapper cannot be installed (${e.message}); nothing compiled`); return BLOCKED; }
529
+ scanEnv = shimApi.shimScanEnv(o.env, shim);
530
+ o.out(`${tag} runtime cargo wrapper ${shim.shim} (identity ${shim.identity.slice(0, 16)}) -> ${realCargo}`);
531
+ }
508
532
 
509
533
  // The toolchain identity this run compiled with (BROKER-CONTRACT B5: the same engine and toolchain for batch and per-crate runs).
510
- const toolchain = toolchainIdentity({ spawn: o.spawn, env: o.env, cwd: snapCwd });
534
+ const toolchain = toolchainIdentity({ spawn: o.spawn, env: o.env, cwd: snapCwd, cargo: readCargo, rustc: readRustc });
511
535
  if (!toolchain) { o.err(`${tag} BLOCKED: ${ROUTE_CODES.toolchainUnreadable}: \`cargo -vV\` or \`rustc -vV\` printed nothing the gate can read; nothing compiled`); return BLOCKED; }
512
536
 
513
537
  // The requested package set (blocked-unit detection and the sidecar re-check), read from the snapshot's own metadata.
514
538
  let scope = null;
515
- const metaScope = o.spawn(shim.shim, ["metadata", "--no-deps", "--format-version", "1", "--locked", ...(parsed.manifestPath ? ["--manifest-path", parsed.manifestPath] : [])], { cwd: snapCwd, env: scanEnv });
539
+ const metaScope = o.spawn(brokerHost ? readCargo : shim.shim, ["metadata", "--no-deps", "--format-version", "1", "--locked", ...(parsed.manifestPath ? ["--manifest-path", parsed.manifestPath] : [])], { cwd: snapCwd, env: scanEnv });
516
540
  try { if (!failed(metaScope)) scope = resolveScope({ before: parsed.before, metadata: JSON.parse(text(metaScope)), directory: parsed.manifestPath ? path.dirname(path.resolve(snapCwd, parsed.manifestPath)) : snapCwd }); } catch { scope = null; }
517
541
 
518
542
  // Sidecar-bound scope (row 8.8): refused before the sync above; this re-check on the snapshot's own metadata is the backstop.
@@ -520,6 +544,32 @@ export async function clippyCommand(o, args, deps = {}) {
520
544
  if (bound.length) { o.err(sidecarRefusal(tag, bound, "found in the snapshot, after the checkout's own metadata showed none")); resultLine(o, tag, { result: "BLOCKED", code: ROUTE_CODES.sidecarBound, blockedOn: ["item7:7.05"], bound, launched: false }); return BLOCKED; }
521
545
  const invocations = [];
522
546
 
547
+ // Broker host: the seam. This run's class A wrote the full verdict for the synced commit; the request names it (gate-seam.mjs verdictForRun). The
548
+ // snapshot's state file binds the repository key; a state that names another commit or tree runs nothing.
549
+ let brokerSeam = null;
550
+ if (brokerHost) {
551
+ try {
552
+ const state = JSON.parse(fs.readFileSync(`${path.resolve(synced.path)}.state.json`, "utf8"));
553
+ if (state?.commit !== synced.commit || state?.tree !== synced.tree || typeof state?.repoKey !== "string") throw new Error(`${synced.path}.state.json does not describe commit ${synced.commit} tree ${synced.tree}`);
554
+ const verdictDir = path.join(path.dirname(path.resolve(snapshotsAt)), "class-a-verdicts");
555
+ // The workspace the broker admits the request under is the client's: the directory of --manifest-path when the request names one, else the working
556
+ // directory (rustright-cli shims.rs normalized_invocation). The verdict must name that same snapshot-relative directory, or the broker refuses it
557
+ // RK_CLASS_A_INVALID "workspace ... differs from admission" (Dell replay 27 Nov: a member crate of the root Cargo workspace named by its manifest path).
558
+ const admittedDir = parsed.manifestPath !== null ? path.dirname(path.resolve(snapCwd, parsed.manifestPath)) : snapCwd;
559
+ const admitted = posix(path.relative(realSnapshot, fs.realpathSync.native(admittedDir))) || ".";
560
+ const verdict = (deps.verdictForRun ?? verdictForRun)({ seam: { commit: synced.commit, tree: synced.tree, repoKey: state.repoKey, verdictDir, scope: null }, workspace: admitted });
561
+ brokerSeam = { verdict, env: seamEnv({ commit: synced.commit, classA: verdict }) };
562
+ } catch (e) { o.err(`${tag} BLOCKED: RK_SEAM: ${e.message}; nothing compiled`); resultLine(o, tag, { result: "BLOCKED", code: "RK_SEAM", launched: false }); return BLOCKED; }
563
+ o.out(`${tag} seam: class A verdict ${brokerSeam.verdict}`);
564
+ }
565
+ // The broker adds --keep-going itself (rustright-policy cargo_argv.rs BR29), so on a broker host the gate does not add it.
566
+ const finalArgv = brokerHost && !parsed.already.includes("--keep-going") ? parsed.final.filter((arg) => arg !== "--keep-going") : parsed.final;
567
+ const transformations = brokerHost ? parsed.transformations.filter((t) => t.arg !== "--keep-going") : parsed.transformations;
568
+ const launchCommand = brokerHost ? brokerClient : shim.shim;
569
+ const launchArgs = brokerHost ? ["cargo", "clippy", ...finalArgv] : ["clippy", ...finalArgv];
570
+ const launchEnv = brokerHost ? { ...o.env, ...brokerSeam.env } : scanEnv;
571
+ if (brokerHost) carriedSettled = false; // from here a broker job may exist until the client reports its exit
572
+
523
573
  t = Date.now();
524
574
  let run = { messages: [], stderr: "", exit: null, signal: null, startError: null };
525
575
  const stateDir = path.join(gateStateDir(commonDirOf(o, root)), "clippy-route");
@@ -527,13 +577,17 @@ export async function clippyCommand(o, args, deps = {}) {
527
577
  const requestId = crypto.randomUUID();
528
578
  messagesFile = path.join(stateDir, `${requestId}.messages.jsonl`);
529
579
  {
530
- const r = await (deps.runCargo ?? defaultSpawnAsync)(shim.shim, ["clippy", ...parsed.final], { cwd: snapCwd, env: scanEnv, signal: abort.signal, stdoutFile: messagesFile });
531
- invocations.push({ role: "requested", argv: ["clippy", ...parsed.final], exit: r.status ?? null });
580
+ const r = await (deps.runCargo ?? defaultSpawnAsync)(launchCommand, launchArgs, { cwd: snapCwd, env: launchEnv, signal: abort.signal, stdoutFile: messagesFile });
581
+ invocations.push({ role: "requested", argv: ["clippy", ...finalArgv], exit: r.status ?? null });
532
582
  let body = "";
533
583
  try { body = fs.readFileSync(messagesFile, "utf8"); } catch { body = String(r.stdout ?? ""); }
534
584
  run = { messages: parseCargoMessages(body).messages, stderr: String(r.stderr ?? ""), exit: r.status ?? null, signal: stopped[0] ?? null, startError: r.error && !r.cancelled ? r.error.message : null };
535
585
  }
536
586
  lap("cargo", t);
587
+ // A broker refusal arrives on the client's stderr (`rustright-result {"code":...}`) with no cargo messages: show it, or the result reads as an empty build.
588
+ if (brokerHost && run.exit !== 0 && run.stderr) for (const l of run.stderr.trimEnd().split(/\r?\n/).slice(-6)) o.err(`${tag} broker: ${l}`);
589
+ // The carried request settled when the client returned an exit status of its own (not killed, not failed to start).
590
+ if (brokerHost) carriedSettled = run.exit !== null && !run.startError && !stopped.length;
537
591
  if (stopped.length) { fs.rmSync(messagesFile, { force: true }); o.err(`${tag} stopped by ${stopped[0]}; no result`); return stopped[0] === "SIGINT" ? 130 : 143; }
538
592
 
539
593
  // The result covers the commit only if the snapshot is still its tree after cargo exits (E6): otherwise the diagnostics are discarded.
@@ -551,14 +605,15 @@ export async function clippyCommand(o, args, deps = {}) {
551
605
  fs.rmSync(messagesFile, { force: true });
552
606
  lap("diagnostics", t);
553
607
  const receipt = {
554
- schema: ROUTE_RECEIPT_SCHEMA, requestId, executor: "direct", issuedAt: new Date().toISOString(),
608
+ schema: ROUTE_RECEIPT_SCHEMA, requestId, executor: brokerHost ? "broker" : "direct", issuedAt: new Date().toISOString(),
555
609
  commit: { sha: synced.commit, tree: synced.tree },
556
610
  snapshot: { path: synced.path, treeAtStart, treeAtExit },
557
611
  snapshotLock: { token: lock.token },
558
- outputDir, outputDirs: { [cargoDir]: outputDir },
559
- cargoWrapper: { identity: shim.identity, workspaces: shim.workspaces },
612
+ outputDir, outputDirs: brokerHost ? null : { [cargoDir]: outputDir },
613
+ cargoWrapper: brokerHost ? null : { identity: shim.identity, workspaces: shim.workspaces },
614
+ broker: brokerHost ? { client: brokerClient, classAVerdict: brokerSeam.verdict, outputs: "pinned by the broker" } : null,
560
615
  toolchain,
561
- argv: { request: parsed.request, final: parsed.final, transformations: parsed.transformations, already: parsed.already },
616
+ argv: { request: parsed.request, final: finalArgv, transformations, already: parsed.already },
562
617
  invocations,
563
618
  exit: { status: run.exit, signal: run.signal }, diagnosticsPath, timingsMs: timings,
564
619
  result: { aggregate: summary.aggregate, complete: summary.complete, completeness: summary.completeness, units: summary.units, blocked: summary.blocked, failedPackages: summary.failedPackages },
@@ -571,20 +626,31 @@ export async function clippyCommand(o, args, deps = {}) {
571
626
  } finally {
572
627
  for (const [sig, h] of handlers) process.off(sig, h);
573
628
  if (shimDir) fs.rmSync(shimDir, { recursive: true, force: true });
574
- // This route submits no broker job, so its lock is released whatever the run's outcome.
575
- lock();
629
+ // Released on positive evidence: always on a direct host; on a broker host only when the carried request settled or never started, else kept for the broker's
630
+ // stale-owner proof (as the door's releaseSeamLock does).
631
+ if (carriedSettled) lock();
632
+ else o.err(`${tag} note: the snapshot lock ${lock.token} is kept: the carried Clippy request did not settle, so a broker job may still be finishing; the lock is reclaimed on the broker's proof`);
576
633
  }
577
634
  }
578
635
 
636
+ /** The real toolchain cargo for a broker host's non-compiling reads (GC-A11): the broker's registered toolchain first, else PATH without the RustRight shims; null when none. */
637
+ function directToolchainCargo(o) {
638
+ const pk = o.platform === "win32" ? (Object.keys(o.env).find((k) => k.toUpperCase() === "PATH") ?? "Path") : "PATH";
639
+ const d = directCargoPath({ env: { ...o.env, PATH: o.env[pk] }, exists: o.exists ?? fs.existsSync, platform: o.platform, gateWrappers: true });
640
+ const name = o.platform === "win32" ? "cargo.exe" : "cargo";
641
+ for (const dir of String(d.path ?? "").split(o.platform === "win32" ? ";" : ":").filter(Boolean)) { const c = path.join(dir, name); if ((o.exists ?? fs.existsSync)(c)) return c; }
642
+ return null;
643
+ }
644
+
579
645
  function commonDirOf(o, root) {
580
646
  const r = o.spawn("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], { cwd: root });
581
647
  return failed(r) ? path.join(root, ".git") : text(r).trim();
582
648
  }
583
649
 
584
650
  /** The toolchain identity in the broker's shape (`name|cargo:<sha256>|rustc:<sha256>`, over `-vV`), or null when unreadable. */
585
- export function toolchainIdentity({ spawn, env, cwd }) {
586
- const cargo = spawn("cargo", ["-vV"], { cwd, env });
587
- const rustc = spawn("rustc", ["-vV"], { cwd, env });
651
+ export function toolchainIdentity({ spawn, env, cwd, cargo: cargoBin = "cargo", rustc: rustcBin = "rustc" }) {
652
+ const cargo = spawn(cargoBin, ["-vV"], { cwd, env });
653
+ const rustc = spawn(rustcBin, ["-vV"], { cwd, env });
588
654
  if (failed(cargo) || failed(rustc) || !text(cargo).trim() || !text(rustc).trim()) return null;
589
655
  return `${env?.RUSTUP_TOOLCHAIN ?? "direct"}|cargo:${sha256(text(cargo).trim())}|rustc:${sha256(text(rustc).trim())}`;
590
656
  }
@@ -823,9 +823,10 @@ export const FAILURE_UNCACHEABLE_INTERNAL = new Set(["ghsa-audit", "advisory-exc
823
823
  /** NN41: the key namespace of a cached failure, so a failure never shares a key with a pass of the same scan. */
824
824
  // /2: a broker-authenticated compile failure is stored only when its output shows compiler diagnostics and no tool or environment failure (a build-script tool panic is environmental; Dell pulse-hub, 2026-11-06).
825
825
  // /3 (2026-11-06): a missing system library (pkg-config, system-deps) is the host, not the inputs; failures stored under /2 may be one.
826
+ // /4 (2026-11-27): a dependency-resolution failure (the host's registry index lacks a version the lock names) is the host, not the inputs; failures stored under /3 may be one (Pulse Mac 97de4c70, rightkit-tauri-shell 0.8.11).
826
827
  /** planScans file digests by file identity (path, inode, size, mtime) for this process: one run plans its stages over the same snapshot. */
827
828
  const PLAN_DIGEST_MEMO = new Map();
828
- export const FAILURE_KEY_SCHEMA = "deterministic-failure/3";
829
+ export const FAILURE_KEY_SCHEMA = "deterministic-failure/4";
829
830
  /** NN23: the version of the internal (file-only) rules; bump when any internal rule's verdict for the same inputs changes. */
830
831
  export const INTERNAL_RULES_SCHEMA = "rightkit.internal-rules/1";
831
832
  /** Why a row's cache key moved, from the stored pass's key parts to this run's: the input entries that differ (paths and the like), the tool
@@ -909,7 +910,7 @@ export const isFailureCacheableCompileId = (id) => /^(?:check|check-features|che
909
910
  export function isDeterministicCompileDiagnostics(text) {
910
911
  const t = String(text ?? "");
911
912
  const diagnostics = /(?:^|\n)\s*error(?:\[[A-Za-z]\d+\])?: /.test(t) || /could not compile|aborting due to/.test(t);
912
- const environmental = /failed to (?:download|fetch|get|update|load source|create|write|open|remove)|network|spurious|timed out|No space left|Too many open files|Permission denied|Resource temporarily|Text file busy|internal compiler error|panicked at|pkg-config|PKG_CONFIG|system library|was not found in the pkg-config search path|Package [^\n]* was not found|linker `[^`]*` not found|unable to find library|cannot find -l|signal: |SIGKILL|SIGSEGV|Killed/i.test(t);
913
+ const environmental = /failed to (?:download|fetch|get|update|load source|create|write|open|remove)|network|spurious|timed out|No space left|Too many open files|Permission denied|Resource temporarily|Text file busy|internal compiler error|panicked at|pkg-config|PKG_CONFIG|system library|was not found in the pkg-config search path|Package [^\n]* was not found|linker `[^`]*` not found|unable to find library|cannot find -l|signal: |SIGKILL|SIGSEGV|Killed|failed to select a version for|no matching package named|location searched:|candidate versions found which didn't match/i.test(t);
913
914
  return diagnostics && !environmental;
914
915
  }
915
916
  export const isLiveScan = (id) => LIVE_SCAN_IDS.some((p) => id === p || String(id).startsWith(`${p}:`));
package/gate/compile.mjs CHANGED
@@ -11,6 +11,7 @@ import { fileStore, resultsByCrate, runCalls } from "./run-calls.mjs";
11
11
  import { runTests } from "./tests.mjs";
12
12
  import { CROSS_TARGETS, hostTarget } from "../cross-targets.mjs";
13
13
  import { resolveBrokerClient } from "../broker-client.mjs";
14
+ import { runtimeManifestPathOf } from "../seam-broker.mjs";
14
15
  import { runSeamCargoCall } from "../seam-broker.mjs";
15
16
  import { codeClosure } from "../code-closure.mjs";
16
17
 
@@ -42,11 +43,11 @@ export function gateCodeFiles(dir = HERE, { readFile = (f) => fs.readFileSync(f,
42
43
  * The broker is named by its exact build (`brokerDigest` of the runtime manifest beside the client), never by a version label, which two builds
43
44
  * can share. `brokerKnown` is false when that digest cannot be read; then nothing is remembered and nothing remembered is reused.
44
45
  */
45
- export function gateIdentity({ commit, snapshot, platform, client, readFile = (f) => fs.readFileSync(f, "utf8") }) {
46
+ export function gateIdentity({ commit, snapshot, platform, client, readFile = (f) => fs.readFileSync(f, "utf8"), realpath = fs.realpathSync.native }) {
46
47
  let toolchain = "unpinned";
47
48
  for (const file of ["rust-toolchain.toml", "rust-toolchain"]) { try { toolchain = crypto.createHash("sha256").update(readFile(path.join(snapshot, file))).digest("hex").slice(0, 16); break; } catch { /* next */ } }
48
49
  let broker = "none";
49
- if (client) { try { const m = JSON.parse(readFile(path.join(path.dirname(client), "runtime-manifest.json"))); broker = typeof m.brokerDigest === "string" && /^[0-9a-f]{64}$/.test(m.brokerDigest) ? m.brokerDigest : "unknown"; } catch { broker = "unknown"; } }
50
+ if (client) { try { const m = JSON.parse(readFile(runtimeManifestPathOf(client, { platform, read: readFile, realpath }))); broker = typeof m.brokerDigest === "string" && /^[0-9a-f]{64}$/.test(m.brokerDigest) ? m.brokerDigest : "unknown"; } catch { broker = "unknown"; } }
50
51
  const code = crypto.createHash("sha256");
51
52
  for (const f of gateCodeFiles(HERE)) code.update(f.name).update("\0").update(f.text).update("\0");
52
53
  return { commit, toolchain, host: platform, broker, brokerKnown: /^[0-9a-f]{64}$/.test(broker), gate: code.digest("hex").slice(0, 16) };
@@ -0,0 +1,140 @@
1
+ // Rust lint waivers (bogusyogi/rightkit#1830, first slice): a port of Legion's `legion-dev check-waivers` (engine/bins/legion-dev/src/checks/waivers.rs at
2
+ // db1f28bf) for every repository the gate checks. A waiver is any of:
3
+ // - a `#[allow(...)]`, `#![allow(...)]`, `#[expect(...)]` or `#![expect(...)]` attribute in Rust code, or one of them inside `cfg_attr(...)`;
4
+ // - a `[lints]` / `[workspace.lints]` level set to "allow" in a Cargo.toml;
5
+ // - a rustflags entry that disables lints (-A, --allow, --cap-lints) in a Cargo.toml or .cargo/config(.toml).
6
+ // Rust attributes are matched on code only: comments, string literals (raw and byte strings too) and char literals are blanked first, keeping every
7
+ // newline so line numbers stay exact. TOML comments are blanked; TOML strings are kept (a level or a flag is a string).
8
+ // Not waivers here: `#[warn(...)]` and a "warn" level. The gate's clippy rows run with `-D warnings` (deterministic-scans.mjs clippyArgs), which turns
9
+ // every warning into an error, so a lint lowered to warn still fails; only allow, expect and a lint cap silence it.
10
+ // Fixture trees (`/tests/fixtures/`) are skipped, as in Legion's check: they hold waivers on purpose, as test input.
11
+
12
+ const WAIVER = /#!?\[\s*(?:allow|expect)\s*\(/g;
13
+ const CFG_ATTR = /#!?\[\s*cfg_attr\s*\(/g;
14
+ const NESTED_WAIVER = /\b(?:allow|expect)\s*\(/;
15
+ const TABLE = /^\s*\[\[?\s*([^[\]]+?)\s*\]\]?\s*$/;
16
+ const KEY_VALUE = /^\s*([A-Za-z0-9_.-]+)\s*=\s*(.*?)\s*$/;
17
+ const INLINE_ALLOW = /=\s*["']allow["']/;
18
+ const RUSTFLAGS_KEY = /^\s*rustflags\s*=/;
19
+ const QUOTED = /"([^"\n]*)"|'([^'\n]*)'/g;
20
+
21
+ export const WAIVER_REASONS = Object.freeze({
22
+ attribute: "lint waiver attribute (allow/expect)",
23
+ cfgAttr: "cfg_attr applies a lint waiver (allow/expect)",
24
+ level: "lint level set to allow",
25
+ flag: "rustflags disable lints (-A, --allow or --cap-lints)",
26
+ });
27
+
28
+ /** The kind of file the scan reads, or null for any other file. */
29
+ export function waiverKindOf(file) {
30
+ if (/(^|\/)tests\/fixtures\//.test(file)) return null;
31
+ if (file.endsWith(".rs")) return "rust";
32
+ if (/(^|\/)Cargo\.toml$/.test(file)) return "manifest";
33
+ if (/(^|\/)\.cargo\/config(\.toml)?$/.test(file)) return "config";
34
+ return null;
35
+ }
36
+
37
+ const isIdent = (c) => c !== undefined && /[\p{L}\p{N}_]/u.test(c);
38
+ const blank = (out, from, to) => { for (let k = from; k < to && k < out.length; k++) if (out[k] !== "\n") out[k] = " "; };
39
+
40
+ /** Blanks comments (nested block comments too), string contents and char literal contents in Rust source, keeping newlines. */
41
+ export function maskRust(text) {
42
+ const c = Array.from(text); const n = c.length; const out = c.slice();
43
+ let i = 0;
44
+ while (i < n) {
45
+ const ch = c[i];
46
+ if (ch === "/" && c[i + 1] === "/") { let e = i; while (e < n && c[e] !== "\n") e++; blank(out, i, e); i = e; continue; }
47
+ if (ch === "/" && c[i + 1] === "*") {
48
+ let depth = 0; let k = i;
49
+ while (k < n) {
50
+ if (c[k] === "/" && c[k + 1] === "*") { depth++; k += 2; }
51
+ else if (c[k] === "*" && c[k + 1] === "/") { depth--; k += 2; if (depth === 0) break; }
52
+ else k++;
53
+ }
54
+ blank(out, i, Math.min(k, n)); i = Math.min(k, n); continue;
55
+ }
56
+ // raw strings: r"..", r#".."#, br"..", cr".."
57
+ {
58
+ const r = (c[i] === "b" || c[i] === "c") ? i + 1 : i;
59
+ if (c[r] === "r" && !(i > 0 && isIdent(c[i - 1]))) {
60
+ let k = r + 1; while (c[k] === "#") k++;
61
+ if (c[k] === '"') {
62
+ const hashes = k - r - 1; let e = k + 1;
63
+ while (e < n && !(c[e] === '"' && Array.from({ length: hashes }, (_, h) => c[e + 1 + h] === "#").every(Boolean))) e++;
64
+ blank(out, k + 1, e); i = Math.min(e + 1 + hashes, n); continue;
65
+ }
66
+ }
67
+ }
68
+ if (ch === '"') { let e = i + 1; while (e < n) { if (c[e] === "\\") e += 2; else if (c[e] === '"') break; else e++; } blank(out, i + 1, e); i = Math.min(e + 1, n); continue; }
69
+ if (ch === "'") {
70
+ let close = null;
71
+ if (c[i + 1] === "\\") { let k = i + 3; while (k < n && c[k] !== "'" && c[k] !== "\n") k++; if (k < n && c[k] === "'") close = k; }
72
+ else if (c[i + 1] !== undefined && c[i + 1] !== "\n" && c[i + 2] === "'") close = i + 2;
73
+ if (close !== null) { blank(out, i + 1, close); i = close + 1; continue; }
74
+ i++; continue; // a lifetime
75
+ }
76
+ i++;
77
+ }
78
+ return out.join("");
79
+ }
80
+
81
+ /** Blanks TOML comments, keeping strings (basic, literal, multi-line) and newlines. */
82
+ export function maskTomlComments(text) {
83
+ const c = Array.from(text); const n = c.length; const out = c.slice();
84
+ let i = 0;
85
+ while (i < n) {
86
+ if (c[i] === "#") { let e = i; while (e < n && c[e] !== "\n") e++; blank(out, i, e); i = e; continue; }
87
+ if (c[i] === '"' || c[i] === "'") {
88
+ const q = c[i];
89
+ if (c[i + 1] === q && c[i + 2] === q) { let k = i + 3; while (k < n && !(c[k] === q && c[k + 1] === q && c[k + 2] === q)) k += (q === '"' && c[k] === "\\") ? 2 : 1; i = Math.min(k + 3, n); continue; }
90
+ let k = i + 1; while (k < n && c[k] !== "\n") { if (q === '"' && c[k] === "\\") k += 2; else if (c[k] === q) { k++; break; } else k++; }
91
+ i = Math.min(k, n); continue;
92
+ }
93
+ i++;
94
+ }
95
+ return out.join("");
96
+ }
97
+
98
+ const lineOf = (text, offset) => text.slice(0, offset).split("\n").length;
99
+ const isAllowFlag = (t) => t.startsWith("-A") || t === "--allow" || t.startsWith("--allow=") || t === "--cap-lints" || t.startsWith("--cap-lints=");
100
+ const flagsOnLine = (line) => [...line.matchAll(QUOTED)].some((m) => String(m[1] ?? m[2] ?? "").split(/\s+/).filter(Boolean).some(isAllowFlag));
101
+
102
+ function rustWaivers(text) {
103
+ const masked = maskRust(text); const out = [];
104
+ for (const m of masked.matchAll(WAIVER)) out.push({ line: lineOf(masked, m.index), reason: WAIVER_REASONS.attribute });
105
+ for (const m of masked.matchAll(CFG_ATTR)) {
106
+ let depth = 1; let k = m.index + m[0].length;
107
+ while (k < masked.length && depth > 0) { if (masked[k] === "(") depth++; else if (masked[k] === ")") depth--; k++; }
108
+ if (NESTED_WAIVER.test(masked.slice(m.index + m[0].length, depth === 0 ? k - 1 : masked.length))) out.push({ line: lineOf(masked, m.index), reason: WAIVER_REASONS.cfgAttr });
109
+ }
110
+ return out;
111
+ }
112
+
113
+ function manifestWaivers(text, kind) {
114
+ const masked = maskTomlComments(text); const out = []; const lines = masked.split("\n");
115
+ if (kind === "manifest") {
116
+ let table = "";
117
+ lines.forEach((line, i) => {
118
+ const t = TABLE.exec(line); if (t) { table = t[1]; return; }
119
+ const kv = KEY_VALUE.exec(line); if (!kv) return;
120
+ const keyPath = table ? `${table}.${kv[1]}` : kv[1];
121
+ const lintsPath = keyPath === "lints" || keyPath.startsWith("lints.") || keyPath === "workspace.lints" || keyPath.startsWith("workspace.lints.");
122
+ const v = kv[2].trim();
123
+ const allows = v.startsWith("{") ? INLINE_ALLOW.test(v) : v.replace(/^["']|["']$/g, "") === "allow";
124
+ if (lintsPath && allows) out.push({ line: i + 1, reason: `${WAIVER_REASONS.level} at ${keyPath}` });
125
+ });
126
+ }
127
+ let inArray = false;
128
+ lines.forEach((line, i) => {
129
+ if (kind === "manifest" && !inArray) { const m = RUSTFLAGS_KEY.exec(line); if (!m) return; inArray = line.slice(m[0].length).trimStart().startsWith("["); }
130
+ if (flagsOnLine(line)) out.push({ line: i + 1, reason: WAIVER_REASONS.flag });
131
+ if (kind === "manifest" && inArray && line.replace(QUOTED, "").includes("]")) inArray = false;
132
+ });
133
+ return out;
134
+ }
135
+
136
+ /** The waivers in one file's text: [{ line, reason }] in line order. `kind` from waiverKindOf. */
137
+ export function waiversIn(text, kind) {
138
+ const found = kind === "rust" ? rustWaivers(text) : kind ? manifestWaivers(text, kind) : [];
139
+ return found.sort((a, b) => a.line - b.line);
140
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.89",
3
+ "version": "0.6.91",
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",
@@ -13,7 +13,7 @@ import { defaultReleaseConfigFile, importReleaseConfig } from "./release-config.
13
13
  import { assertPrimaryReleaseCheckout } from "./release-invocation.mjs";
14
14
  import { assertCleanSource } from "./source-gate.mjs";
15
15
  import { verifyPublicationRelease, PublicationError, assertArtifactUnchanged, digestBytes } from "./publication-artifacts.mjs";
16
- import { uploadVerifiedR2Artifact } from "./r2-verified-upload.mjs";
16
+ import { putVerifiedR2Artifact } from "./r2-verified-upload.mjs";
17
17
  import { verifyPlatformTrust } from "./github-release.mjs";
18
18
  import { admitInstalledQa } from "./release-qa-audit.mjs";
19
19
  import { RIGHT_SUITE_API_ORIGIN, RIGHT_SUITE_GATED_ARTIFACT_HOST, RIGHT_SUITE_PUBLIC_INSTALLER_BASE } from "./suite-api.generated.mjs";
@@ -212,7 +212,7 @@ if (tier === "patch") {
212
212
  if (!appInstallerKind) artifactFile(artifact.signature);
213
213
  if (!uploadedKeys.has(installerKey)) {
214
214
  console.log(`${dryRun ? "[dry-run] " : ""}UPLOAD public/${installerKey}`);
215
- if (!dryRun) uploadVerifiedR2Artifact(verifiedArtifact(file), installerKey, "public", { cwd: root });
215
+ if (!dryRun) await putVerifiedR2Artifact(verifiedArtifact(file), installerKey, "public");
216
216
  uploadedKeys.add(installerKey);
217
217
  }
218
218
  const signature = dryRun ? `<signature:${artifact.signature ?? "msix-authenticode"}>` : signatureFor(artifact);
@@ -234,7 +234,7 @@ if (tier === "patch") {
234
234
  const file = artifactFile(installer.file);
235
235
  if (!uploadedKeys.has(installer.key)) {
236
236
  console.log(`${dryRun ? "[dry-run] " : ""}UPLOAD public/${installer.key}`);
237
- if (!dryRun) uploadVerifiedR2Artifact(verifiedArtifact(file), installer.key, "public", { cwd: root });
237
+ if (!dryRun) await putVerifiedR2Artifact(verifiedArtifact(file), installer.key, "public");
238
238
  uploadedKeys.add(installer.key);
239
239
  }
240
240
  const metadata = dryRun ? { sha256: null, sizeBytes: null } : await fileMetadata(file);
@@ -248,7 +248,7 @@ if (tier === "patch") {
248
248
  // package came from, so it must outlive the version that replaces it.
249
249
  if (installer.versionedKey && !uploadedKeys.has(installer.versionedKey)) {
250
250
  console.log(`${dryRun ? "[dry-run] " : ""}UPLOAD public/${installer.versionedKey}`);
251
- if (!dryRun) uploadVerifiedR2Artifact(verifiedArtifact(file), installer.versionedKey, "public", { cwd: root });
251
+ if (!dryRun) await putVerifiedR2Artifact(verifiedArtifact(file), installer.versionedKey, "public");
252
252
  uploadedKeys.add(installer.versionedKey);
253
253
  }
254
254
  }
@@ -317,7 +317,7 @@ for (const artifact of artifacts) {
317
317
  if (!appInstallerKind) artifactFile(artifact.signature);
318
318
  if (!uploadedKeys.has(artifact.key)) {
319
319
  console.log(`${dryRun ? "[dry-run] " : ""}UPLOAD private/${artifact.key}`);
320
- if (!dryRun) uploadVerifiedR2Artifact(verifiedArtifact(file), artifact.key, "private", { cwd: root });
320
+ if (!dryRun) await putVerifiedR2Artifact(verifiedArtifact(file), artifact.key, "private");
321
321
  uploadedKeys.add(artifact.key);
322
322
  }
323
323
  const signature = dryRun ? `<signature:${artifact.signature ?? "msix-authenticode"}>` : signatureFor(artifact);
@@ -170,6 +170,23 @@ export async function uploadMultipart({ file, evidence, bucket, key, credentials
170
170
  } finally { closeSync(fd); }
171
171
  }
172
172
 
173
+ /**
174
+ * Upload `body` (a Buffer below R2_MULTIPART_THRESHOLD_BYTES) to `bucket/key` in one signed PutObject. Its sha256 and size must equal `evidence`
175
+ * before anything is sent, so an object that does not match the evidence is never created; the caller still reads the remote bytes back with
176
+ * streamObjectDigest. This replaces `pnpm dlx wrangler r2 object put` on the publication path: no child process, no credential leaves this process,
177
+ * nothing is downloaded at publish time. Returns { sizeBytes }.
178
+ */
179
+ export async function putObject({ body, evidence, bucket, key, credentials, account, fetchImpl, sleep }) {
180
+ if (!Buffer.isBuffer(body)) throw new PublicationError("PUBLICATION_ROUTE_INVALID", "putObject takes the verified bytes as a Buffer");
181
+ if (body.length >= R2_MULTIPART_THRESHOLD_BYTES) throw new PublicationError("PUBLICATION_ROUTE_INVALID", `an object of ${body.length} bytes goes up as a multipart upload`);
182
+ if (evidence.sizeBytes !== undefined && body.length !== evidence.sizeBytes) throw new PublicationError("PUBLICATION_SIZE_MISMATCH", `artifact size mismatch: ${key}`);
183
+ const digest = sha256Hex(body);
184
+ if (digest !== evidence.sha256) throw new PublicationError("PUBLICATION_HASH_MISMATCH", `artifact sha256 mismatch: ${key}`);
185
+ const client = s3Client({ bucket, credentials, account, fetchImpl, sleep });
186
+ await client.send("PUT", key, { body, payloadHash: digest });
187
+ return { sizeBytes: body.length };
188
+ }
189
+
173
190
  /** One signed GetObject response (optionally `range: "bytes=N-"`): the body is streamed by the caller. Throws with the HTTP status only. */
174
191
  export async function getObject({ bucket, key, credentials, account, fetchImpl, sleep, range }) {
175
192
  const client = s3Client({ bucket, credentials, account, fetchImpl, sleep });
@@ -1,7 +1,46 @@
1
1
  import path from "node:path";
2
2
  import { spawnSync } from "./background-process.mjs";
3
- import { assertArtifactUnchanged, PublicationError, verifyArtifactFile } from "./publication-artifacts.mjs";
4
- import { deriveR2S3Credentials, R2_ACCOUNT_ID, R2_MULTIPART_THRESHOLD_BYTES, streamObjectDigest, uploadMultipart } from "./r2-s3-multipart.mjs";
3
+ import { assertArtifactUnchanged, PublicationError, readVerifiedArtifact, verifyArtifactFile } from "./publication-artifacts.mjs";
4
+ import { deriveR2S3Credentials, putObject, R2_ACCOUNT_ID, R2_MULTIPART_THRESHOLD_BYTES, streamObjectDigest, uploadMultipart } from "./r2-s3-multipart.mjs";
5
+
6
+ const validRoute = (key, bucket) => ["public", "private"].includes(bucket) && /^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(key ?? "") && !key.includes("..");
7
+
8
+ // One in-process transport for every object (rightkit#1754): no child process, so no credential is carried to a broker job (BROKER-CONTRACT D4)
9
+ // and nothing is downloaded at publish time. `bytes` (already verified) go up in one PutObject; without them the file goes up as a multipart
10
+ // upload. Either way the remote bytes are read back through a sha256 and a byte counter and must equal the evidence.
11
+ async function inProcessUpload({ file, bytes, artifact, key, bucket, env, fetchImpl, sleep }) {
12
+ const bucketName = bucket === "public" ? "rightapps-downloads" : "rightapps-updates";
13
+ const target = `${bucketName}/${key}`;
14
+ const cleanEnv = { ...env, CLOUDFLARE_ACCOUNT_ID: env.CLOUDFLARE_ACCOUNT_ID || R2_ACCOUNT_ID };
15
+ for (const name of ["CLOUDFLARE_API_KEY", "CLOUDFLARE_EMAIL", "CF_API_KEY", "CF_EMAIL"]) delete cleanEnv[name];
16
+ const credentials = await deriveR2S3Credentials(cleanEnv.CLOUDFLARE_API_TOKEN, { account: cleanEnv.CLOUDFLARE_ACCOUNT_ID, fetchImpl });
17
+ const transport = { bucket: bucketName, key, credentials, account: cleanEnv.CLOUDFLARE_ACCOUNT_ID, fetchImpl, sleep };
18
+ try {
19
+ if (bytes) await putObject({ body: bytes, evidence: artifact, ...transport });
20
+ else await uploadMultipart({ file: path.resolve(file), evidence: artifact, ...transport });
21
+ } catch (error) {
22
+ if (error instanceof PublicationError && error.code !== "PUBLICATION_UPLOAD_FAILED") throw error;
23
+ throw new PublicationError("PUBLICATION_UPLOAD_FAILED", `R2 upload failed (${error.message}); inspect remote key ${target}`);
24
+ }
25
+ try {
26
+ const remote = await streamObjectDigest(transport);
27
+ if (remote.sha256 !== artifact.sha256) throw new Error("remote sha256 differs from the evidence");
28
+ if (remote.sizeBytes !== artifact.sizeBytes) throw new Error(`remote size ${remote.sizeBytes} differs from ${artifact.sizeBytes}`);
29
+ } catch (error) {
30
+ throw new PublicationError("PUBLICATION_REMOTE_MISMATCH", `R2 verification failed (${error.message}); remove remote key ${target}`);
31
+ }
32
+ }
33
+
34
+ /**
35
+ * The publication path's upload of one verified artifact (publish-update): the bytes read and hashed at verification go up in process and are
36
+ * read back. An artifact at or above R2_MULTIPART_THRESHOLD_BYTES goes up from its file as a multipart upload after the file is checked unchanged.
37
+ */
38
+ export async function putVerifiedR2Artifact(artifact, key, bucket, { env = process.env, fetchImpl, sleep } = {}) {
39
+ if (!validRoute(key, bucket)) throw new PublicationError("PUBLICATION_ROUTE_INVALID", "invalid R2 publication route");
40
+ const bytes = assertArtifactUnchanged(artifact);
41
+ await inProcessUpload({ file: artifact.file, bytes: bytes.length < R2_MULTIPART_THRESHOLD_BYTES ? bytes : null, artifact, key, bucket, env, fetchImpl, sleep });
42
+ return artifact;
43
+ }
5
44
 
6
45
  // Wrangler's pipe input transports the verified buffer, with no path lookup by its child.
7
46
  export function uploadVerifiedR2Artifact(artifact, key, bucket, { run = spawnSync, env = process.env, cwd } = {}) {
@@ -16,38 +55,17 @@ export function uploadVerifiedR2Artifact(artifact, key, bucket, { run = spawnSyn
16
55
  }
17
56
 
18
57
  // Path-only large-file transport: success requires remote bytes matching captured evidence. Objects below R2_MULTIPART_THRESHOLD_BYTES go up in
19
- // one wrangler request; larger ones (wrangler stops at 300 MiB) go through the S3-compatible endpoint as a multipart upload (r2-s3-multipart.mjs,
20
- // #902). Either way the readback streams GetObject through a sha256 and a byte counter, because `wrangler r2 object get` aborts mid-stream on
21
- // large objects (docs/rules/cloudflare-access.md Rule 6). The S3 credentials are derived in memory from CLOUDFLARE_API_TOKEN and never printed.
58
+ // one PutObject; larger ones go up as a multipart upload (r2-s3-multipart.mjs, #902), both through the S3-compatible endpoint in this process
59
+ // (rightkit#1754: wrangler, a child process, is off this path). Either way the readback streams GetObject through a sha256 and a byte counter
60
+ // (docs/rules/cloudflare-access.md Rule 6). The S3 credentials are derived in memory from CLOUDFLARE_API_TOKEN and never printed.
22
61
  // The order the callers keep is immutable object -> signed envelope -> pointer, and a readback that differs from the evidence is
23
62
  // PUBLICATION_REMOTE_MISMATCH.
24
63
  export async function uploadVerifiedR2File(file, evidence, key, bucket, { run = spawnSync, env = process.env, cwd, dryRun = false, fetchImpl, sleep } = {}) {
25
64
  if (!["public", "private"].includes(bucket) || !/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(key ?? "") || key.includes("..")) throw new PublicationError("PUBLICATION_ROUTE_INVALID", "invalid R2 publication route");
26
65
  const artifact = verifyArtifactFile(file, evidence);
27
66
  if (dryRun) return artifact;
28
- const bucketName = bucket === "public" ? "rightapps-downloads" : "rightapps-updates";
29
- const target = `${bucketName}/${key}`;
30
- const cleanEnv = { ...env, CLOUDFLARE_ACCOUNT_ID: env.CLOUDFLARE_ACCOUNT_ID || R2_ACCOUNT_ID };
31
- for (const name of ["CLOUDFLARE_API_KEY", "CLOUDFLARE_EMAIL", "CF_API_KEY", "CF_EMAIL"]) delete cleanEnv[name];
32
- const credentials = await deriveR2S3Credentials(cleanEnv.CLOUDFLARE_API_TOKEN, { account: cleanEnv.CLOUDFLARE_ACCOUNT_ID, fetchImpl });
33
- const transport = { bucket: bucketName, key, credentials, account: cleanEnv.CLOUDFLARE_ACCOUNT_ID, fetchImpl, sleep };
34
- if (artifact.sizeBytes >= R2_MULTIPART_THRESHOLD_BYTES) {
35
- try { await uploadMultipart({ file: path.resolve(file), evidence: artifact, ...transport }); }
36
- catch (error) {
37
- if (error instanceof PublicationError && error.code !== "PUBLICATION_UPLOAD_FAILED") throw error;
38
- throw new PublicationError("PUBLICATION_UPLOAD_FAILED", `R2 multipart upload failed (${error.message}); inspect remote key ${target}`);
39
- }
40
- } else {
41
- const options = { cwd, env: cleanEnv, windowsHide: true, shell: process.platform === "win32", encoding: "utf8" };
42
- const result = run("pnpm", ["dlx", "wrangler@4", "r2", "object", "put", target, "--file", path.resolve(file), "--remote"], { ...options, stdio: "inherit" });
43
- if (result.error || result.status !== 0) throw new PublicationError("PUBLICATION_UPLOAD_FAILED", `R2 upload failed; inspect remote key ${target}`);
44
- }
45
- try {
46
- const remote = await streamObjectDigest(transport);
47
- if (remote.sha256 !== artifact.sha256) throw new Error("remote sha256 differs from the evidence");
48
- if (remote.sizeBytes !== artifact.sizeBytes) throw new Error(`remote size ${remote.sizeBytes} differs from ${artifact.sizeBytes}`);
49
- } catch (error) {
50
- throw new PublicationError("PUBLICATION_REMOTE_MISMATCH", `R2 verification failed (${error.message}); remove remote key ${target}`);
51
- }
67
+ // Below the multipart threshold the bytes are read once and verified again, then go up in one PutObject; above it the file goes up multipart.
68
+ const bytes = artifact.sizeBytes < R2_MULTIPART_THRESHOLD_BYTES ? readVerifiedArtifact(file, evidence).bytes : null;
69
+ await inProcessUpload({ file, bytes, artifact, key, bucket, env, fetchImpl, sleep });
52
70
  return artifact;
53
71
  }
package/release.mjs CHANGED
@@ -1309,7 +1309,13 @@ async function runCommand(command, root, { env = {}, captureStdout = false } = {
1309
1309
  const nativeCommand = nativeToolOf(command.cmd) !== null;
1310
1310
  const { [NATIVE_SIGNING_FILE_ENV]: signingFile, ...dynamicEnv } = env;
1311
1311
  const commandEnvironment = { ...(await commandEnv(command, root)), ...(nativeCommand ? dynamicEnv : env) };
1312
- const target = buildLaunch(command.cmd, command.args ?? [], { env: { ...process.env, ...commandEnvironment }, stepEnv: command.env, cwd, exists: existsSync, ...(nativeCommand && signingFile ? { signingFile } : {}) });
1312
+ // GC-A28: an assemble-app step stamps CFBundleVersion from RIGHT_BUILD_NUMBER, which the gate counted in the checkout (the snapshot's `.git` stub
1313
+ // cannot). On a broker host the step is an adapter job whose environment carries only the names the step declares, so the number is declared here,
1314
+ // for that step only; the adapter's registry entry must list RIGHT_BUILD_NUMBER (RK_ADAPTER_ENV_DENIED otherwise).
1315
+ const assembles = (command.args ?? []).map(String).includes("assemble-app");
1316
+ const buildNumber = assembles && /^[1-9][0-9]*$/.test(process.env.RIGHT_BUILD_NUMBER ?? "") ? { RIGHT_BUILD_NUMBER: process.env.RIGHT_BUILD_NUMBER } : {};
1317
+ const stepEnv = Object.keys(buildNumber).length ? { ...(command.env ?? {}), ...buildNumber } : command.env;
1318
+ const target = buildLaunch(command.cmd, command.args ?? [], { env: { ...process.env, ...commandEnvironment }, stepEnv, cwd, exists: existsSync, ...(nativeCommand && signingFile ? { signingFile } : {}) });
1313
1319
  // A direct (Linux) launch carries PATH without RustRight shim directories (build-launch `env`).
1314
1320
  return run(target.command, target.args, cwd, { ...commandEnvironment, ...(target.env ?? {}) }, {
1315
1321
  ...command,
@@ -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.9",
52
- "@rightkit/release": "0.6.89",
52
+ "@rightkit/release": "0.6.91",
53
53
  "@rightkit/send-ui": "0.1.0",
54
54
  "@rightkit/settings-ui": "0.7.7",
55
55
  "@rightkit/social-ui": "0.2.1",
@@ -455,7 +455,9 @@
455
455
  "0.6.85",
456
456
  "0.6.86",
457
457
  "0.6.87",
458
- "0.6.88"
458
+ "0.6.88",
459
+ "0.6.89",
460
+ "0.6.90"
459
461
  ],
460
462
  "@rightkit/settings-ui": [
461
463
  "0.1.0",
@@ -547,8 +549,8 @@
547
549
  "stagedCargo": {
548
550
  "rightkit-adapt": "0.2.1",
549
551
  "rightkit-adapt-taste": "0.1.3",
550
- "rightkit-agent-coding-tools": "0.1.9",
551
- "rightkit-agent-config": "0.1.4",
552
+ "rightkit-agent-coding-tools": "0.2.0",
553
+ "rightkit-agent-config": "0.1.6",
552
554
  "rightkit-agent-daemon": "0.2.0",
553
555
  "rightkit-agent-demo": "0.2.1",
554
556
  "rightkit-agent-engine": "0.2.0",
@@ -556,7 +558,7 @@
556
558
  "rightkit-agent-engine-api-platform": "0.1.3",
557
559
  "rightkit-agent-engine-api-sessions": "0.1.1",
558
560
  "rightkit-agent-engine-api-workflows": "0.2.2",
559
- "rightkit-agent-engine-attention": "0.2.1",
561
+ "rightkit-agent-engine-attention": "0.2.2",
560
562
  "rightkit-agent-engine-cli": "0.1.1",
561
563
  "rightkit-agent-engine-core": "0.1.4",
562
564
  "rightkit-agent-engine-history": "0.1.6",
@@ -570,7 +572,7 @@
570
572
  "rightkit-agent-host-traits": "0.1.3",
571
573
  "rightkit-agent-learning": "0.1.2",
572
574
  "rightkit-agent-local-models": "0.1.3",
573
- "rightkit-agent-orchestration": "0.1.7",
575
+ "rightkit-agent-orchestration": "0.1.8",
574
576
  "rightkit-agent-orchestration-handoff": "0.1.2",
575
577
  "rightkit-agent-plugins": "0.1.4",
576
578
  "rightkit-agent-policy": "0.2.4",
@@ -583,7 +585,7 @@
583
585
  "rightkit-agent-tools": "0.4.4",
584
586
  "rightkit-agent-transcript": "0.1.4",
585
587
  "rightkit-agents": "0.2.8",
586
- "rightkit-ai-accounts": "0.1.3",
588
+ "rightkit-ai-accounts": "0.1.4",
587
589
  "rightkit-ai-keys": "0.1.1",
588
590
  "rightkit-android": "0.3.3",
589
591
  "rightkit-app-host": "0.1.3",
@@ -732,7 +734,7 @@
732
734
  "rightkit-profile": "0.1.0",
733
735
  "rightkit-prompt-recipes": "0.2.1",
734
736
  "rightkit-pty": "0.1.3",
735
- "rightkit-qa": "0.10.15",
737
+ "rightkit-qa": "0.10.16",
736
738
  "rightkit-record": "0.4.1",
737
739
  "rightkit-reframe": "0.2.1",
738
740
  "rightkit-remote-compute": "0.2.2",
@@ -758,8 +760,8 @@
758
760
  "rightkit-sync-keys": "0.1.0",
759
761
  "rightkit-sysmem": "0.1.0",
760
762
  "rightkit-system-monitor": "0.3.2",
761
- "rightkit-tauri-shell": "0.8.10",
762
- "rightkit-terminal-ui": "0.1.9",
763
+ "rightkit-tauri-shell": "0.8.11",
764
+ "rightkit-terminal-ui": "0.2.0",
763
765
  "rightkit-text-polish": "0.1.4",
764
766
  "rightkit-theme": "0.1.1",
765
767
  "rightkit-time": "0.1.5",
@@ -923,7 +925,7 @@
923
925
  "@rightkit/qa": "0.7.0",
924
926
  "@rightkit/qa-chrome": "0.1.12",
925
927
  "@rightkit/react-shell": "0.7.7",
926
- "@rightkit/release": "0.6.88",
928
+ "@rightkit/release": "0.6.90",
927
929
  "@rightkit/settings-ui": "0.7.4",
928
930
  "@rightkit/shell": "0.1.1",
929
931
  "@rightkit/tauri": "0.4.3",
@@ -939,7 +941,8 @@
939
941
  ],
940
942
  "rightkit-agent-engine-attention": [
941
943
  "0.1.3",
942
- "0.2.0"
944
+ "0.2.0",
945
+ "0.2.1"
943
946
  ],
944
947
  "rightkit-agent-engine-core": [
945
948
  "0.1.3"
@@ -977,7 +980,8 @@
977
980
  ],
978
981
  "rightkit-ai-accounts": [
979
982
  "0.1.1",
980
- "0.1.2"
983
+ "0.1.2",
984
+ "0.1.3"
981
985
  ],
982
986
  "rightkit-ai-keys": [
983
987
  "0.1.0"
@@ -1539,7 +1543,8 @@
1539
1543
  "0.10.11",
1540
1544
  "0.10.12",
1541
1545
  "0.10.13",
1542
- "0.10.14"
1546
+ "0.10.14",
1547
+ "0.10.15"
1543
1548
  ],
1544
1549
  "rightkit-qa-driver": [
1545
1550
  "0.3.0",
@@ -1678,7 +1683,8 @@
1678
1683
  "0.6.0",
1679
1684
  "0.8.2",
1680
1685
  "0.8.7",
1681
- "0.8.9"
1686
+ "0.8.9",
1687
+ "0.8.10"
1682
1688
  ],
1683
1689
  "rightkit-text-polish": [
1684
1690
  "0.1.1",
@@ -1806,7 +1812,9 @@
1806
1812
  "0.3.2"
1807
1813
  ],
1808
1814
  "rightkit-agent-config": [
1809
- "0.1.3"
1815
+ "0.1.3",
1816
+ "0.1.4",
1817
+ "0.1.5"
1810
1818
  ],
1811
1819
  "rightkit-agent-demo": [
1812
1820
  "0.2.0"
@@ -1825,7 +1833,8 @@
1825
1833
  "0.3.0"
1826
1834
  ],
1827
1835
  "rightkit-agent-orchestration": [
1828
- "0.1.6"
1836
+ "0.1.6",
1837
+ "0.1.7"
1829
1838
  ],
1830
1839
  "rightkit-agent-telemetry": [
1831
1840
  "0.1.0"
@@ -1902,7 +1911,8 @@
1902
1911
  "0.1.5",
1903
1912
  "0.1.6",
1904
1913
  "0.1.7",
1905
- "0.1.8"
1914
+ "0.1.8",
1915
+ "0.1.9"
1906
1916
  ],
1907
1917
  "rightkit-timeline": [
1908
1918
  "0.1.1"
package/seam-broker.mjs CHANGED
@@ -152,26 +152,35 @@ export function posixAgentShimTarget(text) {
152
152
  return exec ? exec[1] : null;
153
153
  }
154
154
 
155
- export function brokerControlTarget(o, { client = o?.client } = {}) {
156
- const platform = o?.platform ?? process.platform;
157
- const env = o?.env ?? process.env;
158
- const read = o?.readFile ?? ((file) => fs.readFileSync(file, "utf8"));
159
- if (typeof client !== "string" || !client) return { ok: false, problem: "the RustRight client is not on PATH, so its runtime identity cannot be read" };
160
- let exe;
161
- try { exe = resolveBrokerClient(client, { platform, readFile: read }).file; } catch (error) { return { ok: false, problem: `the RustRight client cannot be resolved (${error.message})` }; }
155
+ /**
156
+ * The runtime manifest that sits beside the RustRight client `exe` really starts (`exe` already resolved through resolveBrokerClient): on POSIX the real path,
157
+ * and through the installer's agent shim (a short sh script in the managed agent-bin that execs the runtime's client; not a symlink, so its real path is
158
+ * itself and agent-bin holds no manifest) to the client it starts. Used by every reader of the installed broker's identity: the seam's reclaim judge
159
+ * (2026-11-26), the unit compile's result store and the failure cache (2026-11-27: on the Mac both read agent-bin and found nothing, so every unit run
160
+ * reported "nothing is remembered or reused" and no compile failure was cached; CodeRight, rightkit-agent-engine-attention 71ea35fa).
161
+ */
162
+ export function runtimeManifestPathOf(exe, { platform = process.platform, read = (file) => fs.readFileSync(file, "utf8"), realpath = fs.realpathSync.native } = {}) {
162
163
  let real = exe;
163
- if (platform !== "win32") { try { real = (o?.realpath ?? fs.realpathSync.native)(exe); } catch { real = exe; } }
164
- // The installer's POSIX agent shim (a short sh script in the managed agent-bin that execs the runtime's client) is not a symlink, so
165
- // its real path is itself and the manifest was looked for in agent-bin, where there is none: no dead holder's snapshot lock could be
166
- // reclaimed on the Mac (2026-11-26). Follow the shim to the client it starts; the manifest sits beside that.
167
164
  if (platform !== "win32") {
165
+ try { real = realpath(exe); } catch { real = exe; }
168
166
  let shimText = null;
169
167
  try { shimText = read(real); } catch { shimText = null; }
170
168
  const target = posixAgentShimTarget(shimText);
171
169
  if (target) real = target;
172
170
  }
173
171
  const paths = platform === "win32" ? path.win32 : path.posix;
174
- const manifest = paths.join(paths.dirname(real), RUNTIME_MANIFEST_FILE);
172
+ return paths.join(paths.dirname(real), RUNTIME_MANIFEST_FILE);
173
+ }
174
+
175
+ export function brokerControlTarget(o, { client = o?.client } = {}) {
176
+ const platform = o?.platform ?? process.platform;
177
+ const env = o?.env ?? process.env;
178
+ const read = o?.readFile ?? ((file) => fs.readFileSync(file, "utf8"));
179
+ if (typeof client !== "string" || !client) return { ok: false, problem: "the RustRight client is not on PATH, so its runtime identity cannot be read" };
180
+ let exe;
181
+ try { exe = resolveBrokerClient(client, { platform, readFile: read }).file; } catch (error) { return { ok: false, problem: `the RustRight client cannot be resolved (${error.message})` }; }
182
+ // The POSIX agent shim is followed to the client it starts (runtimeManifestPathOf; no dead holder's lock could be reclaimed on the Mac before, 2026-11-26).
183
+ const manifest = runtimeManifestPathOf(exe, { platform, read, ...(o?.realpath ? { realpath: o.realpath } : {}) });
175
184
  let text;
176
185
  try { text = read(manifest); } catch (error) { return { ok: false, problem: `cannot read the runtime manifest ${manifest} beside the client (${error?.message ?? error})` }; }
177
186
  const identity = parseRuntimeIdentity(text);