@rightkit/release 0.6.48 → 0.6.49

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/assembled-app.mjs CHANGED
@@ -277,8 +277,13 @@ export function resolveNestedApp({ root, entry, spec, profile, deps = {} }) {
277
277
  return app;
278
278
  }
279
279
 
280
- /** CFBundleVersion: the commit count of the source revision. A shallow clone is refused (no network, so no unshallow). */
280
+ /**
281
+ * CFBundleVersion: the commit count of the source revision. A shallow clone is refused (no network, so no unshallow).
282
+ * Inside the door's source split `root` is the snapshot, whose `.git` is a config-only stub that cannot answer: the gate counts the commit in the
283
+ * checkout and hands the number down as RIGHT_BUILD_NUMBER (docs/GATE-CONTRACT.md [GC-A28]); a positive integer there is used as given, anything else falls through to git.
284
+ */
281
285
  export function commitCount({ root, env = process.env, run = spawnSync }) {
286
+ if (/^[1-9][0-9]*$/.test(env.RIGHT_BUILD_NUMBER ?? "")) return env.RIGHT_BUILD_NUMBER;
282
287
  const git = (args) => {
283
288
  const result = run("git", args, { cwd: root, env, encoding: "utf8", windowsHide: true, shell: false });
284
289
  if (result.error || result.status !== 0) refuse("ASSEMBLY_VERSION_UNAVAILABLE", `git ${args.join(" ")} failed (${result.status ?? result.error?.message})`);
@@ -2366,6 +2366,9 @@ export function committedSidecarConfigs({ o, git, commit, appDir = ".", base })
2366
2366
  * staged files become immutable `staged` ledger entries. Returns true when nothing is owed or staging passed.
2367
2367
  */
2368
2368
  export async function stageSidecarsOnce({ o, ds, root, git = null, configs, appDir, cli, commonDir, commit, tree, stage, executor = null, tag = "rightkit-gate:", target = null }) {
2369
+ // The `dev` stage stages in dev mode (RIGHTKIT_BUILD_MODE=dev, the mode `right-release dev` gives every step it runs): the app's own `stage-sidecar` step in its dev build then finds the
2370
+ // same mode, features and bytes already staged and changes nothing. Staged in release mode first, its dev re-stage rewrote pulse-engine, membrane and the receipt, which the ledger refuses as a
2371
+ // changed staged entry (Pulse Mac dev install, 2026-11-06; docs/GATE-CONTRACT.md [GC-A28]).
2369
2372
  // Once per door run PER TARGET TRIPLE: `target` null is the host (the compile stage: stage-sidecar's own default, no `--target` passed), anything else is the triple the
2370
2373
  // package recipe stages for (universal-apple-darwin on a Mac recipe with `stageSidecars`), passed to stage-sidecar as `--target`. stage-sidecar is a no-op for a target whose
2371
2374
  // receipt and files are already current, so the recipe's own prepare step afterwards changes nothing.
@@ -2386,7 +2389,7 @@ export async function stageSidecarsOnce({ o, ds, root, git = null, configs, appD
2386
2389
  let r;
2387
2390
  try {
2388
2391
  o.out(`${tag} [${stage}] right-release stage-sidecar --config ${path.join(ds.path, config)}${target ? ` --target ${target}` : ""} (from the snapshot ${ds.path})`);
2389
- r = (o.spawnCapture ?? ((cmd, a, opts) => spawnInherit(cmd, a, { ...opts, encoding: "utf8", maxBuffer: 1 << 26 })))(process.execPath, [cli, "stage-sidecar", "--config", path.join(ds.path, config), ...(target ? ["--target", target] : []), "--json"], { cwd: snapshotAppRootOf(ds.path, appDir), env: carriedEnv(carrier, { ...cleanEnv, ...run.env }) });
2392
+ r = (o.spawnCapture ?? ((cmd, a, opts) => spawnInherit(cmd, a, { ...opts, encoding: "utf8", maxBuffer: 1 << 26 })))(process.execPath, [cli, "stage-sidecar", "--config", path.join(ds.path, config), ...(target ? ["--target", target] : []), "--json"], { cwd: snapshotAppRootOf(ds.path, appDir), env: carriedEnv(carrier, { ...cleanEnv, ...run.env, ...(stage === "dev" ? { RIGHTKIT_BUILD_MODE: "dev" } : {}) }) });
2390
2393
  } finally { endRun(run); }
2391
2394
  const carriedOk = await carrier.finish({ stage });
2392
2395
  if (r?.stderr) o.err(String(r.stderr).trimEnd());
@@ -3517,6 +3520,16 @@ async function runDevTest(o, args, root, git, io, to, appRoot, appDir) {
3517
3520
  }
3518
3521
  const commonDir = path.resolve(root, common);
3519
3522
  const source = ds ? sourceSplitOf({ root, ds, appDir }) : null;
3523
+ // The snapshot's `.git` is a config-only stub, so right-release cannot count commits there (assembled-app.mjs commitCount, ASSEMBLY_VERSION_UNAVAILABLE): the gate
3524
+ // counts the commit in the checkout and hands the number down (docs/GATE-CONTRACT.md [GC-A28]). A shallow history or an unreadable count hands down nothing and says
3525
+ // so; only an app whose build stamps CFBundleVersion needs the number, and right-release refuses there (it cannot count in the stub either).
3526
+ let buildNumber = {};
3527
+ if (ds) {
3528
+ const shallow = git("rev-parse", "--is-shallow-repository");
3529
+ const count = failed(shallow) || text(shallow).trim() === "true" ? null : git("rev-list", "--count", commit);
3530
+ if (count && !failed(count) && /^[1-9][0-9]*$/.test(text(count).trim())) buildNumber = { RIGHT_BUILD_NUMBER: text(count).trim() };
3531
+ else o.out(`${tag} note: no build number for ${commit.slice(0, 12)} (the checkout is shallow or cannot count its history); an app that stamps CFBundleVersion will refuse with ASSEMBLY_VERSION_UNAVAILABLE`);
3532
+ }
3520
3533
  // GB-58 (GATE dev/test exact stage; E19): the selected app's declared sidecars are staged ONCE under this snapshot's ownership before the dependent
3521
3534
  // build, through the same planner and ledger as the compile and package stages (a Tauri crate with externalBin refuses to build without them). The
3522
3535
  // app's own prepare step may stage them too; the ledger's attribution check, not an environment marker, is what keeps that single and exact.
@@ -3541,7 +3554,7 @@ async function runDevTest(o, args, root, git, io, to, appRoot, appDir) {
3541
3554
  // The door's own RightKit runs every sub-step: a dev target's `right-release web-build|stage-sidecar` steps resolve `right-release`
3542
3555
  // on PATH, which found the app's node_modules copy (HeardRight on the Dell, 2026-10-27: the app's 0.6.8 guard refused what the
3543
3556
  // door's 0.6.9 admitted). An installed gate (node_modules/@rightkit/release/bin) has its package's bin shims two levels up.
3544
- const childEnv = carriedEnv(carrier, { ...o.env, ...run.env }, { ...doorPath({ ...o, env: { ...o.env, ...carrier.env } }), ...(pin.dir ? { CARGO_TARGET_DIR: pin.dir } : (pinMulti?.env ?? {})) });
3557
+ const childEnv = carriedEnv(carrier, { ...o.env, ...run.env, ...buildNumber }, { ...doorPath({ ...o, env: { ...o.env, ...carrier.env } }), ...(pin.dir ? { CARGO_TARGET_DIR: pin.dir } : (pinMulti?.env ?? {})) });
3545
3558
  // rightkit#1288: `--to render` builds the app's declared view-render target through the carrier and runs it headless; no right-release child is involved.
3546
3559
  if (to === "render") {
3547
3560
  const rendered = ds ? await runRenderStage({ o, ds, root, appDir, commit, tree, env: childEnv, pinnedTarget: pin.dir ?? null, targetDirs: pinMulti?.targetDirs ?? {}, tag }) : (o.err(`${tag} BLOCKED: --to render runs on the snapshot route only; nothing compiled`), 1);
@@ -3073,7 +3073,7 @@ export const MUTANTS = Object.freeze([
3073
3073
  { nn: "NN29", steps: "S2,S16", what: "the tool-call id of the environment enters every Class A row key", patch: { find: "${rowShape(scan)}`; scanKeys.set(scan.id, full);", replace: "${rowShape(scan)}:${process.env.CODEX_TOOL_CALL_ID ?? \"\"}`; scanKeys.set(scan.id, full);" }, expect: /key differs between identical runs|reuse miss/ },
3074
3074
  { nn: "NN32", steps: "S8", extra: ["--kills", "K02,K02-int"], what: "a dead owner's record is never judged reclaimable (judgeOwner always refuses)", patch: { file: "build-ownership.mjs", find: "if (owner.host !== host) throw busy(`held by pid ${owner.pid} on ${owner.host}`);", replace: "if (true) throw busy(`held by pid ${owner.pid} (MUTANT: a dead owner is never judged reclaimable)`);" }, expect: /reclaimed from|exited/ },
3075
3075
  { nn: "NN40", steps: "S2", compile: true, control: true, what: "the gate starts per-crate `cargo rustdoc` again (two crates of the fixture workspace, two starts)", inject: [spawnLine("rustright", ["cargo", "rustdoc", "-p", "rk-core", "--lib", "--help"]), spawnLine("rustright", ["cargo", "rustdoc", "-p", "rk-util", "--lib", "--help"])], expect: /a cargo rustdoc started/ },
3076
- { nn: "NN41", steps: "S17", control: true, what: "the gate refuses to reuse a cached failure (every failing cache entry is dropped before the run)", inject: ['try { const __fs = process.getBuiltinModule("node:fs"); const __p = process.getBuiltinModule("node:path"); const __d = __p.join(process.cwd(), ".git", "rightkit-gate-cache"); for (const __f of __fs.readdirSync(__d)) { const __x = __p.join(__d, __f); try { if (JSON.parse(__fs.readFileSync(__x, "utf8"))?.row?.status === "fail") __fs.rmSync(__x); } catch { /* not an entry */ } } } catch { /* no cache dir */ }'], expect: /ran again \(a failure must be a cache hit\)/ },
3076
+ { nn: "NN41", steps: "S17", control: true, what: "the gate refuses to reuse a cached failure (every failing cache entry is dropped before the run)", inject: ['try { const __fs = process.getBuiltinModule("node:fs"); const __p = process.getBuiltinModule("node:path"); const __d = __p.join(process.cwd(), ".git", "rightkit-gate-cache"); for (const __f of __fs.readdirSync(__d)) { const __x = __p.join(__d, __f); try { if (JSON.parse(__fs.readFileSync(__x, "utf8"))?.row?.status === "fail") __fs.rmSync(__x); } catch { /* not an entry */ } } } catch { /* no cache dir */ }'], expect: /^S17: (clippy|check|check-features|doc):\S+: failed, .*ran again \(a failure must be a cache hit\)/ },
3077
3077
  { nn: "NN42", steps: "S2", compile: true, control: true, what: "the stage sends one broker command per cross target (two single-target commands of one configuration)", inject: [spawnLine("rustright", ["cargo", "check", "--help", "--target", "aarch64-unknown-linux-gnu"]), spawnLine("rustright", ["cargo", "check", "--help", "--target", "x86_64-pc-windows-msvc"])], expect: /one per target/ },
3078
3078
  { nn: "NN28", steps: "S2", what: "the gate polls for changes with `git status`", inject: [spawnLine("git", ["status", "--short"])], expect: /polling/ },
3079
3079
  ]);
@@ -23,6 +23,7 @@ import { installApp } from "./install-app.mjs";
23
23
  import { previousPathOf } from "./in-place-install.mjs";
24
24
  import { resolveXcodeStorage } from "./ios-host.mjs";
25
25
  import { resolveTargetRoot } from "./cargo-target.mjs";
26
+ import { readSourceSplit } from "./source-split.mjs";
26
27
  import { ASSEMBLED_APP_KIND, AssembledAppError, assembleMacBundle, assembleWindowsPayload, containedRelative, loadStageReceipt, platformPath, resolveAssembly, resolveNestedApp, verifyMacBundle, verifyWindowsPayload } from "./assembled-app.mjs";
27
28
 
28
29
  export { ASSEMBLED_APP_KIND };
@@ -145,7 +146,10 @@ export function buildOuterApp({ root, spec, storage, profile, env = process.env,
145
146
  }
146
147
 
147
148
  export function resolveAssemblyStorage({ root, profile, env, run }) {
148
- return resolveXcodeStorage({ env, run, cwd: root, fallbackRoot: path.join(root, ".right-release", "assembled-app") }); // one Xcode build folder, never one per profile (GC-A15)
149
+ // Inside the door's source split `root` is the snapshot, where `.right-release` is a reserved path (the stage-output ledger refuses it): the fallback build folder
150
+ // stays with the checkout's same app-relative directory, as the release lock and the Linux artifacts do (release.mjs, linux-artifacts.mjs).
151
+ const split = readSourceSplit({ env, cwd: root, run });
152
+ return resolveXcodeStorage({ env, run, cwd: root, fallbackRoot: path.join(split ? split.checkoutAppRoot : root, ".right-release", "assembled-app") }); // one Xcode build folder, never one per profile (GC-A15)
149
153
  }
150
154
 
151
155
  // ---- macOS --------------------------------------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.48",
3
+ "version": "0.6.49",
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.48",
53
+ "@rightkit/release": "0.6.49",
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/snapshot.mjs CHANGED
@@ -594,6 +594,12 @@ function inspectSnapshot({ dir, entries, checkout, commit, platform = process.pl
594
594
 
595
595
  // The ledger's entries, keyed like the walk's, must all be here and byte-identical; anything else the walk met is new.
596
596
  const held = new Map((ledger ?? []).map((e) => [fold(e.path), e]));
597
+ // A tool-created empty directory the commit's own ignore rules ignore (xcodebuild's `.swiftpm/xcode`) holds no byte and is no ledger entry: dropped here, deepest first so a
598
+ // directory left holding only such directories goes too. One the rules do not ignore stays a candidate and is refused below, as are reserved paths (refused above).
599
+ const ignored = neutralIgnored(dir, candidates.map((c) => c.path));
600
+ for (const d of candidates.filter((c) => c.type === "dir" && ignored.has(c.path) && !held.has(fold(c.path))).sort((a, b) => b.path.length - a.path.length)) {
601
+ if (!candidates.some((c) => c !== d && c.path.startsWith(`${d.path}/`))) candidates.splice(candidates.indexOf(d), 1);
602
+ }
597
603
  const seen = new Map(candidates.map((c) => [fold(c.path), c]));
598
604
  for (const [key, want] of held) {
599
605
  const have = seen.get(key);
@@ -609,8 +615,7 @@ function inspectSnapshot({ dir, entries, checkout, commit, platform = process.pl
609
615
  const key = fold(c.path);
610
616
  if (!held.has(key) && !(c.type === "dir" && parents.has(key)) && !admitNew) return problem(`${c.path} is not in the commit's tree and not in the stage-output ledger (new stage outputs are admitted only at the end of a stage)`);
611
617
  }
612
- // Every candidate, ledger or new, must be ignored by the commit's own rules, as the neutral oracle judges them.
613
- const ignored = neutralIgnored(dir, candidates.map((c) => c.path));
618
+ // Every candidate, ledger or new, must be ignored by the commit's own rules, as the neutral oracle judges them (`ignored`, above).
614
619
  // Git's own semantics for a directory: `git status` shows nothing for one whose every entry is ignored (or that holds nothing), even
615
620
  // when no rule names the directory itself (a root rule `src-tauri/gen/schemas/` leaves `src-tauri/gen` unnamed). Judged deepest
616
621
  // first, so a directory counts as ignored exactly when every file and subdirectory below it does; a single unignored file still refuses.
package/stage-ledger.mjs CHANGED
@@ -55,7 +55,7 @@ export function neutralIgnored({ dir, paths, run = spawnSync, env = process.env
55
55
  * Walks `dir` and returns what it holds beyond the commit: `{ entries, problems }`. `tracked` is the set of every path in
56
56
  * `ls-tree <commit>` (posix); `dependencyRoots` the `node_modules` directories the gate installed under 5.09a (posix, relative; their
57
57
  * bytes are bound by the class A environment digest, not here). `entries` are admissible ledger entries; `problems` name every write
58
- * that cannot be one (not ignored, a link, a hard link, reserved, an empty directory, a `.git` holding more than the gate's config).
58
+ * that cannot be one (not ignored, a link, a hard link, reserved, an empty directory the commit's ignore rules do not ignore, a `.git` holding more than the gate's config).
59
59
  */
60
60
  export function walkSnapshot({ dir, tracked, dependencyRoots = new Set(), run = spawnSync, env = process.env, platform = process.platform }) {
61
61
  const f = fold(platform);
@@ -63,7 +63,7 @@ export function walkSnapshot({ dir, tracked, dependencyRoots = new Set(), run =
63
63
  const trackedDirs = new Set();
64
64
  for (const p of tracked) { const parts = f(p).split("/"); for (let i = 1; i < parts.length; i++) trackedDirs.add(parts.slice(0, i).join("/")); }
65
65
  const deps = new Set([...dependencyRoots].map(f));
66
- const candidates = []; const problems = [];
66
+ const candidates = []; const problems = []; const emptyDirs = [];
67
67
  const reserved = (rel) => rel.split("/").find((seg) => LEDGER_RESERVED_SEGMENTS.includes(f(seg)));
68
68
  const walk = (abs, rel) => {
69
69
  let names;
@@ -90,9 +90,10 @@ export function walkSnapshot({ dir, tracked, dependencyRoots = new Set(), run =
90
90
  if (trackedDirs.has(key)) { walk(p, r); continue; }
91
91
  const bad = reserved(r);
92
92
  if (bad) { problems.push(`${r} is under the reserved path segment ${JSON.stringify(bad)} (a stage output is never written there)`); continue; }
93
- const before = candidates.length + problems.length;
93
+ const before = candidates.length + problems.length + emptyDirs.length;
94
94
  walk(p, r);
95
- if (candidates.length + problems.length === before) problems.push(`${r} is an empty directory the commit does not have`);
95
+ // A tool-created empty directory (xcodebuild's `.swiftpm/xcode`) holds no byte: it is judged below like a file, admitted when the commit's own ignore rules ignore it.
96
+ if (candidates.length + problems.length + emptyDirs.length === before) emptyDirs.push(r);
96
97
  continue;
97
98
  }
98
99
  if (!st.isFile()) { problems.push(`${r} is neither a regular file nor a directory`); continue; }
@@ -110,9 +111,10 @@ export function walkSnapshot({ dir, tracked, dependencyRoots = new Set(), run =
110
111
  };
111
112
  walk(dir, "");
112
113
  let ignored;
113
- try { ignored = neutralIgnored({ dir, paths: candidates.map((c) => c.rel), run, env }); }
114
+ try { ignored = neutralIgnored({ dir, paths: [...candidates.map((c) => c.rel), ...emptyDirs], run, env }); }
114
115
  catch (e) { return { entries: [], problems: [...problems, `the ignore rules of the commit could not be evaluated: ${e.message}`] }; }
115
116
  const ignoredFolded = new Set([...ignored].map(f));
117
+ for (const d of emptyDirs) if (!ignoredFolded.has(f(d))) problems.push(`${d} is an empty directory the commit does not have and the commit's own ignore rules do not ignore (an empty directory is admitted only when they do)`);
116
118
  const entries = [];
117
119
  for (const c of candidates) {
118
120
  // A split package stage writes a declared root output (a DMG, an updater tarball) into the snapshot as a generated entry (row 7.04c R-T2 rule 5): it must be