@rightkit/release 0.6.61 → 0.6.62
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/bin/rightkit-gate.mjs +13 -10
- package/class-a-cache-history.mjs +42 -7
- package/gate-serve.mjs +1 -2
- package/package.json +2 -2
- package/rightkit-versions.json +1 -1
- package/snapshot.mjs +0 -1
package/bin/rightkit-gate.mjs
CHANGED
|
@@ -74,6 +74,8 @@
|
|
|
74
74
|
import fs from "node:fs";
|
|
75
75
|
import { createHash, randomUUID } from "node:crypto";
|
|
76
76
|
import { openClassAHistory, openClassBHistory } from "../class-a-cache-history.mjs";
|
|
77
|
+
/** One line, once, when the gate set an unusable cache aside and started an empty one in the same place (class-a-cache-history.mjs). */
|
|
78
|
+
const cacheRestartNote = (o) => ({ store, reason, storeAside }) => (o.out ?? console.log)(`rightkit-gate: cache restarted: ${store} could not be used (${reason}); ${storeAside ? `the old one is kept at ${storeAside}` : "there was no old store to keep"}; every row is checked once more and stored here`);
|
|
77
79
|
import { writeFileAtomic } from "../atomic-write.mjs";
|
|
78
80
|
import { envNamed, gateRunsRoot, resolveManagedRoots } from "../managed-roots.mjs";
|
|
79
81
|
import { resolveBrokerClient, spawnBrokerClient } from "../broker-client.mjs";
|
|
@@ -3451,12 +3453,12 @@ async function runUnionSnapshot({ o, io, root, git, ds, union, unitListClassA })
|
|
|
3451
3453
|
if (!await openSnapshotStage({ o, ds, root, stage: "compile", tag })) return 1;
|
|
3452
3454
|
let code = 1;
|
|
3453
3455
|
// Crates build together (docs/design/2026-11-10-gate-fresh-design.md; Adrian, 2026-11-04: "RK has to build all it's necessary crates together"): a list of crates on a
|
|
3454
|
-
// broker host is compiled by gate/compile.mjs as a few Cargo calls naming every crate, each crate with its own result.
|
|
3455
|
-
//
|
|
3456
|
+
// broker host is compiled by gate/compile.mjs as a few Cargo calls naming every crate, each crate with its own result. No switch selects the per-crate rows
|
|
3457
|
+
// (the RK_GATE_LEGACY_ROWS switch was removed 2026-11-24, rightkit#1514: compiles are combined, GC-A27 NN09).
|
|
3456
3458
|
let together = null;
|
|
3457
3459
|
try {
|
|
3458
3460
|
const ex = (o.resolveExecutor ?? gateResolveExecutor)({ env: o.env, platform: o.platform, exists: o.exists, which: whichIn(o), readFile: o.readFile });
|
|
3459
|
-
if (
|
|
3461
|
+
if (ex?.kind === "broker" && union.selected.every((row) => row.selector.startsWith("cargo:"))) together = { client: brokerClientOf(o, ex) };
|
|
3460
3462
|
} catch { together = null; }
|
|
3461
3463
|
if (together) {
|
|
3462
3464
|
try {
|
|
@@ -4330,8 +4332,9 @@ export async function main(argv, io = {}) {
|
|
|
4330
4332
|
// (snapshot.mjs repositoryOf -> snapshot-git.mjs sealedRepoInfo, cached per canonical path in this process), so the
|
|
4331
4333
|
// common dir is read from that cache, never asked again. An injected spawn (tests) is asked as before.
|
|
4332
4334
|
const commonDir = o.spawn === defaultSpawn ? sealedRepoInfo(snapshotCheckout).commonDir : (() => { const common = o.spawn("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], { cwd: snapshotCheckout }); if (failed(common) || !text(common).trim()) throw new Error("cannot identify Class A cache location"); return text(common).trim(); })();
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
+
// The store has one fixed place per repository; no caller moves it (Adrian, 2026-11-24, rightkit#1514).
|
|
4336
|
+
const storeDir = path.join(commonDir, "rightkit-gate-cache");
|
|
4337
|
+
history = openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir, onRestart: cacheRestartNote(o) });
|
|
4335
4338
|
} catch (error) { o.err(`rightkit-gate: BLOCKED: ${error.message}`); return 1; }
|
|
4336
4339
|
}
|
|
4337
4340
|
const ruleCache = snapshotDir && snapshotCommit && !args.includes("--worktree") && !o.appCheck ? ruleVerdictCache({ checkout: snapshotCheckout, spawn: o.spawn }) : null;
|
|
@@ -5381,9 +5384,9 @@ export async function main(argv, io = {}) {
|
|
|
5381
5384
|
const { files, ids, digestOf } = live;
|
|
5382
5385
|
const under = (dir) => (dir === "." || dir === "" ? files : files.filter((f) => f === dir || f.startsWith(`${dir}/`)));
|
|
5383
5386
|
const objectId = (p) => (ids.has(p) ? ids.get(p) : under(p).length ? digestOf(under(p)) : null);
|
|
5384
|
-
const storeDir =
|
|
5387
|
+
const storeDir = path.join(path.resolve(root, text(common).trim()), "rightkit-gate-cache");
|
|
5385
5388
|
// Nov-18 cache rule applies to every bound full-A form (snapshot, hosted, live), not only guarded snapshot discovery.
|
|
5386
|
-
classAHistory = o[CLASS_A_HISTORY] ?? openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir });
|
|
5389
|
+
classAHistory = o[CLASS_A_HISTORY] ?? openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir, onRestart: cacheRestartNote(o) });
|
|
5387
5390
|
const store = fileScanCache(storeDir);
|
|
5388
5391
|
const listFiles = (dir) => under(dir);
|
|
5389
5392
|
const readBlob = (p) => fs.readFileSync(path.join(liveBase, p), "utf8");
|
|
@@ -5433,10 +5436,10 @@ export async function main(argv, io = {}) {
|
|
|
5433
5436
|
const line = text(r).split(/\r?\n/).find(Boolean);
|
|
5434
5437
|
return line ? (line.split("\t")[0].split(/\s+/)[2] ?? null) : null;
|
|
5435
5438
|
};
|
|
5436
|
-
const storeDir =
|
|
5437
|
-
if (needsForecast) classBHistory = openClassBHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir });
|
|
5439
|
+
const storeDir = path.join(path.resolve(root, text(common).trim()), "rightkit-gate-cache");
|
|
5440
|
+
if (needsForecast) classBHistory = openClassBHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir, onRestart: cacheRestartNote(o) });
|
|
5438
5441
|
// Mixed A+B in one invocation needs its Class A history too; boundFullA opened it above when that block ran.
|
|
5439
|
-
if (needsForecast && !classAHistory && !(snapshotB && o.classAEarlier === true)) classAHistory = o[CLASS_A_HISTORY] ?? openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir });
|
|
5442
|
+
if (needsForecast && !classAHistory && !(snapshotB && o.classAEarlier === true)) classAHistory = o[CLASS_A_HISTORY] ?? openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir, onRestart: cacheRestartNote(o) });
|
|
5440
5443
|
const store = fileScanCache(storeDir);
|
|
5441
5444
|
const listFiles = (dir) => {
|
|
5442
5445
|
const r = git("ls-tree", "-r", "--name-only", "-z", headSha, "--", dir);
|
|
@@ -18,7 +18,18 @@ export function openClassBHistory(options) {
|
|
|
18
18
|
return openHistory(options, "B");
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// A store this gate cannot use (one with no history, or with a history from before Class B was recorded) is set aside under a dated name
|
|
22
|
+
// beside it, and an empty store and history are started in the same fixed place. The gate does this itself and reports it once through
|
|
23
|
+
// `onRestart`; no caller chooses another folder (Adrian, 2026-11-24, rightkit#1514). The Cargo build output is elsewhere and is not touched.
|
|
24
|
+
const stamp = () => new Date().toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
|
|
25
|
+
function setAside(target) {
|
|
26
|
+
let to = target + ".set-aside-" + stamp();
|
|
27
|
+
for (let i = 1; fs.existsSync(to); i += 1) to = target + ".set-aside-" + stamp() + "-" + i;
|
|
28
|
+
fs.renameSync(target, to);
|
|
29
|
+
return to;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function openHistory({ historyRoot, storeDir, onRestart = null }, stage) {
|
|
22
33
|
const label = "Class " + stage;
|
|
23
34
|
const store = path.resolve(storeDir);
|
|
24
35
|
const relative = path.relative(store, path.resolve(historyRoot));
|
|
@@ -42,8 +53,28 @@ function openHistory({ historyRoot, storeDir }, stage) {
|
|
|
42
53
|
if (stage === "B" && document.schema === 1) throw new Error("Class B cache history missing at " + file + " for legacy store " + store + ". Restore verified independent Class B history or select a new store for a declared cold run.");
|
|
43
54
|
return new Map(document.schema === 1 ? document.rows : document.stages[stage]);
|
|
44
55
|
};
|
|
56
|
+
const restart = (reason) => {
|
|
57
|
+
// The old store goes first: if it cannot be moved (a file in it is held open), nothing has changed and the run stops with the reason.
|
|
58
|
+
let storeAside = null; let historyAside = null;
|
|
59
|
+
try {
|
|
60
|
+
if (fs.existsSync(store)) storeAside = setAside(store);
|
|
61
|
+
if (fs.existsSync(file)) historyAside = setAside(file);
|
|
62
|
+
fs.mkdirSync(store, { recursive: true });
|
|
63
|
+
} catch (cause) {
|
|
64
|
+
throw new Error(label + " cache at " + store + " cannot be used (" + reason + ") and could not be set aside: " + (cause.code ?? cause.message));
|
|
65
|
+
}
|
|
66
|
+
save({ schema: 2, namespace, stages: { A: [], B: [] } });
|
|
67
|
+
if (typeof onRestart === "function") onRestart({ store, reason, storeAside, historyAside });
|
|
68
|
+
return new Map();
|
|
69
|
+
};
|
|
45
70
|
let baseline;
|
|
46
|
-
try {
|
|
71
|
+
try {
|
|
72
|
+
const document = read();
|
|
73
|
+
if (stage === "B" && document.schema === 1) {
|
|
74
|
+
const lock = acquireFileLock(file + ".lock", label + " cache history");
|
|
75
|
+
try { const again = read(); baseline = again.schema === 1 ? restart("its history was written before compile results were recorded") : rowsFor(again); } finally { lock.release(); }
|
|
76
|
+
} else baseline = rowsFor(document);
|
|
77
|
+
} catch (error) {
|
|
47
78
|
if (error.code !== "ENOENT") throw error;
|
|
48
79
|
const lock = acquireFileLock(file + ".lock", label + " cache history");
|
|
49
80
|
try {
|
|
@@ -52,14 +83,18 @@ function openHistory({ historyRoot, storeDir }, stage) {
|
|
|
52
83
|
fs.mkdirSync(path.dirname(store), { recursive: true });
|
|
53
84
|
// Exclusive creation establishes a first-use store. An already existing
|
|
54
85
|
// cache without independent evidence must never silently forecast all misses.
|
|
86
|
+
let existing = false;
|
|
55
87
|
try { fs.mkdirSync(store); } catch (cause) {
|
|
56
88
|
if (cause.code !== "EEXIST") throw cause;
|
|
57
|
-
|
|
89
|
+
existing = true;
|
|
90
|
+
}
|
|
91
|
+
if (existing) baseline = restart("it has no history");
|
|
92
|
+
else {
|
|
93
|
+
baseline = new Map();
|
|
94
|
+
// Both classes acquire their independent first-use evidence in one
|
|
95
|
+
// atomic write, before either class may populate the physical store.
|
|
96
|
+
save({ schema: 2, namespace, stages: { A: [], B: [] } });
|
|
58
97
|
}
|
|
59
|
-
baseline = new Map();
|
|
60
|
-
// Both classes acquire their independent first-use evidence in one
|
|
61
|
-
// atomic write, before either class may populate the physical store.
|
|
62
|
-
save({ schema: 2, namespace, stages: { A: [], B: [] } });
|
|
63
98
|
}
|
|
64
99
|
} finally { lock.release(); }
|
|
65
100
|
}
|
package/gate-serve.mjs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// proven", and the caller does the full verify. The server never says "clean" on a guess.
|
|
14
14
|
// - Only plain verifies (no stage-output ledger) use it.
|
|
15
15
|
//
|
|
16
|
-
// Lifecycle: started detached by the first client that finds no server (
|
|
16
|
+
// Lifecycle: started detached by the first client that finds no server (no switch disables it: RK_GATE_SERVE was removed 2026-11-24, rightkit#1514); one server per host and data root;
|
|
17
17
|
// exits after RK_GATE_SERVE_IDLE_MS (default 30 min) without a request, or when a client runs different gate code. No system service is
|
|
18
18
|
// installed. Commands: `node gate-serve.mjs serve`, `node gate-serve.mjs status`, and the internal client ops below.
|
|
19
19
|
import crypto from "node:crypto";
|
|
@@ -311,7 +311,6 @@ export function askInProcess(req, timeoutMs, { sock = socketPath() } = {}) {
|
|
|
311
311
|
|
|
312
312
|
/** One synchronous request to the resident server; null when it is disabled, unreachable or did not answer. Starts it when absent. */
|
|
313
313
|
export function serveRequest(req, { env = process.env, root = null, timeoutMs = 3000, sock = socketPath(env) } = {}) {
|
|
314
|
-
if (env.RK_GATE_SERVE === "0") return null;
|
|
315
314
|
let res = null;
|
|
316
315
|
try { res = askInProcess(req, timeoutMs, { sock }); }
|
|
317
316
|
catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rightkit/release",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.62",
|
|
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",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
],
|
|
92
92
|
"sideEffects": false,
|
|
93
93
|
"scripts": {
|
|
94
|
-
"test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs class-a-cache-history.test.mjs broker-toolchain.test.mjs snapshot-changes.test.mjs gate-serve-changes.test.mjs gate-serve-helper.test.mjs resident-answers.test.mjs probe-memo-kept.test.mjs class-a-lanes.test.mjs feature-partition-targets.test.mjs class-b-target-groups.test.mjs unit-list-lock.test.mjs cargo-profile-check.test.mjs cargo-home-real-path.test.mjs class-a-cache-admission.test.mjs class-b-cache-admission.test.mjs shellcheck-cache-inputs.test.mjs implicit-features.test.mjs test-group-failure-cache.test.mjs sealed-listing-store.test.mjs gate/gate.test.mjs package-files.test.mjs host-gate.test.mjs publish-local-cargo.test.mjs affected-units.test.mjs batch-workspace.test.mjs unit-list-plan.test.mjs compile-inputs.test.mjs snapshot-dependency-reuse.test.mjs publisher-requirement-scan.test.mjs node-check-cache.test.mjs preparation-diagnostics.test.mjs gate-coverage-timing.test.mjs ci-compile-admission.test.mjs qualification-verify.test.mjs test-run-output.test.mjs feature-partition.test.mjs feature-sets.test.mjs gate-seam.test.mjs serial-row.test.mjs seam-repairs.test.mjs snapshot-lock.test.mjs lock-identity.test.mjs stamp-relay.test.mjs install-tauri-authenticode.test.mjs gate-stage-binding.test.mjs tool-output.test.mjs publication-gate.test.mjs gate-release-admission.test.mjs cache-key-explain.test.mjs external-inputs.test.mjs built-bins.test.mjs probe-memo.test.mjs gate-serve-ask.test.mjs double-pass.test.mjs tool-version-memo.test.mjs workspace-manifests.test.mjs test-failure-cache.test.mjs served-metadata.test.mjs windows-pnpm-identity.test.mjs",
|
|
94
|
+
"test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs class-a-cache-history.test.mjs gate-fixed-levers.test.mjs broker-toolchain.test.mjs snapshot-changes.test.mjs gate-serve-changes.test.mjs gate-serve-helper.test.mjs resident-answers.test.mjs probe-memo-kept.test.mjs class-a-lanes.test.mjs feature-partition-targets.test.mjs class-b-target-groups.test.mjs unit-list-lock.test.mjs cargo-profile-check.test.mjs cargo-home-real-path.test.mjs class-a-cache-admission.test.mjs class-b-cache-admission.test.mjs shellcheck-cache-inputs.test.mjs implicit-features.test.mjs test-group-failure-cache.test.mjs sealed-listing-store.test.mjs gate/gate.test.mjs package-files.test.mjs host-gate.test.mjs publish-local-cargo.test.mjs affected-units.test.mjs batch-workspace.test.mjs unit-list-plan.test.mjs compile-inputs.test.mjs snapshot-dependency-reuse.test.mjs publisher-requirement-scan.test.mjs node-check-cache.test.mjs preparation-diagnostics.test.mjs gate-coverage-timing.test.mjs ci-compile-admission.test.mjs qualification-verify.test.mjs test-run-output.test.mjs feature-partition.test.mjs feature-sets.test.mjs gate-seam.test.mjs serial-row.test.mjs seam-repairs.test.mjs snapshot-lock.test.mjs lock-identity.test.mjs stamp-relay.test.mjs install-tauri-authenticode.test.mjs gate-stage-binding.test.mjs tool-output.test.mjs publication-gate.test.mjs gate-release-admission.test.mjs cache-key-explain.test.mjs external-inputs.test.mjs built-bins.test.mjs probe-memo.test.mjs gate-serve-ask.test.mjs double-pass.test.mjs tool-version-memo.test.mjs workspace-manifests.test.mjs test-failure-cache.test.mjs served-metadata.test.mjs windows-pnpm-identity.test.mjs",
|
|
95
95
|
"test:registry-parity": "node registry-parity.mjs --allow-unpublished",
|
|
96
96
|
"test:signer:windows": "node sign-release-manifest.integration.mjs",
|
|
97
97
|
"prepublishOnly": "pnpm test:signer:windows && pnpm test:registry-parity",
|
package/rightkit-versions.json
CHANGED
|
@@ -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.6",
|
|
52
|
-
"@rightkit/release": "0.6.
|
|
52
|
+
"@rightkit/release": "0.6.62",
|
|
53
53
|
"@rightkit/send-ui": "0.1.0",
|
|
54
54
|
"@rightkit/settings-ui": "0.7.5",
|
|
55
55
|
"@rightkit/social-ui": "0.2.1",
|
package/snapshot.mjs
CHANGED
|
@@ -265,7 +265,6 @@ export function treeProvenByChanges({ reply, dir, tree, entries, objectFormat })
|
|
|
265
265
|
* hash of this run.
|
|
266
266
|
*/
|
|
267
267
|
export function beginResidentProof(dir, { env = process.env, ask = serveRequest, waitMs = 8000 } = {}) {
|
|
268
|
-
if (env.RK_GATE_SERVE === "0") return null;
|
|
269
268
|
const root = path.dirname(path.resolve(dir));
|
|
270
269
|
// Only the first question may start the process (each start is a launcher of its own on Windows); the ones after it only ask.
|
|
271
270
|
let r = noteChangeSource(ask({ op: "begin", dir }, { env, root }));
|