@rightkit/release 0.6.87 → 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.
@@ -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.87",
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",
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
  }
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.87",
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",
@@ -452,7 +452,8 @@
452
452
  "0.6.83",
453
453
  "0.6.84",
454
454
  "0.6.85",
455
- "0.6.86"
455
+ "0.6.86",
456
+ "0.6.87"
456
457
  ],
457
458
  "@rightkit/settings-ui": [
458
459
  "0.1.0",
@@ -593,13 +594,13 @@
593
594
  "rightkit-approvals": "0.2.2",
594
595
  "rightkit-asr": "0.5.2",
595
596
  "rightkit-assist": "0.1.1",
596
- "rightkit-audio": "0.4.4",
597
+ "rightkit-audio": "0.4.5",
597
598
  "rightkit-autoedit": "0.2.1",
598
599
  "rightkit-automation": "0.7.6",
599
600
  "rightkit-autostart": "0.1.1",
600
601
  "rightkit-bench": "0.2.1",
601
602
  "rightkit-bot-messaging": "0.3.2",
602
- "rightkit-browser": "0.3.12",
603
+ "rightkit-browser": "0.3.13",
603
604
  "rightkit-cache": "0.2.5",
604
605
  "rightkit-captions": "0.1.1",
605
606
  "rightkit-catalog": "0.1.0",
@@ -630,7 +631,7 @@
630
631
  "rightkit-crash": "0.4.3",
631
632
  "rightkit-credentials": "0.5.10",
632
633
  "rightkit-crypto": "0.1.4",
633
- "rightkit-daemon": "0.9.3",
634
+ "rightkit-daemon": "0.9.4",
634
635
  "rightkit-daemon-remote": "0.1.0",
635
636
  "rightkit-db": "0.5.11",
636
637
  "rightkit-decimal": "0.1.0",
@@ -686,7 +687,7 @@
686
687
  "rightkit-launcher-win": "0.2.1",
687
688
  "rightkit-library": "0.3.1",
688
689
  "rightkit-license": "0.3.5",
689
- "rightkit-llm": "0.7.1",
690
+ "rightkit-llm": "0.7.2",
690
691
  "rightkit-local-gen": "0.1.4",
691
692
  "rightkit-logs": "0.4.5",
692
693
  "rightkit-mail": "0.1.2",
@@ -733,7 +734,7 @@
733
734
  "rightkit-record": "0.4.1",
734
735
  "rightkit-reframe": "0.2.1",
735
736
  "rightkit-remote-compute": "0.2.2",
736
- "rightkit-remote-gateway": "0.1.5",
737
+ "rightkit-remote-gateway": "0.1.6",
737
738
  "rightkit-repo-graph": "0.3.3",
738
739
  "rightkit-repo-graph-grammars": "0.1.1",
739
740
  "rightkit-research": "0.1.2",
@@ -756,7 +757,7 @@
756
757
  "rightkit-sysmem": "0.1.0",
757
758
  "rightkit-system-monitor": "0.3.2",
758
759
  "rightkit-tauri-shell": "0.8.10",
759
- "rightkit-terminal-ui": "0.1.8",
760
+ "rightkit-terminal-ui": "0.1.9",
760
761
  "rightkit-text-polish": "0.1.4",
761
762
  "rightkit-theme": "0.1.1",
762
763
  "rightkit-time": "0.1.5",
@@ -920,7 +921,7 @@
920
921
  "@rightkit/qa": "0.7.0",
921
922
  "@rightkit/qa-chrome": "0.1.12",
922
923
  "@rightkit/react-shell": "0.7.7",
923
- "@rightkit/release": "0.6.86",
924
+ "@rightkit/release": "0.6.87",
924
925
  "@rightkit/settings-ui": "0.7.4",
925
926
  "@rightkit/shell": "0.1.1",
926
927
  "@rightkit/tauri": "0.4.3",
@@ -1022,7 +1023,8 @@
1022
1023
  "0.3.9",
1023
1024
  "0.4.0",
1024
1025
  "0.4.1",
1025
- "0.4.3"
1026
+ "0.4.3",
1027
+ "0.4.4"
1026
1028
  ],
1027
1029
  "rightkit-automation": [
1028
1030
  "0.3.0",
@@ -1050,7 +1052,8 @@
1050
1052
  "0.3.4",
1051
1053
  "0.3.5",
1052
1054
  "0.3.6",
1053
- "0.3.11"
1055
+ "0.3.11",
1056
+ "0.3.12"
1054
1057
  ],
1055
1058
  "rightkit-cache": [
1056
1059
  "0.2.0",
@@ -1147,7 +1150,8 @@
1147
1150
  "0.4.0",
1148
1151
  "0.9.0",
1149
1152
  "0.9.1",
1150
- "0.9.2"
1153
+ "0.9.2",
1154
+ "0.9.3"
1151
1155
  ],
1152
1156
  "rightkit-db": [
1153
1157
  "0.2.1",
@@ -1351,7 +1355,8 @@
1351
1355
  "0.2.1",
1352
1356
  "0.3.0",
1353
1357
  "0.3.1",
1354
- "0.7.0"
1358
+ "0.7.0",
1359
+ "0.7.1"
1355
1360
  ],
1356
1361
  "rightkit-logs": [
1357
1362
  "0.2.0",
@@ -1744,7 +1749,8 @@
1744
1749
  ],
1745
1750
  "rightkit-remote-gateway": [
1746
1751
  "0.1.3",
1747
- "0.1.4"
1752
+ "0.1.4",
1753
+ "0.1.5"
1748
1754
  ],
1749
1755
  "rightkit-web-session": [
1750
1756
  "0.1.1"
@@ -1891,7 +1897,8 @@
1891
1897
  "0.1.4",
1892
1898
  "0.1.5",
1893
1899
  "0.1.6",
1894
- "0.1.7"
1900
+ "0.1.7",
1901
+ "0.1.8"
1895
1902
  ],
1896
1903
  "rightkit-timeline": [
1897
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
+ }