@rightkit/release 0.6.40 → 0.6.42
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 +110 -11
- package/admission-files.mjs +40 -0
- package/admission-host.mjs +2 -1
- package/app-check.mjs +303 -16
- package/app-closure.mjs +6 -4
- package/bin/rightkit-gate.mjs +177 -32
- package/cargo-contract.mjs +17 -31
- package/cargo-license-notices.mjs +129 -19
- package/cargo-target-shim.mjs +14 -0
- package/carried-cargo.mjs +2 -4
- package/cli/right-release.mjs +24 -2
- package/cross-targets.mjs +24 -0
- package/deterministic-scans.mjs +150 -58
- package/development-signing.mjs +25 -2
- package/development.mjs +34 -1
- package/direct-release-command.mjs +154 -0
- package/disk-policy.mjs +16 -0
- package/feature-coverage.mjs +134 -0
- package/gate-coverage.mjs +38 -0
- package/gate-stages.mjs +1 -0
- package/ghsa-audit.mjs +95 -0
- package/install-app.mjs +33 -5
- package/install-channels.mjs +301 -0
- package/interactive-session-run.mjs +105 -0
- package/legal-contract.mjs +10 -1
- package/legion-freeze-consumer.mjs +241 -0
- package/linux-publish.mjs +136 -0
- package/local-publish.mjs +31 -8
- package/nsis-pack.mjs +95 -0
- package/nsis-upgrade-template.mjs +93 -0
- package/outdated-command.mjs +19 -0
- package/ownership-class-rules.mjs +32 -10
- package/ownership-mandatory-set.json +23 -0
- package/ownership-mandatory-set.mjs +66 -8
- package/package-recipe-targets.mjs +54 -19
- package/package.json +1 -1
- package/payload-root-install.mjs +123 -0
- package/plugin-delivery.mjs +141 -0
- package/prebuild-gates.mjs +8 -4
- package/preflight.mjs +6 -1
- package/provision-model-bundle.mjs +172 -0
- package/pub-upload.mjs +1 -1
- package/publish-local-npm.mjs +34 -9
- package/publish-retention.mjs +106 -0
- package/publish-update.mjs +15 -8
- package/qa-build-features.mjs +24 -15
- package/qa-contract.mjs +5 -6
- package/qa-control-scan.mjs +14 -0
- package/qa-web-pairing.mjs +76 -0
- package/r2-s3-multipart.mjs +190 -0
- package/r2-verified-upload.mjs +28 -16
- package/recipe-build.mjs +53 -3
- package/release-checks.mjs +53 -2
- package/release-config.mjs +8 -3
- package/release-invocation.mjs +12 -2
- package/release-pin-floor.mjs +44 -0
- package/release-qa-audit.mjs +18 -2
- package/release-qa-command.mjs +17 -1
- package/release-qa-policy.mjs +30 -3
- package/release-switch-cfg.mjs +271 -0
- package/release-switch-registry.json +60 -1
- package/release-switch-scan.mjs +398 -23
- package/release.mjs +97 -6
- package/render-views.mjs +141 -0
- package/rightkit-registry-resolver.mjs +1 -1
- package/rightkit-versions.json +140 -103
- package/runtime-artifact-manifest.mjs +9 -0
- package/runtime-manifest-refresh.mjs +88 -0
- package/rustright-stage.mjs +197 -0
- package/scan-digest.mjs +15 -9
- package/scan-tool-enrolment.mjs +1 -1
- package/security-policy.mjs +196 -0
- package/shell-contract.mjs +32 -0
- package/snapshot-broker.mjs +8 -1
- package/snapshot-check.mjs +58 -0
- package/snapshot-request.mjs +25 -2
- package/stage-commands.mjs +33 -4
- package/stage-receipt.mjs +115 -0
- package/stage-sidecar.mjs +188 -17
- package/stage-xcframework.mjs +118 -0
- package/suite-api.generated.mjs +16 -1
- package/unit-gate.mjs +14 -2
- package/upload-large.mjs +4 -4
- package/upload-release.mjs +6 -0
- package/win-package-recipe.mjs +26 -4
package/deterministic-scans.mjs
CHANGED
|
@@ -25,7 +25,8 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
25
25
|
import { spawn as spawnChild, spawnSync } from "./background-process.mjs";
|
|
26
26
|
import { spawnUnderOwnership } from "./build-ownership.mjs";
|
|
27
27
|
import { checkAdvisoryExceptions } from "./advisory-exceptions.mjs";
|
|
28
|
-
import {
|
|
28
|
+
import { crateRunsOn, crossCompileEnv, oneOutput, scopedCrossTargets } from "./cross-targets.mjs";
|
|
29
|
+
import { declaredFeatureNames, effectiveCrateFeatures, featureCoverageProblems } from "./feature-coverage.mjs";
|
|
29
30
|
import { CLIPPY_UNIVERSAL_FEATURE_FLAGS, canonicalJson, clippyBatchPlan, clippySelectionOf, digestScanSet, requiredScanIds, rustCratePlan, rustScanId } from "./scan-digest.mjs";
|
|
30
31
|
import { reach } from "./lock-graph.mjs";
|
|
31
32
|
import { cargoManifestState } from "./cargo-manifest-text.mjs";
|
|
@@ -34,6 +35,8 @@ import { PYTHON_LOCK_FILE, pythonLockProblems } from "./python-lock.mjs";
|
|
|
34
35
|
import { lockOwnerOf, packageLockProblems, xcodeProjectLockProblems } from "./swift-lock.mjs";
|
|
35
36
|
import { LAUNCH_GUARD_IMPORT } from "./class-a-launch-guard.mjs";
|
|
36
37
|
import { advisoryCacheRoot, ensureAdvisoryDb, prepareDenyOverlay, readAdvisoryPin } from "./advisory-db.mjs";
|
|
38
|
+
import { ghsaFindings } from "./ghsa-audit.mjs";
|
|
39
|
+
import { OutdatedUnavailableError, resolveOutdatedBin } from "./outdated-command.mjs";
|
|
37
40
|
import { isInsideGenerationTarget, observedEnvOf, readRequestRef, verifySnapshotReceipt, writeSnapshotRequest } from "./snapshot-request.mjs";
|
|
38
41
|
import { SCAN_TOKEN_ENV, appendLedger, readLedger, scanTokenOf, unclaimedLedgers } from "./cargo-ledger.mjs";
|
|
39
42
|
import { brokerSection, carryBrokerAdapterAsync, verifyBrokerLedger } from "./snapshot-broker.mjs";
|
|
@@ -51,7 +54,7 @@ export const CHECKER_IDENTITY = (() => {
|
|
|
51
54
|
try {
|
|
52
55
|
const p = JSON.parse(fs.readFileSync(new URL("./package.json", import.meta.url), "utf8"));
|
|
53
56
|
const h = crypto.createHash("sha256");
|
|
54
|
-
for (const f of ["./deterministic-scans.mjs", "./scan-digest.mjs", "./swift-lock.mjs", "./gradle-lock.mjs", "./python-lock.mjs"]) { h.update(f); h.update("\0"); h.update(fs.readFileSync(new URL(f, import.meta.url))); h.update("\0"); }
|
|
57
|
+
for (const f of ["./deterministic-scans.mjs", "./scan-digest.mjs", "./swift-lock.mjs", "./gradle-lock.mjs", "./python-lock.mjs", "./ghsa-audit.mjs"]) { h.update(f); h.update("\0"); h.update(fs.readFileSync(new URL(f, import.meta.url))); h.update("\0"); }
|
|
55
58
|
return `${p.name}@${p.version}#${h.digest("hex").slice(0, 16)}`;
|
|
56
59
|
} catch { return null; }
|
|
57
60
|
})();
|
|
@@ -72,14 +75,17 @@ export const CLASS_A_SCAN_PREFIXES = Object.freeze([
|
|
|
72
75
|
"actionlint", "shellcheck", "pnpm-lockfile", "swift-lock", "gradle-lock", "python-lock", "pnpm-audit", "cargo-metadata", "cargo-deny", "cargo-audit", "cargo-package-list",
|
|
73
76
|
"changelog-version", "license", "secret-scan", "path-policy", "advisory-exceptions", "suite-api", "build-helpers",
|
|
74
77
|
// Everything mechanical and deterministic that does not compile is class A (Adrian, 2026-10-27): typecheck, lint, generated docs.
|
|
75
|
-
"tsc", "eslint", "biome", "generated-docs",
|
|
78
|
+
"tsc", "eslint", "biome", "oxlint", "generated-docs",
|
|
79
|
+
// The GitHub advisory database beside RustSec (rightkit#1461), dependency freshness as advice (rightkit#1475), the Swift type-check
|
|
80
|
+
// (rightkit#1289) and the Cargo feature coverage check (rightkit#1231).
|
|
81
|
+
"ghsa-audit", "dependency-freshness", "swift-typecheck", "feature-coverage",
|
|
76
82
|
]);
|
|
77
83
|
// Class B includes compiles and tests that execute project code.
|
|
78
84
|
export const CLASS_B_SCAN_PREFIXES = Object.freeze([
|
|
79
85
|
"clippy", "check", "check-all-features", "check-features", "check-dependent", "doc", "swift-build",
|
|
80
86
|
]);
|
|
81
87
|
// Test scripts can invoke a compiler indirectly, so all tests run after Class A.
|
|
82
|
-
export const TEST_SCAN_CLASS = Object.freeze({ "test:rust": "B", "test:rust-serial": "B", "test:npm": "B"
|
|
88
|
+
export const TEST_SCAN_CLASS = Object.freeze({ "test:rust": "B", "test:rust-serial": "B", "test:npm": "B" });
|
|
83
89
|
|
|
84
90
|
/**
|
|
85
91
|
* Rollout switch for the CI integration (ci/gate.config.json: { "deterministicScans": { "enabled": true } }).
|
|
@@ -397,15 +403,18 @@ export const ESLINT_CONFIG_FILES = Object.freeze([
|
|
|
397
403
|
".eslintrc", ".eslintrc.js", ".eslintrc.cjs", ".eslintrc.yaml", ".eslintrc.yml",
|
|
398
404
|
]);
|
|
399
405
|
export const BIOME_CONFIG_FILES = Object.freeze(["biome.json", "biome.jsonc"]);
|
|
406
|
+
// Oxlint reads `.oxlintrc.json` (JSON with comments) or an `oxlint.config.*` from the directory it runs in (rightkit#1402). It is JS/TS only (Rust stays Clippy)
|
|
407
|
+
// and never replaces ESLint or Biome: a package with several of these configs runs every one of them, so no unmatched rule is silently dropped.
|
|
408
|
+
export const OXLINT_CONFIG_FILES = Object.freeze([".oxlintrc.json", "oxlint.config.ts", "oxlint.config.mts", "oxlint.config.cts", "oxlint.config.js", "oxlint.config.mjs", "oxlint.config.cjs"]);
|
|
400
409
|
// Everything scripts/generate-index.mjs reads or writes (its header and loadInventory): crate and package manifests and
|
|
401
410
|
// READMEs, the root Cargo.toml (workspace version), the versions and ownership data, the ownership-availability helper it imports, itself,
|
|
402
411
|
// the port matrix generator it imports, and its outputs (the port matrix's MD and HTML are checked for consistency with its JSON).
|
|
403
412
|
// The Right Suite API contract and every projection scripts/gen-suite-api.mjs writes from it (the test-vector copy included).
|
|
404
|
-
const SUITE_API_INPUT = /^(contracts\/right-suite-api\.v1\.json|scripts\/gen-suite-api\.mjs|crates\/rightkit-license\/src\/suite_api_generated\.rs|packages\/app-update\/src\/suite-api\.generated\.ts|packages\/release\/suite-api\.generated\.mjs|swift\/RightKitSwift\/Sources\/RightKitLicense\/RightSuiteAPI\.generated\.swift
|
|
413
|
+
const SUITE_API_INPUT = /^(contracts\/right-suite-api\.v1\.json|scripts\/gen-suite-api\.mjs|crates\/rightkit-license\/src\/suite_api_generated\.rs|packages\/app-update\/src\/suite-api\.generated\.ts|packages\/release\/suite-api\.generated\.mjs|swift\/RightKitSwift\/Sources\/RightKitLicense\/RightSuiteAPI\.generated\.swift)$/;
|
|
405
414
|
const GENERATOR_INPUT = /^(crates\/[^/]+\/(Cargo\.toml|README\.md)|packages\/[^/]+\/(package\.json|README\.md)|Cargo\.toml|packages\/release\/(rightkit-versions\.json|rightkit-ownership\.json|ownership-availability\.mjs)|scripts\/generate-(index|port-matrix)\.mjs|INDEX\.md|docs\/(ADOPTION|CAPABILITY-MAP|PORT-MATRIX)\.md|docs\/port-matrix\.(html|json))$/;
|
|
406
415
|
const PROBES = Object.freeze({
|
|
407
416
|
rustfmt: ["--version"], node: ["--version"], rustright: ["cargo", "--version"], pnpm: ["--version"],
|
|
408
|
-
actionlint: ["-version"], shellcheck: ["--version"], "right-git": ["--version"], swift: ["--version"],
|
|
417
|
+
actionlint: ["-version"], shellcheck: ["--version"], oxlint: ["--version"], "right-git": ["--version"], swift: ["--version"],
|
|
409
418
|
"cargo-deny": ["--version"], "cargo-audit": ["audit", "--version"], // as cargo itself starts the subcommand binaries
|
|
410
419
|
});
|
|
411
420
|
/**
|
|
@@ -416,11 +425,11 @@ const PROBES = Object.freeze({
|
|
|
416
425
|
* The installers (.github/workflows/publish.yml, publish-app.yml, ci.yml) and the managed host path in ci/rk-pipeline.json
|
|
417
426
|
* provision exactly this version; scripts/ci/scan-receipt.test.mjs holds them to it.
|
|
418
427
|
*/
|
|
419
|
-
export const PINNED_SCAN_TOOLS = Object.freeze({ shellcheck: "0.11.0" });
|
|
428
|
+
export const PINNED_SCAN_TOOLS = Object.freeze({ shellcheck: "0.11.0", oxlint: "1.89.0" });
|
|
420
429
|
/** Scans whose answer depends on a remote service at run time, not only on their inputs: `pnpm-audit` asks the registry's advisory
|
|
421
430
|
* service. A verdict that includes them is reusable only after they are re-run (`rightkit-gate live-scans`; GATE-CONTRACT §1, E18),
|
|
422
431
|
* and a red caused by one is never deterministic. Ids are `<prefix>` or `<prefix>:<root>`; rustright's REMOTE_SCANS mirrors this list. */
|
|
423
|
-
export const LIVE_SCAN_IDS = Object.freeze(["pnpm-audit"]);
|
|
432
|
+
export const LIVE_SCAN_IDS = Object.freeze(["pnpm-audit", "ghsa-audit"]);
|
|
424
433
|
export const isLiveScan = (id) => LIVE_SCAN_IDS.some((p) => id === p || String(id).startsWith(`${p}:`));
|
|
425
434
|
/** Scans whose FAILURE may come from the registry rather than their inputs: `pnpm-lockfile` (`install --frozen-lockfile --lockfile-only`)
|
|
426
435
|
* re-verifies lockfile entries against the registry when pnpm's cache is cold, so an outage fails it. Their pass is deterministic, but a
|
|
@@ -440,6 +449,7 @@ export function inTreeGate(contentRoot, exists = fs.existsSync) {
|
|
|
440
449
|
// The version a probe's output names, for a tool whose first line is not its version (`shellcheck --version` opens with a banner).
|
|
441
450
|
const PROBE_VERSION = Object.freeze({
|
|
442
451
|
shellcheck: (text) => { const m = /^version:\s*(\S+)\s*$/m.exec(text); return m ? `shellcheck ${m[1]}` : null; },
|
|
452
|
+
oxlint: (text) => { const m = /\b(\d+\.\d+\.\d+)\b/.exec(String(text).split(/\r?\n/).find((l) => l.trim()) ?? ""); return m ? `oxlint ${m[1]}` : null; },
|
|
443
453
|
});
|
|
444
454
|
/** null when `version` (a probe's answer) is the pinned one or the tool has no pin, else the problem. */
|
|
445
455
|
export function pinnedVersionProblem(tool, version) {
|
|
@@ -460,7 +470,7 @@ export function pinnedVersionProblem(tool, version) {
|
|
|
460
470
|
* A scan the broker carries (a snapshot-broker host's cargo-deny / cargo-audit) runs the broker's own registered tool: its identity is the
|
|
461
471
|
* broker's tool registration (RustRight), recorded here as `source: "broker"` and never claimed as bound by the gate.
|
|
462
472
|
*/
|
|
463
|
-
export const TRUSTED_SCAN_TOOLS = Object.freeze(["actionlint", "shellcheck", "cargo-deny", "cargo-audit"]);
|
|
473
|
+
export const TRUSTED_SCAN_TOOLS = Object.freeze(["actionlint", "shellcheck", "oxlint", "cargo-deny", "cargo-audit"]);
|
|
464
474
|
const SHA256_HEX = /^[0-9a-f]{64}$/i;
|
|
465
475
|
|
|
466
476
|
/** The scan-tool policy of a pipeline file's `tools` object for `platform`: `{ [tool]: { path, sha256, version } }` for each trusted tool that has a `<platform>` entry (shape unchecked here; resolveTrustedScanTool judges it). */
|
|
@@ -1077,7 +1087,22 @@ export function planScans({
|
|
|
1077
1087
|
const wsIdSuffix = (ws) => (perWorkspaceIds && ws !== "." ? `:${wsLabel(ws)}` : "");
|
|
1078
1088
|
const wsOf = (n) => (rustMap ? rustMap.get(n).cargoDir : cargoWs);
|
|
1079
1089
|
const crateOf = (n) => (rustMap?.get(n)?.crate ?? n);
|
|
1080
|
-
|
|
1090
|
+
// The crate's feature plan input: the declared entry of ci/gate.config.json `rust`, plus `autoAllFeatures` for a crate that declares no featureSets but has Cargo
|
|
1091
|
+
// features (feature-coverage.mjs; rightkit#1231), read from the committed Cargo.toml.
|
|
1092
|
+
const manifestTextOf = (n) => { try { return readFile(path.join(contentRoot, rustDir(n), "Cargo.toml")); } catch { return null; } };
|
|
1093
|
+
const featuresOf = (n) => {
|
|
1094
|
+
const key = crateFeatures?.[n] !== undefined ? n : crateOf(n);
|
|
1095
|
+
return effectiveCrateFeatures({ crateFeatures: { [key]: crateFeatures?.[key] ?? {} }, units: [key], manifestOf: () => manifestTextOf(n) })[key];
|
|
1096
|
+
};
|
|
1097
|
+
// Per-crate platform scope (rightkit#1248, ci/gate.config.json rust.<crate>.platforms): a crate scoped to other hosts plans no compile or test
|
|
1098
|
+
// row here (check, check-features, clippy and its cross targets, doc, test, check-dependent). Its class A rows (package list, changelog,
|
|
1099
|
+
// licence, secrets) are file-only and stay. Said once per crate in the notes; the scoped host's own gate runs the rows.
|
|
1100
|
+
const platformSkipped = new Set();
|
|
1101
|
+
const outOfScope = (n) => {
|
|
1102
|
+
if (crateRunsOn(featuresOf(n), platform)) return false;
|
|
1103
|
+
if (!platformSkipped.has(n)) { platformSkipped.add(n); notes.push(`${crateOf(n)} is scoped to ${featuresOf(n).platforms.join(", ")} (ci/gate.config.json platforms); its compile and test scans are not planned on ${platform} and run on the scoped host`); }
|
|
1104
|
+
return true;
|
|
1105
|
+
};
|
|
1081
1106
|
// With no Rust unit in play the default workspace counts only when it has a Cargo.toml: a root rust-toolchain.toml (or other Rust config)
|
|
1082
1107
|
// in a crate-per-workspace repository must not turn the repository root into a phantom workspace whose cargo scans have no manifest.
|
|
1083
1108
|
const workspaces = rustMap && rustMap.size ? [...new Set([...rustMap.values()].map((u) => u.cargoDir))].sort() : (exists(path.join(contentRoot, cargoWs === "." ? "Cargo.toml" : `${cargoWs}/Cargo.toml`)) ? [cargoWs] : []);
|
|
@@ -1229,6 +1254,9 @@ export function planScans({
|
|
|
1229
1254
|
|
|
1230
1255
|
// Exceptions expire by date, not by change: checked on every run, whatever changed.
|
|
1231
1256
|
if (exists(path.join(contentRoot, "ci/advisory-exceptions.json"))) add({ id: "advisory-exceptions", class: A, internal: "advisory-exceptions" });
|
|
1257
|
+
// Dependency freshness (rightkit#1475): `right-update check --json` once per repository that commits `.rightkit/update.json`. Advice only: it never
|
|
1258
|
+
// fails a run (latest is a live registry answer), and the row carries "N behind latest".
|
|
1259
|
+
if (exists(path.join(contentRoot, ".rightkit/update.json"))) add({ id: "dependency-freshness", class: A, internal: "dependency-freshness", advise: true });
|
|
1232
1260
|
// An app's advisory exceptions follow the same policy as RightKit's own: a Cargo workspace whose deny.toml or .cargo/audit.toml
|
|
1233
1261
|
// ignores an advisory needs its ledger, <workspace>/.rightkit/advisory-exceptions.json, with owner, evidence, an unexpired
|
|
1234
1262
|
// reviewBy, the exact affected versions and dependents in that workspace's Cargo.lock, and a person's approval; deny.toml and
|
|
@@ -1271,6 +1299,9 @@ export function planScans({
|
|
|
1271
1299
|
const pinEnv = { RK_ADVISORY_DB_COMMIT: pin.commit };
|
|
1272
1300
|
add({ id: `cargo-deny${wsIdSuffix(ws)}`, class: A, ...cargoReadIn(ws, "deny", "--frozen", "--metadata-path", "{advisoryMetadata}", "--config", "{advisoryDenyConfig}", "check"), env: pinEnv, advisoryDb: "deny", advisoryPin: pin });
|
|
1273
1301
|
add({ id: `cargo-audit${wsIdSuffix(ws)}`, class: A, ...cargoReadIn(ws, "audit", "--db", "{advisoryDb}", "--no-fetch"), env: pinEnv, advisoryDb: "audit", advisoryPin: pin });
|
|
1302
|
+
// The GitHub advisory database (rightkit#1461): cargo-audit and cargo-deny read RustSec only, so a GHSA RustSec has not copied yet passed the
|
|
1303
|
+
// gate (zip GHSA-m665-v7pm-7grj). One scan per workspace lock asks OSV about its crates.io packages (ghsa-audit.mjs; GATE-CONTRACT GC-A19).
|
|
1304
|
+
if (exists(path.join(contentRoot, inDir(ws, "Cargo.lock")))) add({ id: `ghsa-audit${wsIdSuffix(ws)}`, class: A, internal: "ghsa-audit", lockFile: inDir(ws, "Cargo.lock"), ...(ws === "." ? {} : { cwd: ws }) });
|
|
1274
1305
|
}
|
|
1275
1306
|
// The audit policy is the consumer's own: every package.json script that is exactly `pnpm audit <flags>` (only --prod, --dev,
|
|
1276
1307
|
// --audit-level <low|moderate|high|critical> are accepted) declares one, and the scan runs the strictest of them all: a dependency
|
|
@@ -1326,14 +1357,17 @@ export function planScans({
|
|
|
1326
1357
|
...(trusted ? {} : { deferred: "requires a trusted-root run: the generator is repository code and no separate trusted checkout provides it; the content root's copy is never executed" }),
|
|
1327
1358
|
});
|
|
1328
1359
|
}
|
|
1329
|
-
const clippyEntries = [];
|
|
1360
|
+
const clippyEntries = []; const coverageCrates = [];
|
|
1330
1361
|
for (const name of crateNames) {
|
|
1331
|
-
|
|
1362
|
+
if (outOfScope(name)) continue;
|
|
1363
|
+
// Feature sets as CI's gate runs them (scripts/ci/gate.mjs, ci/gate.config.json rust.<crate>), plus --all-features for a crate that declares none but has features (rightkit#1231):
|
|
1332
1364
|
// clippy per `featureSets` (default features when absent); check per `checkFeatureSets` (default
|
|
1333
1365
|
// --all-features), none when a lint set already uses --all-features. Some crates' features cannot
|
|
1334
1366
|
// all be on together (rightkit-db sqlcipher vs sqlcipher-system; qa-driver wv2 generations).
|
|
1335
1367
|
const own = featuresOf(name);
|
|
1336
|
-
const { lintSets, defaultCheck, checkSets } = rustCratePlan(own);
|
|
1368
|
+
const { lintSets, baseSets, defaultCheck, checkSets } = rustCratePlan(own);
|
|
1369
|
+
// Every feature the crate declares must be enabled by one of these sets (the feature-coverage scan below, rightkit#1231).
|
|
1370
|
+
coverageCrates.push({ name, manifest: inDir(rustDir(name), "Cargo.toml"), sets: [...(defaultCheck ? [[]] : []), ...lintSets, ...checkSets] });
|
|
1337
1371
|
const ws = wsOf(name); const crate = crateOf(name);
|
|
1338
1372
|
// `cargo clippy --all-targets` type-checks exactly what `cargo check --all-targets` does: the default
|
|
1339
1373
|
// check runs only when no clippy set covers default features.
|
|
@@ -1344,10 +1378,10 @@ export function planScans({
|
|
|
1344
1378
|
// The other two OS targets, every lint set, -D warnings, on every host (cross-targets.mjs; Adrian 2026-11-02/03, no skip). The zig C
|
|
1345
1379
|
// toolchain must be provisioned (crossCcDir); without it the scan fails naming the fix, never skipped. On a broker host the broker must
|
|
1346
1380
|
// admit the cross target and its CC_/CXX_/AR_ variables; a refusal there fails the scan.
|
|
1347
|
-
for (const target of
|
|
1381
|
+
for (const target of scopedCrossTargets(own, platform)) {
|
|
1348
1382
|
const crossEnv = crossCompileEnv(target);
|
|
1349
|
-
|
|
1350
|
-
const id = `${rustScanId.clippy(name,
|
|
1383
|
+
baseSets.forEach((set, i) => {
|
|
1384
|
+
const id = `${rustScanId.clippy(name, baseSets.length, i)}@${target}`;
|
|
1351
1385
|
if (!crossEnv) { add({ id, class: B, tool: "node", args: ["-e", `console.error("RK_CROSS_CC_UNPROVISIONED: the zig C toolchain for ${target} is not provisioned; run node scripts/ci/provision-zig.mjs <managed data root>/zig (or set RIGHTKIT_CROSS_CC_DIR)"); process.exit(1)`] }); return; }
|
|
1352
1386
|
const scan = cargoIn(ws, ...clippyArgs(crate, { features: set, locked: true, target }));
|
|
1353
1387
|
add({ id, class: B, batchUnit: name, ...scan, env: { ...(scan.env ?? {}), ...crossEnv } });
|
|
@@ -1359,6 +1393,10 @@ export function planScans({
|
|
|
1359
1393
|
add({ id: rustScanId.doc(name), class: B, ...cargoIn(ws, "rustdoc", "-p", crate, "--lib", ...lintSets[0], "--locked", "--", ...DOC_RUSTDOC_ARGS) });
|
|
1360
1394
|
}
|
|
1361
1395
|
}
|
|
1396
|
+
// Class A, file-only (rightkit#1231): no feature of a crate's Cargo.toml may be left out of every planned feature set, so feature-gated code is never
|
|
1397
|
+
// unchecked. Crates without Cargo features need no row.
|
|
1398
|
+
const featureful = coverageCrates.filter((c) => { const t = manifestTextOf(c.name); return typeof t === "string" && declaredFeatureNames(t).length > 0; });
|
|
1399
|
+
if (featureful.length) add({ id: "feature-coverage", class: A, internal: "feature-coverage", crates: featureful });
|
|
1362
1400
|
if (clippyBatching && clippyEntries.length) {
|
|
1363
1401
|
// One Clippy scan per batch (row 8.6): the independent batches first, the sidecar-bound ones after them (row 8.8; the compile lane
|
|
1364
1402
|
// drains in plan order). The reason a configuration stays separate is recorded in the plan notes.
|
|
@@ -1376,13 +1414,13 @@ export function planScans({
|
|
|
1376
1414
|
const memo = new Map();
|
|
1377
1415
|
const scoped = crateNames.filter((n) => wsOf(n) === ws).map(crateOf);
|
|
1378
1416
|
const workspace = (rustMap ? [...rustMap.keys()] : listDir(path.join(contentRoot, "crates"))).filter((n) => wsOf(n) === ws);
|
|
1379
|
-
const dependents = safeUnits(workspace.filter((n) => !inScope.has(n) && exists(path.join(contentRoot, rustDir(n), "Cargo.toml")) && scoped.some((t) => reach(lock, crateOf(n), memo).has(t))).sort(), "crate");
|
|
1417
|
+
const dependents = safeUnits(workspace.filter((n) => !inScope.has(n) && !outOfScope(n) && exists(path.join(contentRoot, rustDir(n), "Cargo.toml")) && scoped.some((t) => reach(lock, crateOf(n), memo).has(t))).sort(), "crate");
|
|
1380
1418
|
for (const name of dependents) { planned.add(name); add({ id: `check-dependent:${name}`, class: B, batchUnit: name, ...cargoIn(ws, ...checkArgs(crateOf(name), { locked: true })) }); }
|
|
1381
1419
|
}
|
|
1382
1420
|
// Across Cargo workspaces (one workspace and lock per crate): a unit that path-depends on a unit in scope, transitively, is judged by
|
|
1383
1421
|
// the manifests' path dependencies, since no lock holds both.
|
|
1384
1422
|
if (typeof crateDependents === "function" && rustMap && crateNames.length) {
|
|
1385
|
-
const across = [...crateDependents(new Set(crateNames))].filter((n) => !inScope.has(n) && !planned.has(n) && rustMap.has(n) && exists(path.join(contentRoot, rustDir(n), "Cargo.toml"))).sort();
|
|
1423
|
+
const across = [...crateDependents(new Set(crateNames))].filter((n) => !inScope.has(n) && !planned.has(n) && rustMap.has(n) && !outOfScope(n) && exists(path.join(contentRoot, rustDir(n), "Cargo.toml"))).sort();
|
|
1386
1424
|
for (const name of safeUnits(across, "crate")) add({ id: `check-dependent:${name}`, class: B, batchUnit: name, ...cargoIn(wsOf(name), ...checkArgs(crateOf(name), { locked: true })) });
|
|
1387
1425
|
}
|
|
1388
1426
|
// A linter config in the unit's directory or any ancestor of it (a repository-level config covers every unit, as the tools look it up).
|
|
@@ -1410,6 +1448,19 @@ export function planScans({
|
|
|
1410
1448
|
}
|
|
1411
1449
|
if (hasConfig(dir, ESLINT_CONFIG_FILES)) add({ id: `eslint:${name}`, class: A, executes: true, tool: "pnpm", args: ["exec", "eslint", "."], env: PNPM_RUN_ENV, cwd: dir });
|
|
1412
1450
|
if (hasConfig(dir, BIOME_CONFIG_FILES)) add({ id: `biome:${name}`, class: A, executes: true, tool: "pnpm", args: ["exec", "biome", "lint", "."], env: PNPM_RUN_ENV, cwd: dir });
|
|
1451
|
+
// Oxlint (rightkit#1402): the pinned, enrolled native binary (PINNED_SCAN_TOOLS; ci/oxlint.json), never `pnpm exec`, so it needs no installed
|
|
1452
|
+
// dependencies and a package's own copy never judges it. It reads the config in the package directory. A JSON config with no `jsPlugins` is data
|
|
1453
|
+
// and the row is a content check; a script config (`oxlint.config.*`) or `jsPlugins` make Oxlint run repository code, so the row `executes` (full class A only).
|
|
1454
|
+
// Not enrolled on the host: TOOL_UNTRUSTED, as for actionlint; never skipped, never passed.
|
|
1455
|
+
// The nearest directory at or above the package that holds a config decides (the config applies to the whole package; an ancestor's is named with -c).
|
|
1456
|
+
const oxlintDir = [...ancestorDirsOf(dir)].reverse().find((d) => OXLINT_CONFIG_FILES.some((f) => exists(path.join(liveRoot, inDir(d, f)))));
|
|
1457
|
+
if (oxlintDir !== undefined) {
|
|
1458
|
+
const configFile = OXLINT_CONFIG_FILES.find((f) => exists(path.join(liveRoot, inDir(oxlintDir, f))));
|
|
1459
|
+
let runsCode = configFile !== ".oxlintrc.json";
|
|
1460
|
+
if (!runsCode) { try { runsCode = /"jsPlugins"/.test(readFile(path.join(liveRoot, inDir(oxlintDir, configFile)))); } catch { runsCode = true; } }
|
|
1461
|
+
const configArgs = oxlintDir === dir ? [] : ["-c", path.posix.relative(dir, inDir(oxlintDir, configFile))];
|
|
1462
|
+
add({ id: `oxlint:${name}`, class: A, tool: "oxlint", args: [...configArgs, "."], root: "content", cwd: dir, ...(runsCode ? { executes: true } : {}) });
|
|
1463
|
+
}
|
|
1413
1464
|
}
|
|
1414
1465
|
// One `swift build` per Swift package a changed file belongs to: the nearest Package.swift at or above the file, built in its own
|
|
1415
1466
|
// directory (rightkit#1229: Pulse's package is swift/RightKitHub, and a root `swift build` found no package and blocked every push).
|
|
@@ -1426,6 +1477,11 @@ export function planScans({
|
|
|
1426
1477
|
const declared = swiftPackages?.[dir === "" ? "." : dir]?.qualifyOnly;
|
|
1427
1478
|
const reason = typeof declared?.reason === "string" && declared.reason.trim() !== "" ? declared.reason.replace(/\s+/g, " ").trim() : null;
|
|
1428
1479
|
if (declared && !reason) notes.push(`ci/gate.config.json swift.${dir}.qualifyOnly is ignored: it must be { "reason": "<why this package cannot build from the bare snapshot>" } with a non-empty reason; ${id} is planned`);
|
|
1480
|
+
// The Swift type-check (rightkit#1289): Class A, the Mac host only; a package class B does not build (qualify-only) cannot be type-checked from the bare snapshot either.
|
|
1481
|
+
if (!reason) {
|
|
1482
|
+
if (platform === "darwin") add({ id: dir === "" || dir === "." ? "swift-typecheck" : `swift-typecheck:${dir}`, class: A, internal: "swift-typecheck", dir: dir === "" ? "." : dir, executes: true });
|
|
1483
|
+
else notes.push(`swift-typecheck skipped for ${dir === "" || dir === "." ? "the root package" : dir}: the Swift type-check runs on the Mac host only (platform ${platform})`);
|
|
1484
|
+
}
|
|
1429
1485
|
if (reason) { qualifyOwed.push({ id, kind: "swift-build", dir: dir === "" ? "." : dir, reason }); notes.push(`${id} is not built by class B (ci/gate.config.json swift.${dir}.qualifyOnly: ${reason}); it is owed to the qualify stage`); }
|
|
1430
1486
|
// The committed Package.resolved is the lockfile: like cargo --locked and pnpm --frozen-lockfile, a stale one fails here with
|
|
1431
1487
|
// SwiftPM's own message instead of SwiftPM rewriting it inside the snapshot (seen only after the compile as a changed tree).
|
|
@@ -1465,8 +1521,9 @@ export function planScans({
|
|
|
1465
1521
|
// Tests per declared feature set, serially too where the crate asks for it, as CI's gate runs them. `quietTests: true` marks
|
|
1466
1522
|
// every test scan of the crate for the quiet lane (laneOf): run alone, under the broker's quiet lease.
|
|
1467
1523
|
for (const name of crateNames) {
|
|
1524
|
+
if (outOfScope(name)) continue;
|
|
1468
1525
|
const own = featuresOf(name);
|
|
1469
|
-
const sets = rustCratePlan(own).
|
|
1526
|
+
const sets = rustCratePlan(own).baseSets;
|
|
1470
1527
|
const quiet = own.quietTests === true ? { quiet: true } : {};
|
|
1471
1528
|
if (own.quietTests === true && quietTests === "ci") {
|
|
1472
1529
|
deferredToCi.push(...sets.map((set, i) => rustScanId.testRust(name, sets.length, i)), ...(own.alsoSerial ? sets.map((set, i) => rustScanId.testRustSerial(name, sets.length, i)) : []));
|
|
@@ -1555,37 +1612,7 @@ export function planScans({
|
|
|
1555
1612
|
add({ id: `test:npm:${name}`, class: inClassA ? A : B, kind: "test", executes: true, classReason: inClassA ? `class A on recorded evidence (${classAEvidence}); run under the launch guard` : brokerCall ? "its test script reaches the broker (compiles); it runs with the compile scans" : laterReason ?? "test scripts execute project code and run after class A", ...(own.quietTests === true ? { quiet: true } : {}), ...(brokerCall ? { brokerCall } : {}), tool: "pnpm", args: ["--dir", npmDir(name), "run", "test"], env: { ...PNPM_RUN_ENV, ...(isolatedCheckout ? { RIGHTKIT_ISOLATED_CHECKOUT: "1" } : {}), ...(cargoTarget ? { CARGO_TARGET_DIR: cargoTarget } : {}) } });
|
|
1556
1613
|
}
|
|
1557
1614
|
if (deferredToCi.length) notes.push(`${deferredToCi.length} quiet test scan(s) left to the CI shards (one crate per runner), not run here: ${deferredToCi.join(", ")}`);
|
|
1558
|
-
//
|
|
1559
|
-
// relative path literals, followed through packages/*.mjs) changed. Where unreadable, they run.
|
|
1560
|
-
const ciDir = exists(path.join(liveRoot, "scripts/ci"));
|
|
1561
|
-
const scriptsCiTouched = () => {
|
|
1562
|
-
if (files.some((f) => /^(scripts|ci|\.github)\//.test(f))) return true;
|
|
1563
|
-
try {
|
|
1564
|
-
const sources = listDir(path.join(liveRoot, "scripts/ci")).filter((n) => /\.mjs$/.test(n));
|
|
1565
|
-
if (!sources.length) return true;
|
|
1566
|
-
const inputs = new Set(); const seen = new Set();
|
|
1567
|
-
const visit = (rel) => {
|
|
1568
|
-
if (seen.has(rel)) return;
|
|
1569
|
-
seen.add(rel);
|
|
1570
|
-
let text; try { text = readFile(path.join(liveRoot, rel)); } catch { return; }
|
|
1571
|
-
for (const m of text.matchAll(/["'`]((?:\.\.?\/)+[^"'`\s]+)["'`]/g)) {
|
|
1572
|
-
const target = path.posix.normalize(path.posix.join(path.posix.dirname(rel), m[1])).replace(/\/+$/, "");
|
|
1573
|
-
if (!target || target === "." || target.startsWith("..")) continue;
|
|
1574
|
-
inputs.add(target);
|
|
1575
|
-
if (target.startsWith("packages/") && target.endsWith(".mjs")) visit(target);
|
|
1576
|
-
}
|
|
1577
|
-
};
|
|
1578
|
-
for (const n of sources) visit(`scripts/ci/${n}`);
|
|
1579
|
-
return files.some((f) => [...inputs].some((i) => f === i || f.startsWith(`${i}/`)));
|
|
1580
|
-
} catch { return true; }
|
|
1581
|
-
};
|
|
1582
|
-
if (ciDir ? scriptsCiTouched() : (!(rustMap || npmMap) && files.some((f) => f.startsWith("scripts/")))) {
|
|
1583
|
-
// The suite is the exported commit's test files, named explicitly: an untracked WIP test in the live
|
|
1584
|
-
// checkout is never run and can neither block nor pass a push.
|
|
1585
|
-
const suite = listDir(path.join(contentRoot, "scripts", "ci")).filter((n) => n.endsWith(".test.mjs")).sort().map((n) => `scripts/ci/${n}`);
|
|
1586
|
-
// End-to-end tests only (Adrian, 2026-11-03): a repo that removed its scripts/ci unit tests has no suite to run, and no row is planned.
|
|
1587
|
-
if (suite.length) add({ id: "test:scripts-ci", class: B, kind: "test", executes: true, classReason: "tests execute project code and run after class A", tool: "node", args: ["--test", ...suite] });
|
|
1588
|
-
}
|
|
1615
|
+
// End-to-end tests only (Adrian, 2026-11-03): the scripts/ci self-tests were removed, so no `test:scripts-ci` scan is planned.
|
|
1589
1616
|
}
|
|
1590
1617
|
|
|
1591
1618
|
// Without a local compile grant the managed broker path is closed: every broker scan (class A
|
|
@@ -1828,9 +1855,9 @@ export function stripTomlComments(text) {
|
|
|
1828
1855
|
export function testResultsProblem(results) {
|
|
1829
1856
|
if (!results) return { code: "NO_TEST_SUMMARY", detail: "no test counts recorded" };
|
|
1830
1857
|
// End-to-end tests only (Adrian, 2026-11-03: "End to end tests ONLY any unit tests need strict approval along with evidence and
|
|
1831
|
-
// reason"): a Rust crate whose test build runs no test is a pass, recorded with its zero counts. A test that failed still fails, and a
|
|
1832
|
-
// run whose tests were all skipped or ignored still proves nothing (ALL_SKIPPED below).
|
|
1833
|
-
if (
|
|
1858
|
+
// reason"): a Rust crate whose test build runs no test is a pass, recorded with its zero counts; so is an npm test scan whose runner (node:test, vitest) reports zero tests and no failure. A test that failed still fails, and a
|
|
1859
|
+
// run whose tests were all skipped or ignored still proves nothing (ALL_SKIPPED below).
|
|
1860
|
+
if (["libtest", "node:test", "vitest"].includes(results.runner) && !(results.tests > 0) && !(results.fail > 0)) return null;
|
|
1834
1861
|
if (!(results.tests > 0)) return { code: "NO_TESTS", detail: "the test scan executed no test" };
|
|
1835
1862
|
if (results.fail > 0) return { code: "SUMMARY_FAILED", detail: `the test runner exited 0 but its summary reports ${results.fail} failed test(s)` };
|
|
1836
1863
|
// A suite that ran tests but passed none of them (every test skipped or todo) proves nothing (D17, rightkit#1236).
|
|
@@ -2247,9 +2274,22 @@ async function defaultScanSecrets() {
|
|
|
2247
2274
|
export async function ignoredPathSkip(ctx) {
|
|
2248
2275
|
const git = async (args) => { try { return await ctx.deps.spawn("git", args, { cwd: ctx.contentRoot, encoding: "utf8", env: ctx.deps.env }); } catch { return null; } };
|
|
2249
2276
|
const top = await git(["rev-parse", "--show-toplevel"]);
|
|
2250
|
-
if (!top || top.status !== 0) return null;
|
|
2251
2277
|
const same = (a, b) => { try { return fs.realpathSync(a) === fs.realpathSync(b); } catch { return path.resolve(a) === path.resolve(b); } };
|
|
2252
|
-
if (!same(String(top.stdout ?? "").trim(), ctx.contentRoot))
|
|
2278
|
+
if (!top || top.status !== 0 || !same(String(top.stdout ?? "").trim(), ctx.contentRoot)) {
|
|
2279
|
+
// Not a git toplevel: a snapshot, which holds the commit's files and also whatever a stage wrote into it (dist/stage, build output), and
|
|
2280
|
+
// `git ls-files --ignored` cannot tell them apart there. Class A judges the commit's tracked files only (rightkit#1393): with the
|
|
2281
|
+
// gate's list of them, everything else, and every directory with none of them, is skipped. Without the list nothing is skipped.
|
|
2282
|
+
if (!Array.isArray(ctx.trackedFiles)) return null;
|
|
2283
|
+
const trackedSet = new Set(ctx.trackedFiles);
|
|
2284
|
+
const parents = new Set();
|
|
2285
|
+
for (const f of trackedSet) for (let i = f.indexOf("/"); i !== -1; i = f.indexOf("/", i + 1)) parents.add(f.slice(0, i));
|
|
2286
|
+
const base = ctx.contentRoot;
|
|
2287
|
+
return (absolute) => {
|
|
2288
|
+
const rel = path.relative(base, absolute).replaceAll("\\", "/");
|
|
2289
|
+
if (!rel || rel.startsWith("..")) return false;
|
|
2290
|
+
return !trackedSet.has(rel) && !parents.has(rel);
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2253
2293
|
const listed = await git(["ls-files", "-z", "--others", "--ignored", "--exclude-standard", "--directory"]);
|
|
2254
2294
|
if (!listed || listed.status !== 0) return null;
|
|
2255
2295
|
const entries = String(listed.stdout ?? "").split("\0").filter(Boolean);
|
|
@@ -2364,6 +2404,52 @@ const INTERNAL = {
|
|
|
2364
2404
|
for (const f of s.files) { try { parse(ctx.read(f)); } catch (e) { bad.push(`${f}: ${String(e.message).split("\n")[0]}`); } }
|
|
2365
2405
|
return bad;
|
|
2366
2406
|
},
|
|
2407
|
+
// The GitHub advisory database (ghsa-audit.mjs, rightkit#1461): a GHSA advisory RustSec lacks fails like a RustSec vulnerability; no network and no
|
|
2408
|
+
// same-day answer fails (ADVISORY_DB) exactly as cargo-audit does without its database.
|
|
2409
|
+
"ghsa-audit": async (s, ctx) => {
|
|
2410
|
+
let lockText;
|
|
2411
|
+
try { lockText = ctx.read(s.lockFile); } catch (e) { return { code: "ADVISORY_DB", detail: `${s.lockFile} is unreadable (${e.message}); the GitHub advisory scan needs the committed lockfile` }; }
|
|
2412
|
+
try { return (await ghsaFindings({ lockText, fetchFn: ctx.deps.fetch ?? globalThis.fetch, cacheDir: ctx.ghsaCacheDir ?? null })).findings; }
|
|
2413
|
+
catch (e) { return { code: "ADVISORY_DB", detail: `the GitHub advisory database (OSV) could not be asked: ${e.message}; class A refuses to pass a lockfile it could not check against it, as it refuses cargo-audit without its database (connect once; the answer is then kept for the UTC day)` }; }
|
|
2414
|
+
},
|
|
2415
|
+
// Dependency freshness (rightkit#1475): advice, never a failure. `right-update check --json` over the committed repository; the row carries "N behind latest".
|
|
2416
|
+
"dependency-freshness": async (s, ctx) => {
|
|
2417
|
+
let bin;
|
|
2418
|
+
try { bin = resolveOutdatedBin(); } catch (e) { return { advice: `dependency freshness not measured: ${e instanceof OutdatedUnavailableError ? e.message : `right-update could not be located (${e.message})`}` }; }
|
|
2419
|
+
let r;
|
|
2420
|
+
try { r = await ctx.deps.spawn(process.execPath, [bin, "check", "--json", "--repo", ctx.contentRoot], { cwd: ctx.contentRoot, encoding: "utf8", env: { ...ctx.deps.env, ...PNPM_NO_HOOKS_ENV }, timeout: 120_000, maxBuffer: 1 << 26 }); }
|
|
2421
|
+
catch (e) { return { advice: `dependency freshness not measured: right-update check did not run (${e.message})` }; }
|
|
2422
|
+
let report = null;
|
|
2423
|
+
try { report = JSON.parse(String(r?.stdout ?? "")); } catch { report = null; }
|
|
2424
|
+
if (!report || !Array.isArray(report.entries)) return { advice: `dependency freshness not measured: right-update check printed no report${r?.status ? ` (exit ${r.status})` : ""}` };
|
|
2425
|
+
const behind = report.entries.filter((e) => e.status === "outdated");
|
|
2426
|
+
const unjudged = report.entries.filter((e) => e.status === "unknown" || e.error).length;
|
|
2427
|
+
const named = behind.slice(0, 5).map((e) => `${e.name} ${e.pinned ?? "?"} -> ${e.latest ?? "?"}`).join(", ");
|
|
2428
|
+
return { advice: `${behind.length} behind latest${named ? ` (${named}${behind.length > 5 ? ", ..." : ""})` : ""}${unjudged ? `; ${unjudged} not judged` : ""}` };
|
|
2429
|
+
},
|
|
2430
|
+
// The Swift type-check (rightkit#1289): Mac host only, Class A, before any compile stage. SwiftPM compiles each target with `-Xswiftc -typecheck`: swiftc type-checks every
|
|
2431
|
+
// source against the real SDK and the target's dependencies and writes no object file, so a labelled-argument order error fails here in seconds instead of at the
|
|
2432
|
+
// end of the Xcode compile (Pulse, 2026-10-29, exit 65 after the Rust stages). The committed Package.resolved decides the dependencies (`--disable-automatic-resolution`);
|
|
2433
|
+
// SwiftPM's state lives under the gate's scratch root, never in the snapshot. A pass is exit 0. A failure with Swift diagnostics lists them; a failure with none is the
|
|
2434
|
+
// build system's (it did not complete) and still fails: never a pass that checked nothing.
|
|
2435
|
+
"swift-typecheck": async (s, ctx) => {
|
|
2436
|
+
let scratch;
|
|
2437
|
+
try { scratch = swiftScratchPath({ tmpRoot: ctx.tmpRoot, roots: [ctx.contentRoot, ctx.liveRoot, ctx.cargoLiveRoot], id: s.id }); }
|
|
2438
|
+
catch (e) { return { code: "SWIFT_SCRATCH", detail: `${s.id}: ${e.message}` }; }
|
|
2439
|
+
fs.mkdirSync(scratch, { recursive: true });
|
|
2440
|
+
const packageDir = path.join(ctx.contentRoot, s.dir === "." ? "" : s.dir);
|
|
2441
|
+
let r;
|
|
2442
|
+
try { r = await ctx.deps.spawn("swift", ["build", "--disable-automatic-resolution", "--package-path", packageDir, "--scratch-path", scratch, "-Xswiftc", "-typecheck"], { cwd: packageDir, encoding: "utf8", env: { ...ctx.deps.env, ...PNPM_NO_HOOKS_ENV }, timeout: 10 * 60_000, maxBuffer: 1 << 26 }); }
|
|
2443
|
+
catch (e) { return { code: "TOOL_MISSING", detail: `${s.id}: swift could not be started (${e.message}); the Swift type-check is required on the Mac host and is never skipped` }; }
|
|
2444
|
+
if (r?.error) return { code: "TOOL_MISSING", detail: `${s.id}: swift could not be started (${r.error.message}); the Swift type-check is required on the Mac host and is never skipped` };
|
|
2445
|
+
if (r?.status === 0) return [];
|
|
2446
|
+
const output = `${r?.stdout ?? ""}\n${r?.stderr ?? ""}`;
|
|
2447
|
+
const diagnostics = [...new Set(output.split(/\r?\n/).filter((l) => /\.swift:\d+:\d+: error:/.test(l)).map((l) => l.trim().replace(/^.*?(?=[^/\\\s]+\.swift:\d+:\d+: error:)/, "")))];
|
|
2448
|
+
if (diagnostics.length) return diagnostics.slice(0, 8).map((d) => `${s.dir === "." ? "" : `${s.dir}: `}${d}`);
|
|
2449
|
+
return [`${s.dir === "." ? "swift package" : s.dir}: the Swift type-check did not complete (exit ${r?.status ?? "none"}) and printed no Swift diagnostic: ${failureDetail(r)}`];
|
|
2450
|
+
},
|
|
2451
|
+
// Every Cargo feature of a planned crate is enabled by one of its planned feature sets (feature-coverage.mjs, rightkit#1231).
|
|
2452
|
+
"feature-coverage": (s, ctx) => s.crates.flatMap((c) => featureCoverageProblems({ name: c.name, manifestText: ctx.read(c.manifest), sets: c.sets })),
|
|
2367
2453
|
// File-only SwiftPM lockfile check (swift-lock.mjs): runs no SwiftPM, reads Package.swift / project.pbxproj and Package.resolved as committed.
|
|
2368
2454
|
"swift-lock": (s, ctx) => {
|
|
2369
2455
|
const exists = (f) => ctx.deps.exists(path.join(ctx.contentRoot, f));
|
|
@@ -2521,7 +2607,9 @@ export async function runScans(plan, options = {}) {
|
|
|
2521
2607
|
const rootDir = (r) => (r === "content" ? contentRoot : r === "parent" ? path.dirname(contentRoot) : r === "cargoLive" ? (cargoLiveRoot ?? liveRoot) : liveRoot);
|
|
2522
2608
|
const selected = plan.scans.filter((s) => classes.includes(s.class) && !exclude(s));
|
|
2523
2609
|
const ordered = [...selected.filter((s) => s.class === SCAN_CLASS.A), ...selected.filter((s) => s.class === SCAN_CLASS.B)];
|
|
2524
|
-
|
|
2610
|
+
// `trackedFiles` (the gate's list of the commit's own files): where the content root is not a git toplevel (a snapshot), the secret scan judges
|
|
2611
|
+
// exactly these and never what a stage wrote there (rightkit#1393).
|
|
2612
|
+
const ctx = { deps, contentRoot, liveRoot, cargoLiveRoot, tmpRoot, read: (f) => deps.readFile(path.join(contentRoot, f)), trackedFiles: Array.isArray(options.trackedFiles) ? options.trackedFiles : null };
|
|
2525
2613
|
// GATE-CONTRACT GC-A11 (Adrian, 2026-11-02): Class A never runs in the broker. Class A cargo reads are never carried, in any stage; the gate
|
|
2526
2614
|
// runs them directly (snapshot-metadata.mjs directReadSpawn), and cargo-deny / cargo-audit are its own enrolled tools.
|
|
2527
2615
|
const cargoReadsAreCarried = false;
|
|
@@ -2542,6 +2630,8 @@ export async function runScans(plan, options = {}) {
|
|
|
2542
2630
|
// options.cache ={ read(key), write(key, row), digest(scan) => string | null } (null: not cacheable, which is how the live class A checks opt out).
|
|
2543
2631
|
const cache = options.cache && typeof options.cache.read === "function" && typeof options.cache.write === "function" && typeof options.cache.digest === "function" ? options.cache : null;
|
|
2544
2632
|
const cacheHits = [];
|
|
2633
|
+
// The GitHub advisory scan's same-UTC-day answers live beside the pinned RustSec checkout; a run with no cache (the door's live-scans refresh) asks again.
|
|
2634
|
+
if (cache) { try { ctx.ghsaCacheDir = path.join(deps.advisoryCacheRoot ?? advisoryCacheRoot({ env: deps.env, platform: deps.platform }), "ghsa-audit"); } catch { ctx.ghsaCacheDir = null; } }
|
|
2545
2635
|
let classAFailed = false;
|
|
2546
2636
|
// Class B needs class A first: in this call (classes includes A) or valid prior class A evidence for the
|
|
2547
2637
|
// same class A scan set (options.priorClassA: an earlier runScans result whose class A rows all passed).
|
|
@@ -2831,7 +2921,7 @@ export async function runScans(plan, options = {}) {
|
|
|
2831
2921
|
if (s.class === SCAN_CLASS.B && classAFailed) {
|
|
2832
2922
|
return { ...row, status: "not-run", detail: "a class A scan failed; class B starts only after class A passes" };
|
|
2833
2923
|
}
|
|
2834
|
-
let status = "pass"; let detail = ""; let code;
|
|
2924
|
+
let status = "pass"; let detail = ""; let code; let advice;
|
|
2835
2925
|
if (s.deferred) {
|
|
2836
2926
|
// A class A scan that did not run is not a class A pass: class B waits.
|
|
2837
2927
|
if (s.class === SCAN_CLASS.A) classAFailed = true;
|
|
@@ -2841,6 +2931,8 @@ export async function runScans(plan, options = {}) {
|
|
|
2841
2931
|
if (s.internal) {
|
|
2842
2932
|
const out = await INTERNAL[s.internal](s, ctx);
|
|
2843
2933
|
if (out && out.missing) { status = "fail"; code = "TOOL_MISSING"; detail = out.missing; }
|
|
2934
|
+
else if (out && !Array.isArray(out) && out.code) { status = "fail"; code = out.code; detail = out.detail; }
|
|
2935
|
+
else if (out && !Array.isArray(out) && typeof out.advice === "string") { advice = out.advice; }
|
|
2844
2936
|
else if (out.length) { status = "fail"; detail = out.join("; "); }
|
|
2845
2937
|
} else {
|
|
2846
2938
|
const scanDir = path.join(rootDir(s.root), s.cwd ?? "");
|
|
@@ -3212,7 +3304,7 @@ export async function runScans(plan, options = {}) {
|
|
|
3212
3304
|
}
|
|
3213
3305
|
} catch (e) { status = "fail"; code = "SCAN_ERROR"; detail = e.message; }
|
|
3214
3306
|
if (status === "fail" && s.class === SCAN_CLASS.A) classAFailed = true;
|
|
3215
|
-
return { ...row, status, ...(code ? { code } : {}), ...(detail ? { detail } : {}) };
|
|
3307
|
+
return { ...row, status, ...(code ? { code } : {}), ...(detail ? { detail } : {}), ...(advice ? { advice } : {}) };
|
|
3216
3308
|
}
|
|
3217
3309
|
|
|
3218
3310
|
// Cargo calls the gate cannot attribute to a scan (the code under test cleared or replaced the scan token): never skipped.
|
package/development-signing.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import os from "node:os";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { spawnSync } from "./background-process.mjs";
|
|
7
7
|
import { adhocSafeEntitlements } from "./adhoc-entitlements.mjs";
|
|
8
|
+
import { refreshRuntimeManifests, validateRuntimeManifestPaths } from "./runtime-manifest-refresh.mjs";
|
|
8
9
|
import { runMacCodesignCommands } from "./macos-signing-session.mjs";
|
|
9
10
|
import { DEFAULT_TEAM } from "./signing-identity.mjs";
|
|
10
11
|
import { bundleRelativePath, compileBundlePathMap, globToRegExp, isGlobPattern, lookupBundlePath, resolveBundleIdentifier, validateBundleRelativeKey, validateIdentifierTemplate, validateSigningIdentifier } from "./mac-bundle-signing.mjs";
|
|
@@ -175,6 +176,7 @@ const ASSERT_KEYS = new Set(["path", "identifier", "teamIdentifier", "authority"
|
|
|
175
176
|
* install.timestamp true adds --timestamp (a secure timestamp contacts Apple's server)
|
|
176
177
|
* install.assert [{ path-or-glob, identifier?, teamIdentifier?, authority? }]
|
|
177
178
|
* install.assertTeamSignedNested true: every Mach-O in the bundle carries the app's TeamIdentifier
|
|
179
|
+
* install.runtimeManifests / sign.runtimeManifests [bundle-relative manifest.json] re-hashed after the nested code is signed, before the app seal
|
|
178
180
|
* install.* entries win over sign.* entries (so one declaration in `sign` keeps dev and release identifiers identical).
|
|
179
181
|
* `root` resolves entitlement plist paths and checks they exist; without it only the shape is validated.
|
|
180
182
|
*/
|
|
@@ -211,7 +213,11 @@ export function readDevSigningSettings(descriptor = {}, config = {}, { root, exi
|
|
|
211
213
|
for (const key of checks) if (typeof item[key] !== "string" || !item[key].trim()) invalidConfig(`${label}.${key} must be a non-empty string`);
|
|
212
214
|
return { path: item.path, ...Object.fromEntries(checks.map((key) => [key, item[key]])) };
|
|
213
215
|
});
|
|
214
|
-
|
|
216
|
+
// Bundled runtime manifests re-described after the nested code is signed and before the app is sealed (install.runtimeManifests, else sign.runtimeManifests; rightkit#722).
|
|
217
|
+
let runtimeManifests;
|
|
218
|
+
try { runtimeManifests = validateRuntimeManifestPaths(descriptor.runtimeManifests ?? sign.runtimeManifests, descriptor.runtimeManifests !== undefined ? "install.runtimeManifests" : "sign.runtimeManifests"); }
|
|
219
|
+
catch (error) { invalidConfig(error.message); }
|
|
220
|
+
return { identifiers, identifierTemplate, entitlements, timestamp: descriptor.timestamp === true, assertions, assertTeamSignedNested: descriptor.assertTeamSignedNested === true, runtimeManifests };
|
|
215
221
|
}
|
|
216
222
|
|
|
217
223
|
function listBundleFiles(bundle) {
|
|
@@ -366,7 +372,24 @@ export function signMacosDevelopmentBundle(options) {
|
|
|
366
372
|
}
|
|
367
373
|
commands.push([...args, target.file]);
|
|
368
374
|
}
|
|
369
|
-
|
|
375
|
+
// Deepest first: every nested item is signed, then the bundled runtime manifest(s) are re-described from the re-signed bytes, then the
|
|
376
|
+
// app itself seals them (rightkit#722). Without a declared manifest the whole ordered list still runs as one session.
|
|
377
|
+
const sessionOptions = { ...options.sessionOptions, cwd: root, env, run };
|
|
378
|
+
let signed;
|
|
379
|
+
if (settings.runtimeManifests.length && commands.length > 1) {
|
|
380
|
+
const nestedCommands = commands.slice(0, -1);
|
|
381
|
+
const nestedSigned = runMacCodesignCommands(nestedCommands, sessionOptions);
|
|
382
|
+
for (const [index, args] of nestedCommands.entries()) checked("codesign", args, { ...context, run: () => nestedSigned[index] }, "DEV_MAC_SIGNING_FAILED", identity);
|
|
383
|
+
try { refreshRuntimeManifests({ base: bundle, manifests: settings.runtimeManifests }); }
|
|
384
|
+
catch (cause) { throw new MacosDevelopmentSigningError("DEV_MAC_SIGNING_CONFIG_INVALID", cause.message, { cause }); }
|
|
385
|
+
signed = [...nestedSigned, ...runMacCodesignCommands(commands.slice(-1), sessionOptions)];
|
|
386
|
+
} else {
|
|
387
|
+
if (settings.runtimeManifests.length) {
|
|
388
|
+
try { refreshRuntimeManifests({ base: bundle, manifests: settings.runtimeManifests }); }
|
|
389
|
+
catch (cause) { throw new MacosDevelopmentSigningError("DEV_MAC_SIGNING_CONFIG_INVALID", cause.message, { cause }); }
|
|
390
|
+
}
|
|
391
|
+
signed = runMacCodesignCommands(commands, sessionOptions);
|
|
392
|
+
}
|
|
370
393
|
for (const [index, args] of commands.entries()) checked("codesign", args, { ...context, run: () => signed[index] }, "DEV_MAC_SIGNING_FAILED", identity);
|
|
371
394
|
checked("codesign", ["--verify", "--strict", "--deep", bundle], context, "DEV_MAC_SIGNATURE_INVALID", identity);
|
|
372
395
|
const details = output(checked("codesign", ["--display", "--verbose=4", bundle], context, "DEV_MAC_SIGNATURE_INVALID", identity));
|
package/development.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import { assertReleaseExecutionAllowed } from "./execution-policy.mjs";
|
|
|
14
14
|
import { acquireManagedRunLease, directCargoEnv, directPlatform, gateNoBroker, managedRuntimeClient, managedRuntimeCommand, runCargoSync } from "./managed-cargo.mjs";
|
|
15
15
|
import { BUNDLE_MARKERS, bundleMarkerBuffer, readTauriBundleMarkers } from "./tauri-bundle-marker.mjs";
|
|
16
16
|
import { installPortableDevelopment } from "./portable-development.mjs";
|
|
17
|
+
import { PAYLOAD_ROOT_KIND, installPayloadRoot, validatePayloadRootDescriptor } from "./payload-root-install.mjs";
|
|
17
18
|
import { previousPathOf, stagingPathOf, swapInPlace } from "./in-place-install.mjs";
|
|
18
19
|
import { stageDevelopmentBinaries, validateStageEntries } from "./stage-binary.mjs";
|
|
19
20
|
import { assertStableDesignatedRequirement, readBundleExecutable, requestedCiAdhocSigning, signMacosDevelopmentBundle } from "./development-signing.mjs";
|
|
@@ -27,6 +28,8 @@ import { ASSEMBLED_APP_KIND, installAssembledMac, installAssembledWindows, resol
|
|
|
27
28
|
import { assertIosDevelopmentSession, installIosDevelopment, iosDevelopmentApp, iosUiTestCommands, prepareIosDevelopment, prepareIosUiTests, runIosDevelopmentCommands, validateIosDevelopment } from "./ios-dev.mjs";
|
|
28
29
|
import { packLinuxArtifacts, validateLinuxArchive } from "./linux-artifacts.mjs";
|
|
29
30
|
import { buildAndEmbedNativeHelpers, nativeHelpersFromConfig } from "./native-helpers.mjs";
|
|
31
|
+
import { devExpectPresentFindings, devSelfCheckSettings } from "./release-switch-scan.mjs";
|
|
32
|
+
import { devWebQaPairing } from "./qa-web-pairing.mjs";
|
|
30
33
|
import { androidDevelopmentNdkCommand, androidDevelopmentSerial, installAndroidDevelopment, validateAndroidDevelopment } from "./android-dev.mjs";
|
|
31
34
|
|
|
32
35
|
// GATE-CONTRACT GC-A07: the dev installer is the release Cargo profile plus the `qa-native` feature
|
|
@@ -89,6 +92,9 @@ export function validateDevelopmentConfig(config, platform, { root = process.cwd
|
|
|
89
92
|
for (const key of ["sourceDirectory", "entrypoint"]) {
|
|
90
93
|
if (typeof descriptor[key] !== "string" || !descriptor[key] || path.isAbsolute(descriptor[key]) || path.win32.isAbsolute(descriptor[key]) || descriptor[key].split(/[\\/]/).includes("..")) throw new Error(`portable development ${key} must be a contained relative path`);
|
|
91
94
|
}
|
|
95
|
+
} else if (target.install?.kind === PAYLOAD_ROOT_KIND) {
|
|
96
|
+
if (platform === "android" || platform === "ios") throw new Error(`the ${PAYLOAD_ROOT_KIND} development installer is for --platform win, mac or linux`);
|
|
97
|
+
validatePayloadRootDescriptor(target.install, platform);
|
|
92
98
|
} else if (target.install?.kind === TAURI_DEVID_KIND) {
|
|
93
99
|
if (platform !== "mac") throw new Error(`the ${TAURI_DEVID_KIND} development installer is for --platform mac`);
|
|
94
100
|
resolveTauriDevIdDescriptor(target.install, { appRoot: root });
|
|
@@ -176,6 +182,8 @@ export function runDevelopment({ root, platform, config, buildOnly = false, dryR
|
|
|
176
182
|
// broker's per-generation target folder or a hashed dev-targets folder.
|
|
177
183
|
const staged = target.stage?.length ? stageDevelopmentBinaries(target.stage, { root, platform: platform === "win" ? "win32" : process.platform, managedOutputDirs: carriedOutputDirsSince(childEnv) }) : [];
|
|
178
184
|
for (const file of staged) console.log(`right-release dev: staged ${file}`);
|
|
185
|
+
// The web and native QA halves are built together or not at all (rightkit#1480).
|
|
186
|
+
if (!dryRun && (platform === "win" || platform === "mac")) assertDevWebQaPairing({ root, config, commands: target.build });
|
|
179
187
|
// Linux: the declared files become one tarball per architecture plus the digest manifest a guest link pins (rightkit#1230).
|
|
180
188
|
// Only from a clean checkout: an artifact others install must name the exact commit it was built from.
|
|
181
189
|
if (platform === "linux" && target.archive && !dryRun) {
|
|
@@ -199,7 +207,7 @@ export function runDevelopment({ root, platform, config, buildOnly = false, dryR
|
|
|
199
207
|
}
|
|
200
208
|
releaseLease = false;
|
|
201
209
|
return installTauriDevId({ appRoot: root, config: target.install, releaseConfig: config, built, env: childEnv })
|
|
202
|
-
.then((outcome) => ({ built: true, installed: true, ...(staged.length ? { staged } : {}), devid: outcome })
|
|
210
|
+
.then((outcome) => { assertDevSelfCheck({ config, paths: [outcome.installed ?? path.resolve(target.install.destination)] }); return { built: true, installed: true, ...(staged.length ? { staged } : {}), devid: outcome }; })
|
|
203
211
|
.finally(() => lease.release());
|
|
204
212
|
}
|
|
205
213
|
if (target.install.kind === TAURI_AUTHENTICODE_KIND) {
|
|
@@ -216,6 +224,7 @@ export function runDevelopment({ root, platform, config, buildOnly = false, dryR
|
|
|
216
224
|
install: (installer) => installWindowsDevelopment(descriptor, installer, { root, env: childEnv, run, debugDir }),
|
|
217
225
|
installedExe: () => path.resolve(root, descriptor.expectedInstalledPath),
|
|
218
226
|
} });
|
|
227
|
+
assertDevSelfCheck({ config, paths: [path.resolve(root, descriptor.expectedInstalledPath)] });
|
|
219
228
|
return { built: true, installed: true, ...(staged.length ? { staged } : {}), authenticode };
|
|
220
229
|
}
|
|
221
230
|
if (target.install.kind === ASSEMBLED_APP_KIND) {
|
|
@@ -231,10 +240,27 @@ export function runDevelopment({ root, platform, config, buildOnly = false, dryR
|
|
|
231
240
|
.finally(() => lease.release());
|
|
232
241
|
}
|
|
233
242
|
const signing = install(target.install, { root, platform, config, env: childEnv, run, door, sinceMs: startedMs, serial });
|
|
243
|
+
if (target.install.kind === "tauri" && (platform === "win" || platform === "mac")) assertDevSelfCheck({ config, paths: [platform === "win" ? path.resolve(root, target.install.expectedInstalledPath) : path.resolve(target.install.destination)] });
|
|
234
244
|
return { built: true, installed: true, ...(staged.length ? { staged } : {}), ...(platform === "mac" && target.install.kind === "tauri" ? { signing } : {}) };
|
|
235
245
|
} finally { if (releaseLease) lease.release(); }
|
|
236
246
|
}
|
|
237
247
|
|
|
248
|
+
// The dev-build self-check (#397): the installed dev copy must carry the strings the release scan refuses, or that scan proves nothing.
|
|
249
|
+
function assertDevSelfCheck({ config, paths }) {
|
|
250
|
+
const settings = devSelfCheckSettings(config?.releaseSwitches?.devSelfCheck);
|
|
251
|
+
if (settings.skip) { console.log(`right-release dev: dev self-check skipped (releaseSwitches.devSelfCheck.optOut: ${settings.skip})`); return; }
|
|
252
|
+
const findings = devExpectPresentFindings({ binaryPaths: paths, expect: settings.expect });
|
|
253
|
+
if (findings.length) throw new DevelopmentInstallError("DEV_SELF_CHECK_FAILED", `dev self-check failed:\n${findings.map((f) => `- ${f.reason}`).join("\n")}\nAn app whose dev build has no QA control server declares releaseSwitches.devSelfCheck: { "optOut": "<reason>" }.`);
|
|
254
|
+
console.log(`right-release dev: dev self-check: the installed dev binary carries ${settings.expect.join(", ")}`);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// The web and native QA halves must not drift (qa-web-pairing.mjs): refuses a dev build whose bundle and Cargo features disagree.
|
|
258
|
+
function assertDevWebQaPairing({ root, config, commands }) {
|
|
259
|
+
const result = devWebQaPairing({ root, config, commands });
|
|
260
|
+
if (result.findings.length) throw new DevelopmentInstallError("DEV_WEB_QA_PAIRING", `web/native QA pairing failed:\n${result.findings.map((f) => `- ${f.reason}`).join("\n")}`);
|
|
261
|
+
if (result.checked) console.log(`right-release dev: web/native QA pairing ok (qa-native ${result.nativeQa ? "on" : "off"}, web QA marker ${result.webQa ? "present" : "absent"})`);
|
|
262
|
+
}
|
|
263
|
+
|
|
238
264
|
/** WSL reports `linux` as its platform under both generations; which one it is decides whether a Linux kernel runs at all. */
|
|
239
265
|
export function isWsl({ env = process.env, readFile = (f) => readFileSync(f, "utf8") } = {}) {
|
|
240
266
|
if (env.WSL_DISTRO_NAME || env.WSL_INTEROP) return true;
|
|
@@ -260,6 +286,13 @@ export function assertNativeDevelopmentHost(platform, host = process.platform, {
|
|
|
260
286
|
function install(descriptor, { root, platform, config, env, run, door, sinceMs = null, serial }) {
|
|
261
287
|
if (descriptor.kind === "adb") return installAndroidDevelopment(descriptor, { root, env, run, serial });
|
|
262
288
|
if (descriptor.kind === "command") return execute(descriptor, { root, env, run, door, label: "install" });
|
|
289
|
+
if (descriptor.kind === PAYLOAD_ROOT_KIND) {
|
|
290
|
+
const checked = validatePayloadRootDescriptor(descriptor, platform);
|
|
291
|
+
const source = path.resolve(root, checked.sourceDirectory);
|
|
292
|
+
const inside = path.relative(path.resolve(root), source);
|
|
293
|
+
if (inside === "" || inside.startsWith("..") || path.isAbsolute(inside)) throw new Error("payload-root sourceDirectory must be a folder inside the repository");
|
|
294
|
+
return installPayloadRoot(checked, { source, log: (line) => console.log(line) });
|
|
295
|
+
}
|
|
263
296
|
if (descriptor.kind === "portable") return installPortableDevelopment(descriptor, { root, platform: platform === "win" ? "win32" : "darwin", env });
|
|
264
297
|
if (platform === "win") {
|
|
265
298
|
if (!descriptor.expectedInstalledPath) throw new Error("Windows Tauri installer requires expectedInstalledPath for installed verification");
|