@rightkit/release 0.6.51 → 0.6.54

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.
Files changed (89) hide show
  1. package/README.md +1 -1
  2. package/adapter-env.mjs +16 -105
  3. package/admission-host.mjs +14 -1
  4. package/bin/darwin/rightkit-swap +0 -0
  5. package/bin/rightkit-gate.mjs +609 -404
  6. package/broker-admission.mjs +122 -2
  7. package/build-launch.mjs +52 -58
  8. package/build-release.mjs +2 -2
  9. package/cargo-ledger.mjs +24 -5
  10. package/cargo-target-shim.mjs +54 -23
  11. package/cargo-target.mjs +2 -2
  12. package/carried-adapter-run.mjs +7 -8
  13. package/carried-cargo-run.mjs +1 -1
  14. package/ci-compile-admission.mjs +1 -1
  15. package/clippy-route.mjs +65 -18
  16. package/compile-inputs.mjs +91 -15
  17. package/cross-targets.mjs +5 -3
  18. package/deps-cargo-lock.mjs +1 -1
  19. package/deterministic-scans.mjs +789 -259
  20. package/development.mjs +33 -7
  21. package/direct-receipt.mjs +3 -5
  22. package/feature-coverage.mjs +45 -9
  23. package/feature-partition.mjs +204 -0
  24. package/feature-sets.mjs +113 -0
  25. package/gate-acceptance.mjs +187 -115
  26. package/gate-seam.mjs +352 -0
  27. package/gate-serve.mjs +34 -2
  28. package/gate-stages.mjs +6 -2
  29. package/ghsa-audit.mjs +19 -4
  30. package/heavy-command.mjs +5 -4
  31. package/install-tauri-authenticode.mjs +73 -4
  32. package/ios-dev.mjs +3 -3
  33. package/ios-package-recipe.mjs +6 -6
  34. package/linux-setup.mjs +3 -2
  35. package/local-publish.mjs +113 -17
  36. package/lock-identity.mjs +24 -100
  37. package/managed-cargo.mjs +3 -3
  38. package/managed-root-guard.mjs +2 -2
  39. package/managed-roots.mjs +3 -3
  40. package/native-adapters.mjs +41 -244
  41. package/native-helpers.mjs +1 -1
  42. package/pack-digest.mjs +1 -1
  43. package/package-recipe-targets.mjs +3 -3
  44. package/package.json +2 -2
  45. package/publication-gate.mjs +29 -6
  46. package/publish-cargo.mjs +4 -5
  47. package/publish-local-cargo.mjs +77 -1
  48. package/qualification-verify.mjs +76 -49
  49. package/receipt-signature.mjs +104 -0
  50. package/release-switch-registry.json +4 -0
  51. package/release-switch-scan.mjs +13 -10
  52. package/rightkit-versions.json +126 -113
  53. package/scan-digest.mjs +43 -14
  54. package/seam-broker.mjs +168 -0
  55. package/snapshot-check.mjs +4 -1
  56. package/snapshot-dependency-reuse.mjs +1 -1
  57. package/snapshot-metadata.mjs +24 -35
  58. package/snapshot.mjs +328 -49
  59. package/stage-commands.mjs +59 -5
  60. package/stage-ledger.mjs +2 -2
  61. package/{carried-cargo.mjs → stage-seam.mjs} +118 -70
  62. package/stage-sidecar.mjs +3 -3
  63. package/tauri-bundle-marker.mjs +5 -2
  64. package/tauri-locked.mjs +1 -1
  65. package/tool-build.mjs +8 -6
  66. package/unit-gate.mjs +40 -10
  67. package/web-build.mjs +6 -0
  68. package/broker-handshake.mjs +0 -160
  69. package/broker-wire.mjs +0 -278
  70. package/build-ownership.mjs +0 -1578
  71. package/cargo-shapes.mjs +0 -332
  72. package/cargo-width.mjs +0 -49
  73. package/carrier-census.mjs +0 -124
  74. package/clippy-equivalence.mjs +0 -202
  75. package/freshness-census.mjs +0 -405
  76. package/handle-revocation.mjs +0 -100
  77. package/handle-revocation.rust-vector.json +0 -1
  78. package/handle-revocation.vectors.json +0 -53
  79. package/legion-freeze-consumer.mjs +0 -241
  80. package/linux-qualifier.mjs +0 -83
  81. package/native-tool-planning.mjs +0 -94
  82. package/owner-process-proof.mjs +0 -14
  83. package/ownership-mark.mjs +0 -191
  84. package/ownership-recover.mjs +0 -78
  85. package/pnpm-adapter-grammar.mjs +0 -226
  86. package/provenance-verify.mjs +0 -413
  87. package/snapshot-broker.mjs +0 -808
  88. package/snapshot-request.mjs +0 -722
  89. package/unit-list-compile.mjs +0 -356
@@ -1,202 +1,41 @@
1
- // GB-51 / RA-07, RA-08, RA-09: the constrained adapters of the native build tools (xcodegen, xcodebuild, Gradle, CMake): the reference registrations RustRight registers EXACTLY
2
- // (rustright-policy native_adapters.rs `reference_spec`, RR-NATIVE 96b6334: capability names, grammars, environment), and the gate's launch mapping onto them. Each is a snapshot-bound
3
- // adapter job: a pinned executable identity (the registration's), a committed cwd (the snapshot's counterpart of the step's directory), an argument grammar judged BEFORE the send by
4
- // the same parser the pnpm registration uses (pnpm-adapter-grammar.mjs, a port of RustRight's adapter scan), no environment, and an output root the BROKER owns: a caller never names
5
- // where the build writes (`-derivedDataPath`, `-archivePath`, `-exportPath`, `-resultBundlePath`, a cmake build tree or install prefix, a Gradle user or cache home or init script) and
6
- // never supplies a signing identity (signing stays in the provisioned identity and session with its evidence handed off). The broker rewrites the caller's words into the one managed call
7
- // (`managed_call`): every write under its per-project state, the receipt's `executable.managedOutputs` naming each location by role. Nested processes (the compiler the tool starts) are
8
- // attributed to the job by the broker's capability token; cancellation reaps the tree. Nothing here is a direct-session exemption: an unsupported custom command, an unregistered tool
9
- // or an output override refuses at planning, naming the capability.
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
- const flags = (map) => Object.entries(map).map(([name, value]) => ({ name, value }));
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
- adapter: "rightkit-xcodegen", capability: "adapter:rightkit-xcodegen", executable: "xcodegen (digest-pinned by the registration)",
36
- registration: { tool: "xcodegen", lane: "BUILD", compile: false, snapshot: true, snapshotSubcommands: ["generate"], subcommands: ["generate"],
37
- flags: flags({ "--spec": "relpath", "--project": "relpath", "--quiet": "none", "--use-cache": "none" }), positionals: "none", env: [] },
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, or a typed refusal naming the capability: a path flag the gate wrote as an absolute path inside `cwd` is made relative to it (one outside
189
- * `cwd` is refused: a snapshot-bound call names only the snapshot); an option that would move the build's OUTPUT (the broker owns the output root) is refused with the canonical route
190
- * named, never stripped or rewritten; everything left is judged by the tool's registration (snapshot-bound mode) and by the broker's shape rules (`nativeShapeProblem`).
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}; the broker's ${entry.adapter} adapter (capability ${entry.capability}) would refuse it (rightkit#1241), so it is not sent` } });
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
- const problem = adapterArgvRefusal(out, nativeGrammar(tool), { snapshot: true }) ?? nativeShapeProblem(tool, out);
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
- * `{ problem }` when the call has no managed form.
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 (hasFlag(words, "--use-cache")) add("cache", at(L.xcodegenCache)); }
165
+ if (tool === "xcodegen") { if (caller.includes("--use-cache")) add("cache", at(L.xcodegenCache)); }
366
166
  else if (tool === "xcodebuild") {
367
- const mode = xcodebuildMode(words);
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 (mode !== "build") add("install-tree", at(L.cmakeInstall));
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
-
@@ -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 "./carried-cargo.mjs";
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";
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 "./provenance-verify.mjs";
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";
@@ -67,8 +67,6 @@ function buildExtras(spec, label, { postBuild }) {
67
67
  };
68
68
  }
69
69
 
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
70
  /**
73
71
  * The build command also takes `--jobs N` (Cargo parallelism), after the same `--`. A generated Tauri build always forwards
74
72
  * `--locked` to Cargo, so a release can never resolve dependencies differently from the reviewed lockfile (rightkit#725).
@@ -224,7 +222,9 @@ export function expandWinPackageTarget(target, { appRoot, config = {}, env = pro
224
222
  resolve: mapPath.resolve(),
225
223
  ...(installerSource ? { post: [{ from: installerSource.from, to: installerFile, fresh: true }] } : {}),
226
224
  } : undefined;
227
- const bundleArgs = ["exec", "tauri", "bundle", "--bundles", "nsis", "--target", plan.triple, ...configArgs(extras, plan.appRoot, cwd), "--config", JSON.stringify(override), ...profileArgs(extras)];
225
+ const bundleArgs = ["exec", "tauri", "bundle", "--bundles", "nsis", "--target", plan.triple, ...configArgs(extras, plan.appRoot, cwd), "--config", JSON.stringify(override)];
226
+ // `tauri bundle` takes no Cargo arguments (Tauri CLI 2.12: "error: unexpected argument '--profile' found", exit 2); the profile goes to
227
+ // `tauri build --no-bundle` only. HeardRight on the Dell, 2026-11-10: a recipe with `profile: "release"` could not bundle.
228
228
  const bundleCommand = packageStage
229
229
  ? recipeBuildCommand({ extras: { prepare: [], postBuild: [] }, build: { cmd: "pnpm", args: bundleArgs, cwd }, env: QUIET_TAURI_ENV, stage: packageStage, timeoutMs: timeout })
230
230
  : { cmd: "pnpm", args: bundleArgs, cwd, env: QUIET_TAURI_ENV, timeoutMs: timeout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.51",
3
+ "version": "0.6.54",
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 failure-class.test.mjs cargo-width.test.mjs ci-compile-admission.test.mjs ownership-mark-note.test.mjs handle-revocation.test.mjs test-run-output.test.mjs ownership-auto-recover.test.mjs gate-acceptance.test.mjs stamp-relay.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"
@@ -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 > 0 && step.failed === 0)));
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 batchClippyMissingConfigurations(run.batch, evidence, entry.featureSets ?? [[]], crossTargetsFor(entry, run.host.os), expectedWorkspace).length === 0;
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
- if (!(Number.isInteger(run.passed) && run.passed > 0)) bad.push("passed (must be > 0)");
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}`));
package/publish-cargo.mjs CHANGED
@@ -3,8 +3,7 @@ import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { createHash } from "node:crypto";
5
5
  import { fileURLToPath } from "node:url";
6
- import { crossTargetsFor } from "./cross-targets.mjs";
7
- import { enforcePublicationGate, defaultEvidencePath, provenGateSteps, singleHostOfPolicy, batchClippyMissingConfigurations } from "./publication-gate.mjs";
6
+ import { enforcePublicationGate, defaultEvidencePath, provenGateSteps, ranTestsOrNone, singleHostOfPolicy, batchClippyMissingForHost } from "./publication-gate.mjs";
8
7
  import { runCargoSync } from "./managed-cargo.mjs";
9
8
  import { assertPublishCapability, refuseHostUpload } from "./host-upload-refusal.mjs";
10
9
  import { spawnSync } from "./background-process.mjs";
@@ -404,7 +403,7 @@ export async function runCargoPublish(options, execute = (_command, args, settin
404
403
  const proofHost = singleHostOfPolicy(gate.evidence) ?? "darwin";
405
404
  for (const run of gate.evidence.runs.filter((item) => item?.host?.os === proofHost && item.batch)) {
406
405
  const entry = batchConfig?.rust?.[options.crate] ?? {};
407
- const missing = batchClippyMissingConfigurations(run.batch, gate.evidence, entry.featureSets ?? [[]], crossTargetsFor(entry, run.host.os), gate.workspace);
406
+ const missing = batchClippyMissingForHost(run.batch, gate.evidence, entry, run.host.os, gate.workspace);
408
407
  if (missing.length) throw new Error(`batch clippy missing configured feature/target coverage: ${missing.map(({ features, target }) => `${features.join(" ") || "default"} @ ${target ?? "native"}`).join("; ")}`);
409
408
  }
410
409
  }
@@ -433,14 +432,14 @@ export async function runCargoPublish(options, execute = (_command, args, settin
433
432
  const expected = localTestPlan({ kind: "cargo", unit: options.crate, dir: `crates/${options.crate}`, config, batch: Boolean(run.batch), platform: proofHost });
434
433
  for (const step of expected.steps) {
435
434
  const text = `${step.command} ${step.args.join(" ")}`;
436
- if (!run.steps.some((row) => row.command === text && row.ok === true && (!step.test || (row.executed > 0 && row.failed === 0)))) {
435
+ if (!run.steps.some((row) => row.command === text && row.ok === true && (!step.test || (ranTestsOrNone(row.executed, row) && row.failed === 0)))) {
437
436
  throw new Error(`--from-evidence missing configured qualification step: ${text}`);
438
437
  }
439
438
  }
440
439
  // A batch run's clippy lives in its batch receipt, which `expected` leaves out: demand one row per feature set (0.4.1 review A2).
441
440
  if (run.batch) {
442
441
  const entry = config?.rust?.[options.crate] ?? {};
443
- const missing = batchClippyMissingConfigurations(run.batch, gate.evidence, entry.featureSets ?? [[]], crossTargetsFor(entry, run.host.os), gate.workspace);
442
+ const missing = batchClippyMissingForHost(run.batch, gate.evidence, entry, run.host.os, gate.workspace);
444
443
  if (missing.length) throw new Error(`--from-evidence missing batch clippy feature/target coverage: ${missing.map(({ features, target }) => `${features.join(" ") || "default"} @ ${target ?? "native"}`).join("; ")}`);
445
444
  }
446
445
  }