@rightkit/release 0.6.39 → 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 +167 -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 -7
- 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 +568 -491
- 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-ledger.mjs +6 -1
- 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
|
|
@@ -1238,7 +1266,9 @@ export function planScans({
|
|
|
1238
1266
|
const dir = ws === "." ? "" : ws;
|
|
1239
1267
|
// A non-empty list only: `[^\]\s]` is one character that is neither whitespace nor the closing bracket, so `ignore = []` followed by
|
|
1240
1268
|
// a later `]` (the next table header) is not an ignore (Pulse, 2026-10-27: `\S` matched the `]` itself).
|
|
1241
|
-
|
|
1269
|
+
// Comments go first: the @rightkit/config template keeps a commented example inside an empty `ignore = [ ... ]`, which is no
|
|
1270
|
+
// ignore (CutRight, 2026-11-03).
|
|
1271
|
+
const ignores = ["deny.toml", ".cargo/audit.toml"].some((f) => { try { return /\bignore\s*=\s*\[[^\]]*[^\]\s][^\]]*\]/s.test(stripTomlComments(readFile(path.join(contentRoot, dir, f)))); } catch { return false; } });
|
|
1242
1272
|
if (ignores && !(dir === "" && exists(path.join(contentRoot, "ci/advisory-exceptions.json")))) add({ id: `advisory-exceptions${dir ? `:${wsLabel(ws)}` : ""}`, class: A, internal: "advisory-exceptions", dir, exceptionsFile: ".rightkit/advisory-exceptions.json" });
|
|
1243
1273
|
}
|
|
1244
1274
|
// Like generated-docs, planned only when a changed file is one of the contract's inputs or projections. The generator runs from
|
|
@@ -1269,6 +1299,9 @@ export function planScans({
|
|
|
1269
1299
|
const pinEnv = { RK_ADVISORY_DB_COMMIT: pin.commit };
|
|
1270
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 });
|
|
1271
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 }) });
|
|
1272
1305
|
}
|
|
1273
1306
|
// The audit policy is the consumer's own: every package.json script that is exactly `pnpm audit <flags>` (only --prod, --dev,
|
|
1274
1307
|
// --audit-level <low|moderate|high|critical> are accepted) declares one, and the scan runs the strictest of them all: a dependency
|
|
@@ -1324,14 +1357,17 @@ export function planScans({
|
|
|
1324
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" }),
|
|
1325
1358
|
});
|
|
1326
1359
|
}
|
|
1327
|
-
const clippyEntries = [];
|
|
1360
|
+
const clippyEntries = []; const coverageCrates = [];
|
|
1328
1361
|
for (const name of crateNames) {
|
|
1329
|
-
|
|
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):
|
|
1330
1364
|
// clippy per `featureSets` (default features when absent); check per `checkFeatureSets` (default
|
|
1331
1365
|
// --all-features), none when a lint set already uses --all-features. Some crates' features cannot
|
|
1332
1366
|
// all be on together (rightkit-db sqlcipher vs sqlcipher-system; qa-driver wv2 generations).
|
|
1333
1367
|
const own = featuresOf(name);
|
|
1334
|
-
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] });
|
|
1335
1371
|
const ws = wsOf(name); const crate = crateOf(name);
|
|
1336
1372
|
// `cargo clippy --all-targets` type-checks exactly what `cargo check --all-targets` does: the default
|
|
1337
1373
|
// check runs only when no clippy set covers default features.
|
|
@@ -1342,10 +1378,10 @@ export function planScans({
|
|
|
1342
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
|
|
1343
1379
|
// toolchain must be provisioned (crossCcDir); without it the scan fails naming the fix, never skipped. On a broker host the broker must
|
|
1344
1380
|
// admit the cross target and its CC_/CXX_/AR_ variables; a refusal there fails the scan.
|
|
1345
|
-
for (const target of
|
|
1381
|
+
for (const target of scopedCrossTargets(own, platform)) {
|
|
1346
1382
|
const crossEnv = crossCompileEnv(target);
|
|
1347
|
-
|
|
1348
|
-
const id = `${rustScanId.clippy(name,
|
|
1383
|
+
baseSets.forEach((set, i) => {
|
|
1384
|
+
const id = `${rustScanId.clippy(name, baseSets.length, i)}@${target}`;
|
|
1349
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; }
|
|
1350
1386
|
const scan = cargoIn(ws, ...clippyArgs(crate, { features: set, locked: true, target }));
|
|
1351
1387
|
add({ id, class: B, batchUnit: name, ...scan, env: { ...(scan.env ?? {}), ...crossEnv } });
|
|
@@ -1357,6 +1393,10 @@ export function planScans({
|
|
|
1357
1393
|
add({ id: rustScanId.doc(name), class: B, ...cargoIn(ws, "rustdoc", "-p", crate, "--lib", ...lintSets[0], "--locked", "--", ...DOC_RUSTDOC_ARGS) });
|
|
1358
1394
|
}
|
|
1359
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 });
|
|
1360
1400
|
if (clippyBatching && clippyEntries.length) {
|
|
1361
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
|
|
1362
1402
|
// drains in plan order). The reason a configuration stays separate is recorded in the plan notes.
|
|
@@ -1374,13 +1414,13 @@ export function planScans({
|
|
|
1374
1414
|
const memo = new Map();
|
|
1375
1415
|
const scoped = crateNames.filter((n) => wsOf(n) === ws).map(crateOf);
|
|
1376
1416
|
const workspace = (rustMap ? [...rustMap.keys()] : listDir(path.join(contentRoot, "crates"))).filter((n) => wsOf(n) === ws);
|
|
1377
|
-
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");
|
|
1378
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 })) }); }
|
|
1379
1419
|
}
|
|
1380
1420
|
// Across Cargo workspaces (one workspace and lock per crate): a unit that path-depends on a unit in scope, transitively, is judged by
|
|
1381
1421
|
// the manifests' path dependencies, since no lock holds both.
|
|
1382
1422
|
if (typeof crateDependents === "function" && rustMap && crateNames.length) {
|
|
1383
|
-
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();
|
|
1384
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 })) });
|
|
1385
1425
|
}
|
|
1386
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).
|
|
@@ -1408,6 +1448,19 @@ export function planScans({
|
|
|
1408
1448
|
}
|
|
1409
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 });
|
|
1410
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
|
+
}
|
|
1411
1464
|
}
|
|
1412
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
|
|
1413
1466
|
// directory (rightkit#1229: Pulse's package is swift/RightKitHub, and a root `swift build` found no package and blocked every push).
|
|
@@ -1424,6 +1477,11 @@ export function planScans({
|
|
|
1424
1477
|
const declared = swiftPackages?.[dir === "" ? "." : dir]?.qualifyOnly;
|
|
1425
1478
|
const reason = typeof declared?.reason === "string" && declared.reason.trim() !== "" ? declared.reason.replace(/\s+/g, " ").trim() : null;
|
|
1426
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
|
+
}
|
|
1427
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`); }
|
|
1428
1486
|
// The committed Package.resolved is the lockfile: like cargo --locked and pnpm --frozen-lockfile, a stale one fails here with
|
|
1429
1487
|
// SwiftPM's own message instead of SwiftPM rewriting it inside the snapshot (seen only after the compile as a changed tree).
|
|
@@ -1463,8 +1521,9 @@ export function planScans({
|
|
|
1463
1521
|
// Tests per declared feature set, serially too where the crate asks for it, as CI's gate runs them. `quietTests: true` marks
|
|
1464
1522
|
// every test scan of the crate for the quiet lane (laneOf): run alone, under the broker's quiet lease.
|
|
1465
1523
|
for (const name of crateNames) {
|
|
1524
|
+
if (outOfScope(name)) continue;
|
|
1466
1525
|
const own = featuresOf(name);
|
|
1467
|
-
const sets = rustCratePlan(own).
|
|
1526
|
+
const sets = rustCratePlan(own).baseSets;
|
|
1468
1527
|
const quiet = own.quietTests === true ? { quiet: true } : {};
|
|
1469
1528
|
if (own.quietTests === true && quietTests === "ci") {
|
|
1470
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)) : []));
|
|
@@ -1553,36 +1612,7 @@ export function planScans({
|
|
|
1553
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 } : {}) } });
|
|
1554
1613
|
}
|
|
1555
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(", ")}`);
|
|
1556
|
-
//
|
|
1557
|
-
// relative path literals, followed through packages/*.mjs) changed. Where unreadable, they run.
|
|
1558
|
-
const ciDir = exists(path.join(liveRoot, "scripts/ci"));
|
|
1559
|
-
const scriptsCiTouched = () => {
|
|
1560
|
-
if (files.some((f) => /^(scripts|ci|\.github)\//.test(f))) return true;
|
|
1561
|
-
try {
|
|
1562
|
-
const sources = listDir(path.join(liveRoot, "scripts/ci")).filter((n) => /\.mjs$/.test(n));
|
|
1563
|
-
if (!sources.length) return true;
|
|
1564
|
-
const inputs = new Set(); const seen = new Set();
|
|
1565
|
-
const visit = (rel) => {
|
|
1566
|
-
if (seen.has(rel)) return;
|
|
1567
|
-
seen.add(rel);
|
|
1568
|
-
let text; try { text = readFile(path.join(liveRoot, rel)); } catch { return; }
|
|
1569
|
-
for (const m of text.matchAll(/["'`]((?:\.\.?\/)+[^"'`\s]+)["'`]/g)) {
|
|
1570
|
-
const target = path.posix.normalize(path.posix.join(path.posix.dirname(rel), m[1])).replace(/\/+$/, "");
|
|
1571
|
-
if (!target || target === "." || target.startsWith("..")) continue;
|
|
1572
|
-
inputs.add(target);
|
|
1573
|
-
if (target.startsWith("packages/") && target.endsWith(".mjs")) visit(target);
|
|
1574
|
-
}
|
|
1575
|
-
};
|
|
1576
|
-
for (const n of sources) visit(`scripts/ci/${n}`);
|
|
1577
|
-
return files.some((f) => [...inputs].some((i) => f === i || f.startsWith(`${i}/`)));
|
|
1578
|
-
} catch { return true; }
|
|
1579
|
-
};
|
|
1580
|
-
if (ciDir ? scriptsCiTouched() : (!(rustMap || npmMap) && files.some((f) => f.startsWith("scripts/")))) {
|
|
1581
|
-
// The suite is the exported commit's test files, named explicitly: an untracked WIP test in the live
|
|
1582
|
-
// checkout is never run and can neither block nor pass a push.
|
|
1583
|
-
const suite = listDir(path.join(contentRoot, "scripts", "ci")).filter((n) => n.endsWith(".test.mjs")).sort().map((n) => `scripts/ci/${n}`);
|
|
1584
|
-
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.length ? suite : ["scripts/ci/*.test.mjs"])] });
|
|
1585
|
-
}
|
|
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.
|
|
1586
1616
|
}
|
|
1587
1617
|
|
|
1588
1618
|
// Without a local compile grant the managed broker path is closed: every broker scan (class A
|
|
@@ -1808,12 +1838,26 @@ export function defaultSpawnAsync(command, args, options = {}) {
|
|
|
1808
1838
|
* `Tests N passed | M skipped | K failed (T)` line. Null when neither is present. Several node:test summaries (a script that runs
|
|
1809
1839
|
* the runner more than once) are summed. */
|
|
1810
1840
|
/** null when a test summary is evidence of a pass; otherwise { code, detail }. Used for fresh and cached test rows alike. */
|
|
1841
|
+
/** TOML text without its comments: a `#` outside a basic or literal string starts one (a `#` inside quotes is kept). */
|
|
1842
|
+
export function stripTomlComments(text) {
|
|
1843
|
+
return String(text).split("\n").map((line) => {
|
|
1844
|
+
let quote = null;
|
|
1845
|
+
for (let i = 0; i < line.length; i += 1) {
|
|
1846
|
+
const ch = line[i];
|
|
1847
|
+
if (quote) { if (ch === "\\" && quote === '"') i += 1; else if (ch === quote) quote = null; }
|
|
1848
|
+
else if (ch === '"' || ch === "'") quote = ch;
|
|
1849
|
+
else if (ch === "#") return line.slice(0, i);
|
|
1850
|
+
}
|
|
1851
|
+
return line;
|
|
1852
|
+
}).join("\n");
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1811
1855
|
export function testResultsProblem(results) {
|
|
1812
1856
|
if (!results) return { code: "NO_TEST_SUMMARY", detail: "no test counts recorded" };
|
|
1813
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
|
|
1814
|
-
// 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
|
|
1815
|
-
// run whose tests were all skipped or ignored still proves nothing (ALL_SKIPPED below).
|
|
1816
|
-
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;
|
|
1817
1861
|
if (!(results.tests > 0)) return { code: "NO_TESTS", detail: "the test scan executed no test" };
|
|
1818
1862
|
if (results.fail > 0) return { code: "SUMMARY_FAILED", detail: `the test runner exited 0 but its summary reports ${results.fail} failed test(s)` };
|
|
1819
1863
|
// A suite that ran tests but passed none of them (every test skipped or todo) proves nothing (D17, rightkit#1236).
|
|
@@ -2230,9 +2274,22 @@ async function defaultScanSecrets() {
|
|
|
2230
2274
|
export async function ignoredPathSkip(ctx) {
|
|
2231
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; } };
|
|
2232
2276
|
const top = await git(["rev-parse", "--show-toplevel"]);
|
|
2233
|
-
if (!top || top.status !== 0) return null;
|
|
2234
2277
|
const same = (a, b) => { try { return fs.realpathSync(a) === fs.realpathSync(b); } catch { return path.resolve(a) === path.resolve(b); } };
|
|
2235
|
-
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
|
+
}
|
|
2236
2293
|
const listed = await git(["ls-files", "-z", "--others", "--ignored", "--exclude-standard", "--directory"]);
|
|
2237
2294
|
if (!listed || listed.status !== 0) return null;
|
|
2238
2295
|
const entries = String(listed.stdout ?? "").split("\0").filter(Boolean);
|
|
@@ -2347,6 +2404,52 @@ const INTERNAL = {
|
|
|
2347
2404
|
for (const f of s.files) { try { parse(ctx.read(f)); } catch (e) { bad.push(`${f}: ${String(e.message).split("\n")[0]}`); } }
|
|
2348
2405
|
return bad;
|
|
2349
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 })),
|
|
2350
2453
|
// File-only SwiftPM lockfile check (swift-lock.mjs): runs no SwiftPM, reads Package.swift / project.pbxproj and Package.resolved as committed.
|
|
2351
2454
|
"swift-lock": (s, ctx) => {
|
|
2352
2455
|
const exists = (f) => ctx.deps.exists(path.join(ctx.contentRoot, f));
|
|
@@ -2504,7 +2607,9 @@ export async function runScans(plan, options = {}) {
|
|
|
2504
2607
|
const rootDir = (r) => (r === "content" ? contentRoot : r === "parent" ? path.dirname(contentRoot) : r === "cargoLive" ? (cargoLiveRoot ?? liveRoot) : liveRoot);
|
|
2505
2608
|
const selected = plan.scans.filter((s) => classes.includes(s.class) && !exclude(s));
|
|
2506
2609
|
const ordered = [...selected.filter((s) => s.class === SCAN_CLASS.A), ...selected.filter((s) => s.class === SCAN_CLASS.B)];
|
|
2507
|
-
|
|
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 };
|
|
2508
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
|
|
2509
2614
|
// runs them directly (snapshot-metadata.mjs directReadSpawn), and cargo-deny / cargo-audit are its own enrolled tools.
|
|
2510
2615
|
const cargoReadsAreCarried = false;
|
|
@@ -2525,6 +2630,8 @@ export async function runScans(plan, options = {}) {
|
|
|
2525
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).
|
|
2526
2631
|
const cache = options.cache && typeof options.cache.read === "function" && typeof options.cache.write === "function" && typeof options.cache.digest === "function" ? options.cache : null;
|
|
2527
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; } }
|
|
2528
2635
|
let classAFailed = false;
|
|
2529
2636
|
// Class B needs class A first: in this call (classes includes A) or valid prior class A evidence for the
|
|
2530
2637
|
// same class A scan set (options.priorClassA: an earlier runScans result whose class A rows all passed).
|
|
@@ -2814,7 +2921,7 @@ export async function runScans(plan, options = {}) {
|
|
|
2814
2921
|
if (s.class === SCAN_CLASS.B && classAFailed) {
|
|
2815
2922
|
return { ...row, status: "not-run", detail: "a class A scan failed; class B starts only after class A passes" };
|
|
2816
2923
|
}
|
|
2817
|
-
let status = "pass"; let detail = ""; let code;
|
|
2924
|
+
let status = "pass"; let detail = ""; let code; let advice;
|
|
2818
2925
|
if (s.deferred) {
|
|
2819
2926
|
// A class A scan that did not run is not a class A pass: class B waits.
|
|
2820
2927
|
if (s.class === SCAN_CLASS.A) classAFailed = true;
|
|
@@ -2824,6 +2931,8 @@ export async function runScans(plan, options = {}) {
|
|
|
2824
2931
|
if (s.internal) {
|
|
2825
2932
|
const out = await INTERNAL[s.internal](s, ctx);
|
|
2826
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; }
|
|
2827
2936
|
else if (out.length) { status = "fail"; detail = out.join("; "); }
|
|
2828
2937
|
} else {
|
|
2829
2938
|
const scanDir = path.join(rootDir(s.root), s.cwd ?? "");
|
|
@@ -3195,7 +3304,7 @@ export async function runScans(plan, options = {}) {
|
|
|
3195
3304
|
}
|
|
3196
3305
|
} catch (e) { status = "fail"; code = "SCAN_ERROR"; detail = e.message; }
|
|
3197
3306
|
if (status === "fail" && s.class === SCAN_CLASS.A) classAFailed = true;
|
|
3198
|
-
return { ...row, status, ...(code ? { code } : {}), ...(detail ? { detail } : {}) };
|
|
3307
|
+
return { ...row, status, ...(code ? { code } : {}), ...(detail ? { detail } : {}), ...(advice ? { advice } : {}) };
|
|
3199
3308
|
}
|
|
3200
3309
|
|
|
3201
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));
|