@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/bin/rightkit-gate.mjs
CHANGED
|
@@ -88,7 +88,10 @@ const gateResolveExecutor = (args) => resolveExecutor({ ...args, gateWrappers: t
|
|
|
88
88
|
import { ALL_UNITS_ERRORS, ALL_UNITS_EXCEPTIONS_FILE, BROKER_EXCEPTIONS_FILE, BROKER_EXCEPTION_ERRORS, CARGO_WORKSPACE_LIST_FILE, CARGO_WORKSPACE_LIST_KEY, RIGHTKIT_IDENTITY_FILE, authorizeAllUnits, authorizeNoBroker, checkCargoWorkspaceList, describeAllUnitsException, describeBrokerException, isRightKitIdentity, unitsOfSelector } from "../broker-exception.mjs";
|
|
89
89
|
import { SIGNING_REFUSAL_CODES, suiteSigningRefusals } from "../suite-signing-policy.mjs";
|
|
90
90
|
import { gitListRustFiles } from "../signing-files.mjs";
|
|
91
|
-
import {
|
|
91
|
+
import { nativeHelpersFromConfig } from "../native-helpers.mjs";
|
|
92
|
+
import { buildCoverageReport, seconds, writeCoverageReport } from "../gate-coverage.mjs";
|
|
93
|
+
import { renderViews, renderViewsOf } from "../render-views.mjs";
|
|
94
|
+
import { LINUX_BROKER_ROUTE, NO_BROKER_ENV, directCargoPath, directPlatform, linuxBrokerDeclared, managedRuntimeClient, realCargoOf, runCargoSync } from "../managed-cargo.mjs";
|
|
92
95
|
import { createBrokerLive } from "../broker-admission.mjs";
|
|
93
96
|
import { bindingOf, compileOutputsRecord, compileReuseProblem, endRun, readReceipt, RECEIPT_SCHEMA, receiptKey, sameBinding, sameSource, sealedFor, stagesTo, startRun, STAGES, STAGE_SOURCES, writeReceipt } from "../gate-stages.mjs";
|
|
94
97
|
import { spawnSync as spawnInherit } from "../background-process.mjs";
|
|
@@ -141,7 +144,7 @@ function directCargoBinOf(o) {
|
|
|
141
144
|
return null;
|
|
142
145
|
}
|
|
143
146
|
|
|
144
|
-
const USAGE = `usage: rightkit-gate --to check|compile|package|qualify|release [--platform mac|win|ios|android] [--tier patch|update] [--receipt-in <file>] [--receipt-out <file>] | rightkit-gate --to check|compile|package|qualify|release --unit npm:@rightkit/<name>|cargo:rightkit-<name> [--receipt-out <file>] | rightkit-gate --to tool --unit cargo:rightkit-qa|cargo:rightkit-credentials [--no-broker <exception-id>] [--receipt-out <file>] [--commit <rev>] (builds the unit's release binary from the commit and enrols it: cargo:rightkit-qa as the managed rightkit-qa runner, cargo:rightkit-credentials as the managed OS credential provider updater signing runs; Mac and Windows) | rightkit-gate --to check|compile|package|qualify --units-file <json {"units":[<selector>,...]} written for this run> | rightkit-gate --to check|compile|package|qualify --all-units-exception <id> (RightKit only: its unit is named on every run, or every unit by Adrian's entry in ci/all-units-exceptions.json of the commit) | rightkit-gate --to check|compile|package|qualify [--unit <selector>] --no-broker <exception-id> (Mac and Dell only; Adrian's recorded exception in .rightkit/broker-exceptions.json of the commit) | rightkit-gate --to dev|test [--commit <rev>] [-- <right-release args>] | rightkit-gate --to check|compile|package|qualify|dev|test --route [--platform mac|win|ios|android] [--commit <rev>] | rightkit-gate stage --platform mac|win [--tier patch|update] | rightkit-gate [--base <ref>] [--plan] | rightkit-gate install-hook | rightkit-gate env-digest | rightkit-gate snapshot [--commit <rev>] [--verify [--env <sha256>]] [--json] | rightkit-gate live-scans --repo <root> | rightkit-gate clippy [<cargo clippy args>] | rightkit-gate env-digest [--snapshot <dir> --commit <sha>] | rightkit-gate check [--repo <dir>] [--commit <rev> | --worktree] [--rule-tier compile|release] [--only <rule,...>] [--list] [--print-baseline] [--baseline <file>] | rightkit-gate check --commit <sha> --full-a --snapshot <dir> | --version`;
|
|
147
|
+
const USAGE = `usage: rightkit-gate --to check|compile|package|qualify|release [--platform mac|win|ios|android] [--tier patch|update] [--receipt-in <file>] [--receipt-out <file>] | rightkit-gate --to check|compile|package|qualify|release --unit npm:@rightkit/<name>|cargo:rightkit-<name> [--receipt-out <file>] | rightkit-gate --to tool --unit cargo:rightkit-qa|cargo:rightkit-credentials [--no-broker <exception-id>] [--receipt-out <file>] [--commit <rev>] (builds the unit's release binary from the commit and enrols it: cargo:rightkit-qa as the managed rightkit-qa runner, cargo:rightkit-credentials as the managed OS credential provider updater signing runs; Mac and Windows) | rightkit-gate --to check|compile|package|qualify --units-file <json {"units":[<selector>,...]} written for this run> | rightkit-gate --to check|compile|package|qualify --all-units-exception <id> (RightKit only: its unit is named on every run, or every unit by Adrian's entry in ci/all-units-exceptions.json of the commit) | rightkit-gate --to check|compile|package|qualify [--unit <selector>] --no-broker <exception-id> (Mac and Dell only; Adrian's recorded exception in .rightkit/broker-exceptions.json of the commit) | rightkit-gate --to dev|test [--commit <rev>] [-- <right-release args>] | rightkit-gate --to render [--commit <rev>] (builds the app's declared renderViews target from ci/gate.config.json through the carrier, runs it headless and stores the PNGs and a hashed receipt) | rightkit-gate --to check|compile|package|qualify|dev|test --route [--platform mac|win|ios|android] [--commit <rev>] | rightkit-gate stage --platform mac|win [--tier patch|update] | rightkit-gate [--base <ref>] [--plan] | rightkit-gate install-hook | rightkit-gate env-digest | rightkit-gate snapshot [--commit <rev>] [--verify [--env <sha256>]] [--json] | rightkit-gate live-scans --repo <root> | rightkit-gate clippy [<cargo clippy args>] | rightkit-gate env-digest [--snapshot <dir> --commit <sha>] | rightkit-gate check [--repo <dir>] [--commit <rev> | --worktree] [--rule-tier compile|release] [--only <rule,...>] [--list] [--print-baseline] [--baseline <file>] | rightkit-gate check --commit <sha> --full-a --snapshot <dir> | --version`;
|
|
145
148
|
/** The host platform (process.platform) that constructs each platform's artifact; a platform missing here (android) builds on any host. */
|
|
146
149
|
const STAGE_NATIVE_HOST = Object.freeze({ mac: "darwin", ios: "darwin", win: "win32" });
|
|
147
150
|
|
|
@@ -486,25 +489,51 @@ export function pnpmPinOf(packageJsonText) {
|
|
|
486
489
|
}
|
|
487
490
|
|
|
488
491
|
/**
|
|
489
|
-
* Class A runs the pnpm it bound, never a pnpm that relaunches another one: a pnpm older than a package's
|
|
490
|
-
* itself to the pinned version through
|
|
491
|
-
* refuses mid-row as an unreadable launch. This
|
|
492
|
-
*
|
|
493
|
-
*
|
|
492
|
+
* Class A runs the pnpm it bound, never a pnpm that relaunches another one through a shell: on Windows a pnpm older than a package's
|
|
493
|
+
* `packageManager` pin switches itself to the pinned version through `cmd /d /s /c` with ^-escaped text, which the class A launch guard
|
|
494
|
+
* refuses mid-row as an unreadable launch. This checks every pnpm pin of the checked tree BEFORE any class A row launches and returns a
|
|
495
|
+
* typed problem naming both versions and the fix, or null. Nothing is admitted: the guard keeps refusing any relaunch.
|
|
496
|
+
*
|
|
497
|
+
* Pins under a declared fixture directory (ci/gate.config.json `fixtures`) are not the repository's own: a fixture's pnpm pin is
|
|
498
|
+
* evidence content that every other scan skips, so this check skips it too (rightkit#1468).
|
|
499
|
+
*
|
|
500
|
+
* Policy for a repository pinned differently from the host default (rightkit#1468): the pnpm on PATH is first asked from a directory
|
|
501
|
+
* with no package.json (it cannot switch there). When it differs from a pin, the pinned version is probed directly, by running
|
|
502
|
+
* `pnpm --version` inside the pinning package's own directory, where pnpm's packageManager self-switch (or corepack) resolves the pin;
|
|
503
|
+
* the pin is admitted only when that probe prints exactly the pinned version. Only when the probe fails does the check refuse, with the
|
|
504
|
+
* migration path. On Windows the self-switch itself is the refused shell relaunch, so there the pin must equal the neutral version.
|
|
494
505
|
*/
|
|
495
|
-
export function pnpmPinProblem({ root, files, spawn = defaultSpawn, readFile = (f) => fs.readFileSync(f, "utf8"), neutralCwd = os.tmpdir() }) {
|
|
506
|
+
export function pnpmPinProblem({ root, files, spawn = defaultSpawn, readFile = (f) => fs.readFileSync(f, "utf8"), neutralCwd = os.tmpdir(), fixtures = [], platform = process.platform }) {
|
|
507
|
+
const fixtureDirs = fixtures.map((d) => String(d).replace(/\\/g, "/").replace(/\/+$/, "")).filter(Boolean);
|
|
508
|
+
const underFixture = (f) => fixtureDirs.some((d) => f === d || f.startsWith(`${d}/`));
|
|
496
509
|
const pins = new Map();
|
|
497
|
-
for (const f of files.filter((x) => /(^|\/)package\.json$/.test(x))) {
|
|
510
|
+
for (const f of files.filter((x) => /(^|\/)package\.json$/.test(x) && !underFixture(x))) {
|
|
498
511
|
let pin = null; try { pin = pnpmPinOf(readFile(path.join(root, f))); } catch { pin = null; }
|
|
499
512
|
if (pin) pins.set(f, pin);
|
|
500
513
|
}
|
|
501
514
|
if (!pins.size) return null;
|
|
502
515
|
const r = spawn("pnpm", ["--version"], { cwd: neutralCwd, boundedMs: PNPM_PROBE_TIMEOUT_MS });
|
|
503
516
|
const onPath = failed(r) ? "" : text(r).trim();
|
|
504
|
-
const fix = (pin) => `install the pinned pnpm as the pnpm on PATH (for example \`pnpm self-update ${pin}\`) and run again`;
|
|
505
|
-
if (!onPath) { const [pin] = new Set(pins.values()); return { code: PNPM_PIN_REFUSAL, message: `${PNPM_PIN_REFUSAL}: cannot read the version of the pnpm on PATH (${r?.error ? r.error.code ?? r.error.message : why(r)}); ${fix(pin)}` }; }
|
|
517
|
+
const fix = (pin) => `install the pinned pnpm as the pnpm on PATH (for example \`pnpm self-update ${pin}\`), or make the repository's own pin resolvable (corepack enable, network access to the pnpm release), and run again`;
|
|
506
518
|
const bad = [...pins].filter(([, pin]) => pin !== onPath);
|
|
507
519
|
if (!bad.length) return null;
|
|
520
|
+
if (platform !== "win32") {
|
|
521
|
+
// One probe per distinct pin, from the first package.json that carries it: the self-switch is per directory.
|
|
522
|
+
const probed = new Map(); const unresolved = [];
|
|
523
|
+
for (const [file, pin] of bad) {
|
|
524
|
+
if (!probed.has(pin)) {
|
|
525
|
+
const dir = path.join(root, path.dirname(file));
|
|
526
|
+
const pr = spawn("pnpm", ["--version"], { cwd: dir, boundedMs: PNPM_PROBE_TIMEOUT_MS });
|
|
527
|
+
probed.set(pin, failed(pr) ? null : text(pr).trim());
|
|
528
|
+
}
|
|
529
|
+
if (probed.get(pin) !== pin) unresolved.push([file, pin]);
|
|
530
|
+
}
|
|
531
|
+
if (!unresolved.length) return null;
|
|
532
|
+
const [file, pin] = unresolved[0];
|
|
533
|
+
const got = probed.get(pin);
|
|
534
|
+
return { code: PNPM_PIN_REFUSAL, message: `${PNPM_PIN_REFUSAL}: ${file} pins packageManager pnpm@${pin} and the pnpm on PATH is ${onPath || "unreadable"}; running pnpm inside ${path.dirname(file)} to resolve the pin ${got ? `printed ${got}` : "failed"}${unresolved.length > 1 ? ` (${unresolved.length} package.json files differ)` : ""}; ${fix(pin)}` };
|
|
535
|
+
}
|
|
536
|
+
if (!onPath) { const [, pin] = bad[0]; return { code: PNPM_PIN_REFUSAL, message: `${PNPM_PIN_REFUSAL}: cannot read the version of the pnpm on PATH (${r?.error ? r.error.code ?? r.error.message : why(r)}); ${fix(pin)}` }; }
|
|
508
537
|
const [file, pin] = bad[0];
|
|
509
538
|
return { code: PNPM_PIN_REFUSAL, message: `${PNPM_PIN_REFUSAL}: the pnpm on PATH is ${onPath} but ${file} pins packageManager pnpm@${pin}${bad.length > 1 ? ` (${bad.length} package.json files differ)` : ""}; a different pnpm relaunches the pinned one through a shell, which class A refuses (RK_CLASS_A_COMPILE_LAUNCH); ${fix(pin)}` };
|
|
510
539
|
}
|
|
@@ -944,8 +973,7 @@ const plainRelative = (p) => typeof p === "string" && p !== "" && !path.posix.is
|
|
|
944
973
|
* (externalInputs `leavesCrate`: workspace root, current_dir, a bare "..", the manifest directory's parent) keys the scan on the
|
|
945
974
|
* whole HEAD tree, since its tests may read anything.
|
|
946
975
|
* - An npm package scan (test:npm, tsc, eslint, biome) keys on the package's workspace closure (every dependency that is a workspace
|
|
947
|
-
* package, whatever its spec, transitively, by package name) and the root npm inputs; test:
|
|
948
|
-
* root install graph. Every other class B scan (generated-docs, swift-build) uses the whole tree.
|
|
976
|
+
* package, whatever its spec, transitively, by package name) and the root npm inputs; (the scripts/ci self-test scan no longer exists: Adrian, 2026-11-03, end-to-end tests only). Every other class B scan (generated-docs, swift-build) uses the whole tree.
|
|
949
977
|
* - Class A: pnpm-lockfile and advisory-exceptions are never cached (live answers). cargo-deny, cargo-audit and pnpm-audit are cached by
|
|
950
978
|
* their inputs and the identity of the advisory data they read (rightkit#1464, ADR-001 C5; advisoryKey below): a Cargo workspace's lock
|
|
951
979
|
* blob, every Cargo.toml of the commit, the deny and cargo configuration files, and the pinned RustSec commit (cargo-deny and cargo-audit
|
|
@@ -961,7 +989,6 @@ const SHARED_NPM_INPUTS = ["package.json", "pnpm-lock.yaml", "pnpm-workspace.yam
|
|
|
961
989
|
// name than the shared list above) is part of a package's key only when the commit has it, so a repository without one keeps the key it had.
|
|
962
990
|
const LINT_CONFIG_NAMES = [...ESLINT_CONFIG_FILES, ...BIOME_CONFIG_FILES];
|
|
963
991
|
// The gate's own test suite reads the CI scripts, the gate config and the release package it imports from.
|
|
964
|
-
const SCRIPTS_CI_INPUTS = ["scripts", "ci", ".github", "packages/release", "package.json", "pnpm-lock.yaml"];
|
|
965
992
|
|
|
966
993
|
/** ci/shards.json `solo` (crate names that always get an invocation of their own), read from the gated tree; empty when the file is absent or unreadable. */
|
|
967
994
|
function shardSoloOf(o, repo) {
|
|
@@ -1109,7 +1136,6 @@ export function buildCacheDigest({ objectId, headTree, rustUnits = [], npmUnits
|
|
|
1109
1136
|
if (unresolved) return whole();
|
|
1110
1137
|
return canonicalJson({ kind: "npm", id: scan.id, members: members.map((m) => [m.name, m.dir, idOf(m.dir)]), shared: sharedNpmInputs(members) });
|
|
1111
1138
|
}
|
|
1112
|
-
if (scan.id === "test:scripts-ci") return canonicalJson({ kind: "dirs", id: scan.id, inputs: SCRIPTS_CI_INPUTS.map((p) => [p, idOf(p)]) });
|
|
1113
1139
|
return whole();
|
|
1114
1140
|
}
|
|
1115
1141
|
const keyed = rustUnitKey(unit, scan);
|
|
@@ -1452,9 +1478,10 @@ async function runStages(o, args, root, git, io) {
|
|
|
1452
1478
|
const to = option("--to");
|
|
1453
1479
|
// dev and test are door stages like the rest: the same commit-only route (select a commit, sync its snapshot under ownership, class A
|
|
1454
1480
|
// of the snapshot), then right-release dev|test with the snapshot's app root as its cwd. They have no stage list of their own.
|
|
1455
|
-
|
|
1481
|
+
// render (rightkit#1288) is a door stage of the same family: class A of the snapshot, then the app's declared view-render target built through the carrier and run headless.
|
|
1482
|
+
const devTest = to === "dev" || to === "test" || to === "render";
|
|
1456
1483
|
let stages = devTest ? [] : stagesTo(to);
|
|
1457
|
-
if (!stages) { o.err(`${tag} --to must be one of ${[...STAGES, "dev", "test"].join(", ")}${to === "tool" ? " (--to tool builds one named tool unit: --to tool --unit cargo:rightkit-qa or --to tool --unit cargo:rightkit-credentials)" : ""}`); return 2; }
|
|
1484
|
+
if (!stages) { o.err(`${tag} --to must be one of ${[...STAGES, "dev", "test", "render"].join(", ")}${to === "tool" ? " (--to tool builds one named tool unit: --to tool --unit cargo:rightkit-qa or --to tool --unit cargo:rightkit-credentials)" : ""}`); return 2; }
|
|
1458
1485
|
// Every stage the door runs has a row naming where it reads its source from (gate-stages.mjs STAGE_SOURCES, drift-tested in
|
|
1459
1486
|
// door-stages.test.mjs); a stage added without one is refused rather than run with an unstated source.
|
|
1460
1487
|
if (!STAGE_SOURCES[to]) { o.err(`${tag} BLOCKED: stage ${to} has no STAGE_SOURCES row naming its source; nothing ran`); return 2; }
|
|
@@ -1643,6 +1670,24 @@ async function runStages(o, args, root, git, io) {
|
|
|
1643
1670
|
const publisherUploadOnly = to === "release" && !mobile;
|
|
1644
1671
|
// GB-15: a nested app's Class A runs its executing scans for that app's dependency closure; an app at the repository root is the repository.
|
|
1645
1672
|
const appScope = appDir === "." ? [] : ["--scope", appDir];
|
|
1673
|
+
// rightkit#1491: an app whose own @rightkit/release is below the host gate's floor (DIRECT_ROUTE_RELEASE_FLOOR) is refused before any compile
|
|
1674
|
+
// on a broker host: its child would carry the non-compiling cargo calls to the broker, which refuses them (GC-A11). The pin is judged from the
|
|
1675
|
+
// commit's package.json before the check stage; the version installed in the snapshot (Class A installs it) before the compile stage.
|
|
1676
|
+
const appPackageJson = () => { const shown = git("show", `${commit}:${appDir === "." ? "" : `${appDir}/`}package.json`); return failed(shown) ? null : text(shown); };
|
|
1677
|
+
const pinFloor = async (installed) => {
|
|
1678
|
+
if (executor.kind !== "broker" || !stages.includes("compile") || !ds) return null;
|
|
1679
|
+
const packageJsonText = appPackageJson();
|
|
1680
|
+
if (packageJsonText === null) return null;
|
|
1681
|
+
const { releasePinFloorProblem } = await import("../release-pin-floor.mjs");
|
|
1682
|
+
let installedVersion = null;
|
|
1683
|
+
if (installed) {
|
|
1684
|
+
for (const dir of new Set([snapshotAppRootOf(ds.path, appDir), ds.path])) {
|
|
1685
|
+
try { installedVersion = JSON.parse(fs.readFileSync(path.join(dir, "node_modules", "@rightkit", "release", "package.json"), "utf8")).version ?? null; break; } catch { /* not installed here */ }
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
return releasePinFloorProblem({ packageJsonText, installedVersion, where: appDir === "." ? "package.json" : `${appDir}/package.json` });
|
|
1689
|
+
};
|
|
1690
|
+
const phaseTimings = [];
|
|
1646
1691
|
for (const stage of stages) {
|
|
1647
1692
|
if (stage === "check" && publisherUploadOnly && receipt.stages.check?.ok && tierAtLeast(receipt.stages.check.ruleTier ?? "compile", earlyTier)) { o.out(`${tag} [check] already passed (${receipt.stages.check.ruleTier ?? "compile"} tier) for this exact input (commit, tree, lockfiles, gate, toolchain)`); continue; }
|
|
1648
1693
|
if (stage === "compile" && receipt.stages.compile?.ok) {
|
|
@@ -1673,16 +1718,25 @@ async function runStages(o, args, root, git, io) {
|
|
|
1673
1718
|
}
|
|
1674
1719
|
// The start of every stage: the snapshot is exactly tree + dependencies + the ledger of the stages before it (7.08, decision 2 Q1).
|
|
1675
1720
|
if (ds && !(await openSnapshotStage({ o, ds, root, stage, tag }))) { receipt.stages[stage] = { ok: false, at: new Date().toISOString(), snapshot: { path: ds.path, tree: ds.tree, intactAfter: false }, ownership: ds.own.handle }; save(); o.err(`${tag} --to ${to} stopped before ${stage}: the snapshot is not the commit's bytes plus the ledger; nothing ran`); return 2; }
|
|
1676
|
-
let ok = false; const at = new Date().toISOString(); let extra = {}; let directReceipt = null;
|
|
1721
|
+
let ok = false; const at = new Date().toISOString(); const stageStartedMs = Date.now(); let extra = {}; let directReceipt = null;
|
|
1677
1722
|
if (stage === "check") {
|
|
1723
|
+
{ const problem = await pinFloor(false); if (problem) { o.err(`${tag} BLOCKED: ${problem.message}; no class A row ran and nothing compiled`); return 1; } }
|
|
1678
1724
|
ok = (await (o.runCheck ?? (() => main(["check", "--commit", ds ? commit : "HEAD", "--full-a", ...(ds ? ["--snapshot", ds.path] : []), ...appScope, "--rule-tier", earlyTier], { ...io, cwd: root, ...(ds ? { buildOwnership: ds.own } : {}) })))(earlyTier)) === 0;
|
|
1679
1725
|
extra = { ruleTier: earlyTier };
|
|
1680
1726
|
}
|
|
1681
1727
|
else if (stage === "compile") {
|
|
1728
|
+
{ const problem = await pinFloor(true); if (problem) { o.err(`${tag} BLOCKED: ${problem.message}; nothing compiled`); return 1; } }
|
|
1682
1729
|
// A Tauri crate with externalBin needs its sidecars in src-tauri/binaries before it compiles (its build script refuses
|
|
1683
1730
|
// otherwise), so every release config that declares `sidecars` is staged first, through right-release under this door run.
|
|
1684
1731
|
const sidecarConfigs = sidecarConfigsOf();
|
|
1685
1732
|
ok = true;
|
|
1733
|
+
// rightkit#1462 (ADR-001 section 7): a run that goes on to package runs the release admission, read-only, before anything compiles: the same rows `right-release build`
|
|
1734
|
+
// runs at its start (files: config and inputs; host: tools, credentials, signing hosts; network: pin freshness against the registries), asked through its own
|
|
1735
|
+
// `--dry-run`, which prints the rows and exits non-zero on a finding before any lock, cache, install or child build exists. A refusal then costs seconds, not a class B.
|
|
1736
|
+
if (stages.includes("package") && !mobile && PLATFORMS.includes(platform)) {
|
|
1737
|
+
o.out(`${tag} [compile] release admission dry-run for ${platform} before any compile (right-release build --platform ${platform} --dry-run)`);
|
|
1738
|
+
if (!await rightRelease(stage, ["build", "--platform", platform, "--dry-run"])) { o.err(`${tag} BLOCKED: [compile] the release admission (pin freshness, host tools, credentials, signing hosts) refused ${platform}; nothing compiled`); ok = false; }
|
|
1739
|
+
}
|
|
1686
1740
|
// On the snapshot route the sidecars are staged from the snapshot's own config and sources through right-release's source split
|
|
1687
1741
|
// (the staged files and receipt land beside the sources the compile reads; the caches and build trees stay the checkout's), before
|
|
1688
1742
|
// `main --all` compiles. A broker host's stage-sidecar child reaches Cargo through the stage's carrier (carried-cargo.mjs).
|
|
@@ -1839,9 +1893,12 @@ async function runStages(o, args, root, git, io) {
|
|
|
1839
1893
|
}
|
|
1840
1894
|
receipt.stages[stage] = { ok, at, ...extra };
|
|
1841
1895
|
save();
|
|
1842
|
-
|
|
1896
|
+
// rightkit#1463: each stage's own wall-clock time, and the run's phases in one line at the end.
|
|
1897
|
+
phaseTimings.push(`${stage} ${seconds(Date.now() - stageStartedMs)}${ok ? "" : " (failed)"}`);
|
|
1898
|
+
o.out(`${tag} [${stage}] ${ok ? "passed" : "failed"} in ${seconds(Date.now() - stageStartedMs)}`);
|
|
1899
|
+
if (!ok) { o.err(`${tag} --to ${to} stopped at ${stage}: nothing after it ran; phase timings: ${phaseTimings.join(", ")}`); return 1; }
|
|
1843
1900
|
}
|
|
1844
|
-
o.out(`${tag} --to ${to} passed: ${stages.join(", ")}`);
|
|
1901
|
+
o.out(`${tag} --to ${to} passed: ${stages.join(", ")}; phase timings: ${phaseTimings.join(", ") || "none ran"}`);
|
|
1845
1902
|
return 0;
|
|
1846
1903
|
}
|
|
1847
1904
|
|
|
@@ -2555,9 +2612,11 @@ export function snapshotRouteRefusal(o) {
|
|
|
2555
2612
|
/** The refusal codes a route probe can answer with: the codes the stages themselves print (`BLOCKED: <code>: ...`). */
|
|
2556
2613
|
export const ROUTE_REFUSAL_CODES = Object.freeze(["RK_TAURI_CONFIG_OVERRIDE", "RK_STAGE_HOST_MISMATCH", "RK_SNAPSHOT_BROKER_UNAVAILABLE", "RK_SNAPSHOT_CARRIER_NOT_WIRED", "RK_BROKER_CAPABILITY_MISSING", "RK_BROKER_UNAVAILABLE",
|
|
2557
2614
|
// One signing identity per product (rightkit#1303): the Mac and the Dell refuse an unsigned, ad hoc or re-identified test or dev build.
|
|
2558
|
-
...SIGNING_REFUSAL_CODES
|
|
2615
|
+
...SIGNING_REFUSAL_CODES,
|
|
2616
|
+
// The Mac's shared native helper list (targets.mac.macPackage.nativeHelpers) must validate before a Mac test, dev or package stage runs (rightkit#1308).
|
|
2617
|
+
"NATIVE_HELPERS_INVALID"]);
|
|
2559
2618
|
/** The stages `--route` can answer for (`release` writes to the publisher and has no route of its own on a host). */
|
|
2560
|
-
export const ROUTE_PROBE_STAGES = Object.freeze(["check", "compile", "package", "qualify", "dev", "test"]);
|
|
2619
|
+
export const ROUTE_PROBE_STAGES = Object.freeze(["check", "compile", "package", "qualify", "dev", "test", "render"]);
|
|
2561
2620
|
export const ROUTE_SCHEMA = "rightkit-gate.route/1";
|
|
2562
2621
|
|
|
2563
2622
|
/**
|
|
@@ -2675,14 +2734,30 @@ export function routePlan(o, { to, stages, devTest, executor, capabilities = nul
|
|
|
2675
2734
|
}
|
|
2676
2735
|
// One signing identity per product, every build (rightkit#1303): on the Mac and the Dell a test or dev build that would run unsigned, ad hoc or under
|
|
2677
2736
|
// another identifier is refused here, from the commit's own config, so `--route` and a real run decide alike. Linux and hosted CI are exempt.
|
|
2678
|
-
if (snapshot && appConfig?.config && (
|
|
2737
|
+
if (snapshot && appConfig?.config && (to === "test" || to === "dev")) {
|
|
2679
2738
|
const [first] = suiteSigningRefusals({ config: appConfig.config, platform: o.platform, env: o.env, to, devPlatform: appConfig.devPlatform ?? null, readFile: appConfig.readFile, listFiles: appConfig.listFiles ?? null });
|
|
2680
2739
|
if (first) return { route, refusal: refuse(first.code, to, first.message) };
|
|
2681
2740
|
}
|
|
2741
|
+
// rightkit#1308: the shared native helper list is validated at run time by the Mac qa-sign step (suite-signing -> development-signing), the dev install
|
|
2742
|
+
// (development.mjs) and the Mac package recipe (package-recipe-targets.mjs), where a retired `sharedPackage` refuses NATIVE_HELPERS_INVALID mid-run. The
|
|
2743
|
+
// route says so before anything runs, on a Mac, for a test or dev run (whose platform is mac) and a mac package.
|
|
2744
|
+
if (snapshot && appConfig?.config && o.platform === "darwin") {
|
|
2745
|
+
const macRun = (to === "test" || to === "dev") ? (appConfig.devPlatform ?? "mac") === "mac" : stages.includes("package") && stagePlatform === "mac";
|
|
2746
|
+
if (macRun) {
|
|
2747
|
+
const problem = nativeHelpersRefusalText(appConfig.config);
|
|
2748
|
+
if (problem) return { route, refusal: refuse("NATIVE_HELPERS_INVALID", to, problem) };
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2682
2751
|
if (executor?.kind === "refuse") return { route, refusal: refuse("RK_BROKER_UNAVAILABLE", to, executor.problem) };
|
|
2683
2752
|
return { route, refusal: null };
|
|
2684
2753
|
}
|
|
2685
2754
|
|
|
2755
|
+
/** The message validateNativeHelpers refuses `config.targets.mac.macPackage.nativeHelpers` with (NATIVE_HELPERS_INVALID), or null when the list is absent or valid. */
|
|
2756
|
+
export function nativeHelpersRefusalText(config) {
|
|
2757
|
+
try { nativeHelpersFromConfig(config); return null; }
|
|
2758
|
+
catch (error) { if (error?.code === "NATIVE_HELPERS_INVALID") return String(error.message); throw error; }
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2686
2761
|
/**
|
|
2687
2762
|
* The app config of the selected commit for the route's signing refusals, read from the object database (never the checkout): `{ config, readFile }`,
|
|
2688
2763
|
* `readFile(rel)` being an app-relative file of the commit (text or null). Null when the commit has no readable JSON config (class A judges that).
|
|
@@ -2975,6 +3050,35 @@ export function cargoOutputPin({ o, git, root, commit, executor, snapshot, manif
|
|
|
2975
3050
|
return { dir: workspaces.size ? [...workspaces.values()][0] : null, workspaces, dirs: [...workspaces.values()] };
|
|
2976
3051
|
}
|
|
2977
3052
|
|
|
3053
|
+
/**
|
|
3054
|
+
* `--to render`'s stage (rightkit#1288): the app's declared `renderViews` target (the commit's ci/gate.config.json, read from the verified snapshot) is built
|
|
3055
|
+
* through the stage's carrier and run headless outside the broker, one case at a time; the images and a hashed receipt are stored under the host's run-output
|
|
3056
|
+
* root (`rightkit-gate-render/<repo>-<commit>-<time>/`). Returns 0 or 1; every refusal is named and nothing is partially passed.
|
|
3057
|
+
*/
|
|
3058
|
+
export async function runRenderStage({ o, ds, root, appDir, commit, tree, env, pinnedTarget = null, targetDirs = {}, tag = "rightkit-gate:" }) {
|
|
3059
|
+
let gateConfig = null;
|
|
3060
|
+
try { gateConfig = JSON.parse(o.readFile(path.join(ds.path, GATE_CONFIG))); } catch { gateConfig = null; }
|
|
3061
|
+
const declared = renderViewsOf(gateConfig, appDir);
|
|
3062
|
+
if (declared.problems) { for (const p of declared.problems) o.err(`${tag} BLOCKED: [render] ${p}`); o.err(`${tag} nothing compiled`); return 1; }
|
|
3063
|
+
if (declared.none) { o.err(`${tag} BLOCKED: [render] ${appDir === "." ? "the repository" : appDir} declares no renderViews target in ${GATE_CONFIG}; nothing compiled`); return 1; }
|
|
3064
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
3065
|
+
let outDir;
|
|
3066
|
+
try { outDir = path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-gate-render", `${path.basename(root)}-${commit.slice(0, 12)}-${stamp}-${process.pid}`); }
|
|
3067
|
+
catch (error) { o.err(`${tag} BLOCKED: [render] no run-output root to store the images in (${error.message}); nothing compiled`); return 1; }
|
|
3068
|
+
o.out(`${tag} [render] ${declared.package}:${declared.bin}, ${declared.cases.length} case(s): ${declared.cases.join(", ")}; evidence in ${outDir}`);
|
|
3069
|
+
const result = renderViews({
|
|
3070
|
+
target: declared, snapshotRoot: ds.path, commit, tree, outDir, env, platform: o.platform, arch: process.arch,
|
|
3071
|
+
targetDir: targetDirs[declared.cargoDir] ?? pinnedTarget,
|
|
3072
|
+
runCargo: (cargoArgs, options) => runCargoSync(cargoArgs, { ...options, encoding: "utf8", maxBuffer: 512 * 1024 * 1024 }),
|
|
3073
|
+
runExecutable: (exe, exeArgs, options) => o.spawn(exe, exeArgs, { cwd: options.cwd, env: options.env, boundedMs: options.timeoutMs }),
|
|
3074
|
+
log: (m) => o.out(`${tag} [render] ${m}`),
|
|
3075
|
+
});
|
|
3076
|
+
if (!result.ok) { for (const p of result.problems) o.err(`${tag} BLOCKED: [render] ${p}`); return 1; }
|
|
3077
|
+
for (const c of result.receipt.cases) o.out(`${tag} [render] ${c.name}: ${c.png} ${c.width}x${c.height} sha256 ${c.sha256}`);
|
|
3078
|
+
o.out(`${tag} [render] receipt ${result.receiptFile} (${result.receipt.cases.length} image(s); executable sha256 ${result.receipt.executable.sha256})`);
|
|
3079
|
+
return 0;
|
|
3080
|
+
}
|
|
3081
|
+
|
|
2978
3082
|
/**
|
|
2979
3083
|
* rightkit-gate --to dev|test [--commit <rev>] [-- <right-release dev|test arguments>]: the local compiles, on a commit like every other
|
|
2980
3084
|
* stage (docs/GATE-CONTRACT.md "Commit-only build": `--to dev` and `--to test` build a commit; `--worktree` never admits a build). The
|
|
@@ -3053,7 +3157,15 @@ async function runDevTest(o, args, root, git, io, to, appRoot, appDir) {
|
|
|
3053
3157
|
// The door's own RightKit runs every sub-step: a dev target's `right-release web-build|stage-sidecar` steps resolve `right-release`
|
|
3054
3158
|
// on PATH, which found the app's node_modules copy (HeardRight on the Dell, 2026-10-27: the app's 0.6.8 guard refused what the
|
|
3055
3159
|
// door's 0.6.9 admitted). An installed gate (node_modules/@rightkit/release/bin) has its package's bin shims two levels up.
|
|
3056
|
-
const
|
|
3160
|
+
const childEnv = carriedEnv(carrier, { ...o.env, ...run.env }, { ...doorPath({ ...o, env: { ...o.env, ...carrier.env } }), ...(pin.dir ? { CARGO_TARGET_DIR: pin.dir } : (pinMulti?.env ?? {})) });
|
|
3161
|
+
// rightkit#1288: `--to render` builds the app's declared view-render target through the carrier and runs it headless; no right-release child is involved.
|
|
3162
|
+
if (to === "render") {
|
|
3163
|
+
const rendered = ds ? await runRenderStage({ o, ds, root, appDir, commit, tree, env: childEnv, pinnedTarget: pin.dir ?? null, targetDirs: pinMulti?.targetDirs ?? {}, tag }) : (o.err(`${tag} BLOCKED: --to render runs on the snapshot route only; nothing compiled`), 1);
|
|
3164
|
+
const carriedRendered = await carrier.finish({ stage: to });
|
|
3165
|
+
if (ds && !(await closeSnapshotStage({ o, ds, root, stage: to, step: to, tag })).ok) { o.err(`${tag} --to ${to} stopped: the result covers no known bytes`); return 2; }
|
|
3166
|
+
return rendered === 0 && carriedRendered ? 0 : 1;
|
|
3167
|
+
}
|
|
3168
|
+
const r = (o.spawnInherit ?? ((cmd, a, opts) => spawnInherit(cmd, a, { ...opts, stdio: "inherit" })))(process.execPath, [cli, to, ...passthrough], { cwd: source ? snapshotAppRootOf(ds.path, appDir) : appRoot, env: childEnv });
|
|
3057
3169
|
const carriedOk = await carrier.finish({ stage: to });
|
|
3058
3170
|
if (ds && !(await closeSnapshotStage({ o, ds, root, stage: to, step: to, tag })).ok) { o.err(`${tag} --to ${to} stopped: the result covers no known bytes`); return 2; }
|
|
3059
3171
|
return r.status === 0 && carriedOk ? 0 : 1;
|
|
@@ -3103,7 +3215,7 @@ export function stageArgsProblem(args) {
|
|
|
3103
3215
|
if (STAGE_BOOLEAN_FLAGS.includes(a)) continue;
|
|
3104
3216
|
if (STAGE_VALUE_FLAGS.includes(a)) {
|
|
3105
3217
|
const value = gate[i + 1];
|
|
3106
|
-
if (value === undefined || value.startsWith("--")) return a === "--to" ? `--to needs a stage (${[...STAGES, "dev", "test"].join("|")})` : `${a} needs a value`;
|
|
3218
|
+
if (value === undefined || value.startsWith("--")) return a === "--to" ? `--to needs a stage (${[...STAGES, "dev", "test", "render"].join("|")})` : `${a} needs a value`;
|
|
3107
3219
|
if (seen.has(a)) return `${a} was given twice`;
|
|
3108
3220
|
seen.add(a); i += 1; continue;
|
|
3109
3221
|
}
|
|
@@ -3121,6 +3233,15 @@ export async function main(argv, io = {}) {
|
|
|
3121
3233
|
gateFile: fileURLToPath(import.meta.url), ...io,
|
|
3122
3234
|
};
|
|
3123
3235
|
const args = [...argv];
|
|
3236
|
+
// rightkit#1463: a run that does work (a door stage, or a class A / full pass) stamps every log line with its UTC time, so phase times no longer have to be
|
|
3237
|
+
// rebuilt from broker receipts. Machine-readable output is never stamped: the --route JSON, a list or baseline, --json, the version, and the one
|
|
3238
|
+
// `verdict deterministic` marker line other tools read.
|
|
3239
|
+
const stampsLines = (args.includes("--to") || args.includes("--full-a") || args.includes("--all"))
|
|
3240
|
+
&& !args.some((a) => ["--route", "--list", "--print-baseline", "--json", "--plan", "--version", "-v", "--help", "-h"].includes(a));
|
|
3241
|
+
if (stampsLines) {
|
|
3242
|
+
const stamped = (write) => (m) => write(/^rightkit-gate: verdict deterministic/.test(String(m)) ? m : `${new Date().toISOString()} ${m}`);
|
|
3243
|
+
o.out = stamped(o.out); o.err = stamped(o.err);
|
|
3244
|
+
}
|
|
3124
3245
|
// The cache bypass is retired (GC-T14; workspace rule: never write or run a no-cache option). Refused by name so an old caller learns why.
|
|
3125
3246
|
if (args.includes("--no-cache") || (io.env ?? process.env).RK_GATE_CACHE === "0") {
|
|
3126
3247
|
(io.err ?? console.error)("rightkit-gate: --no-cache and RK_GATE_CACHE=0 are retired: results are reused only under a key naming every input they read, so a changed input always reruns (GC-T14)");
|
|
@@ -3926,8 +4047,8 @@ export async function main(argv, io = {}) {
|
|
|
3926
4047
|
e2eCrateDirs, swiftPackages,
|
|
3927
4048
|
rustUnits: rust.units, npmUnits: npm, npmRoots, cargoDir: ".", rustLocks, crateFeatures, crateDependents, externalInputs,
|
|
3928
4049
|
// B1 (rightkit#1458): compile scans of one Cargo workspace run as one cargo invocation per configuration; ci/shards.json `solo` crates never join one.
|
|
3929
|
-
// Batching is
|
|
3930
|
-
classBBatching: o.env.RK_GATE_CLASS_B_BATCH
|
|
4050
|
+
// Batching is on (RK_GATE_CLASS_B_BATCH=0 turns it off): the batch-equivalence run (GATE-CONTRACT GC-I11; Pulse 3b31b4ca, 2026-11-03) gave the same verdict on all 193 scans batched and per crate.
|
|
4051
|
+
classBBatching: o.env.RK_GATE_CLASS_B_BATCH !== "0", shardSolo: shardSoloOf(o, repo),
|
|
3931
4052
|
// The broker (or, on a direct host, the gate itself) admits compiles; no separate grant file decides it here.
|
|
3932
4053
|
localCompile: true,
|
|
3933
4054
|
exists: o.exists, readFile: o.readFile, platform: o.platform,
|
|
@@ -3996,6 +4117,8 @@ export async function main(argv, io = {}) {
|
|
|
3996
4117
|
}
|
|
3997
4118
|
// The result cache keys on the gated commit's object ids; the stdin check above made HEAD the pushed commit.
|
|
3998
4119
|
let cache = null;
|
|
4120
|
+
// rightkit#1463: the input key each scan was looked up under, for the coverage report (gate-coverage.mjs).
|
|
4121
|
+
const scanKeys = new Map();
|
|
3999
4122
|
// Full class A on the working tree (the door, and broker admission of the live checkout) caches on the LIVE bytes: every
|
|
4000
4123
|
// tracked and untracked (not ignored) file is hashed raw, so the door's run and a repeat admission of the same bytes hit the
|
|
4001
4124
|
// cache, and any edit misses it.
|
|
@@ -4047,6 +4170,16 @@ export async function main(argv, io = {}) {
|
|
|
4047
4170
|
const installed = sc.installSnapshotDependencies({ checkout, snapshot: snapshotA, ...ct, roots: installRoots, ...(closure ? { packageDirs: npm.filter((u) => closure.npm.has(u.name)).map((u) => u.dir) } : {}), env: o.env, spawn: o.spawn });
|
|
4048
4171
|
for (const r of installed) o.out(`${tag} ${sc.describeInstall(r)}`);
|
|
4049
4172
|
} catch (error) { o.err(`${tag} ${error.code === "RK_CHECK_ERROR" ? "RK_CHECK_ERROR" : "BLOCKED"}: ${error.message}`); return error.code === "RK_CHECK_ERROR" ? 2 : 1; }
|
|
4173
|
+
} else if (classAOnly && snapshotA && !planOnly && npmRoots.length) {
|
|
4174
|
+
// A content check (no --full-a) installs nothing, so a package the offline store lacks in one of the commit's pnpm roots showed only at the
|
|
4175
|
+
// compile stage's install (ViewRight workers/waitlist, workerd, rightkit#1488). Every root's lockfile is proved against the store here, with no
|
|
4176
|
+
// install: `pnpm fetch --offline` into a scratch virtual store, the snapshot verified unchanged after.
|
|
4177
|
+
const sc = await import("../snapshot-check.mjs");
|
|
4178
|
+
try {
|
|
4179
|
+
const checkout = fs.realpathSync.native(root);
|
|
4180
|
+
const ct = sc.commitOf(checkout, String(snapshot), o.spawn);
|
|
4181
|
+
for (const r of sc.verifySnapshotStore({ checkout, snapshot: snapshotA, ...ct, roots: npmRoots, tmpRoot: gateTmpRoot({ env: o.env, platform: o.platform, exists: o.exists }), env: o.env, spawn: o.spawn })) o.out(`${tag} ${sc.describeStoreCheck(r)}`);
|
|
4182
|
+
} catch (error) { o.err(`${tag} ${error.code === "RK_CHECK_ERROR" ? "RK_CHECK_ERROR" : "BLOCKED"}: ${error.message}`); return error.code === "RK_CHECK_ERROR" ? 2 : 1; }
|
|
4050
4183
|
}
|
|
4051
4184
|
const liveSnapshot = live?.digest ?? null;
|
|
4052
4185
|
// The environment, installed dependencies included, is bound at the start and compared at the end, so a dependency that
|
|
@@ -4057,7 +4190,10 @@ export async function main(argv, io = {}) {
|
|
|
4057
4190
|
if (boundFullA) {
|
|
4058
4191
|
const orphans = orphanedPnpmStores({ root: liveBase, files: live.files });
|
|
4059
4192
|
if (orphans.length) { o.err(`${tag} BLOCKED: orphaned nested pnpm store(s) ${orphans.join(", ")}: left by a standalone install in a workspace member; they can hold stale dependencies and make concurrent vitest runs clear their shared module cache under each other. Move them aside (or reinstall) and run again.`); return 1; }
|
|
4060
|
-
|
|
4193
|
+
// ci/gate.config.json `fixtures`: their package.json pins are evidence content, skipped here as every other scan skips them (rightkit#1468).
|
|
4194
|
+
let pinFixtures = [];
|
|
4195
|
+
try { const f = JSON.parse(o.readFile(path.join(liveBase, GATE_CONFIG))).fixtures; if (Array.isArray(f)) pinFixtures = f.filter((d) => typeof d === "string"); } catch { /* no config: no fixtures */ }
|
|
4196
|
+
const pinProblem = pnpmPinProblem({ root: liveBase, files: live.files, spawn: o.spawn, readFile: o.readFile, fixtures: pinFixtures, platform: o.platform });
|
|
4061
4197
|
if (pinProblem) { o.err(`${tag} BLOCKED: ${pinProblem.message}; no class A row ran`); return 1; }
|
|
4062
4198
|
try { envAtStart = classAEnvironmentDigest({ root: liveBase, gatePackage: o.gatePackage, files: live.files, spawn: o.spawn, includeCaches: false }); envStartWithCaches = classAEnvironmentDigest({ root: liveBase, gatePackage: o.gatePackage, files: live.files, spawn: o.spawn }); cachesAtStart = toolCacheManifest({ root: liveBase, files: live.files }); }
|
|
4063
4199
|
catch (error) { o.err(`${tag} BLOCKED: ${error.message}`); return 1; }
|
|
@@ -4085,7 +4221,7 @@ export async function main(argv, io = {}) {
|
|
|
4085
4221
|
// A row field that shapes what the scan checks without changing its id or command is part of its key: a tsc row's tscWorkspace
|
|
4086
4222
|
// (the sibling packages its check project maps; scopeScans narrows it per scope) changes the verdict on the same tree.
|
|
4087
4223
|
const rowShape = (scan) => (scan.tscWorkspace ? `:tscws=${createHash("sha256").update(canonicalJson([...scan.tscWorkspace].sort())).digest("hex")}` : "");
|
|
4088
|
-
cache = { ...store, digest: (scan) => { if (/^build-helpers(:|$)/.test(scan.id)) return null; const key = digest(scan);
|
|
4224
|
+
cache = { ...store, digest: (scan) => { if (/^build-helpers(:|$)/.test(scan.id)) return null; const key = digest(scan); const full = key === null ? null : `${key}:${environment}${rowShape(scan)}`; scanKeys.set(scan.id, full); return full; } };
|
|
4089
4225
|
} catch { cache = null; }
|
|
4090
4226
|
}
|
|
4091
4227
|
if (!classAOnly) {
|
|
@@ -4114,7 +4250,7 @@ export async function main(argv, io = {}) {
|
|
|
4114
4250
|
// The gate's identity is part of every class B key: a changed check or key logic never reuses an older verdict.
|
|
4115
4251
|
const rowDigest = buildCacheDigest({ objectId, headTree: treeId, rustUnits: rust.units, npmUnits: npm, cargoDir: ".", rustLocks, crateFeatures, listFiles, readBlob });
|
|
4116
4252
|
const gateIdentity = gateCodeIdentity();
|
|
4117
|
-
cache = { ...store, digest: (scan) => { const key = rowDigest(scan);
|
|
4253
|
+
cache = { ...store, digest: (scan) => { const key = rowDigest(scan); const full = key === null ? null : `${key}:${gateIdentity}`; scanKeys.set(scan.id, full); return full; } };
|
|
4118
4254
|
}
|
|
4119
4255
|
} catch { cache = null; }
|
|
4120
4256
|
}
|
|
@@ -4140,7 +4276,9 @@ export async function main(argv, io = {}) {
|
|
|
4140
4276
|
directTiming.cargoStart = Date.now();
|
|
4141
4277
|
census?.start();
|
|
4142
4278
|
const scanResult = await (o.runScans ?? runScans)(plan, {
|
|
4143
|
-
|
|
4279
|
+
// The commit's own files (rightkit#1393): a snapshot is not a git toplevel, so the secret scan needs this list to judge tracked files only and never what a stage wrote there.
|
|
4280
|
+
...(snapshot ? { trackedFiles: files } : {}),
|
|
4281
|
+
classes: classAOnly ? ["A"] : classAEarlier ? ["B"] : ["A", "B"], ...(classAEarlier ? { classAEarlier: true } : {}), jobs, testJobs, classBJobs, classBBatching: o.env.RK_GATE_CLASS_B_BATCH !== "0", classBPipeline: Math.max(1, Number(o.env.RK_GATE_CLASS_B_PIPELINE ?? 2) || 2), ...(brokerHost ? { brokerHost: true } : {}), ...(brokerLive ? { brokerLive } : {}), signal: ac.signal, ...(cache ? { cache } : {}),
|
|
4144
4282
|
...(census ? { spawn: census.wrapSpawn(defaultSpawnAsync) } : {}),
|
|
4145
4283
|
// The declared Linux broker route: the scans are planned with the logical `rustright`, which this spawn (and scanSpawn's pass-through below) starts as the
|
|
4146
4284
|
// executor's validated client, never a PATH lookup (withDeclaredClient).
|
|
@@ -4178,7 +4316,7 @@ export async function main(argv, io = {}) {
|
|
|
4178
4316
|
return path.join(base, "rightkit-gate-scan-logs", `${path.basename(root)}-${stamp}-${process.pid}`);
|
|
4179
4317
|
} catch { return null; }
|
|
4180
4318
|
})(),
|
|
4181
|
-
onResult: (row, p) => o.out(`${tag} [${p.done}/${p.total}] ${(row.cached ? "cached" : row.status).padEnd(7)} ${row.id} (${p.seconds}s)${row.batchedWith ? ` [batch of ${row.batchedWith.units.length}]` : ""}${row.status === "fail" ? ` :: ${String(row.detail ?? "").slice(0, 300)}` : ""}`),
|
|
4319
|
+
onResult: (row, p) => o.out(`${tag} [${p.done}/${p.total}] ${(row.cached ? "cached" : row.status).padEnd(7)} ${row.id} (${p.seconds}s)${row.batchedWith ? ` [batch of ${row.batchedWith.units.length}]` : ""}${row.status === "fail" ? ` :: ${String(row.detail ?? "").slice(0, 300)}` : row.advice ? ` :: ${String(row.advice).slice(0, 300)}` : ""}`),
|
|
4182
4320
|
});
|
|
4183
4321
|
directTiming.cargoEnd = Date.now();
|
|
4184
4322
|
const freshness = census ? census.finish() : null;
|
|
@@ -4194,6 +4332,13 @@ export async function main(argv, io = {}) {
|
|
|
4194
4332
|
const deferrals = scanDeferrals(scanResult);
|
|
4195
4333
|
for (const line of deferrals) failures.push(`DEFERRED ${line}`);
|
|
4196
4334
|
for (const note of scanResult.notes) o.out(`${tag} ${note}`);
|
|
4335
|
+
// rightkit#1463: the per-scan coverage report (hit / ran / skipped, with the cache key and the reason), written beside the scan logs; a cache that never hits shows here.
|
|
4336
|
+
try {
|
|
4337
|
+
const report = buildCoverageReport({ plan, scanResult, keys: scanKeys, classes: classAOnly ? ["A"] : classAEarlier ? ["B"] : ["A", "B"], commit: snapshotBCommit?.commit ?? snapshotCommitId?.commit ?? hostedCommitA?.commit ?? null, startedAt: new Date(directTiming.cargoStart).toISOString(), endedAt: new Date(directTiming.cargoEnd).toISOString() });
|
|
4338
|
+
const base = gateRunsRoot({ env: o.env, platform: o.platform });
|
|
4339
|
+
const file = (o.writeCoverage ?? writeCoverageReport)({ dir: path.join(base, "rightkit-gate-coverage"), name: `${path.basename(root)}-${new Date().toISOString().replace(/[:.]/g, "-")}-${process.pid}`, report });
|
|
4340
|
+
o.out(`${tag} coverage report ${file}: ${report.totals.planned} planned scan(s), ${report.totals.hit} hit, ${report.totals.ran} ran, ${report.totals.skipped} skipped; scans took ${seconds(directTiming.cargoEnd - directTiming.cargoStart)}`);
|
|
4341
|
+
} catch (error) { o.out(`${tag} note: the coverage report could not be written (${error.message})`); }
|
|
4197
4342
|
// What a full class A verdict binds, green or red: the bytes it judged, unchanged from start to end, and the environment it judged
|
|
4198
4343
|
// in (gate, tools, installed dependencies, tool caches), unchanged too. A verdict whose binding moved covers nothing: a green one is
|
|
4199
4344
|
// refused and a red one names no reusable deterministic cause (rightkit#1257). Returns { env, notes } or { prefix, problem, exit }.
|
package/cargo-contract.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { existsSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
import { tmpdir } from "node:os";
|
|
3
4
|
import path from "node:path";
|
|
4
|
-
import { spawnSync } from "./background-process.mjs";
|
|
5
5
|
import { directPlatform, gateNoBroker, linuxBrokerDeclared, managedRuntimeClient, runCargoSync } from "./managed-cargo.mjs";
|
|
6
6
|
|
|
7
7
|
const SKIP_DIRECTORIES = new Set([".audit", ".cache", ".git", ".claude", ".right-release", ".worktrees", "node_modules", "target", "vendor"]);
|
|
@@ -157,36 +157,22 @@ function assertNoRightKitOverrides(parsed, label, source) {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
let
|
|
164
|
-
function resolveTomlRunner() {
|
|
165
|
-
if (tomlRunner) return tomlRunner;
|
|
166
|
-
const probe = "import sys,tomllib";
|
|
167
|
-
const candidates =
|
|
168
|
-
process.platform === "win32"
|
|
169
|
-
? [["py", ["-3.11"]], ["py", ["-3"]], ["python", []]]
|
|
170
|
-
: [["python3.13", []], ["python3.12", []], ["python3.11", []], ["python3", []]];
|
|
171
|
-
for (const [command, prefix] of candidates) {
|
|
172
|
-
const check = spawnSync(command, [...prefix, "-c", probe], { encoding: "utf8", windowsHide: true });
|
|
173
|
-
if (check.status === 0) {
|
|
174
|
-
tomlRunner = { command, prefix };
|
|
175
|
-
return tomlRunner;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
throw new Error(
|
|
179
|
-
"no Python with tomllib found (needs 3.11+). Install one, or put it on PATH: the release " +
|
|
180
|
-
"contract reads Cargo manifests through it.",
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
|
|
160
|
+
// Manifests and .cargo/config files are parsed in-process with smol-toml (a dependency of this package), so the same table
|
|
161
|
+
// results on win32, darwin and linux and no host Python is read or spawned (#919). smol-toml loads on first parse, like
|
|
162
|
+
// rightkit-registry-resolver, so a CI job whose closure only imports this module needs no install.
|
|
163
|
+
let smolTomlParse;
|
|
184
164
|
function readToml(file, label) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
165
|
+
let text;
|
|
166
|
+
try {
|
|
167
|
+
text = readFileSync(file, "utf8");
|
|
168
|
+
} catch (error) {
|
|
169
|
+
throw new Error(`${label} could not be read: ${error.message}`);
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
return (smolTomlParse ??= createRequire(import.meta.url)("smol-toml").parse)(text);
|
|
173
|
+
} catch (error) {
|
|
174
|
+
throw new Error(`${label} is not valid TOML: ${error.message}`);
|
|
175
|
+
}
|
|
190
176
|
}
|
|
191
177
|
|
|
192
178
|
// Not product code: SwiftPM `.build` (dependency checkouts and build products), throwaway probe dirs (`*-probe`, `pdfprobe2`), `tmp`, and
|