@rightkit/release 0.6.71 → 0.6.73
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-cases.json +8 -0
- package/acceptance-launch.mjs +1 -1
- package/acceptance-run.mjs +3 -0
- package/advisory-db.mjs +2 -1
- package/bin/rightkit-gate.mjs +2 -1
- package/deterministic-scans.mjs +8 -3
- package/package.json +1 -1
- package/probe-memo.mjs +35 -1
- package/rightkit-versions.json +1 -1
package/acceptance-cases.json
CHANGED
|
@@ -322,6 +322,14 @@
|
|
|
322
322
|
],
|
|
323
323
|
"count": 2,
|
|
324
324
|
"why": "one per npm package"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"program": "pnpm",
|
|
328
|
+
"args": [
|
|
329
|
+
"--version"
|
|
330
|
+
],
|
|
331
|
+
"count": 2,
|
|
332
|
+
"why": "two different questions: Class A probes pnpm in a neutral folder (its answer is in the pnpm rows' cache keys), compile planning asks in the project folder; pnpm 9+ switches to a project's packageManager version, so the answers can differ. Settled with Gemini, 2026-11-25 (Adrian delegated decisions to Gemini overnight)."
|
|
325
333
|
}
|
|
326
334
|
],
|
|
327
335
|
"cases": [
|
package/acceptance-launch.mjs
CHANGED
|
@@ -224,7 +224,7 @@ export async function launch({ out, commit, kind = null, receiptsDir, limits = n
|
|
|
224
224
|
const changed = storeBefore && storeAfter ? Object.keys(storeAfter).filter((k) => !storeBefore[k] || storeBefore[k][0] !== storeAfter[k][0] || storeBefore[k][1] !== storeAfter[k][1]).sort() : null;
|
|
225
225
|
const rowOfFile = (name) => { try { const d = JSON.parse(fs.readFileSync(path.join(storeDir, name), "utf8")); return typeof d?.row?.id === "string" ? d.row.id : typeof d?.id === "string" ? d.id : null; } catch { return null; } };
|
|
226
226
|
// A combined result names its crates in its own record, or in the command it stores (`-p <crate>`).
|
|
227
|
-
const cratesOfFile = (name) => { try { const d = JSON.parse(fs.readFileSync(path.join(storeDir, name), "utf8")); if (Array.isArray(d?.row?.crates)) return d.row.crates.map(String); const words = String(d?.row?.command ?? "").split(/\s+/); const out = []; words.forEach((w, i) => { if ((w === "-p" || w === "--package") && words[i + 1]) out.push(words[i + 1]); }); return out.length ? [...new Set(out)] : null; } catch { return null; } };
|
|
227
|
+
const cratesOfFile = (name) => { try { const d = JSON.parse(fs.readFileSync(path.join(storeDir, name), "utf8")); if (Array.isArray(d?.row?.crates)) return d.row.crates.map(String); let units = null; try { const text = String(d?.row?.raw?.inputs ?? "null"); units = JSON.parse(text.slice(0, text.lastIndexOf("}") + 1) || "null")?.units; /* the key text is the JSON, then :<key schema> */ } catch { units = null; } if (Array.isArray(units) && units.length) return [...new Set(units.map((u) => String(Array.isArray(u) ? u[0] : u).split(":").pop()))]; /* a combined result's row-index entry lists its units, <workspace>:<crate> */ const words = String(d?.row?.command ?? "").split(/\s+/); const out = []; words.forEach((w, i) => { if ((w === "-p" || w === "--package") && words[i + 1]) out.push(words[i + 1]); }); return out.length ? [...new Set(out)] : null; } catch { return null; } };
|
|
228
228
|
fs.writeFileSync(path.join(out, "cache-written.json"), `${JSON.stringify(changed === null ? null : changed.map((name) => ({ name, row: rowOfFile(name), crates: cratesOfFile(name) })))}\n`);
|
|
229
229
|
const snaps = rootEntries === null ? { root: snapRoot, dirs: {}, known: false } : statSnapshots(snapRoot, Date.parse(record.startedAt), { entries: rootEntries });
|
|
230
230
|
fs.writeFileSync(path.join(out, "snapshot-stat.json"), `${JSON.stringify(snaps)}\n`);
|
package/acceptance-run.mjs
CHANGED
|
@@ -124,6 +124,9 @@ async function main() {
|
|
|
124
124
|
if (id === 1) {
|
|
125
125
|
const aside = path.join(out, "set-aside", new Date().toISOString().replace(/[:.]/g, "-"));
|
|
126
126
|
moveAside(storeDir, path.join(aside, "rightkit-gate-cache")); moveAside(historyFileOf(managed, storeDir), path.join(aside, "history.json"));
|
|
127
|
+
// From nothing includes the sidecar's kept staging (0.6.71): the gate keeps it per snapshot folder, so it outlives the scan store.
|
|
128
|
+
// Only the fixture's own folder: other repositories' kept stagings are theirs.
|
|
129
|
+
{ const snap = (await import("./snapshot.mjs")).repositoryOf(fixture).key; moveAside(path.join(managed, "sidecar-state", snap), path.join(aside, "sidecar-state", snap)); }
|
|
127
130
|
const dirty = path.join(fixture, "rk", "crates", "rk-leaf", "src", "lib.rs");
|
|
128
131
|
fs.writeFileSync(dirty, "pub fn leaf() -> u32 { this does not compile\n");
|
|
129
132
|
try { runs.push(await one(fixture, commit, "case1", { args })); } finally { git(fixture, ["checkout", "--", "rk/crates/rk-leaf/src/lib.rs"]); }
|
package/advisory-db.mjs
CHANGED
|
@@ -55,7 +55,8 @@ export function ensureAdvisoryDb({ cacheRoot, pin, git = defaultGit, fsImpl = fs
|
|
|
55
55
|
const { url, commit } = checkPin(pin);
|
|
56
56
|
const base = path.join(cacheRoot, "advisory-db");
|
|
57
57
|
const dest = path.join(base, commit);
|
|
58
|
-
|
|
58
|
+
// -C names the checkout on the command line, so the process log tells this question from the fixture's own HEAD (NN08, 0.6.72).
|
|
59
|
+
const head = (dir) => { const r = git(["-C", dir, "rev-parse", "HEAD"], { cwd: dir }); return !r.error && r.status === 0 ? String(r.stdout).trim() : null; };
|
|
59
60
|
if (fsImpl.existsSync(dest)) {
|
|
60
61
|
if (head(dest) === commit) return dest;
|
|
61
62
|
// A stale or damaged directory under the pinned name is never trusted; replace it.
|
package/bin/rightkit-gate.mjs
CHANGED
|
@@ -5564,7 +5564,8 @@ export async function main(argv, io = {}) {
|
|
|
5564
5564
|
if (!classAOnly) {
|
|
5565
5565
|
const needsForecast = !o.runScans;
|
|
5566
5566
|
try {
|
|
5567
|
-
|
|
5567
|
+
// The selected commit, never asked again: a self-call names it by its full id (NN08: `git rev-parse HEAD` asked twice in one run on 0.6.71).
|
|
5568
|
+
const named = option("--commit"); const headSha = snapshotBCommit?.commit ?? (/^[0-9a-f]{40}$/.test(named ?? "") ? named : text(git("rev-parse", "HEAD")).trim());
|
|
5568
5569
|
const treeId = text(git("rev-parse", `${headSha}^{tree}`)).trim();
|
|
5569
5570
|
const common = git("rev-parse", "--git-common-dir");
|
|
5570
5571
|
if (headSha && treeId && !failed(common) && text(common).trim()) {
|
package/deterministic-scans.mjs
CHANGED
|
@@ -2333,7 +2333,9 @@ const readMemoKey = (command, args, options = {}) => {
|
|
|
2333
2333
|
// git show <sha>:<path>, ls-tree <sha>, cat-file -p <sha>: content-addressed, the same answer wherever it is asked (a repository without the object fails, and a failure is not kept).
|
|
2334
2334
|
if (/(^|[\\/])git(\.exe)?$/i.test(String(command)) && sub[0] !== "rev-parse") return sha256(JSON.stringify(["object", sub]));
|
|
2335
2335
|
// A tool's own version is the version of the binary that runs: the program as the environment resolves it.
|
|
2336
|
-
|
|
2336
|
+
// Only tools with one binary on PATH: rustup's proxies (cargo, rustc, rustfmt) and pnpm resolve a version per folder, so their key keeps the folder.
|
|
2337
|
+
const tool = String(command).replaceAll("\\", "/").split("/").pop().replace(/.(exe|cmd|bat)$/i, "").toLowerCase();
|
|
2338
|
+
if (["actionlint", "shellcheck", "oxlint", "cargo-deny", "cargo-audit"].includes(tool) && (a.length === 1 || (a.length === 2 && a[1] === "--version"))) {
|
|
2337
2339
|
let file = String(command); try { file = resolveInvocation(command, args, { env: options.env ?? process.env }).file ?? file; } catch { /* as given */ }
|
|
2338
2340
|
return sha256(JSON.stringify(["version", String(file).toLowerCase(), a]));
|
|
2339
2341
|
}
|
|
@@ -2407,7 +2409,8 @@ export function killProcessTree(child, { platform = process.platform, run = spaw
|
|
|
2407
2409
|
*/
|
|
2408
2410
|
export function defaultSpawnAsync(command, args, options = {}) {
|
|
2409
2411
|
// GC-A27 NN08: the reads rememberReads keeps are answered from the same memory here, and an answer this path gets is kept for both.
|
|
2410
|
-
|
|
2412
|
+
// A cancel signal does not change the answer: a remembered one starts nothing to cancel (Class A's version probe always passes one).
|
|
2413
|
+
if (isRememberedRead(command, args) && options.input === undefined && options.stdio === undefined && !options.stdoutFile && !options.onSpawn && !options.signal?.aborted) {
|
|
2411
2414
|
const key = readMemoKey(command, args, options);
|
|
2412
2415
|
if (READ_MEMO.has(key)) return Promise.resolve({ ...READ_MEMO.get(key) });
|
|
2413
2416
|
return rawSpawnAsync(command, args, options).then((r) => { if (r && r.status === 0 && !r.error) READ_MEMO.set(key, { status: 0, signal: null, stdout: r.stdout, stderr: r.stderr }); return r; });
|
|
@@ -2961,7 +2964,9 @@ async function defaultScanSecrets() {
|
|
|
2961
2964
|
*/
|
|
2962
2965
|
export async function ignoredPathSkip(ctx) {
|
|
2963
2966
|
const git = async (args) => { try { return await ctx.deps.spawn("git", args, { cwd: ctx.contentRoot, encoding: "utf8", env: ctx.deps.env }); } catch { return null; } };
|
|
2964
|
-
|
|
2967
|
+
// The gate hands the tracked-file list only for a snapshot run: then the content root is a snapshot, which is what this question found out, so it is
|
|
2968
|
+
// not asked (GC-A27 NN08: the snapshot's top level was asked again after the checkout's, acceptance case 3 on 0.6.71).
|
|
2969
|
+
const top = Array.isArray(ctx.trackedFiles) ? null : await git(["rev-parse", "--show-toplevel"]);
|
|
2965
2970
|
const same = (a, b) => { try { return fs.realpathSync(a) === fs.realpathSync(b); } catch { return path.resolve(a) === path.resolve(b); } };
|
|
2966
2971
|
if (!top || top.status !== 0 || !same(String(top.stdout ?? "").trim(), ctx.contentRoot)) {
|
|
2967
2972
|
// Not a git toplevel: a snapshot, which holds the commit's files and also whatever a stage wrote into it (dist/stage, build output), and
|
package/package.json
CHANGED
package/probe-memo.mjs
CHANGED
|
@@ -26,6 +26,10 @@ export function pureQuestion(cmd, args) {
|
|
|
26
26
|
if (name === "where" || name === "which") return args.length === 1 && /^[A-Za-z0-9._-]+$/.test(args[0]);
|
|
27
27
|
// A broker job's status, by its id: remembered only once the answer is final (see FINAL_ONLY), never while the job may still change.
|
|
28
28
|
if (name === "rustright") return args.length === 2 && args[0] === "status" && /^[0-9a-f-]{36}$/.test(args[1]);
|
|
29
|
+
// A tool's own version, asked with nothing else: the version of the binary PATH resolves (GC-A27 NN08: actionlint -version and shellcheck --version
|
|
30
|
+
// asked once by the lookup pass and again by the real pass, from two probe folders, on 0.6.70). Only tools with one binary on PATH: rustup's proxies
|
|
31
|
+
// (cargo, rustc, rustfmt) and pnpm resolve a version per folder, so they are not listed.
|
|
32
|
+
if (FIXED_VERSION_TOOLS.has(name) && args.length === 1 && TOOL_VERSION_FLAGS.has(args[0])) return true;
|
|
29
33
|
if (name !== "git") return false;
|
|
30
34
|
// Leading `-c key=value` pairs configure the call, they are part of the question (and of the key), not a different question.
|
|
31
35
|
let rest = args; while (rest[0] === "-c" && typeof rest[1] === "string" && rest[1].includes("=")) rest = rest.slice(2);
|
|
@@ -53,6 +57,23 @@ export function pureQuestion(cmd, args) {
|
|
|
53
57
|
if (rest[0] === "ls-tree") return treeListOf(args) !== null || (rest.length >= 2 && SHA.test(rest[rest.length - 1]) && rest.slice(1, -1).every((f) => LS_TREE_FLAGS.has(f)));
|
|
54
58
|
return false;
|
|
55
59
|
}
|
|
60
|
+
const TOOL_VERSION_FLAGS = new Set(["--version", "-version", "-V"]);
|
|
61
|
+
const FIXED_VERSION_TOOLS = new Set(["actionlint", "shellcheck", "oxlint", "cargo-deny", "cargo-audit"]);
|
|
62
|
+
/**
|
|
63
|
+
* A question whose answer is fixed by its arguments alone, whatever folder asks it: a git object named by its full id (the same bytes in any
|
|
64
|
+
* repository that has it; one that does not fails, and a failure is never kept), or a tool's own version (keyed by PATH instead). The checkout and
|
|
65
|
+
* the snapshot asked these separately, so each was asked twice (NN08, acceptance cases on 0.6.70). Exported for its test.
|
|
66
|
+
*/
|
|
67
|
+
export function folderFree(cmd, args) {
|
|
68
|
+
const name = path.basename(String(cmd).replaceAll("\\", "/")).toLowerCase().replace(/\.(exe|cmd|bat)$/, "");
|
|
69
|
+
if (name !== "git") return FIXED_VERSION_TOOLS.has(name) && args.length === 1 && TOOL_VERSION_FLAGS.has(args[0]);
|
|
70
|
+
let rest = args; while (rest[0] === "-c" && typeof rest[1] === "string" && rest[1].includes("=")) rest = rest.slice(2);
|
|
71
|
+
if (rest[0] === "show") return rest.length === 2 && /^[0-9a-f]{40}([0-9a-f]{24})?:/.test(rest[1]);
|
|
72
|
+
if (rest[0] === "cat-file") return rest.length === 3 && SHA.test(rest[2]);
|
|
73
|
+
if (rest[0] === "ls-tree") return rest.length >= 2 && SHA.test(rest[rest.length - 1]);
|
|
74
|
+
if (rest[0] === "rev-parse") { const tail = rest.slice(1); return tail.length >= 1 && /^[0-9a-f]{40}/.test(tail[tail.length - 1]) && !tail.some((a) => a === "--show-toplevel" || a === "HEAD"); }
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
56
77
|
const LS_TREE_FLAGS = new Set(["-r", "-z", "-l", "-t", "--name-only", "--full-tree", "--long"]);
|
|
57
78
|
|
|
58
79
|
/**
|
|
@@ -166,7 +187,9 @@ const copy = (v) => (Buffer.isBuffer(v) ? Buffer.from(v) : v);
|
|
|
166
187
|
const programNameOf = (cmd) => path.basename(String(cmd).replaceAll("\\", "/")).toLowerCase().replace(/\.(exe|cmd|bat)$/, "");
|
|
167
188
|
const questionKeyOf = (cmd, args, options) => {
|
|
168
189
|
const env = Object.entries(options?.env && typeof options.env === "object" ? options.env : process.env).filter(([k]) => /^GIT_/i.test(k)).sort();
|
|
169
|
-
|
|
190
|
+
const free = folderFree(cmd, Array.isArray(args) ? args : []);
|
|
191
|
+
const pathVar = free && programNameOf(cmd) !== "git" ? Object.entries(options?.env && typeof options.env === "object" ? options.env : process.env).filter(([k]) => /^path$/i.test(k)).map(([, v]) => v) : [];
|
|
192
|
+
return JSON.stringify([programNameOf(cmd), args, free ? pathVar : path.resolve(typeof options?.cwd === "string" ? options.cwd : process.cwd()), env]);
|
|
170
193
|
};
|
|
171
194
|
const piped = (options) => options?.stdio === undefined || options.stdio === "pipe";
|
|
172
195
|
/** A batch read or a grep answer larger than this is not kept in memory: it is asked again. */
|
|
@@ -204,6 +227,13 @@ export function installProbeMemo({ storeDir = null } = {}) {
|
|
|
204
227
|
if (answered && !missing && (r.stdout?.length ?? 0) <= KEEP_MAX_BYTES) seenSpawn.set(key, { ...r, stdout: copy(r.stdout), stderr: copy(r.stderr) });
|
|
205
228
|
return r;
|
|
206
229
|
}
|
|
230
|
+
// A path missing from a commit named by its full id is missing for ever (NN08: `git show <sha>:package.json` asked twice, status 128, 0.6.72).
|
|
231
|
+
if (absentAtCommit(cmd, argv)) {
|
|
232
|
+
const r = spawnSync.apply(this, arguments);
|
|
233
|
+
if (r && !r.error && r.signal === null && r.status === 128 && /does not exist in|exists on disk, but not in/.test(String(r.stderr ?? ""))) seenSpawn.set(key, { ...r, stdout: copy(r.stdout), stderr: copy(r.stderr) });
|
|
234
|
+
else if (r && !r.error && r.status === 0 && (r.stdout?.length ?? 0) <= KEEP_MAX_BYTES) seenSpawn.set(key, { ...r, stdout: copy(r.stdout), stderr: copy(r.stderr) });
|
|
235
|
+
return r;
|
|
236
|
+
}
|
|
207
237
|
const question = piped(opts) ? questionKeyOf(cmd, argv, opts) : null;
|
|
208
238
|
const shared = question ? answers.get(question) : undefined;
|
|
209
239
|
if (shared) {
|
|
@@ -250,3 +280,7 @@ export function installProbeMemo({ storeDir = null } = {}) {
|
|
|
250
280
|
module.syncBuiltinESMExports();
|
|
251
281
|
return stats;
|
|
252
282
|
}
|
|
283
|
+
|
|
284
|
+
export function absentAtCommit(cmd, argv) {
|
|
285
|
+
return /(^|[\/])git(.exe)?$/i.test(String(cmd)) && argv.length === 2 && argv[0] === "show" && /^[0-9a-f]{40}:[^:]+$/.test(String(argv[1]));
|
|
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.72",
|
|
53
53
|
"@rightkit/send-ui": "0.1.0",
|
|
54
54
|
"@rightkit/settings-ui": "0.7.5",
|
|
55
55
|
"@rightkit/social-ui": "0.2.1",
|