@rightkit/release 0.6.86 → 0.6.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -61,9 +61,10 @@ The module imports node builtins only (preflight runs with no `node_modules`), r
61
61
  ```
62
62
 
63
63
  - `name` (required, unique): environment variable, argument flag, settings key or `VITE_*` name.
64
- - `class` (required): `S1`..`S6`. `channel` (required): `env`, `argv`, `settings`, `preference` or `frontend`.
64
+ - `class` (required): `S1`..`S7`. `channel` (required): `env`, `argv`, `settings`, `preference` or `frontend`.
65
65
  - S1-S4 need `compiledOut`: `feature:<name>`, `cfg:test`, `cfg:debug_assertions` or, for Swift, `swift:<CONDITION>` (`swift:DEBUG`, `swift:PULSE_QA`: the read sits inside `#if <CONDITION>`; the read exists only there). The source walk skips test directories, including Swift bundles named `Tests`, `UITests`, `<App>Tests` and `<App>UITests`. S5 needs `userGesture: true`. S6 needs `valueType` of `bool`, `int` or `enum`.
66
66
  - `swift:<CONDITION>` (#1169) is any Swift compilation condition (`swift:DEBUG`, or the app's own, e.g. `swift:PULSE_QA`), and it is checked, not trusted: every read of the name must sit in a Swift file inside an `#if <CONDITION>` (or `#elseif`) branch that requires it (`A && COND` does; `#else`, `COND || A` and `!COND` do not), and the project must not define the condition for Release (`SWIFT_ACTIVE_COMPILATION_CONDITIONS` in a Release `buildSettings` block of a `project.pbxproj`, a Release or unscoped `.xcconfig` line, or a SwiftPM `.define("X")` not limited to `.when(configuration: .debug)`). A condition a separate QA build adds on the command line is in no project file and passes; the finding is `not-compiled-out`.
67
+ - **S7, a handoff.** A one-time value (a token, a nonce) the app's own code sets in the environment of a child process it starts, which the child reads and then removes. It selects no test mode, data root, executable, library or identity, so it stays in release; both ends are checked in source instead. The entry needs `channel: "env"` and `handoff: { "setBy": "<path>:<line>", "clearedAt": "<path>:<line>" }`: the first line must show the name being set on a child (`.env(`, `.envs(`, `set_var(`, an `env…insert(` into the child's environment map), the second must show it being removed (`remove_var(`, `env_remove(`, `unsetenv(`). Where the code names it through a constant, add `"nameConst": "<path>:<line>"` pointing at `const X: &str = "NAME";`; the two ends may then show `X`. An entry whose lines do not show this is `inventory-invalid`. S7 names are not on the binary deny list. Example: `{ "name": "PULSE_AGENT_RUN_TOKEN", "class": "S7", "channel": "env", "handoff": { "nameConst": "engine/src/journal/agent_act.rs:170", "setBy": "engine/src/journal/agent_act.rs:1419", "clearedAt": "engine/src/journal/agent_act.rs:2225" } }`.
67
68
  - `anchor` and `note` are informational (except a `releasePresence` anchor, below). Fixtures: `fixtures/release-switches/` (`app/` is a clean example).
68
69
  - **Minimal inventory and opt-out (#397).** Every release build reads one inventory (`switches.json`, or the file `releaseSwitches.inventory` names); a missing file fails a non-dry-run release. An app with no source switches commits the smallest valid one, and that is its explicit opt-out: `{ "schema": 1, "app": "<name>", "switches": [] }`. The walk then still refuses any environment read the app source makes, so the empty list is a claim the source proves. Names the operating system or Cargo supply are not selectors and need no entry (below).
69
70
  - **OS-provided and Cargo-provided variables (#1045).** The registry's `osProvided` list (`HOME`, `HOMEDRIVE`, `HOMEPATH`, `USERPROFILE`, `APPDATA`, `LOCALAPPDATA`, `PROGRAMDATA`, `ALLUSERSPROFILE`, `PATH`, `PATHEXT`, `SystemRoot`, `SystemDrive`, `windir`, `COMSPEC`, `ProgramFiles`, `ProgramFiles(x86)`, `ProgramW6432`, `TEMP`, `TMP`, `TMPDIR`, `USER`, `USERNAME`, `LOGNAME`, the `XDG_*` base directories) is read by the walk as not-a-switch; an app cannot add to it (that list is a registry change, so a selector cannot be declared "OS provided"), and an app that registers one of these names keeps its entry checked. In a file named `build.rs` the variables Cargo sets for a build script (`OUT_DIR`, `TARGET`, `HOST`, `PROFILE`, `DEBUG`, `OPT_LEVEL`, `NUM_JOBS`, `RUSTC*`, `CARGO_CFG_*`, `CARGO_FEATURE_*`, `DEP_*`, `CARGO_MANIFEST_DIR`, `CARGO_PKG_*`) are exempt as well; `env!`/`option_env!` keep the Cargo-set list.
@@ -5899,7 +5899,14 @@ export async function main(argv, io = {}) {
5899
5899
  const outputWorkspaces = (snapshotBroker ? scanResult.scans.map((r) => r.snapshotEvidence?.outputDir) : Object.values(targetDirs ?? {})).filter(Boolean).map((dir) => [dir]);
5900
5900
  // Each broker row's output folder with its Cargo workspace (repository-relative), so a later stage of the same door run can resolve that workspace's
5901
5901
  // target before its own first Cargo call (a multi-workspace app's package admission, CodeRight on the Mac 0.6.80: RK_SPLIT_TARGET_UNRESOLVED).
5902
- const outputsByCargoDir = snapshotBroker ? scanResult.scans.flatMap((r) => { const unit = unitByName.get(rustUnitOfScanId(r.id, known)); const dir = r.snapshotEvidence?.outputDir; return typeof unit?.cargoDir === "string" && typeof dir === "string" && dir ? [[unit.cargoDir, dir]] : []; }) : [];
5902
+ const ranByCargoDir = snapshotBroker ? scanResult.scans.flatMap((r) => { const unit = unitByName.get(rustUnitOfScanId(r.id, known)); const dir = r.snapshotEvidence?.outputDir; return typeof unit?.cargoDir === "string" && typeof dir === "string" && dir ? [[unit.cargoDir, dir]] : []; }) : [];
5903
+ // rightkit#1800: a compile answered wholly from the cache asked the broker nothing, so no row names the workspace's folder and the package stage's admission
5904
+ // could not resolve its Cargo target (CodeRight on the Mac, 2026-11-26: RK_SPLIT_TARGET_UNRESOLVED after a cached compile). For a workspace none of whose rows
5905
+ // ran, the folder its cached rows' stored signed receipts name is handed on, when it still exists. It is only the first resolution of that stage: its own
5906
+ // build's receipt replaces it (stage-seam.mjs carriedOutputDir), and a folder the broker no longer uses is refused by the split's own target checks.
5907
+ const ranDirs = new Set(ranByCargoDir.map(([cargoDir]) => cargoDir));
5908
+ const cachedByCargoDir = snapshotBroker ? scanResult.scans.flatMap((r) => { const unit = unitByName.get(rustUnitOfScanId(r.id, known)); const dir = r.cachedOutputDir; return r.cached === true && typeof unit?.cargoDir === "string" && !ranDirs.has(unit.cargoDir) && typeof dir === "string" && dir && fs.existsSync(dir) ? [[unit.cargoDir, dir]] : []; }) : [];
5909
+ const outputsByCargoDir = [...ranByCargoDir, ...cachedByCargoDir];
5903
5910
  o.onCompileOutputs?.(outputWorkspaces.map(([dir]) => dir), builtBins, outputsByCargoDir);
5904
5911
  o.out(`${tag} class B keying: ${ROW_DIGEST_STATS.misses} row digest(s) computed in ${(ROW_DIGEST_STATS.ms / 1000).toFixed(1)} s, ${ROW_DIGEST_STATS.hits} reused`);
5905
5912
  if (snapshotBroker) o.out(`${tag} broker compile: ${new Set(scanResult.scans.map((r) => r.snapshotEvidence?.requestId).filter(Boolean)).size} carried request(s) with verified signed receipts (${scanResult.scans.filter((r) => r.snapshotEvidence).length} scan row(s)); no direct receipt on a broker host`);
@@ -75,7 +75,12 @@ const WORKTREE_COMPILES = new Set(["dev", "test", "stage-sidecar", "stage-xcfram
75
75
  // commit's objects plus the door's verified snapshot, never the checkout's HEAD, status or branch (each re-proves it through
76
76
  // assertReleaseSource). `upload` does so for the mobile platforms (the host's store upload); a desktop upload, publish and the signing
77
77
  // commands still read the checkout's HEAD and refuse under a split rather than run on the wrong bytes.
78
- const SPLIT_COMMANDS = new Set(["dev", "test", "stage-sidecar", "stage-xcframework", "web-build", "build", "package", "release", "qa"]);
78
+ // assemble-app and create-mac-updater are steps an app's release config runs INSIDE a split build (targets.<p>.prePackage, package, postSign). They
79
+ // read no HEAD, status or branch: assemble-app works on the snapshot's files, the stage-sidecar receipt and the build number the gate hands down
80
+ // (assembled-app.mjs commitCount, GC-A28), and create-mac-updater resolves its paths through the split artifact context (loadSplitArtifactContext).
81
+ // They were missing here, so every app that assembles its payload with assemble-app was refused at its first package step on a snapshot
82
+ // (Pulse, 2026-11-26: RK_SOURCE_SPLIT_UNSUPPORTED), and a mac target's create-mac-updater post-sign step would have been refused the same way.
83
+ const SPLIT_COMMANDS = new Set(["dev", "test", "stage-sidecar", "stage-xcframework", "web-build", "build", "package", "release", "qa", "assemble-app", "create-mac-updater"]);
79
84
  const MOBILE_UPLOAD = (argv) => argv.some((a, i) => (a === "--platform" && ["ios", "android"].includes(argv[i + 1])) || a === "--platform=ios" || a === "--platform=android");
80
85
  async function requireGreenCheck() {
81
86
  const { guardCommand, checkedCommandOf, checkModeFor, appDirectory } = await import("../app-check.mjs");
@@ -436,8 +441,7 @@ Commands:
436
441
  Enroll one native key or create a signed-device request
437
442
  ownership approve-key <fingerprint|request.json> Approve one pending device key from an active host
438
443
  ownership revoke-key <fingerprint> Revoke one active device key
439
- ownership trust-sync Advance this host's protected trust to the committed key log
440
- ownership trust-sync --check Read-only: say whether a sync would ask for approval, and for what (exit 3 if so)
444
+ ownership trust-sync | trust-refresh Retired: no check needs the host's protected trust refreshed (prints why)
441
445
  ownership trust-compare [--json] Print this host's protected-trust digest (Mac is the reference)
442
446
  ownership-approval Retired no-op: exceptions are plain entries in the repo exceptions file, edited directly and reviewed through git
443
447
  ownership-report --workspace <dir> [--markdown <file>] [--json-out <file>]
@@ -4592,7 +4592,10 @@ export async function runScans(plan, options = {}) {
4592
4592
  // One predicate for every stored pass (usableStoredPass; rightkit#1538): the row's own id and command, written by the invocation that ran it, with
4593
4593
  // the evidence its kind needs; a test group's hit carries each member's own run, so the members are judged exactly as on the run that stored it.
4594
4594
  if (usableStoredPass(hit, s, { cacheKey, viaSeam })) {
4595
- cached = { ...row, status: "pass", cached: true, detail: `cached ${String(hit.at ?? "").slice(0, 10) || "earlier"}`, ...(s.kind === "test" || s.runOutside || s.coverageKey ? { results: hit.row.results } : {}), ...(s.coverageKey ? { snapshotEvidence: hit.row.snapshotEvidence ?? null, testRun: hit.row.testRun ?? null } : s.provesPublisher ? { snapshotEvidence: hit.row.snapshotEvidence ?? null, ...(hit.row.testRun ? { testRun: hit.row.testRun } : {}) } : hit.row.testRun ? { testRun: hit.row.testRun } : {}), ...(hit.row.memberRuns ? { memberRuns: hit.row.memberRuns } : {}), ...(hit.row.executableProof ? { executableProof: hit.row.executableProof } : {}), ...(row.seam ? { seamSettled: true } : {}) };
4595
+ cached = { ...row, status: "pass", cached: true, detail: `cached ${String(hit.at ?? "").slice(0, 10) || "earlier"}`, ...(s.kind === "test" || s.runOutside || s.coverageKey ? { results: hit.row.results } : {}), ...(s.coverageKey ? { snapshotEvidence: hit.row.snapshotEvidence ?? null, testRun: hit.row.testRun ?? null } : s.provesPublisher ? { snapshotEvidence: hit.row.snapshotEvidence ?? null, ...(hit.row.testRun ? { testRun: hit.row.testRun } : {}) } : hit.row.testRun ? { testRun: hit.row.testRun } : {}), ...(hit.row.memberRuns ? { memberRuns: hit.row.memberRuns } : {}), ...(hit.row.executableProof ? { executableProof: hit.row.executableProof } : {}), ...(row.seam ? { seamSettled: true } : {}),
4596
+ // rightkit#1800: the folder the stored row's signed receipt names, kept apart from `snapshotEvidence` (this run asked the broker nothing for
4597
+ // this row). The door uses it only to tell a later stage where this workspace's Cargo target is when no row of the workspace ran.
4598
+ ...(viaSeam && retainedReceiptValid(hit.row.snapshotEvidence) && typeof hit.row.snapshotEvidence.outputDir === "string" && hit.row.snapshotEvidence.outputDir ? { cachedOutputDir: hit.row.snapshotEvidence.outputDir } : {}) };
4596
4599
  }
4597
4600
  // NN41: the same inputs, toolchain and broker runtime already failed this compile deterministically: report that failure, marked cached, without running it.
4598
4601
  const failHit = cached ? null : readRowCache(failKey, admission);
package/gate-serve.mjs CHANGED
@@ -167,6 +167,10 @@ export async function serve({ root, idleMs = Number(process.env.RK_GATE_SERVE_ID
167
167
  lastRequest = Date.now();
168
168
  if (req?.schema !== SCHEMA) return { ok: false, why: "schema" };
169
169
  if (req.identity !== IDENTITY) { setTimeout(() => process.exit(0), 50); return { ok: false, why: "gate code changed; the server exits" }; }
170
+ // `stop`: end this server now, the same way the idle timer ends it. The server of a candidate gate runs from the candidate's own
171
+ // folder, and on Windows that keeps `trusted-gate promote` from renaming the folder (rightkit#1778: "Access is denied" until the
172
+ // process was ended by hand). `node gate-serve.mjs stop` is the supported way to end it before a promote.
173
+ if (req.op === "stop") { setTimeout(() => process.exit(0), 50); return { ok: true, stopping: true, pid: process.pid }; }
170
174
  if (req.op === "status") return { ok: true, healthy, changeSource, root: watchedRoot, proven: [...proven].map(([k, v]) => ({ key: k, tree: v.tree })), pid: process.pid, identity: IDENTITY };
171
175
  // Answers kept for later runs (resident-answers.mjs): an opaque string under a sha256 key. The caller stores each answer with the files it
172
176
  // depends on and checks them itself before it uses one; this process only holds the bytes, in memory, oldest out first.
@@ -415,5 +419,8 @@ if (isServeEntry) {
415
419
  ask(req ?? {}, Number(b) || 3000).then((res) => { process.stdout.write(`${JSON.stringify(res)}\n`, () => process.exit(0)); });
416
420
  } else if (cmd === "status") {
417
421
  ask({ op: "status" }, 3000).then((res) => { console.log(JSON.stringify(res, null, 2)); process.exit(res.ok ? 0 : 1); });
418
- } else { console.error("usage: gate-serve.mjs serve <snapshot-root> | status"); process.exit(2); }
422
+ } else if (cmd === "stop") {
423
+ // Exit 0 when a server answered and is stopping, or when none is listening (nothing to stop).
424
+ ask({ op: "stop" }, 3000).then((res) => { console.log(JSON.stringify(res)); process.exit(res.ok || res.unreachable === true ? 0 : 1); });
425
+ } else { console.error("usage: gate-serve.mjs serve <snapshot-root> | status | stop"); process.exit(2); }
419
426
  }
package/init-command.mjs CHANGED
@@ -256,7 +256,7 @@ export const NEXT_STEPS = Object.freeze([
256
256
  "pnpm install (installs the pinned packages and, through `prepare`, the agent hook; no git hook)",
257
257
  "right-release doctor (the build's own checks for this app, as rows)",
258
258
  "set the app's public legal host in legal-snapshot.config.json, replace legal/PRODUCT_SCHEDULE.md and legal/PRIVACY_NOTICE.md with reviewed text, then `pnpm exec legal-snapshot`",
259
- "register the repository on each host: add it to packages/release/ownership-repositories.json in RightKit (and its byte copy under packages/build-control-policy), then run `right-release ownership trust-refresh` on the Mac and the Dell (a person with administrator rights; an agent cannot)",
259
+ "register the repository on each host: add it to packages/release/ownership-repositories.json in RightKit (and its byte copy under packages/build-control-policy), and release RightKit; the gate reads that shipped list, so no host step and no administrator is needed",
260
260
  "README.md in the template: \"Create a new app (checklist)\"",
261
261
  ]);
262
262
 
@@ -306,7 +306,8 @@ function versionAtLeast(actual, minimum) {
306
306
  // re-pin it, is retired (Adrian, decisions.md), so no check refuses on a missing or stale pinned bundle.
307
307
  export const TRUST_SYNC_RETIRED = "right-release ownership trust-sync is retired: no release, ownership or QA check needs a human-approved policy bundle any more. The bundle is still fingerprinted; `right-release ownership trust-compare` reports drift as a warning with a semantic diff.";
308
308
 
309
- export const POLICY_BUNDLE_DRIFT_WARNING = "ownership policy bundle (scanner source, catalog, registry or dependency allowlist) differs from the bundle pinned in protected trust (warning only; trust-sync is retired)";
309
+ export const TRUST_REFRESH_RETIRED = "right-release ownership trust-refresh is retired, like trust-sync: nothing needs an administrator or a refreshed host trust file. A repository registration or a dependency allowlist entry the host's protected copy lacks is read from the lists this gate ships (ownership-repositories.json, ownership-dependency-allowlist.json); add it there and release RightKit.";
310
+ export const POLICY_BUNDLE_DRIFT_WARNING ="ownership policy bundle (scanner source, catalog, registry or dependency allowlist) differs from the bundle pinned in protected trust (warning only; trust-sync is retired)";
310
311
  export const CATALOG_DIGEST_DRIFT_WARNING = "ownership catalog digest differs from the digest pinned in protected trust (warning only; the catalog version still meets the protected minimum; trust-sync is retired)";
311
312
  export function validateOwnershipFloor(trust, { scannerVersion, catalogVersion, catalogDigest, policyBundleDigest } = {}) {
312
313
  const problems = [];
@@ -20,7 +20,7 @@ import { spawnSync } from "./background-process.mjs";
20
20
  import { main as stagedMain } from "./ownership-staged.mjs";
21
21
  import { loadTrustedExternal } from "./ownership-approval.mjs";
22
22
  import { diffPolicyBundles, runningPolicyBundle, trustComparison } from "./ownership-policy-bundle.mjs";
23
- import { POLICY_BUNDLE_DRIFT_WARNING, TRUST_SYNC_RETIRED } from "./ownership-approval.mjs";
23
+ import { POLICY_BUNDLE_DRIFT_WARNING, TRUST_REFRESH_RETIRED, TRUST_SYNC_RETIRED } from "./ownership-approval.mjs";
24
24
  import { isBlockingFinding } from "./ownership-verdict.mjs";
25
25
 
26
26
  const packageRoot = path.dirname(fileURLToPath(import.meta.url));
@@ -76,7 +76,10 @@ export async function main(args, { evidenceFactory = createOwnershipEvidence, gi
76
76
  if (args[0] === "trust-compare") return trustCompare(args, { print, trustLoader });
77
77
  if (args.includes("--staged")) return stagedMain(args, { print });
78
78
  if (args[0] === "trust-sync") { print(`[right-release] ${TRUST_SYNC_RETIRED}`); return 0; }
79
- if (["enroll", "approve-key", "revoke-key", "trust-refresh"].includes(args[0])) {
79
+ // Retired with trust-sync: no check needs the host's protected copy refreshed. A repository or an allowlist entry the host copy
80
+ // lacks is taken from the lists this gate ships. It exits 2 so nobody is sent to an administrator step again (2026-11-26).
81
+ if (args[0] === "trust-refresh") { print(`[right-release] ${TRUST_REFRESH_RETIRED}`); return 2; }
82
+ if (["enroll", "approve-key", "revoke-key"].includes(args[0])) {
80
83
  const { main: keyMain } = await import("./ownership-key-command.mjs");
81
84
  return keyMain(args, { runner: gitRunner, print });
82
85
  }
@@ -5,7 +5,7 @@ import os from "node:os";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { spawnSync, spawnSyncInteractive, windowsPowerShellEnvironment } from "./background-process.mjs";
7
7
  import { createKeyEvent, keyFingerprint, verifyKeyLog, verifyKeyRequest } from "./ownership-key-log.mjs";
8
- import { canonicalRepositoryIdentity, DEFAULT_TRUST_PATH, TRUST_SYNC_RETIRED, loadTrustedExternal, resolveKeyLogTrust, __testOnly as approvalTestOnly } from "./ownership-approval.mjs";
8
+ import { canonicalRepositoryIdentity, DEFAULT_TRUST_PATH, TRUST_REFRESH_RETIRED, TRUST_SYNC_RETIRED, loadTrustedExternal, resolveKeyLogTrust, __testOnly as approvalTestOnly } from "./ownership-approval.mjs";
9
9
  import { readCommittedKeyAuthority } from "./ownership-key-authority.mjs";
10
10
  import { buildMacInvocation, hasTerminal } from "./ownership-key-elevation.mjs";
11
11
  import { mergeRepositoriesFromInstalledRelease, prepareTrustUpdate, REPOSITORY_REGISTRY_MALFORMED_CODE } from "./ownership-key-trust.mjs";
@@ -355,6 +355,7 @@ export async function main(args, deps = {}) {
355
355
  const app = path.resolve(flag(args, "--app") ?? process.cwd());
356
356
  const root = deps.root ?? repoRoot(app, run);
357
357
  if (args[0] === "trust-sync") { print(`[right-release] ${TRUST_SYNC_RETIRED}`); return 0; }
358
+ if (args[0] === "trust-refresh") { print(`[right-release] ${TRUST_REFRESH_RETIRED}`); return 2; }
358
359
  try {
359
360
  if (!platform) throw new Error(`ownership key management unsupported platform: ${process.platform}`);
360
361
  const refresh = args[0] === "trust-refresh";
package/ownership.mjs CHANGED
@@ -695,12 +695,26 @@ function shippedAllowlist() {
695
695
  * Which allowlist applies and how hard. The protected trust copy governs every repository
696
696
  * registered in trust and blocks. When no trust copy applies, or while approval enrollment is pending, the shipped proposal
697
697
  * is advisory and only for repositories it has a baseline for.
698
+ *
699
+ * The host's protected copy cannot be refreshed (trust-sync is retired), so an entry RightKit admitted after that copy was written
700
+ * was refused on that host for good (CodeRight, cargo:image and cargo:mdns-sd, admitted in rightkit#1752, refused on the Mac). The
701
+ * list a registered repository is judged against is therefore the union of the host copy and the list this gate ships: every
702
+ * entry either one admits is admitted. Nothing the host copy admits is lost, and the tier rules are unchanged.
698
703
  */
704
+ export function mergedAllowlist(host, shipped) {
705
+ if (!shipped) return host;
706
+ const union = (a = [], b = []) => [...new Set([...a, ...b])];
707
+ const byIdentity = new Map();
708
+ for (const entry of [...(host.repositories ?? []), ...(shipped.repositories ?? [])]) {
709
+ byIdentity.set(entry.repositoryIdentity, union(byIdentity.get(entry.repositoryIdentity), entry.dependencies));
710
+ }
711
+ return { schema: 1, global: union(host.global, shipped.global), repositories: [...byIdentity].map(([repositoryIdentity, dependencies]) => ({ repositoryIdentity, dependencies })) };
712
+ }
699
713
  export function dependencyAllowlistPolicy(trust, repositoryIdentity, { pending = false, shipped } = {}) {
700
714
  if (!repositoryIdentity) return null;
701
715
  const trusted = trust?.dependencyAllowlist && validateAllowlist(trust.dependencyAllowlist).ok ? trust.dependencyAllowlist : null;
702
- if (trusted && trust.repositories?.some((entry) => entry.repositoryIdentity === repositoryIdentity)) return { allowlist: trusted, tier: pending ? "advise" : "block", source: "protected-trust" };
703
716
  const proposal = shipped === undefined ? shippedAllowlist() : shipped;
717
+ if (trusted && trust.repositories?.some((entry) => entry.repositoryIdentity === repositoryIdentity)) return { allowlist: mergedAllowlist(trusted, proposal), tier: pending ? "advise" : "block", source: proposal ? "protected-trust+shipped" : "protected-trust" };
704
718
  if (proposal?.repositories?.some((entry) => entry.repositoryIdentity === repositoryIdentity)) return { allowlist: proposal, tier: "advise", source: "shipped-proposal" };
705
719
  return null;
706
720
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.86",
3
+ "version": "0.6.88",
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",
@@ -94,7 +94,7 @@ export function toolCommand(command, args, platform = process.platform, comspec
94
94
  return [command, args];
95
95
  }
96
96
 
97
- export function publishLocalNpm(argv, { run = spawnSync, log = console.log, platform = process.platform, readToken = () => readKeychainToken(run), npmrc = accountNpmrc, exists = fs.existsSync, verifyTries = 20, verifyDelaySeconds = 15 } = {}) {
97
+ export function publishLocalNpm(argv, { run = spawnSync, log = console.log, platform = process.platform, readToken = () => readKeychainToken(run), npmrc = accountNpmrc, exists = fs.existsSync, verifyTries = 60, verifyDelaySeconds = 15 } = {}) {
98
98
  const o = parseArgs(argv);
99
99
  if (platform !== "darwin" && platform !== "win32") fail(`publish-local npm runs on the Mac (the token is the Keychain item ${NPM_KEYCHAIN_SERVICE}) or Windows (the account's own npm sign-in); this host is ${platform}`);
100
100
  const userNpmrc = platform === "win32" ? npmrc() : null;
package/qa-contract.mjs CHANGED
@@ -78,7 +78,9 @@ const NPM_QA = "@rightkit/qa";
78
78
  const NPM_QA_CHROME = "@rightkit/qa-chrome";
79
79
  const CARGO_QA = "rightkit-qa";
80
80
  const NPM_SECTIONS = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
81
- const SKIP_DIRS = /^(node_modules(\..*)?|target|vendor|dist|build|\.git|\.cache|\.right-release)$/;
81
+ // `.build` is SwiftPM's build folder: its `checkouts/` hold the package.json files of fetched dependencies (a RightKit checkout among them), which are
82
+ // not the app's manifests. CodeRight's doctor read one there and refused the app's QA adoption (2026-11-26).
83
+ const SKIP_DIRS = /^(node_modules(\..*)?|target|vendor|dist|build|\.build|\.git|\.cache|\.right-release)$/;
82
84
  const MAX_DEPTH = 6;
83
85
  const EXEMPTION_KINDS = ["library", "tooling"];
84
86
 
@@ -194,6 +194,7 @@ export async function runQa({ stage, platform, releaseIdArg, configPath, deps =
194
194
  });
195
195
  }
196
196
  let run, journeysRun = null;
197
+ let evidenceFile = null, evidence = null, evidenceSha256 = null;
197
198
  try {
198
199
  const expand = (value) => String(value).replaceAll("{sealedDir}", sealed?.sealedDir ?? "").replaceAll("{releaseId}", releaseId)
199
200
  .replaceAll("{installedApp}", installedQa?.installedApp ?? "").replaceAll("{installedDir}", installedQa?.installedDir ?? "").replaceAll("{qaRoot}", installedQa?.qaRoot ?? "");
@@ -219,6 +220,14 @@ export async function runQa({ stage, platform, releaseIdArg, configPath, deps =
219
220
  cwd: runCwd, encoding: "utf8", windowsHide: true, maxBuffer: 64 * 1024 * 1024,
220
221
  env: runEnv,
221
222
  });
223
+ // Read the run's evidence now: the journeys run that follows can remove this run's folder (HeardRight 0.1.237, 2026-11-26: the
224
+ // floor read `smoke.launch: missing` after `[qa] PASS app.launch`, because the evidence file was gone by the time it was read).
225
+ evidenceFile = evidencePathFromOutput(run.stdout);
226
+ if (evidenceFile && existsSync(evidenceFile)) {
227
+ const bytes = readFileSync(evidenceFile);
228
+ evidenceSha256 = createHash("sha256").update(bytes).digest("hex");
229
+ evidence = JSON.parse(bytes.toString("utf8"));
230
+ }
222
231
  // Journeys lane: the one release proof (ADR-0001 item 10). A receipt named in the config is read as is.
223
232
  if (journeysConfig && !journeysConfig.receipt) {
224
233
  journeysRun = (deps.spawnJourneys ?? deps.spawnRunner ?? spawnSync)(runnerFile, ["journeys", "run", "--root", runCwd, ...((journeysConfig.args?.[stage] ?? []).map(expand))], {
@@ -229,13 +238,6 @@ export async function runQa({ stage, platform, releaseIdArg, configPath, deps =
229
238
  installedQa?.cleanup();
230
239
  }
231
240
  if (!deps.quiet) { process.stdout.write(String(run.stdout ?? "")); process.stderr.write(String(run.stderr ?? "")); }
232
- const evidenceFile = evidencePathFromOutput(run.stdout);
233
- let evidence = null, evidenceSha256 = null;
234
- if (evidenceFile && existsSync(evidenceFile)) {
235
- const bytes = readFileSync(evidenceFile);
236
- evidenceSha256 = createHash("sha256").update(bytes).digest("hex");
237
- evidence = JSON.parse(bytes.toString("utf8"));
238
- }
239
241
  // The runner binary that produced the evidence is the one that was digested; a swap during the run is refused.
240
242
  if (sha256File(runnerFile) !== runnerSha) throw new Error("the rightkit-qa runner changed while QA was running; refusing to seal");
241
243
  let journeys = null;
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "journeys": {
9
9
  "floorId": "journey",
10
- "receiptSchema": "rightkit.journeys.receipt/1",
10
+ "receiptSchema": "rightkit.journeys.receipt/2",
11
11
  "rule": "all-release-critical-passed"
12
12
  }
13
13
  }
@@ -25,7 +25,10 @@ import { spawnSync } from "./background-process.mjs";
25
25
  import { approvedRunnerDigests } from "./release-qa-policy.mjs";
26
26
  import { QaAdmissionError, qaCommandFor } from "./release-qa-receipt.mjs";
27
27
 
28
- export const JOURNEYS_RECEIPT_SCHEMA = "rightkit.journeys.receipt/1";
28
+ // The runner writes rightkit.journeys.receipt/2 since rightkit-qa 0.10; /1 is still read from an older runner. Every field this file
29
+ // reads has the same name and meaning in both; the runner's own `journeys validate-receipt` re-checks the rest for its schema.
30
+ export const JOURNEYS_RECEIPT_SCHEMA = "rightkit.journeys.receipt/2";
31
+ export const JOURNEYS_RECEIPT_SCHEMAS = Object.freeze(new Set(["rightkit.journeys.receipt/1", JOURNEYS_RECEIPT_SCHEMA]));
29
32
  export const PLATFORM_OS = Object.freeze({ mac: "macos", win: "windows" });
30
33
  export const QA_RUN_ENV = "RIGHT_RELEASE_QA_STAGE";
31
34
  const CLOCK_SKEW_MS = 60_000;
@@ -55,7 +58,7 @@ export function validateJourneysReceipt({ runnerFile, runnerSha256, receiptFile,
55
58
  try { manifestBytes = readFileSync(manifestFile); }
56
59
  catch (error) { return { ok: false, problems: [`journeys manifest is unreadable (${manifestFile}): ${error.message}`], block: null }; }
57
60
  const os = PLATFORM_OS[platform];
58
- if (receipt.schema !== JOURNEYS_RECEIPT_SCHEMA) problems.push(`journeys receipt schema is ${JSON.stringify(receipt.schema)}, expected ${JOURNEYS_RECEIPT_SCHEMA}`);
61
+ if (!JOURNEYS_RECEIPT_SCHEMAS.has(receipt.schema)) problems.push(`journeys receipt schema is ${JSON.stringify(receipt.schema)}, expected one of ${[...JOURNEYS_RECEIPT_SCHEMAS].join(", ")}`);
59
62
  if (receipt.runner !== "rightkit-qa") problems.push("journeys receipt was not produced by the rightkit-qa runner");
60
63
  if (receipt.host?.os !== os) problems.push(`journeys receipt ran on ${receipt.host?.os}, this release is ${os}`);
61
64
  if (receipt.selection?.platform !== os) problems.push(`journeys receipt selected platform ${receipt.selection?.platform}, this release is ${os}`);
@@ -82,7 +85,7 @@ export function validateJourneysReceipt({ runnerFile, runnerSha256, receiptFile,
82
85
  else if (journey.release_critical !== true) problems.push(`release-critical journey ${id} is not marked release_critical in the receipt`);
83
86
  }
84
87
  const block = {
85
- schema: JOURNEYS_RECEIPT_SCHEMA, receiptSha256: sha256Of(bytes), runId: String(receipt.run_id ?? ""), verdict: String(receipt.verdict ?? ""),
88
+ schema: JOURNEYS_RECEIPT_SCHEMAS.has(receipt.schema) ? receipt.schema : JOURNEYS_RECEIPT_SCHEMA, receiptSha256: sha256Of(bytes), runId: String(receipt.run_id ?? ""), verdict: String(receipt.verdict ?? ""),
86
89
  hostOs: String(receipt.host?.os ?? ""), selectionPlatform: String(receipt.selection?.platform ?? ""), tree: String(receipt.source?.tree ?? ""),
87
90
  startedAt: String(receipt.started_at ?? ""), endedAt: String(receipt.ended_at ?? ""), runnerVersion: String(receipt.runner_version ?? ""),
88
91
  validator: { runnerSha256, exitCode: run?.status ?? null, accepted },
@@ -137,7 +140,7 @@ export function hardenQaReceipt({
137
140
  const journeys = receipt.journeys;
138
141
  if (!journeys) refuse("receipt carries no journeys receipt block; run `rightkit-qa journeys run` through `right-release qa` (qa.journeys in the release config)");
139
142
  const os = PLATFORM_OS[platform];
140
- if (journeys.schema !== mapping.receiptSchema) refuse(`journeys receipt schema is ${journeys.schema}`);
143
+ if (!JOURNEYS_RECEIPT_SCHEMAS.has(journeys.schema)) refuse(`journeys receipt schema is ${journeys.schema}`);
141
144
  if (journeys.verdict !== "passed" || journeys.validator?.accepted !== true || journeys.validator?.exitCode !== 0) refuse("the journeys receipt was not accepted by rightkit-qa journeys validate-receipt");
142
145
  if (journeys.validator?.runnerSha256 !== receipt.runner?.sha256) refuse("the journeys receipt was validated by a different runner than the one pinned");
143
146
  if (journeys.hostOs !== os || journeys.selectionPlatform !== os) refuse(`journeys receipt is for ${journeys.hostOs}/${journeys.selectionPlatform}, this is ${os}`);
@@ -76,7 +76,7 @@ export function validateQaFloor(floor) {
76
76
  if (!journeys || typeof journeys !== "object" || Array.isArray(journeys)) problems.push("floor journeys must be an object");
77
77
  else {
78
78
  if (typeof journeys.floorId !== "string" || !QA_STAGES.every((stage) => floor.stages?.[stage]?.required?.includes?.(journeys.floorId))) problems.push("floor journeys.floorId must be a required id of every stage");
79
- if (journeys.receiptSchema !== "rightkit.journeys.receipt/1") problems.push("floor journeys.receiptSchema must be rightkit.journeys.receipt/1");
79
+ if (!["rightkit.journeys.receipt/1", "rightkit.journeys.receipt/2"].includes(journeys.receiptSchema)) problems.push("floor journeys.receiptSchema must be rightkit.journeys.receipt/1 or /2");
80
80
  if (journeys.rule !== "all-release-critical-passed") problems.push("floor journeys.rule must be all-release-critical-passed");
81
81
  }
82
82
  }
@@ -66,7 +66,13 @@ import { WIN_PACKAGE_DEFAULT_TRIPLE } from "./win-package-recipe.mjs";
66
66
  export const TEST_MODE_MARKER = "RIGHTKIT-TEST-MODE-COMPILED"; // identical to `TEST_MODE_MARKER_TEXT` in rightkit-daemon/src/mode.rs
67
67
  const CHUNK = 4 * 1024 * 1024;
68
68
  const FORBIDDEN_CLASSES = new Set(["S1", "S2", "S3", "S4"]);
69
- const CLASSES = new Set(["S1", "S2", "S3", "S4", "S5", "S6"]);
69
+ const CLASSES = new Set(["S1", "S2", "S3", "S4", "S5", "S6", "S7"]);
70
+ // S7, a handoff: a one-time value (a token, a nonce) the app's own code sets on a child process it starts, which the child reads and
71
+ // removes. It selects no test mode, data root, executable, library or identity (M23 names those), so it is not compiled out; both ends
72
+ // are checked in source instead (handoffFindings): the line that sets it on the child and the line that removes it after the read.
73
+ const ANCHOR = /^[^:\s][^:]*:[1-9][0-9]*$/;
74
+ const HANDOFF_SET = /(?:\.envs?\s*\(|\bset_var\s*\(|\bsetenv\s*\(|\benvironment\s*\[|\benv\w*\s*\.\s*insert\s*\()/;
75
+ const HANDOFF_CLEAR = /(?:\benv_remove\s*\(|\bremove_var\s*\(|\bunsetenv\s*\(|\bremoveValue\s*\()/;
70
76
  const CHANNELS = new Set(["env", "argv", "settings", "preference", "frontend"]);
71
77
  // `swift:<CONDITION>`: the read sits inside `#if <CONDITION>`, a Swift compilation condition the Release build does not define
72
78
  // (`DEBUG`, or the app's own, e.g. `PULSE_QA`); the source walk confirms the enclosure and the project's Release settings.
@@ -337,7 +343,7 @@ export function parseInventory(text, label = "switches.json") {
337
343
  if (typeof entry?.name !== "string" || !entry.name) { bad("every switch needs a `name`"); continue; }
338
344
  if (names.has(entry.name)) bad(`${where} is listed twice`);
339
345
  names.add(entry.name);
340
- if (!CLASSES.has(entry.class)) bad(`${where}: \`class\` must be one of S1..S6`);
346
+ if (!CLASSES.has(entry.class)) bad(`${where}: \`class\` must be one of S1..S7`);
341
347
  if (!CHANNELS.has(entry.channel)) bad(`${where}: \`channel\` must be one of ${[...CHANNELS].join(", ")}`);
342
348
  if (FORBIDDEN_CLASSES.has(entry.class)) {
343
349
  if (typeof entry.compiledOut !== "string" || !COMPILED_OUT.test(entry.compiledOut)) {
@@ -355,6 +361,12 @@ export function parseInventory(text, label = "switches.json") {
355
361
  }
356
362
  } else if (entry.class === "S6") {
357
363
  if (!["bool", "int", "enum"].includes(entry.valueType)) bad(`${where}: class S6 needs a bounded \`valueType\` (bool, int or enum)`);
364
+ } else if (entry.class === "S7") {
365
+ if (entry.channel !== "env") bad(`${where}: class S7 is a value handed to a child process in its environment; \`channel\` must be env`);
366
+ const handoff = entry.handoff;
367
+ if (!handoff || typeof handoff !== "object" || Array.isArray(handoff) || !ANCHOR.test(handoff.setBy ?? "") || !ANCHOR.test(handoff.clearedAt ?? "")) {
368
+ bad(`${where}: class S7 needs \`handoff\`: { setBy: "<path>:<line>", clearedAt: "<path>:<line>" } (where the app sets it on its child, and where the child removes it after reading)`);
369
+ }
358
370
  } else if (entry.class === "S5") {
359
371
  if (entry.userGesture !== true) bad(`${where}: class S5 needs \`userGesture: true\` (chosen by a picker, saved preference or the user's own argument)`);
360
372
  }
@@ -588,6 +600,7 @@ export function sourceSwitchFindings({ sourceRoot, sourceRoots, inventoryText, i
588
600
  if (swift) swiftConditions.add(swift[1]);
589
601
  }
590
602
  findings.push(...swiftReleaseConditionFindings(walkRoots, skipAbs, sourceRoot, swiftConditions));
603
+ findings.push(...handoffFindings(doc, sourceRoot, inventoryLabel));
591
604
  return findings;
592
605
  }
593
606
 
@@ -599,6 +612,61 @@ const ownerNameMatches = (pattern, name) => (pattern.endsWith("*") ? name.starts
599
612
  const treeHasCrate = (treeText, crate) => typeof treeText === "string" && new RegExp(`(^|[^A-Za-z0-9_-])${escapeRegExp(crate)} v[0-9]`, "m").test(treeText);
600
613
  const PRESENCE_CALL = { scrub: /(?:env_remove|remove_var|env_clear|scrub\w*|clear\w*|retain)/, clear: /(?:env_remove|remove_var|env_clear|scrub\w*|clear\w*|retain)/, set: /(?:set_var|\.envs?\s*\(|\bset\w*\s*\()/ };
601
614
 
615
+ // Does `<path>:<line>` under the source root show the literal name beside a call matching `call` (two lines either side)? null when it does.
616
+ function anchorCallProblem(sourceRoot, name, anchor, call, what, alias = null) {
617
+ if (!sourceRoot) return "has no source root to read its anchor from";
618
+ const [rel, line] = [anchor.slice(0, anchor.lastIndexOf(":")), Number(anchor.slice(anchor.lastIndexOf(":") + 1))];
619
+ const base = path.resolve(sourceRoot);
620
+ const abs = path.resolve(base, rel);
621
+ if (!within(base, abs)) return `anchor ${anchor} escapes the app root`;
622
+ let lines;
623
+ try { lines = readFileSync(abs, "utf8").split(/\r?\n/); } catch { return `anchor ${anchor}: the file does not exist`; }
624
+ if (line > lines.length) return `anchor ${anchor}: the file has only ${lines.length} lines`;
625
+ const window = lines.slice(Math.max(0, line - 3), line + 2).join("\n");
626
+ const named = window.includes(`"${name}"`) || (alias && new RegExp(`\\b${alias}\\b`).test(window));
627
+ if (!named) return `anchor ${anchor} does not show the literal "${name}"${alias ? ` or its constant ${alias}` : ""} within two lines`;
628
+ if (!call.test(window)) return `anchor ${anchor} shows the name but no ${what} (${call.source})`;
629
+ return null;
630
+ }
631
+
632
+ // The identifier a `<path>:<line>` line declares as a constant equal to "name" (`const X: &str = "name";`, `static`, `let`), or null.
633
+ function constantNamed(sourceRoot, anchor, name) {
634
+ if (!sourceRoot) return null;
635
+ const [rel, line] = [anchor.slice(0, anchor.lastIndexOf(":")), Number(anchor.slice(anchor.lastIndexOf(":") + 1))];
636
+ const base = path.resolve(sourceRoot);
637
+ const abs = path.resolve(base, rel);
638
+ if (!within(base, abs)) return null;
639
+ let text;
640
+ try { text = readFileSync(abs, "utf8").split(/\r?\n/)[line - 1] ?? ""; } catch { return null; }
641
+ const m = /\b(?:const|static|let)\s+([A-Za-z_][A-Za-z0-9_]*)\b[^=]*=\s*"([^"]*)"/.exec(text);
642
+ return m && m[2] === name ? m[1] : null;
643
+ }
644
+
645
+ /**
646
+ * Class S7 (handoff): both ends of each entry are read from source. `handoff.setBy` must show the app setting the name on a child
647
+ * process, and `handoff.clearedAt` must show the name being removed from the environment (the reader clears it once read). An entry
648
+ * whose anchors do not show that is `inventory-invalid`: the name is then an ordinary runtime read with no class.
649
+ */
650
+ export function handoffFindings(doc, sourceRoot, inventoryLabel = "switches.json") {
651
+ const findings = [];
652
+ for (const entry of doc?.switches ?? []) {
653
+ if (entry?.class !== "S7" || !ANCHOR.test(entry.handoff?.setBy ?? "") || !ANCHOR.test(entry.handoff?.clearedAt ?? "")) continue;
654
+ // `handoff.nameConst` (optional): the line declaring the constant the code uses for the name (`const X: &str = "NAME";`). When it
655
+ // is given and shows that, the two ends may name the constant instead of the literal.
656
+ let alias = null;
657
+ if (entry.handoff.nameConst !== undefined) {
658
+ const declared = ANCHOR.test(entry.handoff.nameConst ?? "") ? constantNamed(sourceRoot, entry.handoff.nameConst, entry.name) : null;
659
+ if (!declared) { findings.push({ layer: "inventory", rule: "inventory-invalid", file: inventoryLabel, reason: `inventory-invalid: switch \`${entry.name}\` (class S7 handoff): handoff.nameConst ${entry.handoff.nameConst} does not declare a constant equal to "${entry.name}"` }); continue; }
660
+ alias = declared;
661
+ }
662
+ for (const [anchor, call, what] of [[entry.handoff.setBy, HANDOFF_SET, "call that sets it on a child process"], [entry.handoff.clearedAt, HANDOFF_CLEAR, "call that removes it from the environment"]]) {
663
+ const problem = anchorCallProblem(sourceRoot, entry.name, anchor, call, what, alias);
664
+ if (problem) findings.push({ layer: "inventory", rule: "inventory-invalid", file: inventoryLabel, reason: `inventory-invalid: switch \`${entry.name}\` (class S7 handoff): ${problem}` });
665
+ }
666
+ }
667
+ return findings;
668
+ }
669
+
602
670
  // Does the app anchor `<path>:<line>` show the name inside a call of the claimed mechanism (a window of two lines either side)?
603
671
  function presenceAnchorProblem(sourceRoot, entry) {
604
672
  const presence = entry.releasePresence;
package/release.mjs CHANGED
@@ -67,6 +67,7 @@ import { runIosPackageRecipe } from "./ios-package-recipe.mjs";
67
67
  import { releaseSwitchInputs } from "./ios-build-context.mjs";
68
68
  import { productionBuildEnv, productionModeProblems } from "./production-mode.mjs";
69
69
  import { evaluatePrebuildGates } from "./prebuild-gates.mjs";
70
+ import { UNBOUND_ADVICE_CHECKS, UNBOUND_ADVICE_GATES, unboundRepository } from "./unbound-repository.mjs";
70
71
  import { defaultReleaseConfigFile, importReleaseConfig, releaseConfigFieldProblems } from "./release-config.mjs";
71
72
  import { describeRegistryError, formatNotRun, runAdmission } from "./admission.mjs";
72
73
  import { sccacheRefusal } from "./admission-host.mjs";
@@ -166,7 +167,15 @@ const failedChecks = new Set();
166
167
  // their id before the text. The doctor does, as it does for every admission row: `right-release: <row>: <text>`, the text the
167
168
  // build's controller prints after `right-release build: <row>: `.
168
169
  const DOCTOR_OWNED_ROWS = new Set(["rightkit-registry", "build-inputs", "dirty-inputs"]);
170
+ // The list entry when this release is for a repository RightKit does not bind (unbound-repository.mjs), else null. Read once, on first use.
171
+ let unboundMemo;
172
+ function unbound() {
173
+ if (unboundMemo === undefined) unboundMemo = unboundRepository({ root, source: workerSource });
174
+ return unboundMemo;
175
+ }
176
+ const adviceLine = (name, detail) => `right-release: ADVICE ${name} (this repository is not bound by RightKit's app contract; nothing is refused): ${detail}`;
169
177
  function reject(name, detail) {
178
+ if (UNBOUND_ADVICE_CHECKS.has(name) && unbound()) { console.error(adviceLine(name, detail)); return; }
170
179
  failedChecks.add(name);
171
180
  problems.push({ name, detail: opts.doctor && DOCTOR_OWNED_ROWS.has(name) ? `${name}: ${detail}` : detail });
172
181
  }
@@ -620,6 +629,11 @@ if (opts.doctor) {
620
629
  ? [{ name: "prebuild-gates", detail: `BLOCKED by ${blocker}` }]
621
630
  : evaluatePrebuildGates({ root, config, target, platform: opts.platform, iosSpec, nativeIos, nativeAssembly, nativeFinalizer, strict: !opts.dryRun }).findings;
622
631
  }
632
+ // The same rule as the build: the release-switch inventory gates are advice for an unbound repository.
633
+ if (unbound()) {
634
+ for (const finding of gateFindings.filter((entry) => UNBOUND_ADVICE_GATES.has(entry.name))) console.error(adviceLine(`gate ${finding.name}`, finding.detail));
635
+ gateFindings = gateFindings.filter((entry) => !UNBOUND_ADVICE_GATES.has(entry.name));
636
+ }
623
637
  const configProblems = problems.length;
624
638
  // The config findings (stderr, as every early refusal always was) and the gate rows (stdout) of this one run.
625
639
  printProblems();
@@ -643,9 +657,13 @@ let prePackScanned = false; // set once a pre-pack payload scan has seen a nativ
643
657
  // prebuild-gates.mjs so `doctor --gates` runs the exact same code in the same order. They read the expanded target (and the
644
658
  // iOS spec), so a failed one of those blocks them.
645
659
  const prebuildBlocker = ["target", ...(opts.platform === "ios" ? ["ios-target"] : [])].find((name) => failedChecks.has(name));
646
- const { findings: prebuildFindings, devtoolsAllowance, inventoryText: releaseSwitchInventoryText, presenceAccepted: releasePresenceAccepted } = prebuildBlocker
660
+ const { findings: allPrebuildFindings, devtoolsAllowance, inventoryText: releaseSwitchInventoryText, presenceAccepted: releasePresenceAccepted } = prebuildBlocker
647
661
  ? { findings: [{ name: "prebuild-gates", detail: `BLOCKED by ${prebuildBlocker}` }], devtoolsAllowance: { mode: "denied" }, inventoryText: null }
648
662
  : evaluatePrebuildGates({ root, config, target, platform: opts.platform, iosSpec, nativeIos, nativeAssembly, nativeFinalizer, strict: !opts.dryRun });
663
+ // The release-switch inventory gates are advice for an unbound repository; every other prebuild gate still refuses.
664
+ const prebuildAdvice = unbound() ? allPrebuildFindings.filter((finding) => UNBOUND_ADVICE_GATES.has(finding.name)) : [];
665
+ const prebuildFindings = allPrebuildFindings.filter((finding) => !prebuildAdvice.includes(finding));
666
+ for (const finding of prebuildAdvice) console.error(adviceLine(`gate ${finding.name}`, finding.detail));
649
667
  if (problems.length || prebuildFindings.length) {
650
668
  printProblems();
651
669
  for (const finding of prebuildFindings) console.error(`right-release: ${finding.detail.startsWith("BLOCKED by ") ? `gate ${finding.name}: ` : ""}${finding.detail}`);
@@ -869,6 +887,13 @@ if (opts.platform === "win" && target.signingContract === WINDOWS_NSIS_SIGNING_C
869
887
  if (updaterFiles.length) await run("node", [SIGN_UPDATER, ...(opts.dryRun ? ["--dry-run"] : []), ...updaterFiles.flatMap((file) => ["--file", file])], root);
870
888
  }
871
889
 
890
+ // The portable contract signs every executable before packaging (sign.prePackageFiles) and has no installer-signing block above, so its
891
+ // declared postSign steps were never run on Windows: the line below this one excludes win, and only the NSIS and payload blocks run them.
892
+ // An app that declares post-sign checks under this contract (Pulse: verify-staged and its candidate checks) had them skipped without a word.
893
+ if (opts.platform === "win" && target.signingContract === WINDOWS_PORTABLE_SIGNING_CONTRACT && target.postSign) {
894
+ await runCommands(target.postSign, root);
895
+ }
896
+
872
897
  if (target.postSign && opts.platform !== "win" && (opts.platform !== "mac" || runMacPhase("post-sign"))) {
873
898
  await runCommands(target.postSign, root);
874
899
  }
@@ -941,7 +966,10 @@ function assertNoQaControlBinaries(label, files, { requireBinary = false, prePac
941
966
  try {
942
967
  const stats = assertNoQaControl(files, label, { requireBinary, allowContentOnlyDevtools: devtoolsAllowance.mode === "content-only" });
943
968
  // D4 binary layer, same inputs: no test-mode marker and no S1-S4 selector name in any native binary.
944
- assertNoReleaseSwitches({ binaryPaths: files, devtools: devtoolsAllowance, inventoryText: releaseSwitchInventoryText ?? undefined, appForbid: config.releaseSwitches?.forbid ?? [], requireBinary: false, presenceAccepted: releasePresenceAccepted ?? [] }, `${label} (release switches)`);
969
+ // An unbound repository's own inventory is advice (unbound-repository.mjs), so its declared names are not denied in its binaries;
970
+ // the test-mode marker and the registry's own deny names are still refused.
971
+ const unboundHere = unbound();
972
+ assertNoReleaseSwitches({ binaryPaths: files, devtools: devtoolsAllowance, inventoryText: unboundHere ? undefined : releaseSwitchInventoryText ?? undefined, appForbid: unboundHere ? [] : config.releaseSwitches?.forbid ?? [], requireBinary: false, presenceAccepted: releasePresenceAccepted ?? [] }, `${label} (release switches)`);
945
973
  if (prePack && stats.binaries > 0) prePackScanned = true;
946
974
  for (const opaque of stats.opaque) {
947
975
  console.log(`right-release: ${label}: ${opaque.kind.toUpperCase()} payload is compressed and cannot be scanned (${opaque.file}); the raw payload was scanned before packing`);
@@ -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.86",
52
+ "@rightkit/release": "0.6.88",
53
53
  "@rightkit/send-ui": "0.1.0",
54
54
  "@rightkit/settings-ui": "0.7.7",
55
55
  "@rightkit/social-ui": "0.2.1",
@@ -451,7 +451,9 @@
451
451
  "0.6.82",
452
452
  "0.6.83",
453
453
  "0.6.84",
454
- "0.6.85"
454
+ "0.6.85",
455
+ "0.6.86",
456
+ "0.6.87"
455
457
  ],
456
458
  "@rightkit/settings-ui": [
457
459
  "0.1.0",
@@ -592,13 +594,13 @@
592
594
  "rightkit-approvals": "0.2.2",
593
595
  "rightkit-asr": "0.5.2",
594
596
  "rightkit-assist": "0.1.1",
595
- "rightkit-audio": "0.4.4",
597
+ "rightkit-audio": "0.4.5",
596
598
  "rightkit-autoedit": "0.2.1",
597
599
  "rightkit-automation": "0.7.6",
598
600
  "rightkit-autostart": "0.1.1",
599
601
  "rightkit-bench": "0.2.1",
600
602
  "rightkit-bot-messaging": "0.3.2",
601
- "rightkit-browser": "0.3.12",
603
+ "rightkit-browser": "0.3.13",
602
604
  "rightkit-cache": "0.2.5",
603
605
  "rightkit-captions": "0.1.1",
604
606
  "rightkit-catalog": "0.1.0",
@@ -629,7 +631,7 @@
629
631
  "rightkit-crash": "0.4.3",
630
632
  "rightkit-credentials": "0.5.10",
631
633
  "rightkit-crypto": "0.1.4",
632
- "rightkit-daemon": "0.9.3",
634
+ "rightkit-daemon": "0.9.4",
633
635
  "rightkit-daemon-remote": "0.1.0",
634
636
  "rightkit-db": "0.5.11",
635
637
  "rightkit-decimal": "0.1.0",
@@ -685,7 +687,7 @@
685
687
  "rightkit-launcher-win": "0.2.1",
686
688
  "rightkit-library": "0.3.1",
687
689
  "rightkit-license": "0.3.5",
688
- "rightkit-llm": "0.7.1",
690
+ "rightkit-llm": "0.7.2",
689
691
  "rightkit-local-gen": "0.1.4",
690
692
  "rightkit-logs": "0.4.5",
691
693
  "rightkit-mail": "0.1.2",
@@ -732,7 +734,7 @@
732
734
  "rightkit-record": "0.4.1",
733
735
  "rightkit-reframe": "0.2.1",
734
736
  "rightkit-remote-compute": "0.2.2",
735
- "rightkit-remote-gateway": "0.1.5",
737
+ "rightkit-remote-gateway": "0.1.6",
736
738
  "rightkit-repo-graph": "0.3.3",
737
739
  "rightkit-repo-graph-grammars": "0.1.1",
738
740
  "rightkit-research": "0.1.2",
@@ -755,7 +757,7 @@
755
757
  "rightkit-sysmem": "0.1.0",
756
758
  "rightkit-system-monitor": "0.3.2",
757
759
  "rightkit-tauri-shell": "0.8.10",
758
- "rightkit-terminal-ui": "0.1.5",
760
+ "rightkit-terminal-ui": "0.1.9",
759
761
  "rightkit-text-polish": "0.1.4",
760
762
  "rightkit-theme": "0.1.1",
761
763
  "rightkit-time": "0.1.5",
@@ -919,7 +921,7 @@
919
921
  "@rightkit/qa": "0.7.0",
920
922
  "@rightkit/qa-chrome": "0.1.12",
921
923
  "@rightkit/react-shell": "0.7.7",
922
- "@rightkit/release": "0.6.85",
924
+ "@rightkit/release": "0.6.87",
923
925
  "@rightkit/settings-ui": "0.7.4",
924
926
  "@rightkit/shell": "0.1.1",
925
927
  "@rightkit/tauri": "0.4.3",
@@ -1021,7 +1023,8 @@
1021
1023
  "0.3.9",
1022
1024
  "0.4.0",
1023
1025
  "0.4.1",
1024
- "0.4.3"
1026
+ "0.4.3",
1027
+ "0.4.4"
1025
1028
  ],
1026
1029
  "rightkit-automation": [
1027
1030
  "0.3.0",
@@ -1049,7 +1052,8 @@
1049
1052
  "0.3.4",
1050
1053
  "0.3.5",
1051
1054
  "0.3.6",
1052
- "0.3.11"
1055
+ "0.3.11",
1056
+ "0.3.12"
1053
1057
  ],
1054
1058
  "rightkit-cache": [
1055
1059
  "0.2.0",
@@ -1146,7 +1150,8 @@
1146
1150
  "0.4.0",
1147
1151
  "0.9.0",
1148
1152
  "0.9.1",
1149
- "0.9.2"
1153
+ "0.9.2",
1154
+ "0.9.3"
1150
1155
  ],
1151
1156
  "rightkit-db": [
1152
1157
  "0.2.1",
@@ -1350,7 +1355,8 @@
1350
1355
  "0.2.1",
1351
1356
  "0.3.0",
1352
1357
  "0.3.1",
1353
- "0.7.0"
1358
+ "0.7.0",
1359
+ "0.7.1"
1354
1360
  ],
1355
1361
  "rightkit-logs": [
1356
1362
  "0.2.0",
@@ -1743,7 +1749,8 @@
1743
1749
  ],
1744
1750
  "rightkit-remote-gateway": [
1745
1751
  "0.1.3",
1746
- "0.1.4"
1752
+ "0.1.4",
1753
+ "0.1.5"
1747
1754
  ],
1748
1755
  "rightkit-web-session": [
1749
1756
  "0.1.1"
@@ -1887,7 +1894,11 @@
1887
1894
  ],
1888
1895
  "rightkit-terminal-ui": [
1889
1896
  "0.1.3",
1890
- "0.1.4"
1897
+ "0.1.4",
1898
+ "0.1.5",
1899
+ "0.1.6",
1900
+ "0.1.7",
1901
+ "0.1.8"
1891
1902
  ],
1892
1903
  "rightkit-timeline": [
1893
1904
  "0.1.1"
package/seam-broker.mjs CHANGED
@@ -139,6 +139,19 @@ export function socketProblem(endpoint, o = {}) {
139
139
  } catch (error) { return `cannot connect to the broker at ${endpoint} (${error?.code ?? error?.message ?? error})`; }
140
140
  }
141
141
 
142
+ /**
143
+ * The absolute client path a RustRight POSIX agent shim starts, or null when `text` is not that shim. The shim is the installer's own
144
+ * file: it carries the marker line `# rustright.build-control.agent-shims.install.v<N>` and ends in `exec '<absolute path>' "$@"`.
145
+ * A native executable read as text, a file over 4 KiB, or a script without both lines is not a shim.
146
+ */
147
+ export function posixAgentShimTarget(text) {
148
+ if (typeof text !== "string" || text.length > 4096 || !text.startsWith("#!")) return null;
149
+ const lines = text.split(/\r?\n/);
150
+ if (!lines.some((line) => /^# rustright\.build-control\.agent-shims\.install\.v\d+$/.test(line.trim()))) return null;
151
+ const exec = lines.map((line) => /^exec '(\/[^']+)' "\$@"$/.exec(line.trim())).find(Boolean);
152
+ return exec ? exec[1] : null;
153
+ }
154
+
142
155
  export function brokerControlTarget(o, { client = o?.client } = {}) {
143
156
  const platform = o?.platform ?? process.platform;
144
157
  const env = o?.env ?? process.env;
@@ -148,6 +161,15 @@ export function brokerControlTarget(o, { client = o?.client } = {}) {
148
161
  try { exe = resolveBrokerClient(client, { platform, readFile: read }).file; } catch (error) { return { ok: false, problem: `the RustRight client cannot be resolved (${error.message})` }; }
149
162
  let real = exe;
150
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
+ if (platform !== "win32") {
168
+ let shimText = null;
169
+ try { shimText = read(real); } catch { shimText = null; }
170
+ const target = posixAgentShimTarget(shimText);
171
+ if (target) real = target;
172
+ }
151
173
  const paths = platform === "win32" ? path.win32 : path.posix;
152
174
  const manifest = paths.join(paths.dirname(real), RUNTIME_MANIFEST_FILE);
153
175
  let text;
@@ -0,0 +1,47 @@
1
+ // A repository RightKit does not bind: a tool that may use RightKit packages but owes none of the app contract.
2
+ //
3
+ // The list is the shipped ownership-advise-only.json (each entry carries the owner's ruling, quoted, in `ratifiedBy`). For such a
4
+ // repository the app-contract rules report what they find as advice and refuse nothing:
5
+ // - ownership findings (ownership.mjs adviseOnlyFindings, since 0.6.86);
6
+ // - the RightKit Cargo dependency and profile contracts, QA adoption, and the release-switch inventory and scans (release.mjs).
7
+ // Rules that protect the release itself are NOT in this set and bind every repository: the protected signing workflow shape, secret
8
+ // scans, licence notices, signing, the hosted-workflow checks, build admission, and the test-mode feature closure.
9
+ import { readFileSync } from "node:fs";
10
+ import { spawnSync } from "./background-process.mjs";
11
+ import { canonicalRepositoryIdentity } from "./ownership-approval.mjs";
12
+ import { isSnapshotSource } from "./release-source-identity.mjs";
13
+
14
+ /** The `check()` rows of release.mjs that are app-contract rules. */
15
+ export const UNBOUND_ADVICE_CHECKS = Object.freeze(new Set(["rightkit-cargo-contract", "cargo-profile-contract", "qa-adoption"]));
16
+ /** The prebuild gates (prebuild-gates.mjs) that are the release-switch inventory rule (M21/M23 source layer). */
17
+ export const UNBOUND_ADVICE_GATES = Object.freeze(new Set(["switch-inventory", "switch-inventory-missing", "source-switch-roots", "source-switch-prepare", "release-switches"]));
18
+
19
+ let shipped;
20
+ function shippedList() {
21
+ if (shipped === undefined) {
22
+ try { const data = JSON.parse(readFileSync(new URL("./ownership-advise-only.json", import.meta.url), "utf8")); shipped = Array.isArray(data?.repositories) ? data.repositories : []; }
23
+ catch { shipped = []; }
24
+ }
25
+ return shipped;
26
+ }
27
+
28
+ /** The entry of `repositoryIdentity` in the list (it needs a quoted ruling), or null. */
29
+ export function unboundEntry(repositoryIdentity, list = shippedList()) {
30
+ if (!repositoryIdentity) return null;
31
+ return list.find((entry) => entry?.repositoryIdentity === repositoryIdentity && typeof entry.ratifiedBy === "string" && entry.ratifiedBy.trim()) ?? null;
32
+ }
33
+
34
+ /**
35
+ * The list entry of the repository a release runs for, or null. `source` is the door source split (its checkout holds the origin;
36
+ * the snapshot has no git directory); without one the origin is read from `root`. An origin that cannot be read binds the repository.
37
+ */
38
+ export function unboundRepository({ root, source = null, git = spawnSync, list } = {}) {
39
+ const from = source && isSnapshotSource(source) ? source.checkout : root;
40
+ if (!from) return null;
41
+ const origin = git("git", ["-C", from, "remote", "get-url", "origin"], { encoding: "utf8", windowsHide: true, maxBuffer: 4 * 1024 * 1024 });
42
+ if (origin?.status !== 0) return null;
43
+ let identity;
44
+ try { identity = canonicalRepositoryIdentity(String(origin.stdout ?? "").trim()); } catch { return null; }
45
+ const entry = unboundEntry(identity, list);
46
+ return entry ? { ...entry, repositoryIdentity: identity } : null;
47
+ }