@rightkit/release 0.6.73 → 0.6.75
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/acceptance-run.mjs +5 -0
- package/deterministic-scans.mjs +32 -5
- package/package.json +1 -1
- package/probe-memo.mjs +1 -1
- package/rightkit-versions.json +1 -1
- package/snapshot-dependency-reuse.mjs +23 -3
- package/snapshot-metadata.mjs +5 -1
package/acceptance-run.mjs
CHANGED
|
@@ -115,6 +115,9 @@ async function main() {
|
|
|
115
115
|
if (git(fixture, ["status", "--porcelain", "--untracked-files=no"])) throw new Error("the fixture's working checkout has changes to tracked files; the cases need it clean to start");
|
|
116
116
|
const storeDir = cacheStoreDir(fixture); const args = ["--to", cases.fixture.stage];
|
|
117
117
|
const wanted = (opt("--cases") ?? cases.order.join(",")).split(",").map(Number);
|
|
118
|
+
// The advisory rows key on the UTC day by design: a run that crosses UTC midnight sees them run again in case 2 and reads it as NN06 (0.6.73, 2026-11-25).
|
|
119
|
+
const late = minutesToUtcMidnight(new Date());
|
|
120
|
+
if (wanted.includes(2) && late < MIDNIGHT_MARGIN_MIN) throw new Error(`UTC midnight is ${late} min away; the advisory rows change key at midnight, so start the cases after 00:00 UTC (or with more than ${MIDNIGHT_MARGIN_MIN} min to go)`);
|
|
118
121
|
try {
|
|
119
122
|
for (const id of cases.order.filter((n) => wanted.includes(n))) {
|
|
120
123
|
const def = cases.cases.find((c) => c.id === id); console.log(`case ${id}: ${def.name}`);
|
|
@@ -159,4 +162,6 @@ async function main() {
|
|
|
159
162
|
for (const l of all.realBuild) console.log(`real build ${l.id} ${l.verdict}${l.verdict === "pass" ? "" : `: ${l.why}`}`.slice(0, 600));
|
|
160
163
|
process.exit(all.pass ? 0 : 1);
|
|
161
164
|
}
|
|
165
|
+
export const MIDNIGHT_MARGIN_MIN = 45;
|
|
166
|
+
export function minutesToUtcMidnight(now) { const next = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + 1); return Math.floor((next - now.getTime()) / 60000); }
|
|
162
167
|
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main().catch((e) => { console.error(`acceptance-run: ${e.stack ?? e.message}`); process.exit(2); });
|
package/deterministic-scans.mjs
CHANGED
|
@@ -41,7 +41,7 @@ import { OutdatedUnavailableError, resolveOutdatedBin } from "./outdated-command
|
|
|
41
41
|
import { SCAN_TOKEN_ENV, readLedger, scanTokenOf, unclaimedLedgers } from "./cargo-ledger.mjs";
|
|
42
42
|
import { ADMISSION_POLL_MS, CARRIED_CANCEL_GRACE_MS, QUEUED_CEILING_FACTOR, createRunClock, createStatusPoller, watchBrokerAdmission } from "./broker-admission.mjs";
|
|
43
43
|
import { CANCEL_WAIT_ENV, operationDeadlineEnv } from "./broker-admission.mjs";
|
|
44
|
-
import { windowsPnpmIdentity } from "./snapshot-dependency-reuse.mjs";
|
|
44
|
+
import { pnpmVersionAnswerAsync, windowsPnpmIdentity } from "./snapshot-dependency-reuse.mjs";
|
|
45
45
|
import { compatibleTargetClasses, groupTargetDifference, meetPartitions, parseTreeFeatures, partitionByFeatures, partitionCacheKey, splitNote, stripSelectors, targetSplitNote, treeArgs, treeArgsForTargets, workspaceManifestDigest } from "./feature-partition.mjs";
|
|
46
46
|
import { CLASS_A_ENV, NOT_EXECUTED_EXIT, RECEIPT_NONCE_ENV, contractJobTag, judgeSeamOutcome, normalizeWorkspace, recordContractJob, seamEnv, seamSettled, verdictForRun } from "./gate-seam.mjs";
|
|
47
47
|
|
|
@@ -2291,7 +2291,8 @@ export function defaultSpawn(command, args, options = {}) {
|
|
|
2291
2291
|
const key = readMemoKey(command, args, options);
|
|
2292
2292
|
if (READ_MEMO.has(key)) return { ...READ_MEMO.get(key) };
|
|
2293
2293
|
const r = rawSpawn(command, args, options);
|
|
2294
|
-
|
|
2294
|
+
// As the asynchronous path: a path missing from a commit named by its full id (status 128) is kept too (NN08, 0.6.74 local case 1).
|
|
2295
|
+
if (r && !r.error && (r.status === 0 || (r.status === 128 && absentAtCommit(command, args ?? []) && /does not exist in|exists on disk, but not in/.test(String(r.stderr ?? ""))))) READ_MEMO.set(key, { status: r.status, signal: null, stdout: r.stdout, stderr: r.stderr });
|
|
2295
2296
|
return r;
|
|
2296
2297
|
}
|
|
2297
2298
|
return rawSpawn(command, args, options);
|
|
@@ -2327,6 +2328,7 @@ export function isRememberedRead(command, args) {
|
|
|
2327
2328
|
if (sub[0] === "ls-tree" && sub.length >= 2 && /^[0-9a-f]{40}$/.test(sub[sub.length - 1]) && sub.slice(1, -1).every((a) => /^-[a-z]$|^--name-only$|^--full-tree$/.test(a))) return true;
|
|
2328
2329
|
return sub.length === 2 && sub[0] === "rev-parse" && sub[1] === "--show-toplevel";
|
|
2329
2330
|
}
|
|
2331
|
+
export const PNPM_VERSION_ENV = /^(path|pnpm_home|corepack_.*|npm_config_.*|appdata|localappdata|userprofile|home|xdg_.*)$/i;
|
|
2330
2332
|
const readMemoKey = (command, args, options = {}) => {
|
|
2331
2333
|
const a = (args ?? []).map(String); let i = 0; while (i < a.length && (a[i] === "-c" || a[i] === "-C")) i += 2;
|
|
2332
2334
|
const sub = a.slice(i);
|
|
@@ -2339,7 +2341,11 @@ const readMemoKey = (command, args, options = {}) => {
|
|
|
2339
2341
|
let file = String(command); try { file = resolveInvocation(command, args, { env: options.env ?? process.env }).file ?? file; } catch { /* as given */ }
|
|
2340
2342
|
return sha256(JSON.stringify(["version", String(file).toLowerCase(), a]));
|
|
2341
2343
|
}
|
|
2342
|
-
|
|
2344
|
+
// pnpm --version: what decides the answer is the program, the folder and pnpm's own variables, never a per-run value such as a lease id (NN08: the
|
|
2345
|
+
// lookup pass and the real pass handed different environments, so pnpm --version was asked again from the same folder, 0.6.73 case 1).
|
|
2346
|
+
const versionOnly = tool === "pnpm" && a.length === 1 && a[0] === "--version";
|
|
2347
|
+
const keep = versionOnly ? (k) => PNPM_VERSION_ENV.test(k) : () => true;
|
|
2348
|
+
const env = options.env ? Object.keys(options.env).filter(keep).sort().map((k) => `${k}=${options.env[k]}`).join("\0") : "";
|
|
2343
2349
|
return sha256(JSON.stringify([String(command), a, path.resolve(options.cwd ?? process.cwd()), env]));
|
|
2344
2350
|
};
|
|
2345
2351
|
export function rememberReads(spawn, { store = READ_MEMO } = {}) {
|
|
@@ -2413,7 +2419,8 @@ export function defaultSpawnAsync(command, args, options = {}) {
|
|
|
2413
2419
|
if (isRememberedRead(command, args) && options.input === undefined && options.stdio === undefined && !options.stdoutFile && !options.onSpawn && !options.signal?.aborted) {
|
|
2414
2420
|
const key = readMemoKey(command, args, options);
|
|
2415
2421
|
if (READ_MEMO.has(key)) return Promise.resolve({ ...READ_MEMO.get(key) });
|
|
2416
|
-
|
|
2422
|
+
// A path missing from a commit named by its full id (status 128) is kept too, as the process-wide memory keeps it (NN08, 0.6.73 case 1).
|
|
2423
|
+
return rawSpawnAsync(command, args, options).then((r) => { if (r && !r.error && (r.status === 0 || (r.status === 128 && absentAtCommit(command, args ?? []) && /does not exist in|exists on disk, but not in/.test(String(r.stderr ?? ""))))) READ_MEMO.set(key, { status: r.status, signal: null, stdout: r.stdout, stderr: r.stderr }); return r; });
|
|
2417
2424
|
}
|
|
2418
2425
|
return rawSpawnAsync(command, args, options);
|
|
2419
2426
|
}
|
|
@@ -3432,7 +3439,16 @@ export async function runScans(plan, options = {}) {
|
|
|
3432
3439
|
// gate claims and checks like a scan's.
|
|
3433
3440
|
const probeLedgerEnv = cargoLedger ? { [SCAN_TOKEN_ENV]: PROBE_LEDGER_TOKEN } : {};
|
|
3434
3441
|
if (cargoLedger) claimedTokens.add(PROBE_LEDGER_TOKEN);
|
|
3435
|
-
const
|
|
3442
|
+
const probeEnv = { ...deps.env, ...PNPM_NO_HOOKS_ENV, COREPACK_ENABLE_AUTO_PIN: "0", ...probeLedgerEnv };
|
|
3443
|
+
const rawProbe = (ms) => deps.spawn(command, PROBES[tool] ?? ["--version"], { cwd, env: probeEnv, signal: signalFor(ms) });
|
|
3444
|
+
// pnpm's version is the one answer the Class A digest asks too (bin/rightkit-gate.mjs, pnpmVersionAnswer): with no pin to switch to, both
|
|
3445
|
+
// share it, so one gate process starts `pnpm --version` once for both (NN08, 0.6.73 case 1).
|
|
3446
|
+
const probeOnce = tool !== "pnpm" ? rawProbe : async (ms) => {
|
|
3447
|
+
let started = null;
|
|
3448
|
+
const { version, kept } = await pnpmVersionAnswerAsync({ cwd, env: probeEnv, remember: startsRealPrograms(deps.spawn), run: async () => { started = await rawProbe(ms); return started && !started.error && started.status === 0 ? String(started.stdout ?? "").trim() : null; } });
|
|
3449
|
+
return kept ? { status: 0, signal: null, stdout: `${version}
|
|
3450
|
+
`, stderr: "" } : started;
|
|
3451
|
+
};
|
|
3436
3452
|
// One retry, with three times the bound, when only the bound stopped it (the run itself was not aborted).
|
|
3437
3453
|
let r = await probeOnce(probeMs);
|
|
3438
3454
|
if (r?.cancelled && !signal?.aborted) r = await probeOnce(probeMs * 3);
|
|
@@ -5074,3 +5090,14 @@ export function scanFailures(result) {
|
|
|
5074
5090
|
export function scanDeferrals(result) {
|
|
5075
5091
|
return result.scans.filter((r) => r.status === "deferred").map((r) => `${r.id}: deferred, not passed (${r.detail})`);
|
|
5076
5092
|
}
|
|
5093
|
+
|
|
5094
|
+
/** `git show <full commit id>:<path>`: a missing path there is missing for ever (NN08). Same rule as probe-memo.mjs absentAtCommit. */
|
|
5095
|
+
function absentAtCommit(cmd, argv) {
|
|
5096
|
+
return /(^|[\\/])git(\.exe)?$/i.test(String(cmd)) && argv.length === 2 && argv[0] === "show" && /^[0-9a-f]{40}:[^:]+$/.test(String(argv[1]));
|
|
5097
|
+
}
|
|
5098
|
+
|
|
5099
|
+
/** Whether `spawn` is the real asynchronous spawn, or a wrapper (snapshot-metadata.mjs directReadSpawn) whose `underlying` chain ends in it. Test fakes are neither. */
|
|
5100
|
+
export function startsRealPrograms(spawn) {
|
|
5101
|
+
for (let s = spawn, n = 0; typeof s === "function" && n < 8; s = s.underlying, n += 1) if (s === defaultSpawnAsync) return true;
|
|
5102
|
+
return false;
|
|
5103
|
+
}
|
package/package.json
CHANGED
package/probe-memo.mjs
CHANGED
|
@@ -282,5 +282,5 @@ export function installProbeMemo({ storeDir = null } = {}) {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
export function absentAtCommit(cmd, argv) {
|
|
285
|
-
return /(^|[
|
|
285
|
+
return /(^|[\\/])git(\.exe)?$/i.test(String(cmd)) && argv.length === 2 && argv[0] === "show" && /^[0-9a-f]{40}:[^:]+$/.test(String(argv[1]));
|
|
286
286
|
}
|
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.7",
|
|
52
|
-
"@rightkit/release": "0.6.
|
|
52
|
+
"@rightkit/release": "0.6.75",
|
|
53
53
|
"@rightkit/send-ui": "0.1.0",
|
|
54
54
|
"@rightkit/settings-ui": "0.7.5",
|
|
55
55
|
"@rightkit/social-ui": "0.2.1",
|
|
@@ -274,10 +274,20 @@ export function pnpmVersionSwitchInputs({ dir }) {
|
|
|
274
274
|
return { pin, manageVersions };
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
|
|
277
|
+
// Variables only the scan's version probe adds (no pnpmfile, no lifecycle scripts, no corepack auto-pin). With no pin to switch to they cannot
|
|
278
|
+
// change the version pnpm reports, so there they are left out of the key and the probe shares the Class A digest's answer (NN08, 0.6.73 case 1:
|
|
279
|
+
// `pnpm --version` from the repository root and again from the probe folder, neither with a pin).
|
|
280
|
+
const PROBE_ONLY_PNPM_ENV = /^(?:npm_config_ignore_pnpmfile|npm_config_ignore_scripts|pnpm_config_ignore_pnpmfile|pnpm_config_ignore_scripts|COREPACK_ENABLE_AUTO_PIN|RIGHTKIT_CARGO_SCAN)$/i;
|
|
281
|
+
function pnpmVersionKeyOf({ cwd, env, remember }) {
|
|
278
282
|
const dependencies = remember ? pnpmConfigDependencies({ dir: cwd, env }) : null;
|
|
279
|
-
|
|
280
|
-
const
|
|
283
|
+
if (!dependencies?.program) return { key: null, dependencies };
|
|
284
|
+
const switches = pnpmVersionSwitchInputs({ dir: cwd });
|
|
285
|
+
const noPin = !switches.pin && !switches.manageVersions;
|
|
286
|
+
const lastingEnv = Object.entries(env ?? {}).filter(([name]) => !PER_RUN_BOOKKEEPING.test(String(name).toUpperCase()) && !(noPin && PROBE_ONLY_PNPM_ENV.test(String(name)))).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
287
|
+
return { key: answerKey(['rightkit.pnpm-version-answer/4', dependencies.program, lastingEnv, switches]), dependencies };
|
|
288
|
+
}
|
|
289
|
+
export function pnpmVersionAnswer({ cwd, env, remember = false, run, ask }) {
|
|
290
|
+
const { key, dependencies } = pnpmVersionKeyOf({ cwd, env, remember });
|
|
281
291
|
const kept = key ? recallAnswer(key, { env, ...(ask ? { ask } : {}) }) : null;
|
|
282
292
|
if (kept) return kept;
|
|
283
293
|
const marks = key ? fileMarks(dependencies.files) : null;
|
|
@@ -285,6 +295,16 @@ export function pnpmVersionAnswer({ cwd, env, remember = false, run, ask }) {
|
|
|
285
295
|
if (key && typeof version === 'string' && /^\d+\.\d+\.\d+/.test(version)) rememberAnswer(key, version, marks, { env, ...(ask ? { ask } : {}) });
|
|
286
296
|
return version;
|
|
287
297
|
}
|
|
298
|
+
/** pnpmVersionAnswer for an asynchronous run (the scan's version probe): run() resolves to the version text, or null when it failed. */
|
|
299
|
+
export async function pnpmVersionAnswerAsync({ cwd, env, remember = false, run, ask }) {
|
|
300
|
+
const { key, dependencies } = pnpmVersionKeyOf({ cwd, env, remember });
|
|
301
|
+
const kept = key ? recallAnswer(key, { env, ...(ask ? { ask } : {}) }) : null;
|
|
302
|
+
if (kept) return { version: kept, kept: true };
|
|
303
|
+
const marks = key ? fileMarks(dependencies.files) : null;
|
|
304
|
+
const version = await run();
|
|
305
|
+
if (key && typeof version === 'string' && /^\d+\.\d+\.\d+/.test(version)) rememberAnswer(key, version, marks, { env, ...(ask ? { ask } : {}) });
|
|
306
|
+
return { version, kept: false };
|
|
307
|
+
}
|
|
288
308
|
|
|
289
309
|
export function pnpmConfigIdentity({ dir, env, spawn, remember = false }) {
|
|
290
310
|
const fail = (code) => { const e = new Error(code); e.reuseCode = code; throw e; };
|
package/snapshot-metadata.mjs
CHANGED
|
@@ -274,7 +274,9 @@ export const carriedReadOnlyScan = (words, options) => carriedScanRefusal(words,
|
|
|
274
274
|
export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath, pathKey = "PATH", tmpRoot, env, err = () => {}, memo = null, isAsync = false, served = null }) {
|
|
275
275
|
const prefix = cargoCommand.slice(1);
|
|
276
276
|
const refused = (code, message) => { err(`rightkit-gate: ${code}: ${message}`); return { status: CARGO_REFUSAL_STATUS, signal: null, error: null, stdout: "", stderr: `rightkit-gate: ${code}: ${message}\n` }; };
|
|
277
|
-
|
|
277
|
+
// Anything but cargo in the snapshot goes to `spawn` untouched; `underlying` names it, so a caller can tell this wrapper still starts real programs
|
|
278
|
+
// (NN08: the scan's pnpm version probe kept no answer behind this wrapper, 0.6.74 case 1).
|
|
279
|
+
const wrapped = (cmd, args, opts = {}) => {
|
|
278
280
|
const cargo = cmd === cargoCommand[0] && prefix.every((w, i) => args[i] === w);
|
|
279
281
|
if (!cargo || typeof opts.cwd !== "string" || !within(real(opts.cwd), real(snapshotRoot))) return spawn(cmd, args, opts);
|
|
280
282
|
// A seam request (reset plan section 3: RUSTRIGHT_GATE_COMMIT set) is a class B compile the broker admits; it runs in the snapshot by design and is never a
|
|
@@ -302,4 +304,6 @@ export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath,
|
|
|
302
304
|
cleanup();
|
|
303
305
|
return remember(r);
|
|
304
306
|
};
|
|
307
|
+
wrapped.underlying = spawn;
|
|
308
|
+
return wrapped;
|
|
305
309
|
}
|