@rightkit/release 0.6.51 → 0.6.52

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.
@@ -2328,6 +2328,25 @@ export async function closeSnapshotStage({ o, ds, root, stage, step = "stage", t
2328
2328
  const restaged = stage === "package" ? await restagedSidecars({ o, ds, prior, now }) : { paths: new Set(), receipts: new Set(), producers: new Set(), problems: [] };
2329
2329
  problems.push(...restaged.problems);
2330
2330
  for (const [p, e] of prior) if (e.kind === "staged" && !restaged.paths.has(p) && !restaged.receipts.has(p) && !(restaged.producers.has(e.producer?.step) && !now.has(p)) && (!now.has(p) || entryKey(now.get(p)) !== entryKey(e))) problems.push(`${p} is a staged sidecar output and ${now.has(p) ? "changed" : "was removed"} after it was staged (a staged entry is immutable for the door run)`);
2331
+ // Evidence (Pulse Windows dev, 2026-11-06): for each staged entry that changed, its sha256 then and now; for a receipt, the fields that differ.
2332
+ for (const [p, e] of prior) {
2333
+ if (e.kind !== "staged" || !now.has(p) || entryKey(now.get(p)) === entryKey(e) || restaged.paths.has(p) || restaged.receipts.has(p)) continue;
2334
+ o.err(`${tag} staged-change evidence: ${p}: sha256 ${String(e.sha256).slice(0, 16)} at staging (${e.size} bytes) -> ${String(now.get(p).sha256).slice(0, 16)} now (${now.get(p).size} bytes)`);
2335
+ const before = ds.stagedReceipts?.get(p);
2336
+ if (before) {
2337
+ try {
2338
+ const a = JSON.parse(before); const b = JSON.parse(fs.readFileSync(path.join(ds.path, p), "utf8"));
2339
+ for (const k of new Set([...Object.keys(a), ...Object.keys(b)])) if (k !== "files" && JSON.stringify(a[k]) !== JSON.stringify(b[k])) o.err(`${tag} staged-change evidence: ${p}: ${k}: ${JSON.stringify(a[k]).slice(0, 200)} -> ${JSON.stringify(b[k]).slice(0, 200)}`);
2340
+ const byName = (list) => new Map((Array.isArray(list) ? list : []).map((f) => [f.name ?? f.dest, f]));
2341
+ const fa = byName(a.files); const fb = byName(b.files);
2342
+ for (const n of new Set([...fa.keys(), ...fb.keys()])) {
2343
+ const x = fa.get(n) ?? {}; const y = fb.get(n) ?? {};
2344
+ const diff = [...new Set([...Object.keys(x), ...Object.keys(y)])].filter((k) => !["changed", "cached"].includes(k) && JSON.stringify(x[k]) !== JSON.stringify(y[k]));
2345
+ if (diff.length) o.err(`${tag} staged-change evidence: ${p}: files[${n}]: ${diff.map((k) => `${k} ${JSON.stringify(x[k]).slice(0, 80)} -> ${JSON.stringify(y[k]).slice(0, 80)}`).join("; ")}`);
2346
+ }
2347
+ } catch (error) { o.err(`${tag} staged-change evidence: ${p}: the receipts could not be compared (${error.message})`); }
2348
+ }
2349
+ }
2331
2350
  if (problems.length) { for (const p of problems.slice(0, 10)) o.err(`${tag} RK_CHECK_ERROR: [${stage}] ${p}`); return { ok: false, entries: ds.ledger?.entries ?? [] }; }
2332
2351
  // The compile's own verify (snapshot-check.mjs, 5.09d) returned the entries it admitted: they must be the entries this walk found.
2333
2352
  if (Array.isArray(ds.compileAdmitted) && stage === "compile") {
@@ -2456,6 +2475,8 @@ export async function stageSidecarsOnce({ o, ds, root, git = null, configs, appD
2456
2475
  const priorPaths = new Set(before.map((e) => e.path));
2457
2476
  const priorByPath = new Map(before.map((e) => [e.path, e]));
2458
2477
  ds.ledger = { entries: walked.entries.map((e) => (priorPaths.has(e.path) && priorByPath.get(e.path).sha256 === e.sha256 ? priorByPath.get(e.path) : { ...e, kind: "staged", producer: { stage: "sidecar", step: config } })) };
2478
+ // Evidence for a later "changed after it was staged": the receipt exactly as this staging wrote it.
2479
+ if (receiptAbs) { try { (ds.stagedReceipts ??= new Map()).set(receiptAbs, fs.readFileSync(path.join(ds.path, receiptAbs), "utf8")); } catch { /* the close names the change without the field diff */ } }
2459
2480
  }
2460
2481
  return true;
2461
2482
  }
@@ -2536,7 +2557,9 @@ export async function stageWebBuildOnce({ o, ds, root, git = null, appDir, cli,
2536
2557
  try { declared = readDeclaredInputs(ds.path).map((x) => x.split(/[\\/]/).join("/")); }
2537
2558
  catch (e) { if (e instanceof SnapshotRequestError) return true; throw e; } // a malformed declaration refuses in the compile, which names it
2538
2559
  const absent = () => declared.filter((rel) => !(o.exists ?? fs.existsSync)(path.join(ds.path, ...rel.split("/"))));
2539
- if (!absent().length) return true;
2560
+ // Children of this run (the app's own `right-release web-build` step) reuse these outputs instead of rebuilding them (web-build.mjs).
2561
+ const markBuilt = () => { if (declared.length && o.env) o.env.RK_GATE_WEB_BUILT = snapshotAppRootOf(ds.path, appDir); };
2562
+ if (!absent().length) { markBuilt(); return true; }
2540
2563
  const configs = git ? committedWebBuildConfigs({ o, git, commit, appDir, base: ds.path }) : [];
2541
2564
  if (!configs.length) { o.out(`${tag} [${stage}] declared compile input(s) ${absent().join(", ")} are absent from the snapshot and no release config under ${appDir} declares web.build; the compile will report them missing`); return true; }
2542
2565
  const { declaredOutputProblems } = await import("../stage-ledger.mjs");
@@ -2584,6 +2607,7 @@ export async function stageWebBuildOnce({ o, ds, root, git = null, appDir, cli,
2584
2607
  } catch (e) { o.out(`${tag} [${stage}] web-build ${config}: the dist cache was not written (${e.message}); the next run builds again`); }
2585
2608
  }
2586
2609
  }
2610
+ if (!absent().length) markBuilt();
2587
2611
  return true;
2588
2612
  }
2589
2613
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.51",
3
+ "version": "0.6.52",
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",
@@ -50,7 +50,7 @@
50
50
  "@rightkit/qa": "0.7.0",
51
51
  "@rightkit/qa-chrome": "0.1.12",
52
52
  "@rightkit/react-shell": "0.7.3",
53
- "@rightkit/release": "0.6.51",
53
+ "@rightkit/release": "0.6.52",
54
54
  "@rightkit/settings-ui": "0.7.1",
55
55
  "@rightkit/social-ui": "0.1.0",
56
56
  "@rightkit/system-ui": "0.1.0",
package/web-build.mjs CHANGED
@@ -17,6 +17,7 @@
17
17
  // runs only under a live door run. The exported runner checks it again, so no in-process caller spawns a step around it.
18
18
  import path from "node:path";
19
19
  import { pathToFileURL } from "node:url";
20
+ import fs from "node:fs";
20
21
  import { spawnSync } from "./background-process.mjs";
21
22
  import { existsSync, readFileSync } from "node:fs";
22
23
  import { CommandSpecError, loadAppConfig, resolveInvocation, validateStep } from "./command-spec.mjs";
@@ -115,6 +116,11 @@ export async function main(argv = process.argv.slice(2), { env = process.env, re
115
116
  const appRoot = path.dirname(path.resolve(opts.config));
116
117
  const refusal = webBuildDoorRefusal({ appRoot, env, spawnSyncFn, requireDoor });
117
118
  if (refusal) throw doorError(refusal);
119
+ // The door already produced this app's declared web outputs for this run (rightkit-gate stageWebBuildOnce: built, restored from its dist
120
+ // cache, or present in the snapshot): running vite again would rewrite them, and a Tauri crate that embeds them rebuilds and changes after its
121
+ // sidecar was staged (Pulse Windows dev, 2026-11-06). The door's own marker names the app root; anything else builds as before.
122
+ const real = (p) => { try { return fs.realpathSync(p); } catch { return path.resolve(p); } };
123
+ if (env.RK_GATE_WEB_BUILT && real(env.RK_GATE_WEB_BUILT) === real(appRoot)) { log(`right-release web-build: skipped; the door already produced the declared web outputs of ${appRoot} for this run`); return 0; }
118
124
  const { config } = await loadConfig(opts.config);
119
125
  return runWebBuild(planWebBuild(config), { appRoot, env, dryRun: opts.dryRun, spawnSyncFn, requireDoor, log });
120
126
  }