@rightkit/release 0.6.52 → 0.6.55
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/README.md +6 -1
- package/adapter-env.mjs +16 -105
- package/admission-host.mjs +14 -1
- package/bin/darwin/rightkit-swap +0 -0
- package/bin/rightkit-gate.mjs +585 -404
- package/broker-admission.mjs +122 -2
- package/build-launch.mjs +52 -58
- package/build-release.mjs +2 -2
- package/cargo-ledger.mjs +24 -5
- package/cargo-target-shim.mjs +54 -23
- package/cargo-target.mjs +2 -2
- package/carried-adapter-run.mjs +7 -8
- package/carried-cargo-run.mjs +1 -1
- package/ci-compile-admission.mjs +1 -1
- package/clippy-route.mjs +65 -18
- package/compile-inputs.mjs +91 -15
- package/cross-targets.mjs +5 -3
- package/deps-cargo-lock.mjs +1 -1
- package/deterministic-scans.mjs +789 -259
- package/development.mjs +33 -7
- package/direct-receipt.mjs +3 -5
- package/feature-coverage.mjs +45 -9
- package/feature-partition.mjs +204 -0
- package/feature-sets.mjs +113 -0
- package/gate-acceptance.mjs +187 -115
- package/gate-seam.mjs +352 -0
- package/gate-serve.mjs +34 -2
- package/gate-stages.mjs +6 -2
- package/ghsa-audit.mjs +19 -4
- package/heavy-command.mjs +5 -4
- package/install-tauri-authenticode.mjs +73 -4
- package/ios-dev.mjs +3 -3
- package/ios-package-recipe.mjs +6 -6
- package/linux-setup.mjs +3 -2
- package/local-publish.mjs +113 -17
- package/lock-identity.mjs +24 -100
- package/managed-cargo.mjs +3 -3
- package/managed-root-guard.mjs +2 -2
- package/managed-roots.mjs +3 -3
- package/native-adapters.mjs +41 -244
- package/native-helpers.mjs +1 -1
- package/ownership-mandatory-set.json +16 -0
- package/pack-digest.mjs +1 -1
- package/package-recipe-targets.mjs +19 -11
- package/package.json +2 -2
- package/publication-gate.mjs +29 -6
- package/publish-cargo.mjs +4 -5
- package/publish-local-cargo.mjs +77 -1
- package/qualification-verify.mjs +76 -49
- package/receipt-signature.mjs +104 -0
- package/recipe-build.mjs +15 -2
- package/release-switch-registry.json +4 -0
- package/release-switch-scan.mjs +13 -10
- package/rightkit-versions.json +184 -170
- package/scan-digest.mjs +43 -14
- package/seam-broker.mjs +168 -0
- package/snapshot-check.mjs +4 -1
- package/snapshot-dependency-reuse.mjs +1 -1
- package/snapshot-metadata.mjs +24 -35
- package/snapshot.mjs +328 -49
- package/stage-commands.mjs +59 -5
- package/stage-ledger.mjs +2 -2
- package/{carried-cargo.mjs → stage-seam.mjs} +118 -70
- package/stage-sidecar.mjs +9 -7
- package/tauri-bundle-marker.mjs +5 -2
- package/tauri-locked.mjs +1 -1
- package/tool-build.mjs +8 -6
- package/unit-gate.mjs +40 -10
- package/broker-handshake.mjs +0 -160
- package/broker-wire.mjs +0 -278
- package/build-ownership.mjs +0 -1578
- package/cargo-shapes.mjs +0 -332
- package/cargo-width.mjs +0 -49
- package/carrier-census.mjs +0 -124
- package/clippy-equivalence.mjs +0 -202
- package/freshness-census.mjs +0 -405
- package/handle-revocation.mjs +0 -100
- package/handle-revocation.rust-vector.json +0 -1
- package/handle-revocation.vectors.json +0 -53
- package/legion-freeze-consumer.mjs +0 -241
- package/linux-qualifier.mjs +0 -83
- package/native-tool-planning.mjs +0 -94
- package/owner-process-proof.mjs +0 -14
- package/ownership-mark.mjs +0 -191
- package/ownership-recover.mjs +0 -78
- package/pnpm-adapter-grammar.mjs +0 -226
- package/provenance-verify.mjs +0 -413
- package/snapshot-broker.mjs +0 -808
- package/snapshot-request.mjs +0 -722
- package/unit-list-compile.mjs +0 -356
package/native-adapters.mjs
CHANGED
|
@@ -1,202 +1,41 @@
|
|
|
1
|
-
// GB-51 / RA-07, RA-08, RA-09: the
|
|
2
|
-
// (
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// What the grammar cannot express is mirrored here from the broker (`native_call_problem`), so the gate sends exactly what the broker accepts and nothing it refuses:
|
|
12
|
-
// - the call's SHAPE (`nativeShapeProblem`): xcodebuild `-exportArchive` stands alone with its options file, `archive` is the only action of its call, a test plan or selection needs a
|
|
13
|
-
// test action and selections are `Target[/Class[/test]]`; cmake `--build` / `--install` are modes that must be the FIRST argument and never name a directory (the broker names the
|
|
14
|
-
// one managed build tree), a configure takes no `--config`/`--target`/`--parallel`, and no `-D` entry moves an output (`CMAKE_INSTALL_PREFIX`, `*_OUTPUT_DIRECTORY`, ...);
|
|
15
|
-
// - what only the file system can say (`nativeCallFsProblem`): the Gradle wrapper's pinned distribution, and an export options file that is a regular, small, XML, non-uploading file
|
|
16
|
-
// of the snapshot;
|
|
17
|
-
// - signing: no secret rides an argument or an environment key. The one transient Android signing-properties file is a typed FILE handoff (`signingFileProblem` mirrors the broker's
|
|
18
|
-
// `signing_file_problem` and `SigningFileLease`); RustRight has no request field that carries it yet, so a broker route refuses it before launch (`nativeSigningFileRefusal`);
|
|
19
|
-
// - the receipt's output mapping (`nativeManagedOutputs`, `nativeOutputsFromReceipt`): the roles and absolute paths under the job's managed state, read back, never guessed.
|
|
20
|
-
//
|
|
21
|
-
// The capability names are the contract with RustRight (docs/GATE-CONTRACT.md "Native tool adapters"): a broker advertises `adapter:<name>` in its capabilities, and the gate
|
|
22
|
-
// plans a stage that uses the tool only when it does.
|
|
1
|
+
// GB-51 / RA-07, RA-08, RA-09: the gate's launch mapping of the native build tools (xcodegen, xcodebuild, Gradle, CMake) onto their broker adapters, and nothing more. Plan section 4
|
|
2
|
+
// ("no capability table, no adapter grammar"): the gate no longer holds RustRight's reference registrations, its argument grammar, its shape rules or its file rules. The broker refuses at
|
|
3
|
+
// admission, before spawn: an adapter that is not registered (RK_ADAPTER_UNKNOWN), an unregistered flag, a value of the wrong kind or a denied build setting (RK_ADAPTER_ARGV_DENIED,
|
|
4
|
+
// adapter.rs check_argv), an environment key (RK_ADAPTER_ENV_DENIED), and, before it makes any state, a call with no managed form, an export options file it will not read and a Gradle wrapper
|
|
5
|
+
// whose distribution is not pinned (native_call_problem: RK_ADAPTER_ARGV_DENIED, RK_ADAPTER_PIN_REQUIRED). What stays here is what only the caller can do or read back:
|
|
6
|
+
// - the tool-to-adapter mapping (`rustright run rightkit-<tool> -- <args>`);
|
|
7
|
+
// - making a path the gate generated as an absolute one under the step's directory relative to it (a snapshot-bound adapter takes relative paths);
|
|
8
|
+
// - the signing-properties file handoff: no secret rides an argument or an environment key. The one transient Android signing-properties file is a typed FILE handoff (`signingFileProblem`
|
|
9
|
+
// mirrors the broker's `signing_file_problem`); RustRight has no request field that carries it, so a broker route refuses it before launch (`nativeSigningFileRefusal`), a refusal no broker makes;
|
|
10
|
+
// - the receipt's output mapping (`nativeManagedOutputs`, `nativeOutputsFromReceipt`): the roles and absolute paths under the job's managed state, read back and compared with the receipt, never guessed.
|
|
23
11
|
import { createHash } from "node:crypto";
|
|
24
12
|
import nodeFs from "node:fs";
|
|
25
13
|
import path from "node:path";
|
|
26
14
|
import { SIGNING_FILE_ENV } from "./adapter-env.mjs";
|
|
27
|
-
import { adapterArgvRefusal } from "./pnpm-adapter-grammar.mjs";
|
|
28
15
|
|
|
29
|
-
|
|
30
|
-
const freeze = (o) => Object.freeze(JSON.parse(JSON.stringify(o)));
|
|
31
|
-
|
|
32
|
-
/** The reference registrations, keyed by tool. `registration` is the shape of RustRight's `adapters.<id>` entry (the fields the gate judges). */
|
|
16
|
+
/** The broker adapter of each native tool (the broker's configuration registers exactly these ids; an unregistered one is RK_ADAPTER_UNKNOWN at admission). */
|
|
33
17
|
export const NATIVE_ADAPTERS = Object.freeze({
|
|
34
|
-
xcodegen: freeze({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}),
|
|
39
|
-
xcodebuild: freeze({
|
|
40
|
-
adapter: "rightkit-xcodebuild", capability: "adapter:rightkit-xcodebuild", executable: "xcodebuild (the selected Xcode's, digest-pinned by the registration)",
|
|
41
|
-
registration: { tool: "xcodebuild", lane: "BUILD", compile: true, snapshot: true, subcommands: null,
|
|
42
|
-
// A test plan is a bare name of a plan the project declares; `-exportArchive` reads one snapshot-relative options file; `-only-testing:` / `-skip-testing:` carry their identifier in the same word.
|
|
43
|
-
flags: flags({ "-project": "relpath", "-scheme": "any", "-configuration": "identifier", "-destination": "any", "-sdk": "identifier", "-quiet": "none", "-allowProvisioningUpdates": "none", "-allowProvisioningDeviceRegistration": "none", "-testPlan": "identifier", "-exportArchive": "none", "-exportOptionsPlist": "relpath" }),
|
|
44
|
-
flagPrefixes: { "-only-testing:": "any", "-skip-testing:": "any" },
|
|
45
|
-
positionals: "actionOrBuildSetting", positionalValues: ["build", "build-for-testing", "test", "test-without-building", "archive"], env: [] },
|
|
46
|
-
}),
|
|
47
|
-
gradle: freeze({
|
|
48
|
-
adapter: "rightkit-gradle", capability: "adapter:rightkit-gradle", executable: "the committed Gradle wrapper (its distributionSha256Sum pinned in gradle-wrapper.properties)",
|
|
49
|
-
registration: { tool: "gradle", lane: "BUILD", compile: true, snapshot: true, subcommands: null,
|
|
50
|
-
flags: flags({ "--offline": "none", "--no-daemon": "none", "--console": "identifier", "--stacktrace": "none", "--quiet": "none", "-q": "none", "-p": "relpath", "--project-dir": "relpath" }),
|
|
51
|
-
positionals: "gradleTask", env: [] },
|
|
52
|
-
}),
|
|
53
|
-
cmake: freeze({
|
|
54
|
-
adapter: "rightkit-cmake", capability: "adapter:rightkit-cmake", executable: "cmake (digest-pinned by the registration)",
|
|
55
|
-
registration: { tool: "cmake", lane: "BUILD", compile: true, snapshot: true, subcommands: null,
|
|
56
|
-
// `--build` and `--install` only select the mode (first argument): the broker names the one managed build tree, so there is no `-B` and no directory.
|
|
57
|
-
flags: flags({ "-S": "relpath", "-G": "any", "-A": "identifier", "--build": "none", "--config": "identifier", "--target": "any", "--parallel": "none", "--install": "none" }),
|
|
58
|
-
flagPrefixes: { "-D": "cmakeDefine" }, positionals: "none", env: [] },
|
|
59
|
-
}),
|
|
18
|
+
xcodegen: Object.freeze({ adapter: "rightkit-xcodegen" }),
|
|
19
|
+
xcodebuild: Object.freeze({ adapter: "rightkit-xcodebuild" }),
|
|
20
|
+
gradle: Object.freeze({ adapter: "rightkit-gradle" }),
|
|
21
|
+
cmake: Object.freeze({ adapter: "rightkit-cmake" }),
|
|
60
22
|
});
|
|
61
23
|
|
|
62
|
-
export const NATIVE_ADAPTER_CAPABILITIES = Object.freeze(Object.values(NATIVE_ADAPTERS).map((a) => a.capability));
|
|
63
24
|
const base = (command) => path.basename(String(command ?? "").replaceAll("\\", "/")).replace(/\.(exe|cmd|bat)$/i, "").toLowerCase();
|
|
64
25
|
/** The native tool a command names (`./gradlew` is Gradle), or null. */
|
|
65
26
|
export const nativeToolOf = (command) => { const b = base(command); const tool = b === "gradlew" ? "gradle" : b; return Object.hasOwn(NATIVE_ADAPTERS, tool) ? tool : null; };
|
|
66
27
|
|
|
67
|
-
/** The grammar of a tool's registration, in the shape the argument parser takes. */
|
|
68
|
-
export function nativeGrammar(tool) {
|
|
69
|
-
const { adapter, registration } = NATIVE_ADAPTERS[tool];
|
|
70
|
-
return Object.freeze({
|
|
71
|
-
adapter, subcommands: registration.subcommands, flags: Object.freeze(Object.fromEntries(registration.flags.map((f) => [f.name, f.value]))), positionals: registration.positionals,
|
|
72
|
-
positionalValues: registration.positionalValues, flagPrefixes: registration.flagPrefixes, env: Object.freeze([...registration.env]), opaqueAfterTarget: Object.freeze([]), opaqueTargets: Object.freeze({}),
|
|
73
|
-
snapshotSubcommands: Object.freeze([...(registration.snapshotSubcommands ?? [])]), scratchRoot: undefined,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
28
|
// Flags whose value is a path the gate generated as an absolute one under the step's directory: a snapshot-bound adapter takes it relative to the job's cwd.
|
|
78
29
|
const PATH_VALUED = Object.freeze({ xcodegen: ["--spec", "--project"], xcodebuild: ["-project", "-exportOptionsPlist"], gradle: ["-p", "--project-dir"], cmake: ["-S"] });
|
|
79
|
-
// Options that would move where a build writes (the broker owns the output root: they are not registered, so the broker would refuse them anyway); refused here naming the canonical route.
|
|
80
|
-
const OUTPUT_OWNED = Object.freeze({
|
|
81
|
-
xcodebuild: ["-derivedDataPath", "-resultBundlePath", "-resultStreamPath", "-archivePath", "-exportPath", "-clonedSourcePackagesDirPath", "-packageCachePath"],
|
|
82
|
-
gradle: ["--gradle-user-home", "-g", "--project-cache-dir", "--init-script", "-I", "--include-build"],
|
|
83
|
-
cmake: ["-B", "--install-prefix", "--toolchain", "--preset", "--workflow"],
|
|
84
|
-
xcodegen: ["--cache-path"],
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
/** The words of a caller's argv read the way the broker reads them (native_adapters.rs `split_words`, itself `adapter::scan`): flag names, each valued flag's value, and the positionals. */
|
|
88
|
-
function splitWords(tool, caller) {
|
|
89
|
-
const { registration } = NATIVE_ADAPTERS[tool];
|
|
90
|
-
const valued = new Set(registration.flags.filter((flag) => flag.value !== "none").map((flag) => flag.name));
|
|
91
|
-
const prefixes = Object.keys(registration.flagPrefixes ?? {});
|
|
92
|
-
const found = { flags: [], values: [], positionals: [] };
|
|
93
|
-
let index = 0;
|
|
94
|
-
while (index < caller.length) {
|
|
95
|
-
const word = caller[index];
|
|
96
|
-
index += 1;
|
|
97
|
-
if (word === "--") { found.positionals.push(...caller.slice(index)); break; }
|
|
98
|
-
if (!word.startsWith("-") || word === "-") { found.positionals.push(word); continue; }
|
|
99
|
-
const prefix = prefixes.find((p) => word.startsWith(p) && word.length > p.length);
|
|
100
|
-
if (prefix !== undefined) { found.flags.push(prefix); found.values.push([prefix, word.slice(prefix.length)]); continue; }
|
|
101
|
-
if (word.startsWith("--") && word.includes("=")) { const at = word.indexOf("="); found.flags.push(word.slice(0, at)); found.values.push([word.slice(0, at), word.slice(at + 1)]); continue; }
|
|
102
|
-
found.flags.push(word);
|
|
103
|
-
if (valued.has(word)) { if (index < caller.length) found.values.push([word, caller[index]]); index += 1; }
|
|
104
|
-
}
|
|
105
|
-
return found;
|
|
106
|
-
}
|
|
107
|
-
const hasFlag = (words, flag) => words.flags.includes(flag);
|
|
108
|
-
|
|
109
|
-
/** `Target`, `Target/Class` or `Target/Class/test` (a test may end in `()`), each a bare name (native_adapters.rs `test_identifier_ok`). */
|
|
110
|
-
const testIdentifierOk = (value) => {
|
|
111
|
-
const parts = value.split("/");
|
|
112
|
-
return value !== "" && value.length <= 256 && parts.length <= 3 && parts.every((part) => { const name = part.endsWith("()") ? part.slice(0, -2) : part; return /^[A-Za-z0-9_][A-Za-z0-9_.-]*$/.test(name); });
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
/** What an xcodebuild call is, or why it has no managed form (native_adapters.rs `xcodebuild_mode`): "export" | "archive" | "test" | "build", or `{ problem }`. */
|
|
116
|
-
function xcodebuildMode(words) {
|
|
117
|
-
const actions = words.positionals.filter((word) => !word.includes("="));
|
|
118
|
-
const tests = actions.some((action) => ["test", "test-without-building", "build-for-testing"].includes(action));
|
|
119
|
-
const archives = actions.includes("archive");
|
|
120
|
-
const selecting = hasFlag(words, "-testPlan") || hasFlag(words, "-only-testing:") || hasFlag(words, "-skip-testing:");
|
|
121
|
-
for (const [name, value] of words.values) if ((name === "-only-testing:" || name === "-skip-testing:") && !testIdentifierOk(value)) return { problem: `${name}${value} is not a test identifier (Target, Target/Class or Target/Class/test)` };
|
|
122
|
-
if (hasFlag(words, "-exportArchive")) {
|
|
123
|
-
if (words.positionals.length) return { problem: "-exportArchive takes no action or build setting" };
|
|
124
|
-
for (const flag of ["-project", "-scheme", "-configuration", "-destination", "-sdk"]) if (hasFlag(words, flag)) return { problem: `-exportArchive reads the managed archive; ${flag} belongs to a build` };
|
|
125
|
-
if (selecting) return { problem: "a test plan or selection does not belong to -exportArchive" };
|
|
126
|
-
if (!hasFlag(words, "-exportOptionsPlist")) return { problem: "-exportArchive needs -exportOptionsPlist" };
|
|
127
|
-
return "export";
|
|
128
|
-
}
|
|
129
|
-
if (hasFlag(words, "-exportOptionsPlist")) return { problem: "-exportOptionsPlist belongs to -exportArchive" };
|
|
130
|
-
if (archives && actions.length > 1) return { problem: "archive is the only action of its call" };
|
|
131
|
-
if (selecting && !tests) return { problem: "a test plan or selection needs build-for-testing, test or test-without-building" };
|
|
132
|
-
return archives ? "archive" : tests ? "test" : "build";
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/** What a cmake call is, or why it has no managed form (native_adapters.rs `cmake_mode`): "configure" | "build" | "install", or `{ problem }`. cmake reads `--build`/`--install` only as its first argument. */
|
|
136
|
-
function cmakeMode(words, caller) {
|
|
137
|
-
const build = hasFlag(words, "--build");
|
|
138
|
-
const install = hasFlag(words, "--install");
|
|
139
|
-
if (build && install) return { problem: "cmake takes --build or --install, not both" };
|
|
140
|
-
const mode = build ? "build" : install ? "install" : "configure";
|
|
141
|
-
if (mode === "configure") {
|
|
142
|
-
for (const flag of ["--config", "--target", "--parallel"]) if (hasFlag(words, flag)) return { problem: `${flag} belongs to --build or --install, not to a configure` };
|
|
143
|
-
return mode;
|
|
144
|
-
}
|
|
145
|
-
const selector = build ? "--build" : "--install";
|
|
146
|
-
if (caller[0] !== selector) return { problem: `${selector} must be the first argument: cmake reads its mode there` };
|
|
147
|
-
for (const flag of ["-S", "-G", "-A", "-D"]) if (hasFlag(words, flag)) return { problem: `${flag} configures; it does not belong to ${selector}` };
|
|
148
|
-
return mode;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/** CMake cache entries that move where a build or an install writes: the broker owns the build tree and the install prefix (native_adapters.rs `cmake_output_define`). */
|
|
152
|
-
const cmakeOutputDefine = (name) => {
|
|
153
|
-
const upper = name.toUpperCase();
|
|
154
|
-
return ["CMAKE_INSTALL_PREFIX", "CMAKE_STAGING_PREFIX", "EXECUTABLE_OUTPUT_PATH", "LIBRARY_OUTPUT_PATH", "FETCHCONTENT_BASE_DIR"].includes(upper)
|
|
155
|
-
|| ["CMAKE_RUNTIME_OUTPUT_DIRECTORY", "CMAKE_LIBRARY_OUTPUT_DIRECTORY", "CMAKE_ARCHIVE_OUTPUT_DIRECTORY", "CMAKE_PDB_OUTPUT_DIRECTORY", "CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY"].some((family) => upper.startsWith(family))
|
|
156
|
-
|| (upper.startsWith("CMAKE_") && upper.endsWith("_MODULE_DIRECTORY"));
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const relativeShape = (value) => value !== "" && !value.includes("\0") && !/^[/\\]/.test(value) && !(value.length >= 2 && value[1] === ":") && value.split(/[\\/]/).every((part) => part !== "..");
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Why a call has no managed form, judged on the argv alone (native_adapters.rs `managed_call` modes and `native_call_problem`'s shape rules), or null: the mode rules of xcodebuild and
|
|
163
|
-
* cmake, test selections, an output-moving `-D` entry and a non-relative `-exportOptionsPlist`. Pure: the file-system rules are `nativeCallFsProblem`.
|
|
164
|
-
*/
|
|
165
|
-
export function nativeShapeProblem(tool, args) {
|
|
166
|
-
if (!Object.hasOwn(NATIVE_ADAPTERS, tool)) return `${tool} is not a native build tool`;
|
|
167
|
-
const caller = args.map(String);
|
|
168
|
-
const words = splitWords(tool, caller);
|
|
169
|
-
if (tool === "xcodebuild") {
|
|
170
|
-
const mode = xcodebuildMode(words);
|
|
171
|
-
if (typeof mode !== "string") return mode.problem;
|
|
172
|
-
const plist = words.values.find(([name]) => name === "-exportOptionsPlist")?.[1];
|
|
173
|
-
if (plist !== undefined && !relativeShape(plist)) return `-exportOptionsPlist ${JSON.stringify(plist)} must be a relative path with no \`..\``;
|
|
174
|
-
}
|
|
175
|
-
if (tool === "cmake") {
|
|
176
|
-
const mode = cmakeMode(words, caller);
|
|
177
|
-
if (typeof mode !== "string") return mode.problem;
|
|
178
|
-
for (const [name, value] of words.values) {
|
|
179
|
-
if (name !== "-D") continue;
|
|
180
|
-
const entry = value.split(/[=:]/)[0];
|
|
181
|
-
if (cmakeOutputDefine(entry)) return `-D${entry} moves where CMake writes; the broker owns the build tree and the install prefix`;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
30
|
|
|
187
31
|
/**
|
|
188
|
-
* The argv a carried native-tool step sends
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* `{ args }` or `{ refusal: { code, message } }`. Pure: it reads no file (planning calls it with a directory that does not exist); the file-system rules are `nativeCallFsProblem`.
|
|
32
|
+
* The argv a carried native-tool step sends: a path flag the gate wrote as an absolute path inside `cwd` is made relative to it (one outside `cwd` is refused: a snapshot-bound call names only
|
|
33
|
+
* the snapshot). Nothing else is judged or changed: the broker refuses an output override, an unregistered flag or a call it has no managed form for. Pure: it reads no file.
|
|
34
|
+
* `{ args }` or `{ refusal: { code, message } }`.
|
|
192
35
|
*/
|
|
193
36
|
export function nativeToolLaunch(tool, args, { cwd }) {
|
|
194
|
-
const entry = NATIVE_ADAPTERS[tool];
|
|
195
37
|
const words = args.map(String);
|
|
196
|
-
const refuse = (message) => ({ refusal: { code: "RK_NATIVE_TOOL_REFUSED", message: `${tool} ${words.join(" ")}: ${message};
|
|
197
|
-
const nameOf = (word) => (word.includes("=") && word.startsWith("--") ? word.slice(0, word.indexOf("=")) : word);
|
|
198
|
-
const owned = words.find((word) => (OUTPUT_OWNED[tool] ?? []).includes(nameOf(word)) || (tool === "cmake" && /^-B./.test(word)));
|
|
199
|
-
if (owned !== undefined) return refuse(`${nameOf(owned)} names where the build writes, and the broker owns the output root (it supplies the one managed location); send the step without it`);
|
|
38
|
+
const refuse = (message) => ({ refusal: { code: "RK_NATIVE_TOOL_REFUSED", message: `${tool} ${words.join(" ")}: ${message}; a snapshot-bound call names only the snapshot, so it is not sent` } });
|
|
200
39
|
const pathValued = PATH_VALUED[tool] ?? [];
|
|
201
40
|
const relative = (flag, value) => {
|
|
202
41
|
if (!(path.isAbsolute(value) || path.win32.isAbsolute(value))) return { value };
|
|
@@ -223,60 +62,7 @@ export function nativeToolLaunch(tool, args, { cwd }) {
|
|
|
223
62
|
if (made.problem) return refuse(made.problem);
|
|
224
63
|
out.push(made.value);
|
|
225
64
|
}
|
|
226
|
-
|
|
227
|
-
return problem ? refuse(problem) : { args: out };
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/** Why a committed Gradle wrapper cannot be an adapter's pinned executable: its properties carry no `distributionSha256Sum`. `readFile(relative)` reads the commit's bytes; null when it can. */
|
|
231
|
-
export function gradleWrapperPinProblem(readFile, cwd = ".") {
|
|
232
|
-
const properties = path.posix.join(String(cwd).replaceAll("\\", "/"), "gradle", "wrapper", "gradle-wrapper.properties");
|
|
233
|
-
let text = null;
|
|
234
|
-
try { text = readFile(properties.replace(/^\.\//, "")); } catch { text = null; }
|
|
235
|
-
if (typeof text !== "string") return `${properties} is not in the commit, so the Gradle wrapper has no pinned identity`;
|
|
236
|
-
return /^\s*distributionSha256Sum\s*=\s*[0-9a-f]{64}\s*$/m.test(text) ? null : `${properties} carries no distributionSha256Sum, so the Gradle distribution the wrapper downloads is not pinned`;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/** The export options an `-exportArchive` reads: a regular file (never a link) of the snapshot, small, an XML property list, that does not ask for an upload (native_adapters.rs `export_options_problem`). */
|
|
240
|
-
function exportOptionsProblem(file, fsOps) {
|
|
241
|
-
let meta;
|
|
242
|
-
try { meta = fsOps.lstatSync(file); } catch { return `${file} is not in the snapshot`; }
|
|
243
|
-
if (!meta.isFile()) return `${file} is not a regular file`;
|
|
244
|
-
if (meta.size > 65_536) return `${file} is larger than an export options file`;
|
|
245
|
-
let text;
|
|
246
|
-
try { text = fsOps.readFileSync(file, "utf8"); } catch { return `${file} is not a text property list`; }
|
|
247
|
-
if (!text.replace(/^/, "").trimStart().startsWith("<?xml")) return `${file} must be an XML property list`;
|
|
248
|
-
const key = "<key>destination</key>";
|
|
249
|
-
for (let at = text.indexOf(key); at >= 0; at = text.indexOf(key, at + key.length)) {
|
|
250
|
-
const rest = text.slice(at + key.length).trimStart();
|
|
251
|
-
const value = rest.startsWith("<string>") && rest.includes("</string>") ? rest.slice("<string>".length, rest.indexOf("</string>")).trim() : null;
|
|
252
|
-
if (value === "upload") return `${file} asks the export to upload; a build does not publish`;
|
|
253
|
-
}
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* What only the file system can say about a call, judged where the call runs (native_adapters.rs `native_call_problem`'s second half), or null. `cwd` is the step's directory in the snapshot.
|
|
259
|
-
* A Gradle call needs the wrapper's distribution pinned (`RK_ADAPTER_PIN_REQUIRED` at the broker: `pin: true`); an `-exportArchive` needs its options file. `{ message, pin }` or null.
|
|
260
|
-
*/
|
|
261
|
-
export function nativeCallFsProblem(tool, args, { cwd, fsOps = nodeFs } = {}) {
|
|
262
|
-
const caller = args.map(String);
|
|
263
|
-
if (tool === "gradle") {
|
|
264
|
-
let project = path.resolve(cwd);
|
|
265
|
-
for (let i = 0; i < caller.length; i += 1) {
|
|
266
|
-
if ((caller[i] === "-p" || caller[i] === "--project-dir") && i + 1 < caller.length) { project = path.resolve(cwd, caller[i + 1]); i += 1; }
|
|
267
|
-
else if (caller[i].startsWith("--project-dir=")) project = path.resolve(cwd, caller[i].slice("--project-dir=".length));
|
|
268
|
-
}
|
|
269
|
-
const message = gradleWrapperPinProblem((relative) => fsOps.readFileSync(relative, "utf8"), project);
|
|
270
|
-
return message ? { message, pin: true } : null;
|
|
271
|
-
}
|
|
272
|
-
if (tool === "xcodebuild") {
|
|
273
|
-
const plist = splitWords(tool, caller).values.find(([name]) => name === "-exportOptionsPlist")?.[1];
|
|
274
|
-
if (plist === undefined) return null;
|
|
275
|
-
if (!relativeShape(plist)) return { message: `-exportOptionsPlist ${JSON.stringify(plist)} must be a relative path with no \`..\``, pin: false };
|
|
276
|
-
const message = exportOptionsProblem(path.resolve(cwd, plist), fsOps);
|
|
277
|
-
return message ? { message, pin: false } : null;
|
|
278
|
-
}
|
|
279
|
-
return null;
|
|
65
|
+
return { args: out };
|
|
280
66
|
}
|
|
281
67
|
|
|
282
68
|
// ---- the signing-properties file (RA-08) ----------------------------------------------------------------------------------------------------------------------------
|
|
@@ -348,23 +134,37 @@ export function nativeStateDir(outputDir, tool, relativeCwd = "") {
|
|
|
348
134
|
/** Whether a call writes managed state at all (xcodegen without `--use-cache` writes only the snapshot inputs it exists to generate). */
|
|
349
135
|
export const nativeStateNeeded = (tool, args) => tool !== "xcodegen" || args.map(String).includes("--use-cache");
|
|
350
136
|
|
|
137
|
+
// What a call is, as the broker reads it (native_adapters.rs `xcodebuild_mode`, `cmake_mode`), for an argv the broker has ADMITTED: it decides which managed locations the receipt must name.
|
|
138
|
+
// Not a judgment of the argv: a call the broker refuses never has a receipt.
|
|
139
|
+
const XCODEBUILD_VALUED = new Set(["-project", "-scheme", "-configuration", "-destination", "-sdk", "-testPlan", "-exportOptionsPlist"]);
|
|
140
|
+
const XCODEBUILD_TEST_ACTIONS = ["test", "test-without-building", "build-for-testing"];
|
|
141
|
+
function xcodebuildMode(args) {
|
|
142
|
+
if (args.includes("-exportArchive")) return "export";
|
|
143
|
+
const actions = [];
|
|
144
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
145
|
+
const word = args[i];
|
|
146
|
+
if (XCODEBUILD_VALUED.has(word)) { i += 1; continue; }
|
|
147
|
+
if (!word.startsWith("-") && !word.includes("=")) actions.push(word);
|
|
148
|
+
}
|
|
149
|
+
if (actions.includes("archive")) return "archive";
|
|
150
|
+
return actions.some((action) => XCODEBUILD_TEST_ACTIONS.includes(action)) ? "test" : "build";
|
|
151
|
+
}
|
|
152
|
+
const cmakeMode = (args) => (args[0] === "--build" ? "build" : args[0] === "--install" ? "install" : "configure");
|
|
153
|
+
|
|
351
154
|
/**
|
|
352
155
|
* The locations a call may write, by role, exactly as the broker's `managed_call` names them in the receipt (`[{ role, path }]`, in the broker's order), for the call's SENT args under `state`.
|
|
353
156
|
* `jobId` names the run-unique result bundle of a test action; without it that one entry is `{ role: "result-bundle", path: null, unresolved: true }` (the directory is `results`).
|
|
354
|
-
* `{
|
|
157
|
+
* `{ outputs }`.
|
|
355
158
|
*/
|
|
356
159
|
export function nativeManagedOutputs(tool, args, { state, jobId } = {}) {
|
|
357
160
|
const caller = args.map(String);
|
|
358
|
-
const problem = nativeShapeProblem(tool, caller);
|
|
359
|
-
if (problem) return { problem };
|
|
360
161
|
const at = (leaf) => path.join(state, leaf);
|
|
361
|
-
const words = splitWords(tool, caller);
|
|
362
162
|
const L = NATIVE_STATE_LEAVES;
|
|
363
163
|
const out = [];
|
|
364
164
|
const add = (role, file, extra = {}) => out.push({ role, path: file, ...extra });
|
|
365
|
-
if (tool === "xcodegen") { if (
|
|
165
|
+
if (tool === "xcodegen") { if (caller.includes("--use-cache")) add("cache", at(L.xcodegenCache)); }
|
|
366
166
|
else if (tool === "xcodebuild") {
|
|
367
|
-
const mode = xcodebuildMode(
|
|
167
|
+
const mode = xcodebuildMode(caller);
|
|
368
168
|
if (mode === "export") { add("archive", at(L.archive)); add("export", at(L.export)); }
|
|
369
169
|
else {
|
|
370
170
|
add("derived-data", at(L.derivedData));
|
|
@@ -374,9 +174,8 @@ export function nativeManagedOutputs(tool, args, { state, jobId } = {}) {
|
|
|
374
174
|
} else if (tool === "gradle") {
|
|
375
175
|
add("gradle-user-home", at(L.gradleHome)); add("project-cache", at(L.gradleCache)); add("build-tree", at(L.gradleBuild)); add("init-script", at(L.gradleInit));
|
|
376
176
|
} else if (tool === "cmake") {
|
|
377
|
-
const mode = cmakeMode(words, caller);
|
|
378
177
|
add("build-tree", at(L.cmakeBuild));
|
|
379
|
-
if (
|
|
178
|
+
if (cmakeMode(caller) !== "build") add("install-tree", at(L.cmakeInstall));
|
|
380
179
|
}
|
|
381
180
|
return { outputs: out };
|
|
382
181
|
}
|
|
@@ -393,7 +192,6 @@ export function nativeOutputsFromReceipt(managed, { tool, args, outputDir, relat
|
|
|
393
192
|
if (typeof outputDir !== "string" || outputDir === "") return bad("the job's verified output directory is not known");
|
|
394
193
|
const state = nativeStateDir(outputDir, tool, relativeCwd);
|
|
395
194
|
const expected = nativeManagedOutputs(tool, args, { state, jobId });
|
|
396
|
-
if (expected.problem) return bad(expected.problem);
|
|
397
195
|
if (managed.tool !== tool) return bad(`the receipt maps a ${JSON.stringify(managed.tool)} call, not ${tool}`);
|
|
398
196
|
if (typeof managed.state !== "string" || path.normalize(managed.state) !== path.normalize(state)) return bad(`the receipt's state ${JSON.stringify(managed.state)} is not the job's managed state ${state}`);
|
|
399
197
|
if (managed.outputs.length !== expected.outputs.length) return bad(`the receipt maps ${managed.outputs.length} output(s), the call's grammar maps ${expected.outputs.length}`);
|
|
@@ -408,4 +206,3 @@ export function nativeOutputsFromReceipt(managed, { tool, args, outputDir, relat
|
|
|
408
206
|
const outputs = managed.outputs.map(({ role, path: file }) => ({ role, path: file }));
|
|
409
207
|
return { ok: true, state, outputs, byRole: Object.fromEntries(outputs.map(({ role, path: file }) => [role, file])) };
|
|
410
208
|
}
|
|
411
|
-
|
package/native-helpers.mjs
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
// nested bundles itself, and signNativeHelpers below does the same for any other caller. Every external effect is injectable.
|
|
24
24
|
import { createHash } from "node:crypto";
|
|
25
25
|
import { buildLaunch } from "./build-launch.mjs";
|
|
26
|
-
import { carriedCargoMapOf } from "./
|
|
26
|
+
import { carriedCargoMapOf } from "./stage-seam.mjs";
|
|
27
27
|
import * as nodeFs from "node:fs";
|
|
28
28
|
import os from "node:os";
|
|
29
29
|
import path from "node:path";
|
|
@@ -710,6 +710,22 @@
|
|
|
710
710
|
]
|
|
711
711
|
}
|
|
712
712
|
]
|
|
713
|
+
},
|
|
714
|
+
"v2.2": {
|
|
715
|
+
"description": "TABLE1-AMENDMENT-v2.2 (draft): rightkit-roots joins M6 (Data location). Run mode, Suite, AppRoot and root cutover live there since rightkit-daemon 0.6; from rightkit-roots 0.2.0 it also resolves a flat app folder such as HeardRight's. Draft until apps move to rightkit-daemon 0.9: on older daemon pins the same code is inside the daemon, so enforcing this row earlier fails every app with nothing to adopt. Opt-in via --amendment v2.2.",
|
|
716
|
+
"rows": [
|
|
717
|
+
{
|
|
718
|
+
"id": "M6",
|
|
719
|
+
"profile": "desktop",
|
|
720
|
+
"owners": [
|
|
721
|
+
{
|
|
722
|
+
"name": "rightkit-roots",
|
|
723
|
+
"ecosystem": "cargo",
|
|
724
|
+
"min": "0.2.0"
|
|
725
|
+
}
|
|
726
|
+
]
|
|
727
|
+
}
|
|
728
|
+
]
|
|
713
729
|
}
|
|
714
730
|
}
|
|
715
731
|
}
|
package/pack-digest.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import fs from "node:fs";
|
|
12
12
|
import zlib from "node:zlib";
|
|
13
|
-
import { canonicalJson } from "./
|
|
13
|
+
import { canonicalJson } from "./receipt-signature.mjs";
|
|
14
14
|
import { SWAP_HELPER_BIN, SWAP_HELPER_PACKAGE, SWAP_HELPER_RECEIPT } from "./swap-helper-bundle.mjs";
|
|
15
15
|
|
|
16
16
|
export const CONTENT_DIGEST_DOMAIN = "rightkit-npm-content-v1";
|
|
@@ -54,6 +54,13 @@ function commandList(value, label) {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/** `targets.<platform>.requiredFiles`: app-relative files that must exist after the prepare steps (checked by recipe-build before the build step). */
|
|
58
|
+
function requiredFilesSpec(value, label) {
|
|
59
|
+
if (value === undefined) return undefined;
|
|
60
|
+
if (!Array.isArray(value) || !value.length || value.some((file) => typeof file !== "string" || !file.trim())) fail(`${label}.requiredFiles must be a non-empty list of app-relative file paths`);
|
|
61
|
+
return value.map((file, index) => relativeInside(file, `${label}.requiredFiles[${index}]`));
|
|
62
|
+
}
|
|
63
|
+
|
|
57
64
|
/** The keys shared by winPackage and macPackage: profile, tauriConfig, prepare (and postBuild where allowed). */
|
|
58
65
|
function buildExtras(spec, label, { postBuild }) {
|
|
59
66
|
if (spec.profile !== undefined && (typeof spec.profile !== "string" || !PROFILE.test(spec.profile))) fail(`${label}.profile must be a Cargo profile name`);
|
|
@@ -67,8 +74,6 @@ function buildExtras(spec, label, { postBuild }) {
|
|
|
67
74
|
};
|
|
68
75
|
}
|
|
69
76
|
|
|
70
|
-
/** Tauri v2 passes Cargo flags after `--`; the profile also decides where Tauri looks for the built binary. */
|
|
71
|
-
const profileArgs = (extras) => (extras.profile ? ["--", "--profile", extras.profile] : []);
|
|
72
77
|
/**
|
|
73
78
|
* The build command also takes `--jobs N` (Cargo parallelism), after the same `--`. A generated Tauri build always forwards
|
|
74
79
|
* `--locked` to Cargo, so a release can never resolve dependencies differently from the reviewed lockfile (rightkit#725).
|
|
@@ -81,13 +86,13 @@ const configArgs = (extras, appRoot, cwd) => (extras.tauriConfig ? ["--config",
|
|
|
81
86
|
* release.mjs runs ONE prePackage command: node recipe-build.mjs runs the built-in cleanup, prepare, the Tauri build,
|
|
82
87
|
* the artifact stability poll and postBuild in order. `cleanup` and `stability` are recipe-build plan sections.
|
|
83
88
|
*/
|
|
84
|
-
function recipeBuildCommand({ extras, build, env, cleanup, stability, stage, timeoutMs, verifySidecars, nativeHelpers, boundTargets }) {
|
|
89
|
+
function recipeBuildCommand({ extras, build, env, cleanup, stability, stage, timeoutMs, verifySidecars, nativeHelpers, boundTargets, requiredFiles }) {
|
|
85
90
|
const steps = [
|
|
86
91
|
...extras.prepare.map((step) => ({ phase: "prepare", ...step })),
|
|
87
92
|
{ phase: "build", cmd: build.cmd, args: build.args, cwd: build.cwd },
|
|
88
93
|
...extras.postBuild.map((step) => ({ phase: "postBuild", ...step })),
|
|
89
94
|
];
|
|
90
|
-
const plan = { version: 1, steps, ...(boundTargets?.length ? { boundTargets } : {}), ...(cleanup ? { cleanup } : {}), ...(stability ? { stability } : {}), ...(stage && (stage.pre?.length || stage.post?.length) ? { stage } : {}), ...(verifySidecars ? { verifySidecars } : {}), ...(nativeHelpers ? { nativeHelpers } : {}) };
|
|
95
|
+
const plan = { version: 1, steps, ...(boundTargets?.length ? { boundTargets } : {}), ...(cleanup ? { cleanup } : {}), ...(stability ? { stability } : {}), ...(stage && (stage.pre?.length || stage.post?.length) ? { stage } : {}), ...(verifySidecars ? { verifySidecars } : {}), ...(nativeHelpers ? { nativeHelpers } : {}), ...(requiredFiles?.length ? { requiredFiles } : {}) };
|
|
91
96
|
return { cmd: process.execPath, args: [RECIPE_BUILD, "--plan", JSON.stringify(plan)], env, ...(timeoutMs ? { timeoutMs } : {}) };
|
|
92
97
|
}
|
|
93
98
|
|
|
@@ -171,9 +176,9 @@ function splitTargetRootMapper({ spec, appRoot, cwd, resolveTargetRoot, label })
|
|
|
171
176
|
return mapper;
|
|
172
177
|
}
|
|
173
178
|
|
|
174
|
-
function winPrePackage({ extras, cwd, appRoot, triple, jobs, timeoutMs, cleanup, stability, stage, boundTargets }) {
|
|
179
|
+
function winPrePackage({ extras, cwd, appRoot, triple, jobs, timeoutMs, cleanup, stability, stage, boundTargets, requiredFiles }) {
|
|
175
180
|
const args = ["exec", "tauri", "build", "--no-bundle", "--target", triple, ...configArgs(extras, appRoot, cwd), ...buildCargoArgs(extras, jobs)];
|
|
176
|
-
return recipeBuildCommand({ extras, build: { cmd: "pnpm", args, cwd }, env: QUIET_TAURI_ENV, cleanup, stability, stage, timeoutMs, boundTargets });
|
|
181
|
+
return recipeBuildCommand({ extras, build: { cmd: "pnpm", args, cwd }, env: QUIET_TAURI_ENV, cleanup, stability, stage, timeoutMs, boundTargets, requiredFiles });
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
/** `targets.win.winPackage` → prePackage (`tauri build --no-bundle`) and package (`tauri bundle --bundles nsis`). */
|
|
@@ -224,7 +229,9 @@ export function expandWinPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
224
229
|
resolve: mapPath.resolve(),
|
|
225
230
|
...(installerSource ? { post: [{ from: installerSource.from, to: installerFile, fresh: true }] } : {}),
|
|
226
231
|
} : undefined;
|
|
227
|
-
const bundleArgs = ["exec", "tauri", "bundle", "--bundles", "nsis", "--target", plan.triple, ...configArgs(extras, plan.appRoot, cwd), "--config", JSON.stringify(override)
|
|
232
|
+
const bundleArgs = ["exec", "tauri", "bundle", "--bundles", "nsis", "--target", plan.triple, ...configArgs(extras, plan.appRoot, cwd), "--config", JSON.stringify(override)];
|
|
233
|
+
// `tauri bundle` takes no Cargo arguments (Tauri CLI 2.12: "error: unexpected argument '--profile' found", exit 2); the profile goes to
|
|
234
|
+
// `tauri build --no-bundle` only. HeardRight on the Dell, 2026-11-10: a recipe with `profile: "release"` could not bundle.
|
|
228
235
|
const bundleCommand = packageStage
|
|
229
236
|
? recipeBuildCommand({ extras: { prepare: [], postBuild: [] }, build: { cmd: "pnpm", args: bundleArgs, cwd }, env: QUIET_TAURI_ENV, stage: packageStage, timeoutMs: timeout })
|
|
230
237
|
: { cmd: "pnpm", args: bundleArgs, cwd, env: QUIET_TAURI_ENV, timeoutMs: timeout };
|
|
@@ -233,7 +240,7 @@ export function expandWinPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
233
240
|
return {
|
|
234
241
|
...rest,
|
|
235
242
|
signingContract: "windows-raw-exe-authenticode-before-nsis-v1",
|
|
236
|
-
prePackage: winPrePackage({ extras, cwd, appRoot: plan.appRoot, triple: plan.triple, jobs, timeoutMs: timeout, cleanup, stability: { files: [rawExe] }, stage: prePackageStage, boundTargets: mapPath.bound }),
|
|
243
|
+
prePackage: winPrePackage({ extras, cwd, appRoot: plan.appRoot, triple: plan.triple, jobs, timeoutMs: timeout, cleanup, stability: { files: [rawExe] }, stage: prePackageStage, boundTargets: mapPath.bound, requiredFiles: requiredFilesSpec(target.requiredFiles, "targets.win") }),
|
|
237
244
|
package: bundleCommand,
|
|
238
245
|
sign: { ...(target.sign ?? {}), prePackageFiles: [rawExe], files: [installerFile] },
|
|
239
246
|
recipe: { kind: "winPackage", productName: plan.productName, updater: plan.updater },
|
|
@@ -383,7 +390,8 @@ export function expandMacPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
383
390
|
// An entry inside another staged entry (a file within the .app) is covered by copying the outer one.
|
|
384
391
|
const macEntries = [...mapPath.staged.values()].filter((entry) => ![...mapPath.staged.values()].some((outer) => outer !== entry && entry.to.startsWith(`${outer.to}/`)));
|
|
385
392
|
const macStage = macEntries.length ? { post: macEntries.map((entry) => ({ ...entry, fresh: true })), resolve: mapPath.resolve() } : undefined;
|
|
386
|
-
const
|
|
393
|
+
const requiredFiles = requiredFilesSpec(target.requiredFiles, "targets.mac");
|
|
394
|
+
const wrapped = extras.prepare.length || extras.postBuild.length || cleanup || macStage || helpers || requiredFiles;
|
|
387
395
|
const forceArch = helpers && triple !== "universal-apple-darwin" ? (triple === "aarch64-apple-darwin" ? "arm64" : "x86_64") : undefined;
|
|
388
396
|
const nativeHelpersPlan = helpers ? { app, helpers, ...(config?.version ? { version: config.version } : {}), ...(forceArch ? { forceArch } : {}), configuration: "release" } : undefined;
|
|
389
397
|
const verifySidecars = sidecars && triple === "universal-apple-darwin" ? { receipt: sidecars.receipt, target: triple } : undefined;
|
|
@@ -400,8 +408,8 @@ export function expandMacPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
400
408
|
...rest,
|
|
401
409
|
...postSign,
|
|
402
410
|
prePackage: prebuilt
|
|
403
|
-
? (wrapped ? recipeBuildCommand({ extras, build: { cmd: target.prePackage.cmd, args: target.prePackage.args ?? [], ...(target.prePackage.cwd === undefined ? {} : { cwd: target.prePackage.cwd }) }, env: target.prePackage.env ?? {}, cleanup, stage: macStage, boundTargets: mapPath.bound }) : target.prePackage)
|
|
404
|
-
: wrapped ? recipeBuildCommand({ extras, build: { cmd: "pnpm", args, cwd }, env: QUIET_TAURI_ENV, cleanup, stage: macStage, verifySidecars, nativeHelpers: nativeHelpersPlan, boundTargets: mapPath.bound }) : { cmd: "pnpm", args, cwd, env: QUIET_TAURI_ENV },
|
|
411
|
+
? (wrapped ? recipeBuildCommand({ extras, build: { cmd: target.prePackage.cmd, args: target.prePackage.args ?? [], ...(target.prePackage.cwd === undefined ? {} : { cwd: target.prePackage.cwd }) }, env: target.prePackage.env ?? {}, cleanup, stage: macStage, boundTargets: mapPath.bound, requiredFiles }) : target.prePackage)
|
|
412
|
+
: wrapped ? recipeBuildCommand({ extras, build: { cmd: "pnpm", args, cwd }, env: QUIET_TAURI_ENV, cleanup, stage: macStage, verifySidecars, nativeHelpers: nativeHelpersPlan, boundTargets: mapPath.bound, requiredFiles }) : { cmd: "pnpm", args, cwd, env: QUIET_TAURI_ENV },
|
|
405
413
|
// Helpers are signed by release.mjs inside-out through sign.nestedCode (deepest path first, hardened runtime, each helper's own entitlements), then the app.
|
|
406
414
|
sign: { ...(target.sign ?? {}), ...(helpers ? { nestedCode: { ...nativeHelperNestedCode(helpers), ...(target.sign?.nestedCode ?? {}) } } : {}), prePackageFiles },
|
|
407
415
|
notarize: { ...target.notarize, app, appBeforePackage: true },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rightkit/release",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.55",
|
|
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",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"smol-toml": "1.9.1"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
|
-
"test": "node --test affected-units.test.mjs batch-workspace.test.mjs unit-list-compile.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
|
|
103
|
+
"test": "node --test gate/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 gate-acceptance.test.mjs stamp-relay.test.mjs install-tauri-authenticode.test.mjs gate-stage-binding.test.mjs tool-output.test.mjs publication-gate.test.mjs",
|
|
104
104
|
"test:registry-parity": "node registry-parity.mjs --allow-unpublished",
|
|
105
105
|
"test:signer:windows": "node sign-release-manifest.integration.mjs",
|
|
106
106
|
"verify:standalone": "node standalone-clone-verify.mjs"
|
package/publication-gate.mjs
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
// passing host run receipts from that same SHA: macOS and Windows, or macOS only for Swift.
|
|
5
5
|
// Format: docs/RIGHTKIT-SHARED-PACKAGES.md, "Publication gate" -> "Evidence file format".
|
|
6
6
|
import crypto from "node:crypto";
|
|
7
|
-
import { crossTargetsFor } from "./cross-targets.mjs";
|
|
7
|
+
import { crossTargetsFor, scopedCrossTargets } from "./cross-targets.mjs";
|
|
8
|
+
import { crossFeatureSets, hostFeatureSets } from "./feature-sets.mjs";
|
|
8
9
|
import { committedCargoWorkspace } from "./committed-cargo-workspace.mjs";
|
|
9
10
|
import fs from "node:fs";
|
|
10
11
|
import os from "node:os";
|
|
@@ -102,8 +103,10 @@ export function batchReceiptProblems(batch, evidence, tree, expectedWorkspace) {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
/** Missing native and cross-target configurations, each bound to the authenticated workspace. */
|
|
105
|
-
export function batchClippyMissingConfigurations(batch, evidence, featureSets, targets, expectedWorkspace) {
|
|
106
|
+
export function batchClippyMissingConfigurations(batch, evidence, featureSets, targets, expectedWorkspace, crossSets = featureSets) {
|
|
106
107
|
const sets = (Array.isArray(featureSets) && featureSets.length ? featureSets : [[]]);
|
|
108
|
+
// The sets that are also linted for foreign targets (feature-sets.mjs): a host-scoped set is a native-host set and owes no cross-target row.
|
|
109
|
+
const crossKeys = new Set((Array.isArray(crossSets) ? crossSets : sets).map((set) => JSON.stringify(set)));
|
|
107
110
|
if (!text(expectedWorkspace) || !Array.isArray(targets) || sets.some((set) => !Array.isArray(set) || set.some((arg) => !text(arg)))) throw new Error("invalid batch clippy requirements");
|
|
108
111
|
const rows = (Array.isArray(batch?.checks) ? batch.checks : []).filter((row) => row?.name === "clippy" && row.ok === true
|
|
109
112
|
&& row.commit === evidence.commit && row.tree === batch.tree && row.workspace === expectedWorkspace
|
|
@@ -111,13 +114,25 @@ export function batchClippyMissingConfigurations(batch, evidence, featureSets, t
|
|
|
111
114
|
&& new Set(row.crates).size === row.crates.length
|
|
112
115
|
&& row.crates.every((crate) => typeof crate === "string" && /^[A-Za-z0-9_-]+$/.test(crate) && batch.workspaces?.[crate] === expectedWorkspace));
|
|
113
116
|
const missing = [];
|
|
114
|
-
for (const features of sets) for (const target of [null, ...targets]) {
|
|
117
|
+
for (const features of sets) for (const target of [null, ...(crossKeys.has(JSON.stringify(features)) ? targets : [])]) {
|
|
115
118
|
const command = (crates) => ["cargo", "clippy", ...crates.flatMap((crate) => ["-p", crate]), "--message-format=json-render-diagnostics", "--no-deps", "--all-targets", ...(target ? ["--target", target] : []), ...features, "--", "-D", "warnings"].join(" ");
|
|
116
119
|
if (!rows.some((row) => row.command === command(row.crates))) missing.push({ features, target });
|
|
117
120
|
}
|
|
118
121
|
return missing;
|
|
119
122
|
}
|
|
120
123
|
|
|
124
|
+
/**
|
|
125
|
+
* `batchClippyMissingConfigurations` for the crate's own entry in ci/gate.config.json on the host that PRODUCED the evidence (`platform`: its
|
|
126
|
+
* `run.host.os`): that host's feature sets (feature-sets.mjs), the foreign targets its `platforms` scope names, and a cross-target row only for
|
|
127
|
+
* the sets that are not host-scoped. A crate whose every declared set is scoped to other hosts has nothing a batch on this host could prove.
|
|
128
|
+
*/
|
|
129
|
+
export function batchClippyMissingForHost(batch, evidence, entry, platform, expectedWorkspace) {
|
|
130
|
+
const sets = hostFeatureSets(entry, platform, "featureSets", evidence?.name) ?? [[]];
|
|
131
|
+
if (sets.length === 0 && Array.isArray(entry?.featureSets) && entry.featureSets.length) return [{ features: [], target: null }];
|
|
132
|
+
const cross = crossFeatureSets(entry, platform, "featureSets", evidence?.name) ?? [[]];
|
|
133
|
+
return batchClippyMissingConfigurations(batch, evidence, sets, scopedCrossTargets(entry, platform), expectedWorkspace, cross);
|
|
134
|
+
}
|
|
135
|
+
|
|
121
136
|
// Historical helper keeps its feature-array result while requiring independent workspace identity.
|
|
122
137
|
export function batchClippyMissingFeatureSets(batch, evidence, featureSets, expectedWorkspace) {
|
|
123
138
|
return batchClippyMissingConfigurations(batch, evidence, featureSets, [], expectedWorkspace).map((entry) => entry.features);
|
|
@@ -139,12 +154,12 @@ export function provenGateSteps(evidence, expectedWorkspace, gateConfig) {
|
|
|
139
154
|
if (!runs.length || runs.some((run) => run.commit !== evidence.commit)) return none;
|
|
140
155
|
const name = escapeRegExp(evidence.name);
|
|
141
156
|
const stepProves = (run, pattern, needTests) => (Array.isArray(run.steps) ? run.steps : []).some((step) => step?.ok === true
|
|
142
|
-
&& pattern.test(String(step.command ?? "")) && (!needTests || (step.executed
|
|
157
|
+
&& pattern.test(String(step.command ?? "")) && (!needTests || (ranTestsOrNone(step.executed, step) && step.failed === 0)));
|
|
143
158
|
const batchOk = (run) => {
|
|
144
159
|
if (!gateConfig || run.batch === undefined || batchReceiptProblems(run.batch, evidence, undefined, expectedWorkspace).length) return false;
|
|
145
160
|
try {
|
|
146
161
|
const entry = gateConfig?.rust?.[evidence.name] ?? {};
|
|
147
|
-
return
|
|
162
|
+
return batchClippyMissingForHost(run.batch, evidence, entry, run.host.os, expectedWorkspace).length === 0;
|
|
148
163
|
} catch { return false; }
|
|
149
164
|
};
|
|
150
165
|
return {
|
|
@@ -155,6 +170,13 @@ export function provenGateSteps(evidence, expectedWorkspace, gateConfig) {
|
|
|
155
170
|
};
|
|
156
171
|
}
|
|
157
172
|
|
|
173
|
+
/**
|
|
174
|
+
* The test count rule of GATE-CONTRACT GC-A08 (Adrian, 2026-11-03, end-to-end tests only: "My decision was no unit tests. Only e2e."):
|
|
175
|
+
* a positive count, or exactly zero tests with nothing skipped and nothing ignored (a crate or package with no test). The failure
|
|
176
|
+
* count is the caller's own check; zero tests beside a skip or an ignore is never a pass, named or not.
|
|
177
|
+
*/
|
|
178
|
+
export const ranTestsOrNone = (count, { skipped, ignored } = {}) => Number.isInteger(count) && (count > 0 || (count === 0 && !(skipped > 0) && !(ignored > 0)));
|
|
179
|
+
|
|
158
180
|
// Names of the fields of one host run that do not qualify (empty when the run qualifies). Every run binds to
|
|
159
181
|
// the same unit, commit and artifact: commit, host arch, feature set and artifactSha256 equal to the evidence.
|
|
160
182
|
function invalidRunFields(run, evidence, tree, expectedWorkspace) {
|
|
@@ -166,7 +188,8 @@ function invalidRunFields(run, evidence, tree, expectedWorkspace) {
|
|
|
166
188
|
if (!text(run.command)) bad.push("command");
|
|
167
189
|
if (!text(run.operator)) bad.push("operator");
|
|
168
190
|
if (!text(run.timestamp)) bad.push("timestamp");
|
|
169
|
-
|
|
191
|
+
// A Swift package is outside the no-test decision (crates and npm units only): its run still needs a positive count.
|
|
192
|
+
if (!(evidence.kind === "swift" ? Number.isInteger(run.passed) && run.passed > 0 : ranTestsOrNone(run.passed, run))) bad.push("passed (must be > 0, or 0 with nothing skipped or ignored)");
|
|
170
193
|
if (run.failed !== 0) bad.push("failed (must be 0)");
|
|
171
194
|
if (run.jobs !== undefined && !(Number.isInteger(run.jobs) && run.jobs >= 1 && run.jobs <= MAX_CARGO_JOBS)) bad.push(`jobs (must be an integer from 1 to ${MAX_CARGO_JOBS})`);
|
|
172
195
|
if (run.batch !== undefined) bad.push(...batchReceiptProblems(run.batch, evidence, tree ?? null, expectedWorkspace).map((problem) => `batch: ${problem}`));
|