@rightkit/release 0.6.38 → 0.6.40
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 +70 -14
- package/deterministic-scans.mjs +132 -14
- package/local-publish.mjs +29 -3
- package/package.json +1 -1
- package/publish-local-cargo.mjs +20 -4
- package/rightkit-versions.json +508 -450
- package/snapshot-metadata.mjs +12 -3
- package/stage-ledger.mjs +6 -1
package/snapshot-metadata.mjs
CHANGED
|
@@ -130,8 +130,14 @@ export function snapshotCargoSpawn({ spawn, carrySpawn = spawn, cargoCommand, sn
|
|
|
130
130
|
* otherwise write target/.rustc_info.json beside the manifest and the snapshot would no longer be the commit's tree); the scratch is removed
|
|
131
131
|
* when the call returns. Every other cargo call inside the snapshot is refused (a compile belongs to the broker); calls outside the snapshot
|
|
132
132
|
* and every non-cargo command pass through to `spawn` unchanged. `spawn` may be synchronous or return a promise.
|
|
133
|
+
*
|
|
134
|
+
* `memo` (a Map the caller shares between the synchronous and the asynchronous spawn of one run; `isAsync` says which this one is) answers a
|
|
135
|
+
* repeated metadata call from the first one's result (rightkit#1460): the gate reads each workspace's `metadata --no-deps --locked` once to
|
|
136
|
+
* discover units and again as the Class A `cargo-metadata` scan, in the same verified snapshot, with the same toolchain and registry state, so the
|
|
137
|
+
* second run can only repeat the first. Only a successful call that streams to no file is kept (a failure is never replayed), keyed on the snapshot
|
|
138
|
+
* directory it ran in and its exact words; every other call (fetch, deny, audit, package, fmt) always runs.
|
|
133
139
|
*/
|
|
134
|
-
export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath, pathKey = "PATH", tmpRoot, env, err = () => {} }) {
|
|
140
|
+
export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath, pathKey = "PATH", tmpRoot, env, err = () => {}, memo = null, isAsync = false }) {
|
|
135
141
|
const prefix = cargoCommand.slice(1);
|
|
136
142
|
const refused = (code, message) => { err(`rightkit-gate: ${code}: ${message}`); return { status: BROKER_REFUSAL_STATUS, signal: null, error: null, stdout: "", stderr: `rightkit-gate: ${code}: ${message}\n` }; };
|
|
137
143
|
return (cmd, args, opts = {}) => {
|
|
@@ -140,6 +146,9 @@ export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath,
|
|
|
140
146
|
const words = args.slice(prefix.length);
|
|
141
147
|
const shape = carriedScanRefusal(words);
|
|
142
148
|
if (shape !== null) return refused(CARRIED_METADATA_REFUSED, `\`cargo ${words.join(" ")}\` would run inside the managed snapshot ${snapshotRoot} and is not one of the read-only shapes Class A runs directly (GC-A11): ${shape}`);
|
|
149
|
+
const memoKey = memo && words[0] === "metadata" && opts.stdoutFile === undefined ? `${real(opts.cwd)}\0${words.join(" ")}` : null;
|
|
150
|
+
if (memoKey !== null && memo.has(memoKey)) { const hit = { ...memo.get(memoKey) }; return isAsync ? Promise.resolve(hit) : hit; }
|
|
151
|
+
const remember = (result) => { if (memoKey !== null && result && !result.error && result.status === 0 && typeof result.stdout === "string") memo.set(memoKey, { status: 0, signal: null, error: null, stdout: result.stdout, stderr: result.stderr ?? "" }); return result; };
|
|
143
152
|
let scratch;
|
|
144
153
|
try { fs.mkdirSync(tmpRoot, { recursive: true }); scratch = fs.mkdtempSync(path.join(tmpRoot, "rk-class-a-cargo-")); }
|
|
145
154
|
catch (e) { return refused("RK_CLASS_A_SCRATCH", `cannot create a scratch target under ${tmpRoot}: ${e.message}`); }
|
|
@@ -148,8 +157,8 @@ export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath,
|
|
|
148
157
|
let r;
|
|
149
158
|
try { r = spawn("cargo", words, { ...opts, env: childEnv }); }
|
|
150
159
|
catch (e) { cleanup(); throw e; }
|
|
151
|
-
if (r && typeof r.then === "function") return r.finally(cleanup);
|
|
160
|
+
if (r && typeof r.then === "function") return r.then(remember).finally(cleanup);
|
|
152
161
|
cleanup();
|
|
153
|
-
return r;
|
|
162
|
+
return remember(r);
|
|
154
163
|
};
|
|
155
164
|
}
|
package/stage-ledger.mjs
CHANGED
|
@@ -121,6 +121,9 @@ export function walkSnapshot({ dir, tracked, dependencyRoots = new Set(), run =
|
|
|
121
121
|
return { entries, problems };
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
/** tauri-build's generated schema files, `<app crate>/gen/schemas/<name>.json`. */
|
|
125
|
+
export const TAURI_GEN_SCHEMA = /(?:^|\/)gen\/schemas\/[^/]+\.json$/;
|
|
126
|
+
|
|
124
127
|
/** What changed between two entry lists: `{ added, changed, removed }` as paths. */
|
|
125
128
|
export function diffEntries(before, after) {
|
|
126
129
|
const b = new Map(before.map((e) => [e.path, e])); const a = new Map(after.map((e) => [e.path, e]));
|
|
@@ -144,7 +147,9 @@ export function attributionProblems({ before, after, reported, receipt, removabl
|
|
|
144
147
|
// the staged sidecar outputs of the step's own earlier staging, which a `wipeStageDir` re-stage deletes); nothing else may be removed.
|
|
145
148
|
const removableSet = new Set(removable);
|
|
146
149
|
const problems = [];
|
|
147
|
-
|
|
150
|
+
// tauri-build writes its capability and ACL schemas to `<app crate>/gen/schemas/*.json` on every build of a Tauri crate; the folder is
|
|
151
|
+
// ignored by the app's own rules (checked in the walk) and is that build script's fixed output, not an unattributed write (Pulse, 2026-11-03).
|
|
152
|
+
for (const p of [...d.added, ...d.changed]) if (!allowed.has(p) && !TAURI_GEN_SCHEMA.test(p)) problems.push(`${p} was written by the staging step but it did not report it`);
|
|
148
153
|
for (const p of d.removed) if (!removableSet.has(p)) problems.push(`${p} was removed by the staging step`);
|
|
149
154
|
const present = new Set(after.map((e) => e.path));
|
|
150
155
|
for (const p of allowed) if (!present.has(p)) problems.push(`${p} was reported by the staging step but is not in the snapshot as a ledger entry`);
|