@rightkit/release 0.6.44 → 0.6.45

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.
@@ -1438,10 +1438,18 @@ export async function rightkitDoorRule(o, args, root, git, io, { unitsFileFlag,
1438
1438
  if (unitsFileFlag) {
1439
1439
  const stage = option("--to");
1440
1440
  const given = args.filter((a, i) => a.startsWith("--") && args[i - 1] !== "--units-file" && a !== "--units-file");
1441
- if (given.some((a) => a !== "--to" && a !== "--commit")) { o.err(`${tag} a unit list run takes only --to, --units-file and optional --commit (a receipt is written per unit run: run the unit alone with --receipt-out)`); return { exit: 2 }; }
1441
+ if (given.some((a) => a !== "--to" && a !== "--commit" && a !== "--receipt-dir")) { o.err(`${tag} a unit list run takes only --to, --units-file and optional --commit and --receipt-dir (one receipt file per unit is written into the directory)`); return { exit: 2 }; }
1442
+ const receiptDir = option("--receipt-dir");
1443
+ if (receiptDir !== undefined && (receiptDir.startsWith("--") || !path.isAbsolute(receiptDir))) { o.err(`${tag} --receipt-dir needs an absolute directory`); return { exit: 2 }; }
1444
+ // One Class A for the whole list (rightkit#1505; Adrian, 2026-10-31: "a JSON file that is created at that time"): the first unit's Class A is scoped to
1445
+ // every listed unit's directory (the repeatable --scope), and a pass is remembered for the commit and rule tier, so the other units do not run it again.
1446
+ // Before this, each unit ran its own Class A: 145 s median of a 206 s unit run on 2026-11-04, the same scans on the same commit 168 times.
1447
+ const dirOf = (sel) => { const m = /^(?:npm:@rightkit\/([a-z0-9-]+)|cargo:(rightkit-[a-z0-9-]+))$/.exec(sel); return m ? (m[1] ? `packages/${m[1]}` : `crates/${m[2]}`) : null; };
1448
+ const unitListClassA = { dirs: [...new Set(unitList.map(dirOf).filter(Boolean))], memo: new Map() };
1442
1449
  for (const [i, selector] of unitList.entries()) {
1443
1450
  o.out(`${tag} unit list ${i + 1}/${unitList.length}: ${selector} on commit ${pinned.commit.slice(0, 12)}`);
1444
- const code = await main(["--to", stage, "--unit", selector, "--commit", pinned.commit], io);
1451
+ const receipt = receiptDir === undefined ? [] : ["--receipt-out", path.join(receiptDir, `gate-${selector.replace(/^npm:@rightkit\//, "npm-").replace(/^cargo:/, "")}.json`)];
1452
+ const code = await main(["--to", stage, "--unit", selector, "--commit", pinned.commit, ...receipt], { ...io, unitListClassA });
1445
1453
  if (code !== 0) { o.err(`${tag} BLOCKED: unit ${selector} ended with exit ${code}; ${unitList.length - i - 1} unit(s) of the list did not run`); return { exit: code }; }
1446
1454
  }
1447
1455
  return { exit: 0 };
@@ -2551,7 +2559,17 @@ async function runUnitSnapshot(o, args, root, git, io, option) {
2551
2559
  for (const p of calls.slice(0, 10)) o.err(`${tag} RK_CHECK_ERROR: [unit:${stage}] a cargo call the unit stage made did not complete: ${typeof p === "string" ? p : JSON.stringify(p)}`);
2552
2560
  return calls.length === 0;
2553
2561
  } };
2554
- const runCheck = (tier) => (o.runCheck ?? (() => main(["check", "--commit", ds.commit, "--full-a", "--snapshot", ds.path, "--rule-tier", tier, "--scope", path.posix.dirname(manifest)], { ...io, cwd: root, buildOwnership: own })))(tier);
2562
+ // A unit-list run (--units-file) shares one Class A: scoped to every listed unit's directory, run by the first unit, remembered for the rest.
2563
+ const unitDir = path.posix.dirname(manifest);
2564
+ const shared = io.unitListClassA?.dirs?.includes(unitDir) ? io.unitListClassA : null;
2565
+ const runCheck = async (tier) => {
2566
+ const memoKey = `${ds.commit}:${tier}`;
2567
+ if (shared && shared.memo.get(memoKey) === 0) { o.out(`${tag} class A (${tier} tier) of this unit list already passed on ${ds.commit.slice(0, 12)}: not run again`); return 0; }
2568
+ const scopes = shared ? shared.dirs : [unitDir];
2569
+ const code = await (o.runCheck ?? (() => main(["check", "--commit", ds.commit, "--full-a", "--snapshot", ds.path, "--rule-tier", tier, ...scopes.flatMap((d) => ["--scope", d])], { ...io, cwd: root, buildOwnership: own })))(tier);
2570
+ if (shared && code === 0) shared.memo.set(memoKey, 0);
2571
+ return code;
2572
+ };
2555
2573
  if (toolRun) {
2556
2574
  const { runUnitTool } = await import("../tool-build.mjs");
2557
2575
  return await runUnitTool({ selector, root: ds.path, commonDir: path.resolve(root, text(common).trim()), commit: ds.commit, tree: ds.tree, executor, env: o.env, platform: o.platform, source, envExtra, targetDirs: bound.targetDirs ?? {},
@@ -3201,7 +3219,7 @@ export function doorPath(o, gateFile = o.gateFile ?? fileURLToPath(import.meta.u
3201
3219
  * lookup of a usable rustfmt, which the deferred Rust gate needs).
3202
3220
  */
3203
3221
  /** The gate flags a `--to <stage>` invocation takes (before a `--` separator, after which the arguments belong to right-release), and whether each takes a value. */
3204
- const STAGE_VALUE_FLAGS = Object.freeze(["--to", "--platform", "--tier", "--commit", "--receipt-in", "--receipt-out", "--unit", "--units-file", "--all-units-exception"]);
3222
+ const STAGE_VALUE_FLAGS = Object.freeze(["--to", "--platform", "--tier", "--commit", "--receipt-in", "--receipt-out", "--unit", "--units-file", "--all-units-exception", "--receipt-dir"]);
3205
3223
  const STAGE_BOOLEAN_FLAGS = Object.freeze(["--route"]);
3206
3224
 
3207
3225
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.44",
3
+ "version": "0.6.45",
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.44",
53
+ "@rightkit/release": "0.6.45",
54
54
  "@rightkit/settings-ui": "0.7.1",
55
55
  "@rightkit/social-ui": "0.1.0",
56
56
  "@rightkit/system-ui": "0.1.0",