@rightkit/release 0.6.40 → 0.6.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -11
- package/admission-files.mjs +40 -0
- package/admission-host.mjs +2 -1
- package/app-check.mjs +303 -16
- package/app-closure.mjs +6 -4
- package/bin/rightkit-gate.mjs +177 -32
- package/cargo-contract.mjs +17 -31
- package/cargo-license-notices.mjs +129 -19
- package/cargo-target-shim.mjs +14 -0
- package/carried-cargo.mjs +2 -4
- package/cli/right-release.mjs +24 -2
- package/cross-targets.mjs +24 -0
- package/deterministic-scans.mjs +150 -58
- package/development-signing.mjs +25 -2
- package/development.mjs +34 -1
- package/direct-release-command.mjs +154 -0
- package/disk-policy.mjs +16 -0
- package/feature-coverage.mjs +134 -0
- package/gate-coverage.mjs +38 -0
- package/gate-stages.mjs +1 -0
- package/ghsa-audit.mjs +95 -0
- package/install-app.mjs +33 -5
- package/install-channels.mjs +301 -0
- package/interactive-session-run.mjs +105 -0
- package/legal-contract.mjs +10 -1
- package/legion-freeze-consumer.mjs +241 -0
- package/linux-publish.mjs +136 -0
- package/local-publish.mjs +31 -8
- package/nsis-pack.mjs +95 -0
- package/nsis-upgrade-template.mjs +93 -0
- package/outdated-command.mjs +19 -0
- package/ownership-class-rules.mjs +32 -10
- package/ownership-mandatory-set.json +23 -0
- package/ownership-mandatory-set.mjs +66 -8
- package/package-recipe-targets.mjs +54 -19
- package/package.json +1 -1
- package/payload-root-install.mjs +123 -0
- package/plugin-delivery.mjs +141 -0
- package/prebuild-gates.mjs +8 -4
- package/preflight.mjs +6 -1
- package/provision-model-bundle.mjs +172 -0
- package/pub-upload.mjs +1 -1
- package/publish-local-npm.mjs +34 -9
- package/publish-retention.mjs +106 -0
- package/publish-update.mjs +15 -8
- package/qa-build-features.mjs +24 -15
- package/qa-contract.mjs +5 -6
- package/qa-control-scan.mjs +14 -0
- package/qa-web-pairing.mjs +76 -0
- package/r2-s3-multipart.mjs +190 -0
- package/r2-verified-upload.mjs +28 -16
- package/recipe-build.mjs +53 -3
- package/release-checks.mjs +53 -2
- package/release-config.mjs +8 -3
- package/release-invocation.mjs +12 -2
- package/release-pin-floor.mjs +44 -0
- package/release-qa-audit.mjs +18 -2
- package/release-qa-command.mjs +17 -1
- package/release-qa-policy.mjs +30 -3
- package/release-switch-cfg.mjs +271 -0
- package/release-switch-registry.json +60 -1
- package/release-switch-scan.mjs +398 -23
- package/release.mjs +97 -6
- package/render-views.mjs +141 -0
- package/rightkit-registry-resolver.mjs +1 -1
- package/rightkit-versions.json +140 -103
- package/runtime-artifact-manifest.mjs +9 -0
- package/runtime-manifest-refresh.mjs +88 -0
- package/rustright-stage.mjs +197 -0
- package/scan-digest.mjs +15 -9
- package/scan-tool-enrolment.mjs +1 -1
- package/security-policy.mjs +196 -0
- package/shell-contract.mjs +32 -0
- package/snapshot-broker.mjs +8 -1
- package/snapshot-check.mjs +58 -0
- package/snapshot-request.mjs +25 -2
- package/stage-commands.mjs +33 -4
- package/stage-receipt.mjs +115 -0
- package/stage-sidecar.mjs +188 -17
- package/stage-xcframework.mjs +118 -0
- package/suite-api.generated.mjs +16 -1
- package/unit-gate.mjs +14 -2
- package/upload-large.mjs +4 -4
- package/upload-release.mjs +6 -0
- package/win-package-recipe.mjs +26 -4
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// `right-release stage-xcframework --crate <dir> --targets <triple>[,<triple>...] --headers <dir> --out <Name.xcframework>` (rightkit#1234).
|
|
3
|
+
//
|
|
4
|
+
// A RightKit-owned way to turn a Rust staticlib crate into an iOS xcframework (Pulse: swift/MeshLink/RightKitMeshFFI.xcframework from
|
|
5
|
+
// rightkit-mesh-ffi), usable as a `development.targets.ios.prepare` step and as an `iosPackage.prepare` step. It replaces a hand-made, git-ignored product:
|
|
6
|
+
// 1. every target is compiled through RustRight's managed Cargo seam (`rustright cargo build --locked`, the same call stage-sidecar makes: through the
|
|
7
|
+
// broker on Mac and Dell, one output directory, the release profile - GC-A15, there is no dev or debug output), and the `.a` is read from Cargo's own
|
|
8
|
+
// JSON artifact stream (never a hard-coded broker path);
|
|
9
|
+
// 2. `xcodebuild -create-xcframework` assembles one slice per target with the headers directory;
|
|
10
|
+
// 3. a receipt `<out>.receipt.json` beside the product records the crate, each target's library path and sha256, the headers digest and the xcframework's
|
|
11
|
+
// Info.plist sha256, so the product is never a stale copy nobody can date.
|
|
12
|
+
// Output `--out` is replaced whole (a stale xcframework is removed first); the crate, headers and output paths must lie inside the working directory's repository.
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
14
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
15
|
+
import path from "node:path";
|
|
16
|
+
import { pathToFileURL } from "node:url";
|
|
17
|
+
import { oneOutput } from "./cross-targets.mjs";
|
|
18
|
+
import { defaultRun } from "./stage-sidecar.mjs";
|
|
19
|
+
import { spawnSync } from "./background-process.mjs";
|
|
20
|
+
|
|
21
|
+
export class StageXcframeworkError extends Error {
|
|
22
|
+
constructor(message) { super(message); this.name = "StageXcframeworkError"; this.code = "RK_STAGE_XCFRAMEWORK"; }
|
|
23
|
+
}
|
|
24
|
+
const fail = (message) => { throw new StageXcframeworkError(message); };
|
|
25
|
+
|
|
26
|
+
export const XCFRAMEWORK_TARGETS = Object.freeze(["aarch64-apple-ios", "aarch64-apple-ios-sim", "x86_64-apple-ios"]);
|
|
27
|
+
|
|
28
|
+
export function parseStageXcframeworkArgs(argv) {
|
|
29
|
+
const opts = { crate: null, targets: [], headers: null, out: null, package: null };
|
|
30
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
31
|
+
const flag = argv[i];
|
|
32
|
+
const value = argv[i + 1];
|
|
33
|
+
if (!["--crate", "--targets", "--headers", "--out", "--package"].includes(flag)) fail(`unknown argument: ${flag}`);
|
|
34
|
+
if (value === undefined || value.startsWith("--")) fail(`${flag} needs a value`);
|
|
35
|
+
i += 1;
|
|
36
|
+
if (flag === "--targets") opts.targets = value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
37
|
+
else opts[flag.slice(2)] = value;
|
|
38
|
+
}
|
|
39
|
+
for (const key of ["crate", "headers", "out"]) if (!opts[key]) fail(`--${key} is required`);
|
|
40
|
+
if (!opts.targets.length) fail("--targets is required (for example aarch64-apple-ios,aarch64-apple-ios-sim)");
|
|
41
|
+
const bad = opts.targets.filter((target) => !XCFRAMEWORK_TARGETS.includes(target));
|
|
42
|
+
if (bad.length) fail(`unsupported target(s) ${bad.join(", ")} (allowed: ${XCFRAMEWORK_TARGETS.join(", ")})`);
|
|
43
|
+
if (new Set(opts.targets).size !== opts.targets.length) fail("--targets lists a target twice");
|
|
44
|
+
if (opts.targets.includes("aarch64-apple-ios-sim") && opts.targets.includes("x86_64-apple-ios")) fail("aarch64-apple-ios-sim and x86_64-apple-ios are both simulator slices; an xcframework holds one simulator library (lipo them first)");
|
|
45
|
+
if (!/\.xcframework$/.test(opts.out)) fail("--out must end in .xcframework");
|
|
46
|
+
return opts;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The staticlib Cargo reports in its JSON stream for the crate at `manifest` (the last matching compiler-artifact), or undefined. */
|
|
50
|
+
export function staticlibFromStream(stdout, manifest, packageName) {
|
|
51
|
+
let found;
|
|
52
|
+
for (const line of String(stdout ?? "").split("\n")) {
|
|
53
|
+
if (!line.startsWith("{")) continue;
|
|
54
|
+
let message;
|
|
55
|
+
try { message = JSON.parse(line); } catch { continue; }
|
|
56
|
+
if (message.reason !== "compiler-artifact" || !(message.target?.kind ?? []).includes("staticlib")) continue;
|
|
57
|
+
if (packageName ? message.target?.name !== packageName.replaceAll("-", "_") && message.target?.name !== packageName : path.resolve(String(message.manifest_path ?? "")) !== path.resolve(manifest)) continue;
|
|
58
|
+
const library = (message.filenames ?? []).find((file) => file.endsWith(".a"));
|
|
59
|
+
if (library) found = library;
|
|
60
|
+
}
|
|
61
|
+
return found;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const sha256File = (file) => createHash("sha256").update(readFileSync(file)).digest("hex");
|
|
65
|
+
|
|
66
|
+
function digestTree(dir, prefix = "") {
|
|
67
|
+
const hash = createHash("sha256");
|
|
68
|
+
for (const name of readdirSync(path.join(dir, prefix)).sort()) {
|
|
69
|
+
const relative = prefix ? `${prefix}/${name}` : name;
|
|
70
|
+
const full = path.join(dir, relative);
|
|
71
|
+
if (lstatSync(full).isDirectory()) hash.update(`d ${relative}\n${digestTree(dir, relative)}\n`);
|
|
72
|
+
else hash.update(`f ${relative} ${sha256File(full)}\n`);
|
|
73
|
+
}
|
|
74
|
+
return hash.digest("hex");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Build every slice and assemble the xcframework. Injectable: run (rustright), xcodebuild (spawnSync-shaped), fs pieces, log, cwd, platform. */
|
|
78
|
+
export function stageXcframework(opts, { run = defaultRun, xcodebuild = spawnSync, log = (line) => console.log(line), cwd = process.cwd(), platform = process.platform, env = process.env } = {}) {
|
|
79
|
+
if (platform !== "darwin") fail("stage-xcframework runs on macOS (xcodebuild assembles the xcframework)");
|
|
80
|
+
const crate = path.resolve(cwd, opts.crate);
|
|
81
|
+
const manifest = path.join(crate, "Cargo.toml");
|
|
82
|
+
const headers = path.resolve(cwd, opts.headers);
|
|
83
|
+
const out = path.resolve(cwd, opts.out);
|
|
84
|
+
if (!existsSync(manifest)) fail(`no Cargo.toml in the crate directory ${crate}`);
|
|
85
|
+
if (!existsSync(headers) || !lstatSync(headers).isDirectory()) fail(`headers directory not found: ${headers}`);
|
|
86
|
+
if (!readdirSync(headers).length) fail(`headers directory ${headers} is empty`);
|
|
87
|
+
const inside = (file) => { const relative = path.relative(path.resolve(cwd), file); return relative !== "" && !relative.startsWith("..") && !path.isAbsolute(relative); };
|
|
88
|
+
if (!inside(out)) fail(`--out ${out} must be inside the working directory`);
|
|
89
|
+
const libraries = [];
|
|
90
|
+
for (const target of opts.targets) {
|
|
91
|
+
const args = oneOutput(["cargo", "build", "--locked", "--manifest-path", manifest, ...(opts.package ? ["-p", opts.package] : []), "--target", target, "--lib", "--message-format=json-render-diagnostics"]);
|
|
92
|
+
log(`stage-xcframework: rustright ${args.join(" ")}`);
|
|
93
|
+
const built = run("rustright", args, { cwd: crate, env });
|
|
94
|
+
if (built?.error || built?.status !== 0) fail(`the build of ${path.basename(crate)} for ${target} failed (${built?.error?.message ?? `exit ${built?.status}`})`);
|
|
95
|
+
const library = staticlibFromStream(built.stdout, manifest, opts.package);
|
|
96
|
+
if (!library || !existsSync(library)) fail(`Cargo reported no staticlib for ${path.basename(crate)} (${target}); set crate-type = ["staticlib"] in its [lib]`);
|
|
97
|
+
libraries.push({ target, source: library, sha256: sha256File(library) });
|
|
98
|
+
}
|
|
99
|
+
rmSync(out, { recursive: true, force: true });
|
|
100
|
+
mkdirSync(path.dirname(out), { recursive: true });
|
|
101
|
+
const created = xcodebuild("xcodebuild", ["-create-xcframework", ...libraries.flatMap((item) => ["-library", item.source, "-headers", headers]), "-output", out], { encoding: "utf8", windowsHide: true, shell: false });
|
|
102
|
+
if (created?.error || created?.status !== 0) { rmSync(out, { recursive: true, force: true }); fail(`xcodebuild -create-xcframework failed (${created?.error?.message ?? `exit ${created?.status}`}): ${String(created?.stderr ?? created?.stdout ?? "").trim()}`); }
|
|
103
|
+
const plist = path.join(out, "Info.plist");
|
|
104
|
+
if (!existsSync(plist)) { rmSync(out, { recursive: true, force: true }); fail(`xcodebuild reported success but ${plist} does not exist`); }
|
|
105
|
+
const receipt = { schema: 1, crate: path.relative(cwd, crate).split(path.sep).join("/") || ".", targets: libraries.map(({ target, sha256 }) => ({ target, sha256 })), headersSha256: digestTree(headers), xcframeworkInfoPlistSha256: sha256File(plist), profile: "release" };
|
|
106
|
+
writeFileSync(`${out}.receipt.json`, `${JSON.stringify(receipt, null, 2)}\n`);
|
|
107
|
+
log(`stage-xcframework: wrote ${out} (${libraries.length} slice(s)) and ${path.basename(out)}.receipt.json`);
|
|
108
|
+
return { out, receipt };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function main(argv = process.argv.slice(2)) {
|
|
112
|
+
try { stageXcframework(parseStageXcframeworkArgs(argv)); return 0; } catch (error) {
|
|
113
|
+
console.error(`right-release stage-xcframework: ${error.message}`);
|
|
114
|
+
return error instanceof StageXcframeworkError ? 1 : 2;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) process.exitCode = main();
|
package/suite-api.generated.mjs
CHANGED
|
@@ -60,6 +60,9 @@ export const APP_ARTIFACT_HOSTS = {
|
|
|
60
60
|
"rightapps-license-gate.adrdsouza.workers.dev",
|
|
61
61
|
"pub-6c73208d46c245a9b4881d5e02f6b618.r2.dev"
|
|
62
62
|
],
|
|
63
|
+
"cutright": [
|
|
64
|
+
"pub-6c73208d46c245a9b4881d5e02f6b618.r2.dev"
|
|
65
|
+
],
|
|
63
66
|
"heardright": [
|
|
64
67
|
"rightapps-license-gate.adrdsouza.workers.dev",
|
|
65
68
|
"pub-6c73208d46c245a9b4881d5e02f6b618.r2.dev"
|
|
@@ -68,6 +71,10 @@ export const APP_ARTIFACT_HOSTS = {
|
|
|
68
71
|
"rightapps-license-gate.adrdsouza.workers.dev",
|
|
69
72
|
"pub-6c73208d46c245a9b4881d5e02f6b618.r2.dev"
|
|
70
73
|
],
|
|
74
|
+
"scraperight": [
|
|
75
|
+
"rightapps-license-gate.adrdsouza.workers.dev",
|
|
76
|
+
"pub-6c73208d46c245a9b4881d5e02f6b618.r2.dev"
|
|
77
|
+
],
|
|
71
78
|
"viewright": [
|
|
72
79
|
"pub-6c73208d46c245a9b4881d5e02f6b618.r2.dev"
|
|
73
80
|
]
|
|
@@ -81,7 +88,11 @@ export const RIGHT_SUITE_API_CONTRACT = {
|
|
|
81
88
|
],
|
|
82
89
|
"licenseHost": "coderight.cc"
|
|
83
90
|
},
|
|
84
|
-
"cutright": {
|
|
91
|
+
"cutright": {
|
|
92
|
+
"artifactHosts": [
|
|
93
|
+
"public"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
85
96
|
"genright": {
|
|
86
97
|
"licenseHost": "heardright.app"
|
|
87
98
|
},
|
|
@@ -102,6 +113,10 @@ export const RIGHT_SUITE_API_CONTRACT = {
|
|
|
102
113
|
"postright": {},
|
|
103
114
|
"pulse": {},
|
|
104
115
|
"scraperight": {
|
|
116
|
+
"artifactHosts": [
|
|
117
|
+
"gated",
|
|
118
|
+
"public"
|
|
119
|
+
],
|
|
105
120
|
"licenseHost": "scraperight.cc"
|
|
106
121
|
},
|
|
107
122
|
"viewright": {
|
package/unit-gate.mjs
CHANGED
|
@@ -13,7 +13,9 @@ import { RIGHTKIT_REPOSITORY, buildDirectOrigin, directStageEvidence, verifyDire
|
|
|
13
13
|
import { exclusionsFor } from "./pack-digest.mjs";
|
|
14
14
|
import { ATTEST_STAGE_NONCE_ENV, qualificationNonce } from "./provenance-verify.mjs";
|
|
15
15
|
import { verifyQualificationReceipts } from "./qualification-verify.mjs";
|
|
16
|
-
import { assignJobs, describeCommand, expectedStageCommands } from "./stage-commands.mjs";
|
|
16
|
+
import { assignJobs, describeCommand, directRowsNotRun, expectedStageCommands } from "./stage-commands.mjs";
|
|
17
|
+
import { carriedCargoMapOf } from "./carried-cargo.mjs";
|
|
18
|
+
import { UNSCOPED, readLedger } from "./cargo-ledger.mjs";
|
|
17
19
|
import { resolveManagedRoots } from "./managed-roots.mjs";
|
|
18
20
|
import { controlPlaneProblem } from "./control-plane.mjs";
|
|
19
21
|
|
|
@@ -400,8 +402,18 @@ export async function runUnitGate({ selector, to, root, commonDir, commit, tree,
|
|
|
400
402
|
// so a missing one fails here, before any dispatch, naming it. Jobs that are none of the stage's commands are not carried.
|
|
401
403
|
const fetched = [...new Set(ids ?? [])].map((id) => fetchReceipt(id));
|
|
402
404
|
// A carried cargo command is bound to the directory of the primary checkout it ran in (source.checkout; stage-commands.mjs requestIs).
|
|
403
|
-
const
|
|
405
|
+
const rows = stageCommands({ unit, root, platform })[stage];
|
|
406
|
+
const { assigned, missing } = assignJobs(rows, fetched.map((r) => ({ id: r.id, payload: r.provenance.payload })), { checkout: source?.checkout ?? null });
|
|
404
407
|
if (missing.length) throw new Error(`the ${stage} stage's ${describeCommand(missing[0])} has no broker job receipt (${missing.length} required command(s) missing)`);
|
|
408
|
+
// GC-A11: a command that compiles nothing runs directly and makes no receipt (rightkit#1484); the stage's carrier ledger must show it ran with exit 0.
|
|
409
|
+
if (rows.some((row) => row.direct === true)) {
|
|
410
|
+
const carried = carriedCargoMapOf(envExtra);
|
|
411
|
+
let entries = null;
|
|
412
|
+
if (carried?.map) { try { entries = readLedger(carried.map.ledgerDir, UNSCOPED).entries; } catch { entries = null; } }
|
|
413
|
+
if (entries === null) throw new Error(`the ${stage} stage runs ${rows.filter((row) => row.direct === true).length} direct (non-compiling) command(s) and its carrier ledger cannot be read to verify them`);
|
|
414
|
+
const notRun = directRowsNotRun(rows, entries);
|
|
415
|
+
if (notRun.length) throw new Error(`the ${stage} stage's direct command ${describeCommand(notRun[0].row)} ${notRun[0].why} in the carrier ledger (${notRun.length} direct command(s) unverified)`);
|
|
416
|
+
}
|
|
405
417
|
receipts[stage] = fetched.filter((r) => assigned.has(r.id));
|
|
406
418
|
};
|
|
407
419
|
const verifyArtifact = (result) => {
|
package/upload-large.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { verifySealedRelease } from "./release-state.mjs";
|
|
|
7
7
|
import { uploadVerifiedR2File } from "./r2-verified-upload.mjs";
|
|
8
8
|
import { resolveCloudflareApiToken } from "./protected-credentials.mjs";
|
|
9
9
|
|
|
10
|
-
export function runLargeUpload(argv, { run = spawnSync, env = process.env, credentialStore } = {}) {
|
|
10
|
+
export async function runLargeUpload(argv, { run = spawnSync, env = process.env, credentialStore } = {}) {
|
|
11
11
|
const [localFile, r2Key, bucketAlias = "public", flag, evidencePath, ...extra] = argv;
|
|
12
12
|
if (!localFile || !r2Key) throw new Error("Usage: upload-large <file> <key> public|private --evidence <json> | --seal <sealed-dir>");
|
|
13
13
|
if (!["public", "private"].includes(bucketAlias)) throw new Error(`invalid bucket alias ${bucketAlias}; expected public|private`);
|
|
@@ -22,7 +22,7 @@ export function runLargeUpload(argv, { run = spawnSync, env = process.env, crede
|
|
|
22
22
|
evidence = { sha256: value.artifactSha256, sizeBytes: value.sizeBytes };
|
|
23
23
|
}
|
|
24
24
|
// Validate before runner discovery or any remote operation, including dry runs.
|
|
25
|
-
uploadVerifiedR2File(localFile, evidence, r2Key, bucketAlias, { dryRun: true });
|
|
25
|
+
await uploadVerifiedR2File(localFile, evidence, r2Key, bucketAlias, { dryRun: true });
|
|
26
26
|
// The Cloudflare token is resolved only for a real upload; it is injected into the Wrangler child environment alone.
|
|
27
27
|
const dryRun = env.RIGHT_RELEASE_UPLOAD_DRY_RUN === "1";
|
|
28
28
|
const token = resolveCloudflareApiToken({ env, credentialStore, required: !dryRun });
|
|
@@ -30,11 +30,11 @@ export function runLargeUpload(argv, { run = spawnSync, env = process.env, crede
|
|
|
30
30
|
const probe = run("pnpm", ["--version"], { env, stdio: "ignore", shell: process.platform === "win32", windowsHide: true });
|
|
31
31
|
if (probe.error || probe.status !== 0) throw new Error("no package runner found: pnpm dlx");
|
|
32
32
|
const object = `${bucketAlias === "public" ? "rightapps-downloads" : "rightapps-updates"}/${r2Key}`;
|
|
33
|
-
console.log(`
|
|
33
|
+
console.log(`r2 put ${object} (wrangler below 200 MiB, S3 multipart above it; mandatory streamed sha256 and size readback)`);
|
|
34
34
|
console.log("runner: pnpm dlx");
|
|
35
35
|
return uploadVerifiedR2File(localFile, evidence, r2Key, bucketAlias, { run, env: uploadEnv, dryRun });
|
|
36
36
|
}
|
|
37
37
|
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
38
|
-
try { runLargeUpload(process.argv.slice(2)); }
|
|
38
|
+
try { await runLargeUpload(process.argv.slice(2)); }
|
|
39
39
|
catch (error) { console.error(`upload-large: ${error.message}`); process.exitCode = 1; }
|
|
40
40
|
}
|
package/upload-release.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { defaultReleaseConfigFile } from "./release-config.mjs";
|
|
|
7
7
|
import { authorizeGitHubUpload } from "./github-upload-gate.mjs";
|
|
8
8
|
import { recordPublishedVersion } from "./artifact-storage.mjs";
|
|
9
9
|
import { admitInstalledQa } from "./release-qa-audit.mjs";
|
|
10
|
+
import { retainAfterPublish } from "./publish-retention.mjs";
|
|
10
11
|
|
|
11
12
|
const args = process.argv.slice(2);
|
|
12
13
|
let platform = process.platform === "win32" ? "win" : process.platform === "darwin" ? "mac" : process.platform;
|
|
@@ -81,6 +82,11 @@ if (!dryRun) writeJson(verifiedMarker, {
|
|
|
81
82
|
// Candidate builds never enter published.json.
|
|
82
83
|
if (!dryRun) recordPublishedVersion({ app: sealed.manifest.app, version: sealed.manifest.version, platform });
|
|
83
84
|
console.log(`right-release upload: ${dryRun ? "dry-run " : ""}${result.status} ${releaseId} tier=${tier} repo=${repo}`);
|
|
85
|
+
// Only after the remote bytes were verified: bound what the sealed and state folders keep by count and age, and fail loudly above the size limit (rightkit#763).
|
|
86
|
+
if (!dryRun) {
|
|
87
|
+
try { retainAfterPublish({ root: repoRoot, keep: { releaseId }, log: (line) => console.log(line) }); }
|
|
88
|
+
catch (error) { console.error(`right-release upload: published, but ${error.message}`); process.exitCode = 1; }
|
|
89
|
+
}
|
|
84
90
|
|
|
85
91
|
function writeJson(file, value) {
|
|
86
92
|
mkdirSync(path.dirname(file), { recursive: true });
|
package/win-package-recipe.mjs
CHANGED
|
@@ -25,6 +25,7 @@ import { resolveCommand } from "./development.mjs";
|
|
|
25
25
|
import { verifyNsisEmbeddedBinary } from "./nsis-payload.mjs";
|
|
26
26
|
import { resolveArtifactPath, splitArtifactContext } from "./release-artifact-path.mjs";
|
|
27
27
|
import { signingReceiptPath } from "./signing-receipts.mjs";
|
|
28
|
+
import { defaultManagedRoots, isUnderManagedRoot } from "./managed-target-stage.mjs";
|
|
28
29
|
import { patchTauriBundleType } from "./tauri-bundle-marker.mjs";
|
|
29
30
|
|
|
30
31
|
const TOOL_ROOT = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -81,11 +82,25 @@ function relativeInside(appRoot, value, label, issues) {
|
|
|
81
82
|
return resolved;
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
/**
|
|
86
|
+
* An artifact path under a broker-managed root (the RustRight data root, .rightkit-managed, rightkit-build-control) may be absolute
|
|
87
|
+
* (rightkit#717): the raw EXE and the NSIS installer of a managed Cargo target live there, and the Authenticode-before-NSIS contract
|
|
88
|
+
* must address them where Tauri writes them. Anything absolute outside a managed root, or with a `..` segment, is still refused.
|
|
89
|
+
*/
|
|
90
|
+
function managedAbsolute(value, label, issues, managedRoots) {
|
|
91
|
+
if (typeof value !== "string" || value.trim() === "" || value !== value.trim() || value.includes("\0")) return undefined;
|
|
92
|
+
if (!(path.win32.isAbsolute(value) || path.posix.isAbsolute(value))) return undefined;
|
|
93
|
+
if (value.replaceAll("\\", "/").split("/").includes("..")) { issues.push(`${label} must not contain .., received ${JSON.stringify(value)}`); return null; }
|
|
94
|
+
if (!path.isAbsolute(value)) return undefined;
|
|
95
|
+
if (!isUnderManagedRoot(path.dirname(value), managedRoots)) return undefined;
|
|
96
|
+
return path.resolve(value);
|
|
97
|
+
}
|
|
98
|
+
|
|
84
99
|
/**
|
|
85
100
|
* Validate `target.winPackage` strictly and return the normalised plan. Throws WinPackageConfigError listing
|
|
86
101
|
* every problem. Unknown keys are refused so a typo cannot silently drop a sidecar or the updater step.
|
|
87
102
|
*/
|
|
88
|
-
export function validateWinPackage({ appRoot, config = {}, target } = {}) {
|
|
103
|
+
export function validateWinPackage({ appRoot, config = {}, target, env = process.env, managedRoots = defaultManagedRoots(env) } = {}) {
|
|
89
104
|
const issues = [];
|
|
90
105
|
if (typeof appRoot !== "string" || appRoot === "") issues.push("appRoot must be a non-empty string");
|
|
91
106
|
if (!isPlainObject(target)) throw new WinPackageConfigError([...issues, "target must be an object"]);
|
|
@@ -109,8 +124,14 @@ export function validateWinPackage({ appRoot, config = {}, target } = {}) {
|
|
|
109
124
|
const installerDeclared = spec.installerFile ?? (Array.isArray(target.sign?.files) && target.sign.files.length === 1 ? target.sign.files[0] : undefined);
|
|
110
125
|
if (rawDeclared === undefined) issues.push("the raw EXE path is unknown: set winPackage.rawExe or exactly one target.sign.prePackageFiles entry");
|
|
111
126
|
if (installerDeclared === undefined) issues.push("the installer path is unknown: set winPackage.installerFile or exactly one target.sign.files entry");
|
|
112
|
-
const
|
|
113
|
-
|
|
127
|
+
const artifactPath = (declared, label) => {
|
|
128
|
+
if (declared === undefined) return { file: null, managed: false };
|
|
129
|
+
const absolute = managedAbsolute(declared, label, issues, managedRoots);
|
|
130
|
+
if (absolute === null) return { file: null, managed: false };
|
|
131
|
+
return absolute ? { file: absolute, managed: true } : { file: relativeInside(appRoot, declared, label, issues), managed: false };
|
|
132
|
+
};
|
|
133
|
+
const { file: rawExe, managed: rawExeManaged } = artifactPath(rawDeclared, "rawExe");
|
|
134
|
+
const { file: installerFile, managed: installerFileManaged } = artifactPath(installerDeclared, "installerFile");
|
|
114
135
|
if (rawExe && !/\.exe$/i.test(rawExe)) issues.push(`rawExe must be an .exe, received ${rawDeclared}`);
|
|
115
136
|
if (installerFile && !/\.exe$/i.test(installerFile)) issues.push(`installerFile must be an .exe, received ${installerDeclared}`);
|
|
116
137
|
if (rawExe && installerFile && rawExe.toLowerCase() === installerFile.toLowerCase()) issues.push("rawExe and installerFile must be different files");
|
|
@@ -147,6 +168,7 @@ export function validateWinPackage({ appRoot, config = {}, target } = {}) {
|
|
|
147
168
|
triple,
|
|
148
169
|
rawExe,
|
|
149
170
|
installerFile,
|
|
171
|
+
managed: Object.freeze({ rawExe: rawExeManaged, installerFile: installerFileManaged }),
|
|
150
172
|
sidecars: Object.freeze(sidecars),
|
|
151
173
|
tauriCwd,
|
|
152
174
|
});
|
|
@@ -286,7 +308,7 @@ export function runWinPackageRecipe({ appRoot, config = {}, target, deps = {} }
|
|
|
286
308
|
|
|
287
309
|
phase("build", () => {
|
|
288
310
|
if (!dry) fs.rmSync(rawExe, { force: true });
|
|
289
|
-
tauri(["build", "--no-bundle", "--target", plan.triple], quiet);
|
|
311
|
+
tauri(["build", "--no-bundle", "--target", plan.triple, "--", "--locked"], quiet); // the reviewed lockfile only (rightkit#725)
|
|
290
312
|
if (dry) return;
|
|
291
313
|
raw = locate(rawExe, { env, fs, split });
|
|
292
314
|
if (!fs.existsSync(raw)) throw new Error(`tauri build did not produce the raw EXE: ${rawExe}`);
|