@rightkit/release 0.6.85 → 0.6.86

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.
@@ -0,0 +1,11 @@
1
+ {
2
+ "schema": 1,
3
+ "description": "Repositories RightKit does not bind: each may use RightKit packages but owes none, so every finding of its ownership scan is advice. An entry needs the owner's ruling, quoted, in ratifiedBy. Read by ownership.mjs (adviseOnlyFindings).",
4
+ "repositories": [
5
+ {
6
+ "repositoryIdentity": "https://github.com/orthic-labs/legion",
7
+ "issue": "bogusyogi/rightkit#1754",
8
+ "ratifiedBy": "Adrian, 2026-11-26 06:28 UTC, typed in the Legion chat (pulse chat said; Orthic-Labs/legion#149): \"Legion can use a few Rk packages and crates but no mandatory and doesn't have to.\""
9
+ }
10
+ ]
11
+ }
package/ownership.mjs CHANGED
@@ -793,6 +793,26 @@ export function exceptionMatches(entry, finding) {
793
793
  if (entry.path !== undefined && !(finding.file === entry.path || finding.file?.startsWith(`${entry.path.replace(/\/$/, "")}/`))) return false;
794
794
  return true;
795
795
  }
796
+ /**
797
+ * A repository RightKit does not bind (listed in the shipped ownership-advise-only.json with the owner's ruling in `ratifiedBy`): it
798
+ * may use RightKit packages but owes none, so every finding of its scan is advice. Violations lose their
799
+ * blocking tier and any `banned` policy; they are still reported in full. Coverage gaps and scan problems are not findings and still refuse.
800
+ */
801
+ let adviseOnlyList;
802
+ function adviseOnlyRepositories() {
803
+ if (adviseOnlyList === undefined) {
804
+ try { const data = JSON.parse(readFileSync(new URL("./ownership-advise-only.json", import.meta.url), "utf8")); adviseOnlyList = Array.isArray(data?.repositories) ? data.repositories : []; }
805
+ catch { adviseOnlyList = []; }
806
+ }
807
+ return adviseOnlyList;
808
+ }
809
+ export function adviseOnlyFindings(result, repositoryIdentity, registry = adviseOnlyRepositories()) {
810
+ const entry = repositoryIdentity ? registry.find((e) => e?.repositoryIdentity === repositoryIdentity && typeof e.ratifiedBy === "string" && e.ratifiedBy.trim()) : null;
811
+ if (!entry) return result;
812
+ const advise = ({ policy, ...finding }) => ({ ...finding, tier: "advise" });
813
+ return { ...result, violations: result.violations.map(advise), warnings: [...(result.warnings ?? []), `ownership findings are advice for ${repositoryIdentity}: ${entry.ratifiedBy}`] };
814
+ }
815
+
796
816
  export function evaluate(findings, exceptions, options = {}) {
797
817
  const problems = [], covered = [], violations = [], warnings = [];
798
818
  for (const e of exceptions) {
@@ -846,7 +866,7 @@ function checkAppInternal(appRoot, manifest, options, readAuthority) {
846
866
  const scanned = scanInternal(appRoot, manifest, { inventory: fileInventory(appRoot, trust, location.prefix, location.root), trust, repositoryIdentity, repositoryRoot: location.root, pathPrefix: location.prefix, allowlistPolicy: dependencyAllowlistPolicy(trust, repositoryIdentity, { pending: enrollmentPending(trust, enrollment), shipped: options.shippedAllowlist }) });
847
867
  const metadata = { ...scanMetadata(appRoot, manifest, scanned.coverage, scanned.contentDigests, repositoryIdentity, location.commit), pathBase: location.pathBase, pathPrefix: location.prefix, provenance: scanned.provenance, ...Object.fromEntries(Object.entries(resolved).filter(([key]) => key !== "trust")) };
848
868
  if (trust?.rootFingerprint && Array.isArray(trust.ownershipKeys) && !trust.ownershipKeys.length) throw new Error("protected ownership key log has no active approval keys");
849
- const result = evaluate(scanned.findings, loadExceptions(appRoot), { ...options, manifest, trust, trustEnrollment: enrollment, metadata });
869
+ const result = adviseOnlyFindings(evaluate(scanned.findings, loadExceptions(appRoot), { ...options, manifest, trust, trustEnrollment: enrollment, metadata }), repositoryIdentity);
850
870
  const coverage = [...new Map(metadata.coverage.map((x) => [`${x.path}\0${x.reason}`, x])).values()];
851
871
  const rows = capabilityTable(manifest, scanned.deps, { ...result, coverage });
852
872
  return { ok: !result.violations.some(isBlockingFinding) && !result.problems.length && !coverage.length, rows, ...result, findings: scanned.findings, coverage, metadata };
@@ -927,9 +947,9 @@ function checkCommitted(appRoot, manifest, options, acquire, readAuthority = rea
927
947
  ...(scope ? { ownershipScopeClosed: scope } : {}),
928
948
  source: "committed-git-tree", ...(keyLogDigest ? { keyLogDigest, keyCheckpoint, rootFingerprint: trust.rootFingerprint, ...(keyAuthorityBinding ? { keyAuthority: keyAuthorityBinding } : {}) } : {}),
929
949
  };
930
- const result = evaluate(scanned.findings, exceptions, { ...options, manifest, trust, trustEnrollment: trust?.rootFingerprint
950
+ const result = adviseOnlyFindings(evaluate(scanned.findings, exceptions, { ...options, manifest, trust, trustEnrollment: trust?.rootFingerprint
931
951
  ? { enrolled: trust.enrollmentComplete === true, pending: trust.enrollmentComplete !== true }
932
- : trustState?.pending !== undefined || trustState?.enrolled !== undefined ? trustState : undefined, metadata });
952
+ : trustState?.pending !== undefined || trustState?.enrolled !== undefined ? trustState : undefined, metadata }), repositoryIdentity);
933
953
  const coverage = [...new Map(metadata.coverage.map((x) => [`${x.path}\0${x.reason}`, x])).values()];
934
954
  const rows = capabilityTable(manifest, scanned.deps, { ...result, coverage });
935
955
  return { ok: !result.violations.some(isBlockingFinding) && !result.problems.length && !coverage.length, rows, ...result, findings: scanned.findings, coverage, metadata };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.85",
3
+ "version": "0.6.86",
4
4
  "description": "Portable release CLI/SDK with fail-closed public GitHub Releases and private R2 + RightApps distribution.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -44,8 +44,19 @@ export function fetchVersionDocument(run, name, version) {
44
44
  const cut = text.lastIndexOf("\n");
45
45
  const status = Number(text.slice(cut + 1).trim());
46
46
  if (!Number.isInteger(status) || status === 0) return { status: 0, error: "curl returned no HTTP status" };
47
- if (status !== 200) return { status, error: `HTTP ${status}` };
48
- try { return { status, body: JSON.parse(text.slice(0, cut)) }; } catch (e) { return { status, error: `HTTP 200 with an unreadable body: ${e.message}` }; }
47
+ if (status === 200) {
48
+ try { return { status, body: JSON.parse(text.slice(0, cut)) }; } catch (e) { return { status, error: `HTTP 200 with an unreadable body: ${e.message}` }; }
49
+ }
50
+ // The per-version address can keep answering a cached 404 for minutes after the registry has the version (seen on 0.6.84 and
51
+ // 0.6.85: 20 tries of 404 while the package document already listed it). Ask the package document before calling it absent.
52
+ const all = run("curl", ["-sS", "--max-time", "30", "-H", "cache-control: no-cache", "-H", "pragma: no-cache", "-H", "accept: application/vnd.npm.install-v1+json", `${REGISTRY}${name.replace("/", "%2f")}`], { encoding: "utf8", maxBuffer: 1 << 26 });
53
+ if (!all.error && all.status === 0) {
54
+ try {
55
+ const listed = JSON.parse(String(all.stdout ?? ""))?.versions?.[version];
56
+ if (listed?.dist) return { status: 200, body: listed };
57
+ } catch { /* not a package document: the version address's answer stands */ }
58
+ }
59
+ return { status, error: `HTTP ${status}` };
49
60
  }
50
61
 
51
62
  /** The pnpm store the checkout installed from (`storeDir` in its node_modules/.modules.yaml, e.g. /Volumes/D/.pnpm-store/v11), as a `--store-dir` value (its parent). */
@@ -203,12 +203,13 @@ export async function runQa({ stage, platform, releaseIdArg, configPath, deps =
203
203
  const sourceListing = split && journeysConfig && !journeysConfig.receipt
204
204
  ? (deps.writeSourceListing ?? writeQaSourceListing)({ source: release, dir: path.join(repoRoot, ".right-release", "qa-source"), git: gitRunner })
205
205
  : null;
206
- // The journeys runner builds with `rustright cargo` in the app root, not through the seam, so the broker checks the stage's Class A
207
- // verdict against that directory (its workspace is the cwd relative to the snapshot). Hand it the verdict for that directory, derived
208
- // from the stage's root verdict exactly as the seam derives one for each of its own calls (seam-broker.mjs verdictForCwd).
206
+ // The journeys runner builds with `rustright cargo` itself, not through the seam, so the broker checks the stage's Class A verdict
207
+ // against the directory rustright selects for that build: the directory of the build's `--manifest-path`, or the app root without
208
+ // one (journeysBuildWorkspace). Hand it the verdict for that directory, derived from the stage's root verdict exactly as the seam
209
+ // derives one for each of its own calls (seam-broker.mjs verdictForCwd).
209
210
  const runCwd = appRoot;
210
211
  const stageEnv = deps.env ?? process.env;
211
- const classAForRoot = sourceListing && stageEnv[CLASS_A_ENV] ? (deps.verdictForCwd ?? verdictForCwd)(stageEnv, runCwd) : null;
212
+ const classAForRoot = sourceListing && stageEnv[CLASS_A_ENV] ? (deps.verdictForCwd ?? verdictForCwd)(stageEnv, journeysBuildWorkspace({ manifestFile: path.resolve(appRoot, journeysConfig.manifest ?? "journeys.toml"), appRoot, args: (journeysConfig.args?.[stage] ?? []).map(String) })) : null;
212
213
  const runEnv = {
213
214
  ...process.env, ...(sourceListing ? { [QA_SOURCE_LISTING_ENV]: sourceListing } : {}), ...(classAForRoot ? { [CLASS_A_ENV]: classAForRoot } : {}), RIGHT_RELEASE_QA_STAGE: stage, RIGHT_RELEASE_QA_COMMIT: source.commit, RIGHT_RELEASE_QA_RELEASE_ID: releaseId,
214
215
  ...(sealed ? { RIGHT_RELEASE_QA_SEALED_DIR: sealed.sealedDir } : {}), ...(installedDirs.length ? { RIGHTKIT_QA_INSTALLED_DIRS: installedDirs.join(";") } : {}), ...(installedQa?.env ?? {}),
@@ -274,6 +275,44 @@ function usage(code) {
274
275
  process.exit(code);
275
276
  }
276
277
 
278
+ /**
279
+ * The directory `rustright cargo` selects as its workspace for the journeys build the runner is about to make. rustright does not
280
+ * take the process cwd when the command names `--manifest-path`: it takes the manifest's directory (rustright-cli shims.rs
281
+ * normalized_invocation), and the broker checks the Class A verdict against that directory. The build commands are the `build`
282
+ * arrays of the manifest's `[[adapter]]` tables (and `[app_build].command`); `--id` values in the journeys arguments narrow them to
283
+ * the adapters of the named journeys. A build without `--manifest-path` selects the app root. Builds that select different
284
+ * directories cannot share one verdict, so that is refused by name.
285
+ */
286
+ export function journeysBuildWorkspace({ manifestFile, appRoot, args = [] }) {
287
+ if (!existsSync(manifestFile)) return appRoot;
288
+ const doc = createRequire(import.meta.url)("smol-toml").parse(readFileSync(manifestFile, "utf8"));
289
+ const ids = new Set();
290
+ for (let index = 0; index < args.length; index += 1) {
291
+ if (args[index] === "--id" && args[index + 1]) ids.add(String(args[index + 1]));
292
+ else if (String(args[index]).startsWith("--id=")) ids.add(String(args[index]).slice("--id=".length));
293
+ }
294
+ const journeys = (Array.isArray(doc.journey) ? doc.journey : []).filter((journey) => ids.size === 0 || ids.has(String(journey.id)));
295
+ const wanted = new Set(journeys.filter((journey) => journey.adapter).map((journey) => String(journey.adapter)));
296
+ const builds = (Array.isArray(doc.adapter) ? doc.adapter : [])
297
+ .filter((adapter) => Array.isArray(adapter.build) && (ids.size === 0 || wanted.has(String(adapter.name))))
298
+ .map((adapter) => ({ name: `adapter ${adapter.name}`, command: adapter.build.map(String) }));
299
+ if (Array.isArray(doc.app_build?.command) && journeys.some((journey) => !journey.adapter)) builds.push({ name: "app_build", command: doc.app_build.command.map(String) });
300
+ const dirOf = (command) => {
301
+ const separator = command.indexOf("--");
302
+ const index = command.findIndex((value, at) => (separator < 0 || at < separator) && (value === "--manifest-path" || value.startsWith("--manifest-path=")));
303
+ if (index < 0) return appRoot;
304
+ const manifest = command[index] === "--manifest-path" ? command[index + 1] : command[index].slice("--manifest-path=".length);
305
+ return manifest ? path.dirname(path.resolve(appRoot, manifest)) : appRoot;
306
+ };
307
+ const dirs = new Map();
308
+ for (const build of builds) { const dir = dirOf(build.command); dirs.set(dir, [...(dirs.get(dir) ?? []), build.name]); }
309
+ if (dirs.size === 0) return appRoot;
310
+ if (dirs.size > 1) {
311
+ throw new Error(`${manifestFile}: the journeys builds of this run select different rustright workspaces (${[...dirs].map(([dir, names]) => `${dir}: ${names.join(", ")}`).join("; ")}); one run carries one Class A verdict, so name one journey set per run with --id`);
312
+ }
313
+ return [...dirs.keys()][0];
314
+ }
315
+
277
316
  export async function main(args) {
278
317
  if (args[0] === "audit") process.exit(auditMain(args.slice(1)));
279
318
  if (args[0] === "policy") process.exit(policyMain(args.slice(1), { program: "right-release qa policy" }));
@@ -49,7 +49,7 @@
49
49
  "@rightkit/qa": "0.7.0",
50
50
  "@rightkit/qa-chrome": "0.1.12",
51
51
  "@rightkit/react-shell": "0.7.9",
52
- "@rightkit/release": "0.6.85",
52
+ "@rightkit/release": "0.6.86",
53
53
  "@rightkit/send-ui": "0.1.0",
54
54
  "@rightkit/settings-ui": "0.7.7",
55
55
  "@rightkit/social-ui": "0.2.1",
@@ -450,7 +450,8 @@
450
450
  "0.6.81",
451
451
  "0.6.82",
452
452
  "0.6.83",
453
- "0.6.84"
453
+ "0.6.84",
454
+ "0.6.85"
454
455
  ],
455
456
  "@rightkit/settings-ui": [
456
457
  "0.1.0",
@@ -596,7 +597,7 @@
596
597
  "rightkit-automation": "0.7.6",
597
598
  "rightkit-autostart": "0.1.1",
598
599
  "rightkit-bench": "0.2.1",
599
- "rightkit-bot-messaging": "0.3.1",
600
+ "rightkit-bot-messaging": "0.3.2",
600
601
  "rightkit-browser": "0.3.12",
601
602
  "rightkit-cache": "0.2.5",
602
603
  "rightkit-captions": "0.1.1",
@@ -754,7 +755,7 @@
754
755
  "rightkit-sysmem": "0.1.0",
755
756
  "rightkit-system-monitor": "0.3.2",
756
757
  "rightkit-tauri-shell": "0.8.10",
757
- "rightkit-terminal-ui": "0.1.4",
758
+ "rightkit-terminal-ui": "0.1.5",
758
759
  "rightkit-text-polish": "0.1.4",
759
760
  "rightkit-theme": "0.1.1",
760
761
  "rightkit-time": "0.1.5",
@@ -918,7 +919,7 @@
918
919
  "@rightkit/qa": "0.7.0",
919
920
  "@rightkit/qa-chrome": "0.1.12",
920
921
  "@rightkit/react-shell": "0.7.7",
921
- "@rightkit/release": "0.6.84",
922
+ "@rightkit/release": "0.6.85",
922
923
  "@rightkit/settings-ui": "0.7.4",
923
924
  "@rightkit/shell": "0.1.1",
924
925
  "@rightkit/tauri": "0.4.3",
@@ -1036,6 +1037,9 @@
1036
1037
  "0.7.3",
1037
1038
  "0.7.4"
1038
1039
  ],
1040
+ "rightkit-bot-messaging": [
1041
+ "0.3.1"
1042
+ ],
1039
1043
  "rightkit-browser": [
1040
1044
  "0.2.0",
1041
1045
  "0.2.1",
@@ -1882,7 +1886,8 @@
1882
1886
  "0.2.0"
1883
1887
  ],
1884
1888
  "rightkit-terminal-ui": [
1885
- "0.1.3"
1889
+ "0.1.3",
1890
+ "0.1.4"
1886
1891
  ],
1887
1892
  "rightkit-timeline": [
1888
1893
  "0.1.1"