@rightkit/release 0.6.88 → 0.6.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app-check.mjs CHANGED
@@ -110,6 +110,7 @@ import { CONSUMER_CONTRACT_RULES } from "./consumer-contracts.mjs";
110
110
  import { OWNERSHIP_CLASS_RULES } from "./ownership-class-rules.mjs";
111
111
  import { SOURCE_CLOSURE_RULES } from "./source-closure-rules.mjs";
112
112
  import { SHELL_CONTRACT_RULES } from "./shell-contract.mjs";
113
+ import { neutralIgnored } from "./stage-ledger.mjs";
113
114
  import { CONSUMER_SOURCE_RULES } from "./consumer-source-contracts.mjs";
114
115
  import { CONSUMER_POLICY_RULES } from "./consumer-policy.mjs";
115
116
  import { engineRecordStore, suiteKeyLiteral, suiteUpdaterKey } from "./suite-trust-roots.mjs";
@@ -1307,8 +1308,33 @@ function trustPolicyExclude({ root, files }) {
1307
1308
  return out;
1308
1309
  }
1309
1310
 
1311
+ // G29: the QA runner keeps a stash of the app binary and a pointer file under the app root (rightkit-qa binary.rs STASH_DIR, POINTER_FILE;
1312
+ // `[ui] pointer_file` renames the pointer). Its first run of an installed-QA stage writes them into the snapshot. A commit that does not
1313
+ // ignore them then has a snapshot that is no longer its tree: the broker fails the journeys build on its post-check (the client exits 125),
1314
+ // and the stage ledger refuses the file at the end of qualify, after package, signing and notarization (Pulse 1386c633 and CodeRight
1315
+ // 7622df951, 2026-11-26). The app root is the directory that holds both a release config and the runner's rightkit-qa.toml.
1316
+ function qaStashIgnored({ root, files }) {
1317
+ const out = [];
1318
+ const configDirs = new Set(configFiles(files).map(dirOf));
1319
+ for (const file of files.filter((f) => /(^|\/)rightkit-qa\.toml$/.test(f) && scanned(f) && configDirs.has(dirOf(f)))) {
1320
+ const dir = dirOf(file);
1321
+ const text = readText(root, file) ?? "";
1322
+ const pointer = /^\s*pointer_file\s*=\s*"([^"]+)"/m.exec(text)?.[1] ?? ".rightkit-qa-app-binary";
1323
+ const under = (name) => (dir === "." ? name : `${dir}/${name}`);
1324
+ const wanted = [[under(".rightkit-qa-bin/host/app"), under(".rightkit-qa-bin/")], [under(pointer), under(pointer)]];
1325
+ let ignored;
1326
+ try { ignored = neutralIgnored({ dir: root, paths: wanted.map(([probe]) => probe) }); } catch { continue; } // git cannot answer here: the stage ledger still guards at the end
1327
+ for (const [probe, line] of wanted) {
1328
+ if (ignored.has(probe)) continue;
1329
+ out.push({ file, subject: line, problem: `${line} is not ignored by the commit's own ignore rules; the QA runner writes it under the app root during installed QA, so the snapshot stops being the commit's tree and qualification fails after the package stage`, fix: `add "${line}" to the commit's .gitignore` });
1330
+ }
1331
+ }
1332
+ return out;
1333
+ }
1334
+
1310
1335
  export const RULES = Object.freeze([
1311
1336
  { id: "eol-policy", gap: "G04", run: eolPolicy },
1337
+ { id: "qa-stash-ignored", gap: "G29", run: qaStashIgnored },
1312
1338
  { id: "file-url", gap: "G12", run: fileUrls },
1313
1339
  { id: "retired-alias", gap: "P11", run: retiredAlias },
1314
1340
  { id: "qa-platform", gap: "G13", run: qaPlatform },
@@ -2113,7 +2113,8 @@ async function runStages(o, args, root, git, io) {
2113
2113
  try { decided = routePlan(o, { to, stages: devTest ? [] : stages, devTest, executor: routeExecutor, stagePlatform: platform, appConfig: selected && to !== "check" ? routeAppConfig({ git, commit: selected.commit, appDir, platform: devTestPlatform(args) }) : null }); }
2114
2114
  catch (e) { o.err(`${tag} ${e.message}`); return 2; }
2115
2115
  if (decided.refusal) { o.err(`${tag} BLOCKED: ${decided.refusal.code}: ${decided.refusal.message}; nothing ran${decided.route === "snapshot" ? " and the checkout is never built" : ""}`); return 1; }
2116
- const notPublisher = decided.route === "snapshot" ? releaseRouteRefusal(o, { stages, platform }) : null;
2116
+ const sealedProvider = () => (selected?.commit ? sealedProviderOf((o.sealedFor ?? sealedFor)({ root, commit: selected.commit, platform })) : null);
2117
+ const notPublisher = decided.route === "snapshot" ? releaseRouteRefusal(o, { stages, platform, sealedProvider }) : null;
2117
2118
  if (notPublisher) { o.err(`${tag} BLOCKED: ${notPublisher.code}: ${notPublisher.message}; nothing ran and the checkout is never built`); return 1; }
2118
2119
  // The declared Linux broker admits snapshots only under its own data root: refused before any ownership or sync when the gate's root is elsewhere.
2119
2120
  if (decided.route === "snapshot" && !hosted) {
@@ -2182,7 +2183,10 @@ async function runStages(o, args, root, git, io) {
2182
2183
  // Release writes to R2. The write credential lives only in the trusted publisher: a GitHub Actions job in the protected
2183
2184
  // publication environment, which sets RIGHTKIT_PUBLISHER=github-environment. Hosts and agents never hold it, so the door refuses the
2184
2185
  // stage anywhere else rather than fail half way through an upload.
2185
- if (stages.includes("release") && !mobile && !(o.env.GITHUB_ACTIONS === "true" && o.env.RIGHTKIT_PUBLISHER === "github-environment")) {
2186
+ // rightkit#1754: an app whose sealed set declares r2-rightapps publishes from this host through publish-update (the release stage re-reads
2187
+ // the provider from the manifest bytes the receipt vouches for); a github-releases app still publishes only from the trusted publisher.
2188
+ const r2LocalRelease = stages.includes("release") && !mobile && sealedProviderOf((o.sealedFor ?? sealedFor)({ root, commit, platform })) === "r2-rightapps";
2189
+ if (stages.includes("release") && !mobile && !r2LocalRelease && !(o.env.GITHUB_ACTIONS === "true" && o.env.RIGHTKIT_PUBLISHER === "github-environment")) {
2186
2190
  o.err(`${tag} BLOCKED: --to release runs only in the trusted publisher (the release workflow's protected publication job). Run --to qualify here, then dispatch the release workflow for ${commit.slice(0, 12)}`);
2187
2191
  return 1;
2188
2192
  }
@@ -2236,6 +2240,22 @@ async function runStages(o, args, root, git, io) {
2236
2240
  const carriedOk = await carrier.finish({ stage });
2237
2241
  return childOk && carriedOk;
2238
2242
  };
2243
+ // rightkit#1754: publish-update runs from the primary checkout, never the snapshot: it reads the checkout's clean HEAD (assertPrimaryReleaseCheckout,
2244
+ // assertCleanSource), so its door run carries no source split and the CLI's checkout guard applies (HEAD must be the sealed commit). It stays out
2245
+ // of SPLIT_COMMANDS. It uploads in process (r2-verified-upload.mjs), so no credential is carried to a broker job.
2246
+ const rightReleaseFromCheckout = async (stage, cliArgs) => {
2247
+ const carrier = await carrierForChildren({ o, ds, root, git, executor, stage, tag, appDir });
2248
+ if (carrier.refusal) { o.err(`${tag} BLOCKED: ${carrier.refusal}; nothing ran`); return false; }
2249
+ const run = startRun({ commonDir, commit, tree, stage });
2250
+ let childOk = false;
2251
+ try {
2252
+ o.out(`${tag} [${stage}] right-release ${cliArgs.join(" ")} (from the primary checkout ${appRoot})`);
2253
+ const r = (o.spawnInherit ?? inheritLaunch)(process.execPath, [cli, ...cliArgs], { cwd: appRoot, env: carriedEnv(carrier, { ...o.env, ...run.env }) });
2254
+ childOk = r.status === 0;
2255
+ } finally { endRun(run); }
2256
+ const carriedOk = await carrier.finish({ stage });
2257
+ return childOk && carriedOk;
2258
+ };
2239
2259
 
2240
2260
  o.out(`${tag} --to ${to} for ${commit.slice(0, 12)}${appDir === "." ? "" : ` (app ${appDir})`}: ${stages.join(" -> ")}; executor ${executor.kind}`);
2241
2261
  // A later stage on the sealed bytes: check, compile and package already passed for them (in this receipt) and the bytes on disk are
@@ -2286,6 +2306,9 @@ async function runStages(o, args, root, git, io) {
2286
2306
  return releasePinFloorProblem({ packageJsonText, installedVersion, where: appDir === "." ? "package.json" : `${appDir}/package.json` });
2287
2307
  };
2288
2308
  const phaseTimings = [];
2309
+ // The registry verdict this door run took before its compile, as a file only this process knows: a later invocation on the same commit
2310
+ // has no such file and asks the registries itself (rightkit#1754; the binding is to the run, never to the commit).
2311
+ let doorRegistryAdmissionFile = null;
2289
2312
  for (const stage of stages) {
2290
2313
  if (stage === "check" && publisherUploadOnly && receipt.stages.check?.ok && tierAtLeast(receipt.stages.check.ruleTier ?? "compile", earlyTier)) { o.out(`${tag} [check] already passed (${receipt.stages.check.ruleTier ?? "compile"} tier) for this exact input (commit, tree, lockfiles, gate, toolchain)`); continue; }
2291
2314
  if (stage === "compile" && receipt.stages.compile?.ok) {
@@ -2319,7 +2342,23 @@ async function runStages(o, args, root, git, io) {
2319
2342
  let ok = false; const at = new Date().toISOString(); const stageStartedMs = Date.now(); let extra = {}; let directReceipt = null; let packageSigned = new Map();
2320
2343
  if (stage === "check") {
2321
2344
  { const problem = await pinFloor(false); if (problem) { o.err(`${tag} BLOCKED: ${problem.message}; no class A row ran and nothing compiled`); return 1; } }
2345
+ // An app pinned to an older @rightkit/release than this host gate: said once, never refused (release-pin-floor.mjs releasePinBehindHostNote).
2346
+ try {
2347
+ const packageJsonText = appPackageJson();
2348
+ if (packageJsonText !== null) {
2349
+ const { releasePinBehindHostNote } = await import("../release-pin-floor.mjs");
2350
+ const hostVersion = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
2351
+ const note = releasePinBehindHostNote({ packageJsonText, hostVersion, where: appDir === "." ? "package.json" : `${appDir}/package.json` });
2352
+ if (note) o.out(`${tag} [check] note: ${note}`);
2353
+ }
2354
+ } catch { /* informational only */ }
2322
2355
  ok = (await (o.runCheck ?? (() => main(["check", "--commit", ds ? commit : "HEAD", "--full-a", ...(ds ? ["--snapshot", ds.path] : []), ...appScope, "--rule-tier", earlyTier], { ...io, cwd: root, ...(ds ? { snapshotLock: ds.lock } : {}) })))(earlyTier)) === 0;
2356
+ // A run that goes on to qualify: a journeys manifest whose release-critical journeys cannot pass one installed-QA run is refused here,
2357
+ // before anything compiles (release-qa-hardening.mjs criticalJourneySelectionProblems; CodeRight 2026-11-26: four adapters, found after notarization).
2358
+ if (ok && stages.includes("qualify") && !mobile && PLATFORMS.includes(platform)) {
2359
+ const shape = await journeysShapeProblems({ o, git, commit, appDir, base: ds ? ds.path : root, platform });
2360
+ if (shape.length) { for (const line of shape) o.err(`${tag} BLOCKED: [check] ${line}`); ok = false; }
2361
+ }
2323
2362
  extra = { ruleTier: earlyTier };
2324
2363
  }
2325
2364
  else if (stage === "compile") {
@@ -2344,6 +2383,14 @@ async function runStages(o, args, root, git, io) {
2344
2383
  };
2345
2384
  const admissionAfterStaging = wantsAdmission && executor.kind === "broker" && Boolean(ds);
2346
2385
  if (wantsAdmission && !admissionAfterStaging) ok = await admissionDryRun("before any compile");
2386
+ // On a broker host the full dry-run waits for a Cargo target; the registry rows (pin freshness) need none, so they run first.
2387
+ // A stale pin is then refused in seconds, before the sidecars and the app compile, and the verdict is kept for this run's package stage.
2388
+ if (ok && wantsAdmission && admissionAfterStaging) {
2389
+ const file = path.join(fs.mkdtempSync(path.join(os.tmpdir(), "rk-door-registry-")), "admission.json");
2390
+ o.out(`${tag} [compile] registry admission for ${platform} before any compile (right-release build --platform ${platform} --registry-admission-out)`);
2391
+ if (await rightRelease(stage, ["build", "--platform", platform, "--registry-admission-out", file])) doorRegistryAdmissionFile = file;
2392
+ else { o.err(`${tag} BLOCKED: [compile] the registry admission (pin freshness against the registries) refused ${platform}; nothing compiled`); ok = false; }
2393
+ }
2347
2394
  // On the snapshot route the sidecars are staged from the snapshot's own config and sources through right-release's source split
2348
2395
  // (the staged files and receipt land beside the sources the compile reads; the caches and build trees stay the checkout's), before
2349
2396
  // `main --all` compiles. A broker host's stage-sidecar child reaches Cargo through the stage's carrier (stage-seam.mjs).
@@ -2432,7 +2479,7 @@ async function runStages(o, args, root, git, io) {
2432
2479
  else if (packageMulti.note) o.out(`${tag} [package] ${packageMulti.note}`);
2433
2480
  }
2434
2481
  const packageEnv = packagePin.dir ? { CARGO_TARGET_DIR: packagePin.dir } : (packageMulti?.env ?? {});
2435
- ok = ok && await rightRelease(stage, ["build", "--platform", platform], packageEnv);
2482
+ ok = ok && await rightRelease(stage, ["build", "--platform", platform], { ...packageEnv, ...(doorRegistryAdmissionFile ? { RK_DOOR_REGISTRY_ADMISSION: doorRegistryAdmissionFile } : {}) });
2436
2483
  const sealed = ok ? (o.sealedFor ?? sealedFor)({ root: releaseRoot, commit, platform }) : null;
2437
2484
  if (ok && !sealed) { o.err(`${tag} [package] the build reported success but sealed nothing for ${commit.slice(0, 8)} on ${platform}`); ok = false; }
2438
2485
  if (sealed) extra = { platform, sealed: sealed.id, manifestSha256: sealed.digest };
@@ -2522,6 +2569,10 @@ async function runStages(o, args, root, git, io) {
2522
2569
  } else {
2523
2570
  if (!receipt.stages.qualify?.ok || receipt.stages.qualify.manifestSha256 !== sealed.manifestSha256) { o.err(`${tag} BLOCKED: [release] the sealed set was not qualified (installed QA) in this door run's receipt`); ok = false; }
2524
2571
  else if (qualifyRecordProblem(receipt.stages.qualify)) { o.err(`${tag} BLOCKED: [release] the recorded qualification no longer stands: ${qualifyRecordProblem(receipt.stages.qualify)}; nothing was uploaded`); ok = false; }
2572
+ else if (sealedProviderOf(sealedNow) === "r2-rightapps" && sealedNow?.digest === sealed.manifestSha256 && !(o.env.GITHUB_ACTIONS === "true" && o.env.RIGHTKIT_PUBLISHER === "github-environment")) {
2573
+ // rightkit#1754: the provider is re-read from the manifest bytes this receipt vouches for; GC-T22 still needs Adrian's words for the build.
2574
+ ok = await rightReleaseFromCheckout(stage, ["publish-update", "--release", sealed.sealed, "--platform", platform, "--tier", tier]); extra = { sealed: sealed.sealed, manifestSha256: sealed.manifestSha256, tier, route: "r2-local" };
2575
+ }
2525
2576
  else { ok = await rightRelease(stage, ["upload", "--release", sealed.sealed, "--platform", platform, "--tier", tier]); extra = { sealed: sealed.sealed, manifestSha256: sealed.manifestSha256, tier }; }
2526
2577
  }
2527
2578
  }
@@ -2987,6 +3038,33 @@ export function qualifyOwedProblem({ o, git, commit, appDir = ".", base, owed })
2987
3038
  return owed.map((x) => `${x.id} (${x.kind}${x.dir ? ` ${x.dir}` : ""}) is owed to qualification (${x.reason}) but no release config under ${appDir} declares qa.journeys, so nothing would run it; declare qa.journeys with a journeys.toml that covers it`);
2988
3039
  }
2989
3040
 
3041
+ /**
3042
+ * Why the journeys manifests of the app's release configs cannot pass one installed-QA run on `platform`; empty when they can or when no
3043
+ * config declares `qa.journeys` with a manifest. Read from `base` (the commit's bytes): the manifest path is the config's
3044
+ * `qa.journeys.manifest`, relative to the config's directory. A manifest that cannot be read or parsed is left to the installed stage,
3045
+ * which names that failure itself.
3046
+ */
3047
+ export async function journeysShapeProblems({ o, git, commit, appDir = ".", base, platform }) {
3048
+ const listed = git("ls-tree", "-r", "--name-only", "-z", commit);
3049
+ const configs = (failed(listed) ? [] : text(listed).split("\0").filter((f) => /(^|\/)right-release\.config\.(json|mjs)$/.test(f)).filter((f) => appDir === "." || f.startsWith(`${appDir}/`)));
3050
+ const problems = [];
3051
+ let judge = null;
3052
+ for (const config of configs) {
3053
+ let body;
3054
+ try { body = String(o.readFile(path.join(base, config))); } catch { continue; }
3055
+ const m = /\bjourneys["']?\s*:\s*\{[^{}]*?\bmanifest["']?\s*:\s*["']([^"']+)["']/.exec(body);
3056
+ if (!m) continue;
3057
+ const manifestRel = path.posix.join(path.posix.dirname(config), m[1]);
3058
+ let manifestText;
3059
+ try { manifestText = String(o.readFile(path.join(base, manifestRel))); } catch { continue; }
3060
+ judge ??= (await import("../release-qa-hardening.mjs")).criticalJourneySelectionProblems;
3061
+ let found;
3062
+ try { found = judge(manifestText, platform); } catch { continue; }
3063
+ for (const line of found) problems.push(`${manifestRel}: ${line}`);
3064
+ }
3065
+ return problems;
3066
+ }
3067
+
2990
3068
  /** The release configs of `commit` (under `appDir`) that declare a `web` block (`web.build` steps), read from `base`: the commit's config decides, never the checkout's. */
2991
3069
  export function committedWebBuildConfigs({ o, git, commit, appDir = ".", base }) {
2992
3070
  const listedConfigs = git("ls-tree", "-r", "--name-only", "-z", commit);
@@ -3651,12 +3729,27 @@ export const ROUTE_SCHEMA = "rightkit-gate.route/1";
3651
3729
  * protected publication job (GITHUB_ACTIONS with RIGHTKIT_PUBLISHER=github-environment); a mobile platform's store upload has its own tier-less route. Asked by a real
3652
3730
  * run before it takes ownership or syncs the snapshot (E2E L3-03); the probe has no release route, so this is not a probe code.
3653
3731
  */
3654
- export function releaseRouteRefusal(o, { stages, platform }) {
3732
+ export function releaseRouteRefusal(o, { stages, platform, sealedProvider = () => null }) {
3655
3733
  if (!stages.includes("release") || MOBILE_PLATFORMS.has(platform)) return null;
3656
3734
  if (o.env.GITHUB_ACTIONS === "true" && o.env.RIGHTKIT_PUBLISHER === "github-environment") return null;
3735
+ // rightkit#1754: an app whose sealed manifest declares r2-rightapps publishes from the host through publish-update; the release stage
3736
+ // re-reads the provider from the manifest bytes the receipt vouches for before anything is uploaded.
3737
+ if (sealedProvider() === "r2-rightapps") return null;
3657
3738
  return { code: "RK_RELEASE_PUBLISHER_ONLY", message: "--to release runs only in the trusted publisher (the release workflow's protected publication job). Run --to qualify on the native host, then dispatch the release workflow for the commit" };
3658
3739
  }
3659
3740
 
3741
+ /** The distribution provider a sealed set declares (`manifest.distribution.provider`), read from the manifest bytes whose sha256 is `sealed.digest`;
3742
+ * null for no sealed set, unreadable or changed bytes, or a manifest sealed before the field existed. */
3743
+ export function sealedProviderOf(sealed, { readFile = (f) => fs.readFileSync(f) } = {}) {
3744
+ if (!sealed?.manifest) return null;
3745
+ try {
3746
+ const bytes = readFile(sealed.manifest);
3747
+ if (createHash("sha256").update(bytes).digest("hex") !== sealed.digest) return null;
3748
+ const provider = JSON.parse(String(bytes)).distribution?.provider;
3749
+ return typeof provider === "string" ? provider : null;
3750
+ } catch { return null; }
3751
+ }
3752
+
3660
3753
  /**
3661
3754
  * Which route this host's door takes for `--to <stage>` and whether it refuses, WITHOUT running anything: the decisions of `runStages`
3662
3755
  * in the order it makes them. `runStages` takes its own pre-ownership route and refusal from this very function (rightkit#1297 L1), so
@@ -4566,13 +4659,20 @@ export async function main(argv, io = {}) {
4566
4659
  // GC-A24: RightKit's own preflight and exports probe execute the commit's code with its installed dependencies; a pass is reused
4567
4660
  // for the same commit tree, installed-dependency bytes, node and platform (and scope), and only a pass.
4568
4661
  const effects = path.join(snapshotDir, "scripts", "ci", "exports-import-effects.mjs");
4662
+ // rightkit#1808: the exports probe imports every exported module from the snapshot, so it needs the snapshot's dependencies. Only a
4663
+ // full admission (--full-a) installs them; a content check installs nothing. The probe therefore runs only on a full admission, and
4664
+ // whether it ran is part of the cache key, so a content check's pass is never reused as a probed one.
4665
+ const probes = o.exists(effects) && scopeForward.length === 0 && fullAdmission;
4569
4666
  let selfKey = null;
4570
- if (ruleCache) { try { selfKey = ruleCache.key({ rule: "rightkit-self-rules", tree: snapshotCommit.tree, scope: scopeForward, installed: installedDependencyDigest({ root: snapshotDir, files: sc.commitFiles(snapshotCheckout, snapshotCommit.commit, o.spawn).files, includeCaches: false }), effects: o.exists(effects) }); } catch { selfKey = null; } }
4667
+ if (ruleCache) { try { selfKey = ruleCache.key({ rule: "rightkit-self-rules", tree: snapshotCommit.tree, scope: scopeForward, installed: installedDependencyDigest({ root: snapshotDir, files: sc.commitFiles(snapshotCheckout, snapshotCommit.commit, o.spawn).files, includeCaches: false }), effects: probes }); } catch { selfKey = null; } }
4571
4668
  const selfCached = Boolean(selfKey && ruleCache.passed(selfKey));
4572
4669
  if (selfCached) o.out(`preflight: ${snapshotCommit.commit.slice(0, 12)} cached pass (tree ${snapshotCommit.tree.slice(0, 12)}, same installed dependencies)`);
4573
4670
  const r = selfCached ? { status: 0 } : launch(process.execPath, [path.join(snapshotDir, "scripts", "preflight.mjs"), "--repo", root, "--commit", snapshotCommit.commit], { cwd: root, env: o.env });
4574
4671
  selfRules = r.status === 0 ? 0 : 1;
4575
- if (!selfCached && selfRules === 0 && o.exists(effects) && scopeForward.length === 0) {
4672
+ if (!selfCached && selfRules === 0 && o.exists(effects) && scopeForward.length === 0 && !fullAdmission) {
4673
+ o.out("exports-import-effects: not run by this content check (it installs no dependencies into the snapshot); run the check with --full-a, or any --to stage, to probe the exports");
4674
+ }
4675
+ if (!selfCached && selfRules === 0 && probes) {
4576
4676
  const common = o.spawn("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], { cwd: root });
4577
4677
  const report = path.join(failed(common) ? path.join(root, ".git") : text(common).trim(), "rightkit-gate", "import-effects", `snapshot-${snapshotCommit.commit}.json`);
4578
4678
  const e = launch(process.execPath, [effects, "--root", snapshotDir, "--no-export", "--report", report], { cwd: snapshotDir, env: o.env });
package/build-release.mjs CHANGED
@@ -122,6 +122,7 @@ let platform = process.platform === "win32" ? "win" : process.platform === "darw
122
122
  let dryRun = false;
123
123
  let skipChecks = false;
124
124
  let resumeFrom = null;
125
+ let registryAdmissionOut = null;
125
126
 
126
127
  for (let i = 0; i < args.length; i += 1) {
127
128
  const arg = args[i];
@@ -130,6 +131,7 @@ for (let i = 0; i < args.length; i += 1) {
130
131
  else if (arg === "--dry-run") dryRun = true;
131
132
  else if (arg === "--skip-checks") skipChecks = true;
132
133
  else if (arg === "--resume-from") resumeFrom = args[++i];
134
+ else if (arg === "--registry-admission-out") registryAdmissionOut = args[++i];
133
135
  else if (arg === "--tier" || arg.startsWith("--tier=")) fail("build is tier-neutral; select patch or update only during upload");
134
136
  else if (arg === "-h" || arg === "--help") usage(0);
135
137
  else fail(`unknown argument: ${arg}`);
@@ -178,6 +180,13 @@ let requestActiveRunStop = null;
178
180
  // Admission (admission.mjs): every refusal the committed files, this host or the registries can decide is raised here, before the
179
181
  // dry-run exit, the clean-source gate, the release lock, any state file, the install, a slot or the worker. `right-release doctor`
180
182
  // runs the same rows with the same text, so the two cannot disagree (rightkit#946); a refused build leaves nothing behind.
183
+ // Declared before its first use below: both functions that read it are called from this top-level code (a const is not hoisted).
184
+ /** The schema of the registry admission a door run takes before any compile and hands to its own package stage. */
185
+ const DOOR_REGISTRY_ADMISSION_SCHEMA = "rightkit.door-registry-admission/1";
186
+
187
+ // The door asks for the registry rows alone, before any compile (rightkit#1754): pin freshness needs no Cargo target, while the full
188
+ // admission's recipe rows do. The verdict and its snapshot are written for the door run that asked; nothing else is read or started.
189
+ if (registryAdmissionOut) await registryAdmissionOnly();
181
190
  const admitted = await admit();
182
191
 
183
192
  // A dry-run is an inspection contract, not a partial build. It prints the admission rows and exits with their verdict, so it can
@@ -623,6 +632,50 @@ try {
623
632
  lock?.release();
624
633
  }
625
634
 
635
+ // `right-release build --registry-admission-out <file>`: resolve this app's RightKit pins against the registries, refuse a pin behind the
636
+ // settled latest exactly as the build admission does, and write the snapshot for the door run. No lock, state, cache or install.
637
+ // The lock inventory is the build's when it can be read without a Cargo target, else the app's own; the package stage checks the
638
+ // snapshot against its full inventory before it trusts it (prepareRightKitResolution with boundSnapshot), so a pin cannot be missed.
639
+ async function registryAdmissionOnly() {
640
+ const commit = releaseSource.commit;
641
+ let config;
642
+ try { config = await importReleaseConfig(configPath, { query: `commit=${commit}` }); }
643
+ catch (error) { console.error(`right-release build: release config could not be loaded (${configPath}): ${error instanceof Error ? error.message : String(error)}`); process.exit(1); }
644
+ let extraLocks;
645
+ try {
646
+ const inputs = resolveReleaseBuildInputs({ repoRoot: sourceRoot, appRoot, configPath, config, target: config.targets?.[platform] });
647
+ extraLocks = rightKitLockInventory({ requiredInputs: inputs.requiredInputs, cargoLockPaths: inputs.cargoLockPaths, nativeLayout: inputs.nativeLayout, config, root: appRoot });
648
+ } catch { extraLocks = rightKitLockInventory({ config, root: appRoot }); }
649
+ let resolution;
650
+ try {
651
+ resolution = await prepareRightKitResolution({
652
+ root: appRoot, extraLocks,
653
+ versions: JSON.parse(readFileSync(path.join(TOOL_ROOT, "rightkit-versions.json"), "utf8")),
654
+ ownership: JSON.parse(readFileSync(path.join(TOOL_ROOT, "rightkit-ownership.json"), "utf8")),
655
+ releaseVersion: RELEASE_TOOL_VERSION, admission: true, cacheDir: "",
656
+ });
657
+ } catch (error) {
658
+ if (!(error instanceof RightKitRegistryError)) throw error;
659
+ console.error(`right-release build: rightkit-registry: ${error.message}`);
660
+ console.error("right-release build: registry admission found a blocking problem; nothing was started");
661
+ process.exit(1);
662
+ }
663
+ for (const line of resolution.freshness.warnings) console.error(`[right-release] WARNING ${line}`);
664
+ writeFileSync(path.resolve(registryAdmissionOut), `${JSON.stringify({ schema: DOOR_REGISTRY_ADMISSION_SCHEMA, commit, platform, observedAt: new Date().toISOString(), snapshot: resolution.snapshot })}\n`);
665
+ console.log(`right-release build: rightkit-registry: ${resolution.summary}; admitted before any compile for this door run`);
666
+ process.exit(0);
667
+ }
668
+
669
+ /** The registry admission this door run took before its compile (RK_DOOR_REGISTRY_ADMISSION), when it is for this commit and platform; else null. */
670
+ function doorRegistryAdmission(commit) {
671
+ const file = process.env.RK_DOOR_REGISTRY_ADMISSION;
672
+ if (!file) return null;
673
+ try {
674
+ const record = JSON.parse(readFileSync(file, "utf8"));
675
+ return record?.schema === DOOR_REGISTRY_ADMISSION_SCHEMA && record.commit === commit && record.platform === platform && record.snapshot ? record : null;
676
+ } catch { return null; }
677
+ }
678
+
626
679
  // Read the config and run the admission rows (files, this host and, for a fresh build, the registries) with no side effect: no lock,
627
680
  // state directory, cache directory, install or snapshot file. A finding is printed with its row and the process exits 1, no stack.
628
681
  async function admit() {
@@ -648,12 +701,29 @@ async function admit() {
648
701
  registry: async (ctx) => {
649
702
  const inputs = ctx.buildInputs();
650
703
  if (!inputs.ok) return undefined; // the build-inputs row reports it
651
- return prepareRightKitResolution({
704
+ const common = {
652
705
  root: appRoot,
653
706
  extraLocks: rightKitLockInventory({ requiredInputs: inputs.value.requiredInputs, cargoLockPaths: inputs.value.cargoLockPaths, nativeLayout: inputs.value.nativeLayout, config, root: appRoot }),
654
707
  versions: JSON.parse(readFileSync(path.join(TOOL_ROOT, "rightkit-versions.json"), "utf8")),
655
708
  ownership: JSON.parse(readFileSync(path.join(TOOL_ROOT, "rightkit-ownership.json"), "utf8")),
656
709
  releaseVersion: RELEASE_TOOL_VERSION,
710
+ };
711
+ // The door run already took the registry verdict before its compile (--registry-admission-out). It is reused only when it covers
712
+ // this build's full lock inventory; otherwise it is dropped and the registries are asked now, as before. So the clock cannot turn
713
+ // a pin stale between an app's compile and its package (the 24-hour settle rule; Pulse 2026-11-26, admitted 15:31Z, refused 15:56Z).
714
+ const doorBound = doorRegistryAdmission(commit);
715
+ if (doorBound) {
716
+ try {
717
+ const bound = await prepareRightKitResolution({ ...common, boundSnapshot: doorBound.snapshot, reuse: true });
718
+ console.error(`right-release build: rightkit-registry: the verdict this door run took before its compile (${doorBound.observedAt}) covers this build; the registries are not asked again`);
719
+ return bound;
720
+ } catch (error) {
721
+ if (!(error instanceof RightKitRegistryError)) throw error;
722
+ console.error(`right-release build: rightkit-registry: the verdict taken before the compile does not cover this build's locks (${String(error.message).split("\n")[0]}); asking the registries now`);
723
+ }
724
+ }
725
+ return prepareRightKitResolution({
726
+ ...common,
657
727
  // Build admission: refuse every pin behind the registry's latest. A dry run asks, but keeps no cache on disk.
658
728
  admission: true,
659
729
  ...(dryRun ? { cacheDir: "" } : {}),
@@ -872,6 +942,9 @@ function sealRelease({ configRoot, managedCargoTarget, artifactPaths = null, and
872
942
  // DevTools allowance (owner's fixed design): { mode: "denied" } for every app; content-only only for an allow-listed app.
873
943
  devtools: devtoolsEvidence(resolveDevtoolsAllowance({ config, root: configRoot })),
874
944
  platform,
945
+ // The app's distribution provider, sealed with the bytes (rightkit#1754): the door decides a desktop release's route from the verified sealed
946
+ // manifest (r2-rightapps may publish from a broker host; github-releases only from the trusted publisher), never by executing app code.
947
+ ...(typeof config.distribution?.provider === "string" ? { distribution: { provider: config.distribution.provider } } : {}),
875
948
  ...(mediaSidecars ? { mediaSidecars } : {}),
876
949
  cacheKey,
877
950
  // Portable contracts sign only raw executables — installer/embedding
@@ -823,9 +823,10 @@ export const FAILURE_UNCACHEABLE_INTERNAL = new Set(["ghsa-audit", "advisory-exc
823
823
  /** NN41: the key namespace of a cached failure, so a failure never shares a key with a pass of the same scan. */
824
824
  // /2: a broker-authenticated compile failure is stored only when its output shows compiler diagnostics and no tool or environment failure (a build-script tool panic is environmental; Dell pulse-hub, 2026-11-06).
825
825
  // /3 (2026-11-06): a missing system library (pkg-config, system-deps) is the host, not the inputs; failures stored under /2 may be one.
826
+ // /4 (2026-11-27): a dependency-resolution failure (the host's registry index lacks a version the lock names) is the host, not the inputs; failures stored under /3 may be one (Pulse Mac 97de4c70, rightkit-tauri-shell 0.8.11).
826
827
  /** planScans file digests by file identity (path, inode, size, mtime) for this process: one run plans its stages over the same snapshot. */
827
828
  const PLAN_DIGEST_MEMO = new Map();
828
- export const FAILURE_KEY_SCHEMA = "deterministic-failure/3";
829
+ export const FAILURE_KEY_SCHEMA = "deterministic-failure/4";
829
830
  /** NN23: the version of the internal (file-only) rules; bump when any internal rule's verdict for the same inputs changes. */
830
831
  export const INTERNAL_RULES_SCHEMA = "rightkit.internal-rules/1";
831
832
  /** Why a row's cache key moved, from the stored pass's key parts to this run's: the input entries that differ (paths and the like), the tool
@@ -909,7 +910,7 @@ export const isFailureCacheableCompileId = (id) => /^(?:check|check-features|che
909
910
  export function isDeterministicCompileDiagnostics(text) {
910
911
  const t = String(text ?? "");
911
912
  const diagnostics = /(?:^|\n)\s*error(?:\[[A-Za-z]\d+\])?: /.test(t) || /could not compile|aborting due to/.test(t);
912
- const environmental = /failed to (?:download|fetch|get|update|load source|create|write|open|remove)|network|spurious|timed out|No space left|Too many open files|Permission denied|Resource temporarily|Text file busy|internal compiler error|panicked at|pkg-config|PKG_CONFIG|system library|was not found in the pkg-config search path|Package [^\n]* was not found|linker `[^`]*` not found|unable to find library|cannot find -l|signal: |SIGKILL|SIGSEGV|Killed/i.test(t);
913
+ const environmental = /failed to (?:download|fetch|get|update|load source|create|write|open|remove)|network|spurious|timed out|No space left|Too many open files|Permission denied|Resource temporarily|Text file busy|internal compiler error|panicked at|pkg-config|PKG_CONFIG|system library|was not found in the pkg-config search path|Package [^\n]* was not found|linker `[^`]*` not found|unable to find library|cannot find -l|signal: |SIGKILL|SIGSEGV|Killed|failed to select a version for|no matching package named|location searched:|candidate versions found which didn't match/i.test(t);
913
914
  return diagnostics && !environmental;
914
915
  }
915
916
  export const isLiveScan = (id) => LIVE_SCAN_IDS.some((p) => id === p || String(id).startsWith(`${p}:`));
@@ -359,6 +359,19 @@ export function installAssembledWindows({ root, config, descriptor: rawDescripto
359
359
  if (listFiles(fs, incoming).join("\n") !== before.join("\n")) abandon("the incoming payload changed its file list while signing");
360
360
  for (const [file, want] of unsigned) if (digest(fs, platformPath(incoming, file)) !== want) abandon(`${file} changed while signing`);
361
361
  try { verifyWindowsPayload({ spec, payload: incoming, profile: "dev", fs }); } catch (error) { removeOrAside(incoming); throw error; }
362
+ // The dev marker's `files` map is written at assembly, before signing, so for every signed executable it names bytes that are no longer on
363
+ // disk (Pulse 4e2f01b1, 2026-11-26: 8 of 14 hashes differed from the installed files). `files` keeps its meaning (the payload as
364
+ // assembled); `installed` is added here, after signing and verification, with the hash of each of those files as it will be installed.
365
+ // The marker is not part of a signature on Windows. A marker that cannot be rewritten is reported and the install goes on: it is no
366
+ // worse than before.
367
+ if (spec.devMarker) {
368
+ const markerFile = platformPath(incoming, spec.devMarker);
369
+ try {
370
+ const marker = JSON.parse(fs.readFileSync(markerFile, "utf8"));
371
+ marker.installed = Object.fromEntries(Object.keys(marker.files ?? {}).map((file) => [file, digest(fs, platformPath(incoming, file))]));
372
+ fs.writeFileSync(markerFile, `${JSON.stringify(marker, null, 2)}\n`);
373
+ } catch (error) { d.log(`right-release dev: ${spec.devMarker} could not record the installed hashes (${error.message}); its files map still lists the pre-signing hashes`); }
374
+ }
362
375
 
363
376
  // 2. Stop: the background task and everything that runs from the install folder.
364
377
  const exe = descriptor.stop.process ? path.join(dir, descriptor.stop.process) : null;
package/local-publish.mjs CHANGED
@@ -777,7 +777,7 @@ export async function compileLocalUnit(kind, argv, { env = process.env, source =
777
777
  if (step.done || step.value?.stage !== "compile") refuse("unit compile did not complete");
778
778
  assertUnitDoor(parsed.workspaceRoot, "compile", env, identity, source);
779
779
  const state = Object.freeze({});
780
- unitStages.set(state, { runner, parsed, identity, source, stage: "compile", compileRequests: [...(step.value.brokerRequests ?? [])] });
780
+ unitStages.set(state, { runner, parsed, identity, source, stage: "compile", compileRequests: [...(step.value.brokerRequests ?? [])], tests: step.value.tests ?? null });
781
781
  return state;
782
782
  } catch (error) { await runner.return(); throw error; }
783
783
  }
@@ -801,6 +801,8 @@ export const packageLocalUnit = (state, { env = process.env } = {}) => advanceLo
801
801
  export const qualifyLocalUnit = (state, { env = process.env } = {}) => advanceLocalUnit(state, "package", "qualify", env);
802
802
  /** The broker request ids of this process's completed compile stage (the package stage's ride on its result). */
803
803
  export const localUnitCompileRequests = (state) => [...(unitStages.get(state)?.compileRequests ?? [])];
804
+ /** The compile stage's test counts ({ executed, skipped, ignored, assetGated }), or null when the unit ran no test step that reported any. */
805
+ export const localUnitCompileTests = (state) => unitStages.get(state)?.tests ?? null;
804
806
  export async function closeLocalUnit(state) {
805
807
  const entry = unitStages.get(state);
806
808
  if (entry) { unitStages.delete(state); await entry.runner.return(); }
@@ -962,7 +964,9 @@ async function* publishUnitStages(parsed, deps, batch) {
962
964
  const verdict = judgeUnit({ name: unit, steps: steps.map((s) => ({ ...s, unit: plan.id })), allowNoTests: true, allowIgnored: ignoredAllowed ? [unit] : [], allowMissingAssets: isAssetGated ? [unit] : [] });
963
965
  if (verdict.status === "fail" || steps.some((s) => s.failed > 0)) refuse(`${plan.id} not qualified: ${verdict.problems.join("; ") || "failed tests reported"}`);
964
966
  log(`[right-release] ${plan.id}: ${verdict.executed} passed, 0 failed, ${verdict.skipped} skipped, ${verdict.ignored} ignored${isAssetGated ? " (asset-gated: RIGHTKIT_REQUIRE_ASSETS=0, skips recorded)" : ""}`);
965
- const packageEnv = yield { stage: "compile", kind, name: unit, version, commit: head, brokerRequests: brokerRequests.splice(0) };
967
+ // The test counts travel with the compile result (rightkit#1754): `skipped` counts SKIP marker lines, so a unit whose asset-gated tests
968
+ // returned early is told from one whose tests ran.
969
+ const packageEnv = yield { stage: "compile", kind, name: unit, version, commit: head, brokerRequests: brokerRequests.splice(0), tests: { executed: verdict.executed, skipped: verdict.skipped, ignored: verdict.ignored, assetGated: Boolean(isAssetGated) } };
966
970
  if (packageEnv) Object.assign(env, testEnv({ env: packageEnv }, isAssetGated));
967
971
 
968
972
  // Availability is a publication/qualification precondition, not a compile precondition.
@@ -228,6 +228,19 @@ export function planMacSigning({ entries, nestedCode = [], nestedSigning, root,
228
228
  const apps = entries.map((entry) => entry.file).filter((file) => /\.app\/?$/.test(file)).map((file) => file.replace(/\/+$/, ""));
229
229
  for (const app of apps) {
230
230
  const own = [...byPath.values()].filter((item) => item.file.startsWith(app + path.sep) || item.file.startsWith(`${app}/`));
231
+ // A per-path sign.entitlements entry reaches nested code only: the bundle and its main executable are signed by the bundle's own
232
+ // sign.prePackageFiles entry. A key naming either, or an exact key naming no nested code at all, used to be dropped in silence and the
233
+ // binary shipped hardened with no entitlements (HeardRight's macOS config, found by reading 2026-11-26). It is refused here, where the
234
+ // main executable's name is known, with the message sign.nestedCode already gives for the same mistake.
235
+ if (nestedSigning.entitlements && typeof nestedSigning.entitlements === "object" && !Array.isArray(nestedSigning.entitlements)) {
236
+ const mainRelative = `Contents/MacOS/${mainName(app)}`;
237
+ const nestedRelative = new Set(own.map((item) => path.relative(app, item.file).split(path.sep).join("/")));
238
+ for (const key of Object.keys(nestedSigning.entitlements)) {
239
+ const normalized = key.replace(/^\.\/+/, "").replace(/\/+$/, "");
240
+ if (normalized === "." || normalized === "" || normalized === mainRelative) throw invalid(`sign.entitlements[${JSON.stringify(key)}]: the bundle and its main executable are signed with the bundle; set entitlements on its sign.prePackageFiles entry ({ file, entitlements }). A per-path entry applies to nested code only`);
241
+ if (!/[*?]/.test(normalized) && !nestedRelative.has(normalized)) throw invalid(`sign.entitlements[${JSON.stringify(key)}]: names no nested code inside ${path.basename(app)}; the entry would be ignored and the file signed without entitlements`);
242
+ }
243
+ }
231
244
  let settings;
232
245
  try { settings = resolveSettings(own.map((item) => item.file), { app, sign: nestedSigning, root: root ?? process.cwd() }); }
233
246
  catch (error) { throw invalid(error.message); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.88",
3
+ "version": "0.6.90",
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",
@@ -178,6 +178,9 @@ export async function publishLocalCargo(argv, { run = spawnSync, log = console.l
178
178
  const problems = compileReportProblems(report, { name, version, commit, tree });
179
179
  if (problems.length) fail(`the compile report does not prove cargo:${name} ${version} at ${commit}: ${problems.join("; ")}`);
180
180
  log(`publish-local: compile report ok for cargo:${name} ${version} at ${commit.slice(0, 12)} (executor ${report.executor ?? (report.schema === UNIT_LIST_COMPILE_SCHEMA ? `broker seam, unit-list run ${report.runId}` : report.schema === UNIT_RESULT_SCHEMA ? "broker seam, together compile" : "unknown")})`);
181
+ // What the unit's tests did, when the report carries it: a skipped asset-gated test (a SKIP marker line) is said, never counted as run.
182
+ const unitTests = report?.stages?.compile?.tests;
183
+ if (unitTests && Number.isInteger(unitTests.executed)) log(`publish-local: tests of cargo:${name}: ${unitTests.executed} passed, ${unitTests.skipped ?? 0} skipped${(unitTests.skipped ?? 0) > 0 ? " (a skipped test returned early and did not exercise what it needs)" : ""}, ${unitTests.ignored ?? 0} ignored`);
181
184
  // The broker's cargo, run directly: package and publish --no-verify compile nothing (GC-A11).
182
185
  const pathKey = platform === "win32" ? (Object.keys(env).find((k) => k.toUpperCase() === "PATH") ?? "Path") : "PATH";
183
186
  const direct = directCargoPath({ env: { ...env, PATH: env[pathKey] }, platform, gateWrappers: true });
@@ -13,7 +13,7 @@ import { defaultReleaseConfigFile, importReleaseConfig } from "./release-config.
13
13
  import { assertPrimaryReleaseCheckout } from "./release-invocation.mjs";
14
14
  import { assertCleanSource } from "./source-gate.mjs";
15
15
  import { verifyPublicationRelease, PublicationError, assertArtifactUnchanged, digestBytes } from "./publication-artifacts.mjs";
16
- import { uploadVerifiedR2Artifact } from "./r2-verified-upload.mjs";
16
+ import { putVerifiedR2Artifact } from "./r2-verified-upload.mjs";
17
17
  import { verifyPlatformTrust } from "./github-release.mjs";
18
18
  import { admitInstalledQa } from "./release-qa-audit.mjs";
19
19
  import { RIGHT_SUITE_API_ORIGIN, RIGHT_SUITE_GATED_ARTIFACT_HOST, RIGHT_SUITE_PUBLIC_INSTALLER_BASE } from "./suite-api.generated.mjs";
@@ -212,7 +212,7 @@ if (tier === "patch") {
212
212
  if (!appInstallerKind) artifactFile(artifact.signature);
213
213
  if (!uploadedKeys.has(installerKey)) {
214
214
  console.log(`${dryRun ? "[dry-run] " : ""}UPLOAD public/${installerKey}`);
215
- if (!dryRun) uploadVerifiedR2Artifact(verifiedArtifact(file), installerKey, "public", { cwd: root });
215
+ if (!dryRun) await putVerifiedR2Artifact(verifiedArtifact(file), installerKey, "public");
216
216
  uploadedKeys.add(installerKey);
217
217
  }
218
218
  const signature = dryRun ? `<signature:${artifact.signature ?? "msix-authenticode"}>` : signatureFor(artifact);
@@ -234,7 +234,7 @@ if (tier === "patch") {
234
234
  const file = artifactFile(installer.file);
235
235
  if (!uploadedKeys.has(installer.key)) {
236
236
  console.log(`${dryRun ? "[dry-run] " : ""}UPLOAD public/${installer.key}`);
237
- if (!dryRun) uploadVerifiedR2Artifact(verifiedArtifact(file), installer.key, "public", { cwd: root });
237
+ if (!dryRun) await putVerifiedR2Artifact(verifiedArtifact(file), installer.key, "public");
238
238
  uploadedKeys.add(installer.key);
239
239
  }
240
240
  const metadata = dryRun ? { sha256: null, sizeBytes: null } : await fileMetadata(file);
@@ -248,7 +248,7 @@ if (tier === "patch") {
248
248
  // package came from, so it must outlive the version that replaces it.
249
249
  if (installer.versionedKey && !uploadedKeys.has(installer.versionedKey)) {
250
250
  console.log(`${dryRun ? "[dry-run] " : ""}UPLOAD public/${installer.versionedKey}`);
251
- if (!dryRun) uploadVerifiedR2Artifact(verifiedArtifact(file), installer.versionedKey, "public", { cwd: root });
251
+ if (!dryRun) await putVerifiedR2Artifact(verifiedArtifact(file), installer.versionedKey, "public");
252
252
  uploadedKeys.add(installer.versionedKey);
253
253
  }
254
254
  }
@@ -317,7 +317,7 @@ for (const artifact of artifacts) {
317
317
  if (!appInstallerKind) artifactFile(artifact.signature);
318
318
  if (!uploadedKeys.has(artifact.key)) {
319
319
  console.log(`${dryRun ? "[dry-run] " : ""}UPLOAD private/${artifact.key}`);
320
- if (!dryRun) uploadVerifiedR2Artifact(verifiedArtifact(file), artifact.key, "private", { cwd: root });
320
+ if (!dryRun) await putVerifiedR2Artifact(verifiedArtifact(file), artifact.key, "private");
321
321
  uploadedKeys.add(artifact.key);
322
322
  }
323
323
  const signature = dryRun ? `<signature:${artifact.signature ?? "msix-authenticode"}>` : signatureFor(artifact);
@@ -170,6 +170,23 @@ export async function uploadMultipart({ file, evidence, bucket, key, credentials
170
170
  } finally { closeSync(fd); }
171
171
  }
172
172
 
173
+ /**
174
+ * Upload `body` (a Buffer below R2_MULTIPART_THRESHOLD_BYTES) to `bucket/key` in one signed PutObject. Its sha256 and size must equal `evidence`
175
+ * before anything is sent, so an object that does not match the evidence is never created; the caller still reads the remote bytes back with
176
+ * streamObjectDigest. This replaces `pnpm dlx wrangler r2 object put` on the publication path: no child process, no credential leaves this process,
177
+ * nothing is downloaded at publish time. Returns { sizeBytes }.
178
+ */
179
+ export async function putObject({ body, evidence, bucket, key, credentials, account, fetchImpl, sleep }) {
180
+ if (!Buffer.isBuffer(body)) throw new PublicationError("PUBLICATION_ROUTE_INVALID", "putObject takes the verified bytes as a Buffer");
181
+ if (body.length >= R2_MULTIPART_THRESHOLD_BYTES) throw new PublicationError("PUBLICATION_ROUTE_INVALID", `an object of ${body.length} bytes goes up as a multipart upload`);
182
+ if (evidence.sizeBytes !== undefined && body.length !== evidence.sizeBytes) throw new PublicationError("PUBLICATION_SIZE_MISMATCH", `artifact size mismatch: ${key}`);
183
+ const digest = sha256Hex(body);
184
+ if (digest !== evidence.sha256) throw new PublicationError("PUBLICATION_HASH_MISMATCH", `artifact sha256 mismatch: ${key}`);
185
+ const client = s3Client({ bucket, credentials, account, fetchImpl, sleep });
186
+ await client.send("PUT", key, { body, payloadHash: digest });
187
+ return { sizeBytes: body.length };
188
+ }
189
+
173
190
  /** One signed GetObject response (optionally `range: "bytes=N-"`): the body is streamed by the caller. Throws with the HTTP status only. */
174
191
  export async function getObject({ bucket, key, credentials, account, fetchImpl, sleep, range }) {
175
192
  const client = s3Client({ bucket, credentials, account, fetchImpl, sleep });
@@ -1,7 +1,46 @@
1
1
  import path from "node:path";
2
2
  import { spawnSync } from "./background-process.mjs";
3
- import { assertArtifactUnchanged, PublicationError, verifyArtifactFile } from "./publication-artifacts.mjs";
4
- import { deriveR2S3Credentials, R2_ACCOUNT_ID, R2_MULTIPART_THRESHOLD_BYTES, streamObjectDigest, uploadMultipart } from "./r2-s3-multipart.mjs";
3
+ import { assertArtifactUnchanged, PublicationError, readVerifiedArtifact, verifyArtifactFile } from "./publication-artifacts.mjs";
4
+ import { deriveR2S3Credentials, putObject, R2_ACCOUNT_ID, R2_MULTIPART_THRESHOLD_BYTES, streamObjectDigest, uploadMultipart } from "./r2-s3-multipart.mjs";
5
+
6
+ const validRoute = (key, bucket) => ["public", "private"].includes(bucket) && /^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(key ?? "") && !key.includes("..");
7
+
8
+ // One in-process transport for every object (rightkit#1754): no child process, so no credential is carried to a broker job (BROKER-CONTRACT D4)
9
+ // and nothing is downloaded at publish time. `bytes` (already verified) go up in one PutObject; without them the file goes up as a multipart
10
+ // upload. Either way the remote bytes are read back through a sha256 and a byte counter and must equal the evidence.
11
+ async function inProcessUpload({ file, bytes, artifact, key, bucket, env, fetchImpl, sleep }) {
12
+ const bucketName = bucket === "public" ? "rightapps-downloads" : "rightapps-updates";
13
+ const target = `${bucketName}/${key}`;
14
+ const cleanEnv = { ...env, CLOUDFLARE_ACCOUNT_ID: env.CLOUDFLARE_ACCOUNT_ID || R2_ACCOUNT_ID };
15
+ for (const name of ["CLOUDFLARE_API_KEY", "CLOUDFLARE_EMAIL", "CF_API_KEY", "CF_EMAIL"]) delete cleanEnv[name];
16
+ const credentials = await deriveR2S3Credentials(cleanEnv.CLOUDFLARE_API_TOKEN, { account: cleanEnv.CLOUDFLARE_ACCOUNT_ID, fetchImpl });
17
+ const transport = { bucket: bucketName, key, credentials, account: cleanEnv.CLOUDFLARE_ACCOUNT_ID, fetchImpl, sleep };
18
+ try {
19
+ if (bytes) await putObject({ body: bytes, evidence: artifact, ...transport });
20
+ else await uploadMultipart({ file: path.resolve(file), evidence: artifact, ...transport });
21
+ } catch (error) {
22
+ if (error instanceof PublicationError && error.code !== "PUBLICATION_UPLOAD_FAILED") throw error;
23
+ throw new PublicationError("PUBLICATION_UPLOAD_FAILED", `R2 upload failed (${error.message}); inspect remote key ${target}`);
24
+ }
25
+ try {
26
+ const remote = await streamObjectDigest(transport);
27
+ if (remote.sha256 !== artifact.sha256) throw new Error("remote sha256 differs from the evidence");
28
+ if (remote.sizeBytes !== artifact.sizeBytes) throw new Error(`remote size ${remote.sizeBytes} differs from ${artifact.sizeBytes}`);
29
+ } catch (error) {
30
+ throw new PublicationError("PUBLICATION_REMOTE_MISMATCH", `R2 verification failed (${error.message}); remove remote key ${target}`);
31
+ }
32
+ }
33
+
34
+ /**
35
+ * The publication path's upload of one verified artifact (publish-update): the bytes read and hashed at verification go up in process and are
36
+ * read back. An artifact at or above R2_MULTIPART_THRESHOLD_BYTES goes up from its file as a multipart upload after the file is checked unchanged.
37
+ */
38
+ export async function putVerifiedR2Artifact(artifact, key, bucket, { env = process.env, fetchImpl, sleep } = {}) {
39
+ if (!validRoute(key, bucket)) throw new PublicationError("PUBLICATION_ROUTE_INVALID", "invalid R2 publication route");
40
+ const bytes = assertArtifactUnchanged(artifact);
41
+ await inProcessUpload({ file: artifact.file, bytes: bytes.length < R2_MULTIPART_THRESHOLD_BYTES ? bytes : null, artifact, key, bucket, env, fetchImpl, sleep });
42
+ return artifact;
43
+ }
5
44
 
6
45
  // Wrangler's pipe input transports the verified buffer, with no path lookup by its child.
7
46
  export function uploadVerifiedR2Artifact(artifact, key, bucket, { run = spawnSync, env = process.env, cwd } = {}) {
@@ -16,38 +55,17 @@ export function uploadVerifiedR2Artifact(artifact, key, bucket, { run = spawnSyn
16
55
  }
17
56
 
18
57
  // Path-only large-file transport: success requires remote bytes matching captured evidence. Objects below R2_MULTIPART_THRESHOLD_BYTES go up in
19
- // one wrangler request; larger ones (wrangler stops at 300 MiB) go through the S3-compatible endpoint as a multipart upload (r2-s3-multipart.mjs,
20
- // #902). Either way the readback streams GetObject through a sha256 and a byte counter, because `wrangler r2 object get` aborts mid-stream on
21
- // large objects (docs/rules/cloudflare-access.md Rule 6). The S3 credentials are derived in memory from CLOUDFLARE_API_TOKEN and never printed.
58
+ // one PutObject; larger ones go up as a multipart upload (r2-s3-multipart.mjs, #902), both through the S3-compatible endpoint in this process
59
+ // (rightkit#1754: wrangler, a child process, is off this path). Either way the readback streams GetObject through a sha256 and a byte counter
60
+ // (docs/rules/cloudflare-access.md Rule 6). The S3 credentials are derived in memory from CLOUDFLARE_API_TOKEN and never printed.
22
61
  // The order the callers keep is immutable object -> signed envelope -> pointer, and a readback that differs from the evidence is
23
62
  // PUBLICATION_REMOTE_MISMATCH.
24
63
  export async function uploadVerifiedR2File(file, evidence, key, bucket, { run = spawnSync, env = process.env, cwd, dryRun = false, fetchImpl, sleep } = {}) {
25
64
  if (!["public", "private"].includes(bucket) || !/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(key ?? "") || key.includes("..")) throw new PublicationError("PUBLICATION_ROUTE_INVALID", "invalid R2 publication route");
26
65
  const artifact = verifyArtifactFile(file, evidence);
27
66
  if (dryRun) return artifact;
28
- const bucketName = bucket === "public" ? "rightapps-downloads" : "rightapps-updates";
29
- const target = `${bucketName}/${key}`;
30
- const cleanEnv = { ...env, CLOUDFLARE_ACCOUNT_ID: env.CLOUDFLARE_ACCOUNT_ID || R2_ACCOUNT_ID };
31
- for (const name of ["CLOUDFLARE_API_KEY", "CLOUDFLARE_EMAIL", "CF_API_KEY", "CF_EMAIL"]) delete cleanEnv[name];
32
- const credentials = await deriveR2S3Credentials(cleanEnv.CLOUDFLARE_API_TOKEN, { account: cleanEnv.CLOUDFLARE_ACCOUNT_ID, fetchImpl });
33
- const transport = { bucket: bucketName, key, credentials, account: cleanEnv.CLOUDFLARE_ACCOUNT_ID, fetchImpl, sleep };
34
- if (artifact.sizeBytes >= R2_MULTIPART_THRESHOLD_BYTES) {
35
- try { await uploadMultipart({ file: path.resolve(file), evidence: artifact, ...transport }); }
36
- catch (error) {
37
- if (error instanceof PublicationError && error.code !== "PUBLICATION_UPLOAD_FAILED") throw error;
38
- throw new PublicationError("PUBLICATION_UPLOAD_FAILED", `R2 multipart upload failed (${error.message}); inspect remote key ${target}`);
39
- }
40
- } else {
41
- const options = { cwd, env: cleanEnv, windowsHide: true, shell: process.platform === "win32", encoding: "utf8" };
42
- const result = run("pnpm", ["dlx", "wrangler@4", "r2", "object", "put", target, "--file", path.resolve(file), "--remote"], { ...options, stdio: "inherit" });
43
- if (result.error || result.status !== 0) throw new PublicationError("PUBLICATION_UPLOAD_FAILED", `R2 upload failed; inspect remote key ${target}`);
44
- }
45
- try {
46
- const remote = await streamObjectDigest(transport);
47
- if (remote.sha256 !== artifact.sha256) throw new Error("remote sha256 differs from the evidence");
48
- if (remote.sizeBytes !== artifact.sizeBytes) throw new Error(`remote size ${remote.sizeBytes} differs from ${artifact.sizeBytes}`);
49
- } catch (error) {
50
- throw new PublicationError("PUBLICATION_REMOTE_MISMATCH", `R2 verification failed (${error.message}); remove remote key ${target}`);
51
- }
67
+ // Below the multipart threshold the bytes are read once and verified again, then go up in one PutObject; above it the file goes up multipart.
68
+ const bytes = artifact.sizeBytes < R2_MULTIPART_THRESHOLD_BYTES ? readVerifiedArtifact(file, evidence).bytes : null;
69
+ await inProcessUpload({ file, bytes, artifact, key, bucket, env, fetchImpl, sleep });
52
70
  return artifact;
53
71
  }
@@ -42,3 +42,18 @@ export function releasePinFloorProblem({ packageJsonText, installedVersion = nul
42
42
  if (installedVersion !== null && compareVersions(installedVersion, floor) === -1) return { code: RELEASE_PIN_BELOW_FLOOR, message: `${RELEASE_PIN_BELOW_FLOOR}: the installed ${PACKAGE} is ${installedVersion} (${where} asks ${specs.join(", ")}), below the host gate's floor ${floor} for compile stages: its own right-release child would carry non-compiling cargo calls to the broker, which refuses them (GC-A11); ${fix}` };
43
43
  return null;
44
44
  }
45
+
46
+ /**
47
+ * One informational line, or null: the app pins an exact @rightkit/release older than the host gate that is running. Inside a gate stage
48
+ * the host gate's own copy runs whatever the app pins (build-launch.mjs runs this package's own right-release for `pnpm exec right-release`),
49
+ * so this is never a refusal. A command typed by hand in the app runs the pinned copy, which can judge a config by older rules
50
+ * (Pulse, 2026-11-26: its 0.6.82 copy refused a switch class the host gate 0.6.88 accepts). A range pin or no pin says nothing.
51
+ */
52
+ export function releasePinBehindHostNote({ packageJsonText, hostVersion, where = "package.json" }) {
53
+ let manifest;
54
+ try { manifest = JSON.parse(packageJsonText); } catch { return null; }
55
+ const pins = DEPENDENCY_TABLES.map((t) => manifest?.[t]?.[PACKAGE]).filter((v) => typeof v === "string").map(exactPinOf).filter((pin) => pin !== null);
56
+ const older = pins.filter((pin) => compareVersions(pin, hostVersion) === -1).sort((a, b) => compareVersions(a, b));
57
+ if (!older.length) return null;
58
+ return `${where} pins ${PACKAGE}@${older[0]}; the host gate is ${hostVersion}. The gate's stages run the host gate's copy; a command typed by hand in the app runs the pinned ${older[0]}, whose rules can differ`;
59
+ }
@@ -46,6 +46,31 @@ export function criticalJourneyIds(manifestText, platform) {
46
46
  .map((journey) => String(journey.id)).sort();
47
47
  }
48
48
 
49
+ /**
50
+ * Why the release-critical journeys of `platform` cannot pass one installed-QA run, from the manifest alone; empty when they can.
51
+ * The runner builds once per run (rightkit-qa journeys/run.rs plan_build): the selection is scenario journeys only, or adapter journeys
52
+ * that all name one adapter; and the installed stage needs every release-critical journey of the platform in the one receipt and
53
+ * refuses zero. Asked at the check stage so a manifest that cannot pass is refused before anything compiles.
54
+ */
55
+ export function criticalJourneySelectionProblems(manifestText, platform) {
56
+ const os = PLATFORM_OS[platform];
57
+ if (!os) throw new Error(`unknown platform ${platform}`);
58
+ const journeys = parseToml(manifestText).journey;
59
+ const critical = (Array.isArray(journeys) ? journeys : []).filter((journey) => journey?.release_critical === true && Array.isArray(journey.platforms) && journey.platforms.includes(os));
60
+ if (!critical.length) return [`the journeys manifest declares no release-critical journey for ${os}; zero is never a pass`];
61
+ const problems = [];
62
+ const adapterJourneys = critical.filter((journey) => journey.runner === "adapter");
63
+ const scenarioJourneys = critical.filter((journey) => journey.runner !== "adapter");
64
+ if (adapterJourneys.length && scenarioJourneys.length) {
65
+ problems.push(`the release-critical journeys for ${os} mix adapter journeys (${adapterJourneys.map((j) => j.id).join(", ")}) and scenario journeys (${scenarioJourneys.map((j) => j.id).join(", ")}); one run builds once, so they cannot share the installed-QA run`);
66
+ }
67
+ const adapters = [...new Set(adapterJourneys.map((journey) => String(journey.adapter ?? "")))].sort();
68
+ if (adapters.length > 1) {
69
+ problems.push(`the release-critical journeys for ${os} name ${adapters.length} adapters (${adapters.join(", ")}); one run builds for exactly one adapter, and every release-critical journey must be in the one receipt: put them behind one adapter, or leave one journey release-critical`);
70
+ }
71
+ return problems;
72
+ }
73
+
49
74
  /**
50
75
  * Validate a journeys receipt through the runner and against the manifest. Never throws for a refusal.
51
76
  * Returns { ok, problems, block }; `block` is the `journeys` section for the QA receipt (null when nothing readable).
@@ -439,7 +439,32 @@ const DYNAMIC_READS = [
439
439
  // Builtins every JS runtime sets; they select nothing and are not part of the inventory.
440
440
  const JS_BUILTINS = new Set(["MODE", "DEV", "PROD", "BASE_URL", "SSR", "NODE_ENV"]);
441
441
 
442
+ // In a git checkout the walk reads what git knows: tracked files, and untracked files the checkout's ignore rules do not ignore (a new source
443
+ // file not yet committed is still judged). It does not descend into nested repositories, so the agent worktrees under `.claude/worktrees`
444
+ // (each a whole copy of the repository) and ignored backup folders are not read. A gate stage's snapshot has no git directory and is walked
445
+ // on disk as before; it holds only the commit's files. Before this, a doctor run in a primary checkout reported 228 findings where the
446
+ // snapshot had 2 (Pulse 0d781b61, 2026-11-26). Returns paths relative to `root` with `/`, or null when `root` is not in a git work tree.
447
+ function gitListedFiles(root) {
448
+ let r;
449
+ try { r = spawnSync("git", ["-C", root, "ls-files", "-z", "--cached", "--others", "--exclude-standard"], { encoding: "utf8", maxBuffer: 1 << 28, windowsHide: true }); } catch { return null; }
450
+ if (!r || r.error || r.status !== 0) return null;
451
+ return String(r.stdout ?? "").split("\0").filter(Boolean);
452
+ }
453
+ function* listedSource(root, skipAbs, listed, wanted) {
454
+ const skipped = [...skipAbs];
455
+ for (const rel of listed) {
456
+ const parts = rel.split("/");
457
+ const name = parts.pop();
458
+ if (parts.some(skipDir)) continue;
459
+ const full = path.join(root, ...parts, name);
460
+ if (skipped.some((dir) => full === dir || full.startsWith(dir + path.sep))) continue;
461
+ if (!wanted(name)) continue;
462
+ try { if (lstatSync(full).isFile()) yield full; } catch { /* listed by git and gone from disk: nothing to read */ }
463
+ }
464
+ }
442
465
  function* walkSource(root, skipAbs = new Set()) {
466
+ const listed = gitListedFiles(root);
467
+ if (listed) { yield* listedSource(root, skipAbs, listed, (name) => SOURCE_EXT.has(path.extname(name)) && !TEST_FILE.test(name)); return; }
443
468
  const stack = [root];
444
469
  while (stack.length) {
445
470
  const dir = stack.pop();
@@ -471,6 +496,8 @@ export function envHelperPatterns(envHelpers, problems = []) {
471
496
 
472
497
  // Xcode and SwiftPM project files, for the Swift Release-configuration check.
473
498
  function* walkProjectFiles(root, skipAbs = new Set()) {
499
+ const listed = gitListedFiles(root);
500
+ if (listed) { yield* listedSource(root, skipAbs, listed, (name) => name === "project.pbxproj" || name === "Package.swift" || /\.xcconfig$/.test(name)); return; }
474
501
  const stack = [root];
475
502
  while (stack.length) {
476
503
  const dir = stack.pop();
package/release.mjs CHANGED
@@ -454,6 +454,13 @@ if (!rejectBlocked("target-checks", ["target"], "the target checks (signed, medi
454
454
  if (opts.platform === "mac") {
455
455
  if (target.signingContract !== MACOS_PORTABLE_SIGNING_CONTRACT) reject("mac-signing-contract", `${app} mac must declare signingContract: ${MACOS_PORTABLE_SIGNING_CONTRACT}`);
456
456
  if (!target.prePackage?.cmd) reject("mac-prepackage", `${app} mac must declare prePackage to materialize Developer ID signing files`);
457
+ // A string sign.entitlements is the development-signing form (development-signing.mjs reads it for the dev install). Release signing never
458
+ // reads it. With no sign.prePackageFiles entry carrying entitlements the app would be signed hardened with none and nothing would say so
459
+ // (CodeRight until 5603d8560). That combination is refused here, before anything builds; the string beside an entry that does carry
460
+ // entitlements is the dev route's setting and stays allowed.
461
+ if (typeof target.sign?.entitlements === "string" && !(target.sign.prePackageFiles ?? []).some((entry) => entry && typeof entry === "object" && typeof entry.entitlements === "string" && entry.entitlements.trim())) {
462
+ reject("mac-sign-entitlements-string", `${app} mac sign.entitlements is a string, which only development signing reads: release signing would sign the app with no entitlements. Set them on the bundle's sign.prePackageFiles entry ({ file, entitlements })`);
463
+ }
457
464
  if (!target.sign?.prePackageFiles?.length) reject("mac-sign-prepackage-files", `${app} mac must declare at least one sign.prePackageFiles`);
458
465
  else if (!rejectBlocked("mac-signing", ["media-sidecar", "external-bin"], `${app} mac signing config validation (it reads the sidecar and externalBin configs)`)) {
459
466
  await check("mac-signing", [], () => {
@@ -23,7 +23,7 @@
23
23
  "@rightkit/app-update": "0.4.7",
24
24
  "@rightkit/ax": "0.3.2",
25
25
  "@rightkit/blender-worker": "0.1.1",
26
- "@rightkit/ci": "0.3.2",
26
+ "@rightkit/ci": "0.3.3",
27
27
  "@rightkit/config": "0.1.1",
28
28
  "@rightkit/doc-render": "0.2.2",
29
29
  "@rightkit/document-core": "0.2.0",
@@ -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.88",
52
+ "@rightkit/release": "0.6.90",
53
53
  "@rightkit/send-ui": "0.1.0",
54
54
  "@rightkit/settings-ui": "0.7.7",
55
55
  "@rightkit/social-ui": "0.2.1",
@@ -97,7 +97,8 @@
97
97
  "0.2.45",
98
98
  "0.2.49",
99
99
  "0.3.0",
100
- "0.3.1"
100
+ "0.3.1",
101
+ "0.3.2"
101
102
  ],
102
103
  "@rightkit/doc-render": [
103
104
  "0.1.0",
@@ -453,7 +454,9 @@
453
454
  "0.6.84",
454
455
  "0.6.85",
455
456
  "0.6.86",
456
- "0.6.87"
457
+ "0.6.87",
458
+ "0.6.88",
459
+ "0.6.89"
457
460
  ],
458
461
  "@rightkit/settings-ui": [
459
462
  "0.1.0",
@@ -581,7 +584,7 @@
581
584
  "rightkit-agent-tools": "0.4.4",
582
585
  "rightkit-agent-transcript": "0.1.4",
583
586
  "rightkit-agents": "0.2.8",
584
- "rightkit-ai-accounts": "0.1.3",
587
+ "rightkit-ai-accounts": "0.1.4",
585
588
  "rightkit-ai-keys": "0.1.1",
586
589
  "rightkit-android": "0.3.3",
587
590
  "rightkit-app-host": "0.1.3",
@@ -600,7 +603,7 @@
600
603
  "rightkit-autostart": "0.1.1",
601
604
  "rightkit-bench": "0.2.1",
602
605
  "rightkit-bot-messaging": "0.3.2",
603
- "rightkit-browser": "0.3.13",
606
+ "rightkit-browser": "0.3.14",
604
607
  "rightkit-cache": "0.2.5",
605
608
  "rightkit-captions": "0.1.1",
606
609
  "rightkit-catalog": "0.1.0",
@@ -730,7 +733,7 @@
730
733
  "rightkit-profile": "0.1.0",
731
734
  "rightkit-prompt-recipes": "0.2.1",
732
735
  "rightkit-pty": "0.1.3",
733
- "rightkit-qa": "0.10.14",
736
+ "rightkit-qa": "0.10.16",
734
737
  "rightkit-record": "0.4.1",
735
738
  "rightkit-reframe": "0.2.1",
736
739
  "rightkit-remote-compute": "0.2.2",
@@ -756,8 +759,8 @@
756
759
  "rightkit-sync-keys": "0.1.0",
757
760
  "rightkit-sysmem": "0.1.0",
758
761
  "rightkit-system-monitor": "0.3.2",
759
- "rightkit-tauri-shell": "0.8.10",
760
- "rightkit-terminal-ui": "0.1.9",
762
+ "rightkit-tauri-shell": "0.8.11",
763
+ "rightkit-terminal-ui": "0.2.0",
761
764
  "rightkit-text-polish": "0.1.4",
762
765
  "rightkit-theme": "0.1.1",
763
766
  "rightkit-time": "0.1.5",
@@ -902,7 +905,7 @@
902
905
  "@rightkit/app-shell": "0.6.2",
903
906
  "@rightkit/app-update": "0.4.4",
904
907
  "@rightkit/ax": "0.3.2",
905
- "@rightkit/ci": "0.3.1",
908
+ "@rightkit/ci": "0.3.2",
906
909
  "@rightkit/doc-render": "0.2.1",
907
910
  "@rightkit/git": "0.2.42",
908
911
  "@rightkit/hooks": "0.1.2",
@@ -921,7 +924,7 @@
921
924
  "@rightkit/qa": "0.7.0",
922
925
  "@rightkit/qa-chrome": "0.1.12",
923
926
  "@rightkit/react-shell": "0.7.7",
924
- "@rightkit/release": "0.6.87",
927
+ "@rightkit/release": "0.6.89",
925
928
  "@rightkit/settings-ui": "0.7.4",
926
929
  "@rightkit/shell": "0.1.1",
927
930
  "@rightkit/tauri": "0.4.3",
@@ -975,7 +978,8 @@
975
978
  ],
976
979
  "rightkit-ai-accounts": [
977
980
  "0.1.1",
978
- "0.1.2"
981
+ "0.1.2",
982
+ "0.1.3"
979
983
  ],
980
984
  "rightkit-ai-keys": [
981
985
  "0.1.0"
@@ -1053,7 +1057,8 @@
1053
1057
  "0.3.5",
1054
1058
  "0.3.6",
1055
1059
  "0.3.11",
1056
- "0.3.12"
1060
+ "0.3.12",
1061
+ "0.3.13"
1057
1062
  ],
1058
1063
  "rightkit-cache": [
1059
1064
  "0.2.0",
@@ -1535,7 +1540,9 @@
1535
1540
  "0.10.10",
1536
1541
  "0.10.11",
1537
1542
  "0.10.12",
1538
- "0.10.13"
1543
+ "0.10.13",
1544
+ "0.10.14",
1545
+ "0.10.15"
1539
1546
  ],
1540
1547
  "rightkit-qa-driver": [
1541
1548
  "0.3.0",
@@ -1674,7 +1681,8 @@
1674
1681
  "0.6.0",
1675
1682
  "0.8.2",
1676
1683
  "0.8.7",
1677
- "0.8.9"
1684
+ "0.8.9",
1685
+ "0.8.10"
1678
1686
  ],
1679
1687
  "rightkit-text-polish": [
1680
1688
  "0.1.1",
@@ -1898,7 +1906,8 @@
1898
1906
  "0.1.5",
1899
1907
  "0.1.6",
1900
1908
  "0.1.7",
1901
- "0.1.8"
1909
+ "0.1.8",
1910
+ "0.1.9"
1902
1911
  ],
1903
1912
  "rightkit-timeline": [
1904
1913
  "0.1.1"
@@ -452,7 +452,14 @@ export function verifySnapshotStore({ checkout, snapshot, commit, tree, ledger,
452
452
  const message = miss && missingName
453
453
  ? `root ${root}: ${missingName} is missing from the store ${storeDir} (offline, no network fallback); install the checkout's dependencies so the store holds it, then run the check again`
454
454
  : `root ${root}: the offline store check failed (store ${storeDir}): ${diagnostic.codes.join(", ") || `exit ${Number.isInteger(r?.status) ? r.status : "unknown"}`}`;
455
- throw new CheckError(`${message}; ${diagnostic.detail}`);
455
+ // pnpm's own text is never printed (it can carry registry addresses; rightkit#1505 keeps codes and a hash only). The two metadata codes
456
+ // say little on their own, so their meaning on an OFFLINE check is spelled out (Pulse, 2026-11-26: the cause behind them was pnpm's
457
+ // minimum-release-age rule holding back a package published an hour earlier, which this command's output never named).
458
+ const metadataMiss = !(miss && missingName) && diagnostic.codes.some((code) => code === "ERR_PNPM_NO_OFFLINE_META" || code === "ERR_PNPM_META_FETCH_FAIL");
459
+ const meaning = metadataMiss
460
+ ? "; on this offline check those codes mean the store has no metadata for a version the lockfile names: either the checkout's dependencies were not installed after the lockfile changed (install them, then run the check again), or pnpm's minimum-release-age rule is holding back a version published within its window (see minimumReleaseAge and minimumReleaseAgeExclude in the root's pnpm settings)"
461
+ : "";
462
+ throw new CheckError(`${message}${meaning}; ${diagnostic.detail}`);
456
463
  }
457
464
  records.push({ root, storeDir, storeSource: source, pnpm: version, pinned: pin, lockfileSha256: crypto.createHash("sha256").update(fs.readFileSync(path.join(dir, "pnpm-lock.yaml"))).digest("hex"), ms });
458
465
  }
package/unit-gate.mjs CHANGED
@@ -394,7 +394,7 @@ export async function runUnitGate({ selector, to, root, commonDir, commit, tree,
394
394
  const runtime = hash(runtimeFiles.map((file) => `${path.relative(runtimeDir, file)}\0${hash(fs.readFileSync(file))}`).join("\n"));
395
395
  const report = { schema: "rightkit.unit-gate-report/1", unit, commit, tree, runtime, executor: executor.kind, stages: {} };
396
396
  const save = () => { if (writeReport) writeReport(report); };
397
- let state, owner, artifact, currentStage, checkTier = null;
397
+ let state, owner, artifact, currentStage, checkTier = null, compileTests = null;
398
398
  // A broker-host run that reaches the qualify stage (--to qualify, or --to release) has its compile and package jobs attested: a pnpm job
399
399
  // is sent the stage nonce, a carried Cargo call a nonce derived from it, both bound to this commit, tree, unit and stage, so each job's
400
400
  // signed receipt can be verified hosted for exactly that and nothing else. `--to qualify` is the sanctioned no-upload route to that
@@ -466,6 +466,7 @@ export async function runUnitGate({ selector, to, root, commonDir, commit, tree,
466
466
  const before = ledgerIds();
467
467
  state = await stageEnv(stage, (runEnv) => owner.compileLocalUnit(unit.kind, argv, { env: runEnv, ...(source ? { source } : {}) }));
468
468
  collectReceipts(stage, owner.localUnitCompileRequests?.(state), before);
469
+ compileTests = owner.localUnitCompileTests?.(state) ?? null;
469
470
  } else if (stage === "package") {
470
471
  const before = ledgerIds();
471
472
  artifact = await stageEnv(stage, (runEnv) => owner.packageLocalUnit(state, { env: runEnv }));
@@ -503,7 +504,7 @@ export async function runUnitGate({ selector, to, root, commonDir, commit, tree,
503
504
  try { command = (stageCommands({ unit, root, platform })[stage] ?? []).map(describeCommand).join("; ") || command; } catch { /* the stage name alone identifies the command */ }
504
505
  directStages[stage] = directStageEvidence({ stage, commit, tree, command, ...(stage === "package" ? { outputSha256: artifact.artifactSha256 } : {}) });
505
506
  }
506
- report.stages[stage] = { ok: true, ...(stage === "package" || stage === "qualify" ? { artifactFile: artifact.artifactFile, artifactSha256: artifact.artifactSha256, ...(artifact.contentSha256 ? { contentSha256: artifact.contentSha256 } : {}) } : {}), ...(receipts[stage] ? { receipts: receipts[stage] } : {}), ...(released ?? {}) };
507
+ report.stages[stage] = { ok: true, ...(stage === "compile" && compileTests ? { tests: compileTests } : {}), ...(stage === "package" || stage === "qualify" ? { artifactFile: artifact.artifactFile, artifactSha256: artifact.artifactSha256, ...(artifact.contentSha256 ? { contentSha256: artifact.contentSha256 } : {}) } : {}), ...(receipts[stage] ? { receipts: receipts[stage] } : {}), ...(released ?? {}) };
507
508
  save();
508
509
  out(`rightkit-gate: [${stage}] ${unit.kind}:${unit.name} passed`);
509
510
  }