@rightkit/release 0.6.47 → 0.6.49
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/artifact-storage.mjs +2 -2
- package/assembled-app.mjs +6 -1
- package/bin/rightkit-gate.mjs +96 -18
- package/build-helpers-command.mjs +1 -1
- package/build-ownership.mjs +2 -2
- package/cargo-contract.mjs +1 -1
- package/cargo-guard.mjs +1 -1
- package/cli/right-release.mjs +2 -0
- package/credential-provider.mjs +2 -2
- package/deterministic-scans.mjs +120 -14
- package/gate-acceptance.mjs +1899 -52
- package/gate-serve.mjs +5 -2
- package/install-assembled-app.mjs +5 -1
- package/managed-cargo.mjs +3 -3
- package/managed-roots.mjs +48 -12
- package/ownership-mandatory-set.json +162 -0
- package/ownership-mandatory-set.mjs +1 -1
- package/package.json +1 -1
- package/qa-runner.mjs +1 -1
- package/release-qa-command.mjs +1 -1
- package/rightkit-signing-agent.mjs +3 -2
- package/rightkit-versions.json +1 -1
- package/signing-agent-install.mjs +1 -1
- package/snapshot-broker.mjs +7 -4
- package/snapshot-git.mjs +22 -1
- package/snapshot.mjs +9 -4
- package/spawn-ledger.mjs +46 -0
- package/stage-ledger.mjs +7 -5
- package/tool-build.mjs +1 -1
- package/unit-gate.mjs +1 -1
package/gate-serve.mjs
CHANGED
|
@@ -28,9 +28,12 @@ import { resolveManagedRoots } from "./managed-roots.mjs";
|
|
|
28
28
|
const SELF = fileURLToPath(import.meta.url);
|
|
29
29
|
const SCHEMA = "rightkit.gate-serve/1";
|
|
30
30
|
const COOKIE_PREFIX = "0000000000000000.gate-serve-cookie-";
|
|
31
|
-
|
|
31
|
+
// The server's identity covers every local module it runs (this file and managed-roots.mjs, its only local import), so a client never
|
|
32
|
+
// takes answers from a server whose code differs from its own, e.g. one started from an edited checkout answering a sealed gate.
|
|
33
|
+
const SERVER_MODULES = [SELF, fileURLToPath(new URL("./managed-roots.mjs", import.meta.url))];
|
|
34
|
+
const IDENTITY = (() => { try { const h = crypto.createHash("sha256"); for (const f of SERVER_MODULES) { h.update(path.basename(f)); h.update("\0"); h.update(fs.readFileSync(f)); h.update("\0"); } return h.digest("hex").slice(0, 16); } catch { return "unknown"; } })();
|
|
32
35
|
|
|
33
|
-
function dataRoot(env = process.env) { return resolveManagedRoots({ env, platform: process.platform }).
|
|
36
|
+
function dataRoot(env = process.env) { return resolveManagedRoots({ env, platform: process.platform }).gateRoot; }
|
|
34
37
|
export function socketPath(env = process.env) {
|
|
35
38
|
if (process.platform === "win32") return `\\\\.\\pipe\\rightkit-gate-serve-${(os.userInfo().username || "user").replace(/[^A-Za-z0-9_-]/g, "_")}`;
|
|
36
39
|
return path.join(dataRoot(env), "gate-serve", "serve.sock");
|
|
@@ -23,6 +23,7 @@ import { installApp } from "./install-app.mjs";
|
|
|
23
23
|
import { previousPathOf } from "./in-place-install.mjs";
|
|
24
24
|
import { resolveXcodeStorage } from "./ios-host.mjs";
|
|
25
25
|
import { resolveTargetRoot } from "./cargo-target.mjs";
|
|
26
|
+
import { readSourceSplit } from "./source-split.mjs";
|
|
26
27
|
import { ASSEMBLED_APP_KIND, AssembledAppError, assembleMacBundle, assembleWindowsPayload, containedRelative, loadStageReceipt, platformPath, resolveAssembly, resolveNestedApp, verifyMacBundle, verifyWindowsPayload } from "./assembled-app.mjs";
|
|
27
28
|
|
|
28
29
|
export { ASSEMBLED_APP_KIND };
|
|
@@ -145,7 +146,10 @@ export function buildOuterApp({ root, spec, storage, profile, env = process.env,
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
export function resolveAssemblyStorage({ root, profile, env, run }) {
|
|
148
|
-
|
|
149
|
+
// Inside the door's source split `root` is the snapshot, where `.right-release` is a reserved path (the stage-output ledger refuses it): the fallback build folder
|
|
150
|
+
// stays with the checkout's same app-relative directory, as the release lock and the Linux artifacts do (release.mjs, linux-artifacts.mjs).
|
|
151
|
+
const split = readSourceSplit({ env, cwd: root, run });
|
|
152
|
+
return resolveXcodeStorage({ env, run, cwd: root, fallbackRoot: path.join(split ? split.checkoutAppRoot : root, ".right-release", "assembled-app") }); // one Xcode build folder, never one per profile (GC-A15)
|
|
149
153
|
}
|
|
150
154
|
|
|
151
155
|
// ---- macOS --------------------------------------------------------------------------------------------------------
|
package/managed-cargo.mjs
CHANGED
|
@@ -118,7 +118,7 @@ export function resolveLinuxBrokerRoute({ env = process.env, platform = process.
|
|
|
118
118
|
return { declared: true, ok: true, client, socket, clientSha256 };
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
const MANAGED_AGENT_BIN = /(?:^|\/)(?:\.rightkit-managed|rightkitmanagedagent|rightkit\/build-control)\/agent-bin\/?$/i;
|
|
121
|
+
const MANAGED_AGENT_BIN = /(?:^|\/)(?:\.rightkit-managed|\.rustright|rightkitmanagedagent|rightkit\/build-control|rustright\/build-control)\/agent-bin\/?$/i;
|
|
122
122
|
function fileHead(file) {
|
|
123
123
|
let fd = null;
|
|
124
124
|
try { fd = openSync(file, "r"); const b = Buffer.alloc(4096); const n = readSync(fd, b, 0, 4096, 0); return b.subarray(0, n).toString("latin1"); }
|
|
@@ -233,7 +233,7 @@ export function managedRuntimeCommand(client, args) {
|
|
|
233
233
|
export function acquireManagedRunLease({ command, env = process.env, platform = process.platform, exists = existsSync, pid = process.pid } = {}) {
|
|
234
234
|
const client = managedRuntimeClient(env, platform, exists);
|
|
235
235
|
if (!client) return { path: null, release() {} };
|
|
236
|
-
const runs = path.join(resolveManagedRoots({ env, platform }).
|
|
236
|
+
const runs = path.join(resolveManagedRoots({ env, platform }).buildControl, "global", "runs");
|
|
237
237
|
const file = path.join(runs, `${pid}-${randomUUID()}.json`);
|
|
238
238
|
try {
|
|
239
239
|
mkdirSync(runs, { recursive: true });
|
|
@@ -249,7 +249,7 @@ export function managedHost(env, platform = process.platform) {
|
|
|
249
249
|
// Linux is broker-managed only through the explicit declared route (linuxBrokerDeclared), whatever else the env names.
|
|
250
250
|
if (directPlatform(platform)) return linuxBrokerDeclared(env, platform);
|
|
251
251
|
return Boolean(env.RUSTRIGHT_BUILD_BROKER_SOCKET || env.RIGHTKIT_BUILD_BROKER_SOCKET)
|
|
252
|
-
|| /(?:^|[;:])[^;:]*[/\\](?:\.rightkit-managed|rightkitmanagedagent|rightkit[/\\]build-control)[/\\]agent-bin(?:[;:]|$)/i.test(String(env.PATH ?? ""));
|
|
252
|
+
|| /(?:^|[;:])[^;:]*[/\\](?:\.rightkit-managed|\.rustright|rightkitmanagedagent|rightkit[/\\]build-control|rustright[/\\]build-control)[/\\]agent-bin(?:[;:]|$)/i.test(String(env.PATH ?? ""));
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
/**
|
package/managed-roots.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
2
|
+
import { existsSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
3
3
|
import { homedir, userInfo } from 'node:os';
|
|
4
4
|
import { posix, win32 } from 'node:path';
|
|
5
5
|
import path from 'node:path';
|
|
@@ -27,29 +27,61 @@ export const envNamed = (env, name) => {
|
|
|
27
27
|
* way (rustright 07829c05, pinned in the shared fixtures as "linux no-env defaults to the account state directory"). The broker's answering roots, not either
|
|
28
28
|
* resolver's guess, say where a running broker keeps its state.
|
|
29
29
|
*/
|
|
30
|
-
export function resolveManagedRoots({ env = process.env, platform = process.platform, home = homedir(), controlRoot, dataRoot, runtimeRoot, windowsControlDefault = 'localappdata' } = {}) {
|
|
30
|
+
export function resolveManagedRoots({ env = process.env, platform = process.platform, home = homedir(), controlRoot, dataRoot, gateRoot, runtimeRoot, layout, windowsControlDefault = 'localappdata', isDir } = {}) {
|
|
31
31
|
const paths = platform === 'win32' ? win32 : posix;
|
|
32
|
+
layout ??= platform === process.platform ? detectLayout({ env, platform, home, controlRoot, dataRoot, gateRoot, runtimeRoot, windowsControlDefault, isDir }) : 'rustright';
|
|
33
|
+
if (layout !== 'rustright' && layout !== 'legacy') throw new Error(`managed roots layout must be rustright or legacy, not ${String(layout)}`);
|
|
34
|
+
const legacyLayout = layout === 'legacy';
|
|
32
35
|
const legacyRoot = platform === 'win32' ? 'D:\\.rightkit-managed' : '/Volumes/D/.rightkit-managed';
|
|
33
36
|
const managedPlatform = platform === 'darwin' || platform === 'win32';
|
|
34
|
-
|
|
37
|
+
// RightKit's own default root: the pre-rename managed root, or the account's state directory off Mac and Windows (never the Mac volume).
|
|
38
|
+
const previousDataRoot = managedPlatform ? legacyRoot : paths.join(home, '.local', 'state', 'rightkit');
|
|
39
|
+
const defaultDataRoot = legacyLayout ? previousDataRoot
|
|
40
|
+
: platform === 'win32' ? 'D:\\.rustright' : platform === 'darwin' ? '/Volumes/D/.rustright' : paths.join(home, '.local', 'state', 'rustright');
|
|
41
|
+
const namedDataRoot = dataRoot ?? (envNamed(env, 'DATA_ROOT') || envNamed(env, 'MANAGED_ROOT') || envNamed(env, 'EXTERNAL_ROOT'));
|
|
42
|
+
dataRoot = namedDataRoot ?? defaultDataRoot;
|
|
43
|
+
// The gate root (RightKit's own data) is the data root on the legacy layout; else explicit, else GATE_ROOT, else the data root when one was named (a lab or test names one root for everything), else RightKit's own default.
|
|
44
|
+
gateRoot = legacyLayout ? dataRoot : gateRoot ?? (envNamed(env, 'GATE_ROOT') || namedDataRoot) ?? previousDataRoot;
|
|
45
|
+
const buildLeaf = legacyLayout ? LEGACY_BUILD_DIR : BUILD_DIR;
|
|
35
46
|
// rustright#54 (Adrian, 2026-11-02: "all apps are installed in internal drives ... doesn't rr belong there? the dev workspace sits on d"): the
|
|
36
|
-
// Windows control root (config, logs, policy,
|
|
37
|
-
// Support; build data (ws, sccache, cargo home, snapshots) stays on the data root.
|
|
47
|
+
// Windows control root (config, logs, policy, attestation) is %LOCALAPPDATA%\RustRight\build-control (RightKit\build-control on the legacy layout; Adrian, 2026-11-04,
|
|
48
|
+
// the broker's data leaves RightKit), as the Mac's is under Application Support; build data (ws, sccache, cargo home, snapshots) stays on the data root.
|
|
49
|
+
const product = legacyLayout ? 'RightKit' : 'RustRight';
|
|
38
50
|
const localAppData = () => env.LOCALAPPDATA || paths.join(home, 'AppData', 'Local');
|
|
39
51
|
controlRoot ??= envNamed(env, 'CONTROL_ROOT') || (platform === 'darwin'
|
|
40
|
-
? paths.join(home, 'Library', 'Application Support',
|
|
41
|
-
: platform === 'win32' && windowsControlDefault === 'localappdata' ? paths.join(localAppData(),
|
|
52
|
+
? paths.join(home, 'Library', 'Application Support', product, 'build-control')
|
|
53
|
+
: platform === 'win32' && windowsControlDefault === 'localappdata' ? paths.join(localAppData(), product, 'build-control') : dataRoot);
|
|
42
54
|
runtimeRoot ??= envNamed(env, 'RUNTIME_ROOT') || (platform === 'darwin' ? paths.join(home, 'Library', 'Application Support', 'RustRight') : platform === 'win32' ? (windowsControlDefault === 'localappdata' ? paths.join(localAppData(), 'RustRight') : 'D:\\.rustright') : controlRoot);
|
|
43
|
-
return Object.freeze({ controlRoot, dataRoot, legacyRoot, runtimeCurrent: paths.join(controlRoot, 'runtime'), runtimeRoot, liveRuntime: paths.join(runtimeRoot, 'runtime'),
|
|
55
|
+
return Object.freeze({ controlRoot, dataRoot, gateRoot, legacyRoot, buildControl: paths.join(dataRoot, buildLeaf), runtimeCurrent: paths.join(controlRoot, 'runtime'), runtimeRoot, liveRuntime: paths.join(runtimeRoot, 'runtime'),
|
|
44
56
|
configPath: paths.join(controlRoot, 'config.json'), socket: platform === 'win32' ? null : paths.join(controlRoot, 'broker.sock'),
|
|
45
|
-
//
|
|
57
|
+
// On Windows agent-bin stays on the data root (agents' PATH and the broker's job PATH name <data root>\agent-bin). `sharedAgentBin` is the directory the broker puts first on every
|
|
58
|
+
// job's PATH; `forwardedAgentBin` is the pre-migration PATH entry every app still names (a link to the shared one once a host has migrated).
|
|
46
59
|
logs: paths.join(controlRoot, 'logs'), agentBin: platform === 'win32' ? paths.join(dataRoot, 'agent-bin') : paths.join(controlRoot, 'agent-bin'),
|
|
60
|
+
sharedAgentBin: paths.join(dataRoot, 'agent-bin'), forwardedAgentBin: paths.join(gateRoot, 'agent-bin'),
|
|
47
61
|
agentPolicy: paths.join(controlRoot, 'agent-policy'), ownershipInstall: paths.join(controlRoot, 'ownership-install'),
|
|
48
62
|
// The Mac signing agent already lives on the internal disk; moving it would force a re-provision.
|
|
49
63
|
signingAgent: platform === 'darwin' ? paths.join(home, 'Library', 'Application Support', 'Orthic Labs', 'shared', 'signing-agent')
|
|
50
64
|
: paths.join(controlRoot, 'signing-agent') });
|
|
51
65
|
}
|
|
52
66
|
|
|
67
|
+
/** The broker's data directory inside the data root: `build-control`, and `rightkit-build-control` before the managed-roots migration (rustright_core::layout). */
|
|
68
|
+
export const BUILD_DIR = 'build-control';
|
|
69
|
+
export const LEGACY_BUILD_DIR = 'rightkit-build-control';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The layout a host is on (RustRight's `detect_layout`): `rustright` when `<data root>/build-control` is a directory, else `legacy` when only the legacy data root's
|
|
73
|
+
* `rightkit-build-control` is, else (a fresh host, or a root that holds neither) `rustright`. The data root is the one the options resolve to under each layout. The
|
|
74
|
+
* installer's migration renames the build directory in one step, so a host is never on both. `isDir` is injectable.
|
|
75
|
+
*/
|
|
76
|
+
export function detectLayout(options = {}) {
|
|
77
|
+
const { isDir = (dir) => { try { return statSync(dir).isDirectory(); } catch { return false; } }, ...rest } = options;
|
|
78
|
+
const paths = (rest.platform ?? process.platform) === 'win32' ? win32 : posix;
|
|
79
|
+
const current = resolveManagedRoots({ ...rest, layout: 'rustright' });
|
|
80
|
+
if (isDir(paths.join(current.dataRoot, BUILD_DIR))) return 'rustright';
|
|
81
|
+
const previous = resolveManagedRoots({ ...rest, layout: 'legacy' });
|
|
82
|
+
return isDir(paths.join(previous.dataRoot, LEGACY_BUILD_DIR)) ? 'legacy' : 'rustright';
|
|
83
|
+
}
|
|
84
|
+
|
|
53
85
|
/**
|
|
54
86
|
* Where a gate run keeps evidence that must not live in the repository (failing scans' complete output, the direct executor's
|
|
55
87
|
* diagnostics): RIGHTKIT_SCRATCH_ROOT, else `<data root>/runs`. A managed Mac or Windows host has a data root, and so does any host
|
|
@@ -59,7 +91,7 @@ export function resolveManagedRoots({ env = process.env, platform = process.plat
|
|
|
59
91
|
*/
|
|
60
92
|
export function gateRunsRoot({ env = process.env, platform = process.platform, home = homedir() } = {}) {
|
|
61
93
|
if (env.RIGHTKIT_SCRATCH_ROOT) return env.RIGHTKIT_SCRATCH_ROOT;
|
|
62
|
-
return (platform === 'win32' ? win32 : posix).join(resolveManagedRoots({ env, platform, home }).
|
|
94
|
+
return (platform === 'win32' ? win32 : posix).join(resolveManagedRoots({ env, platform, home }).gateRoot, 'runs'); // `runs` is RightKit's: the gate root, never the broker's data root
|
|
63
95
|
}
|
|
64
96
|
|
|
65
97
|
export function managedControlCandidates(options = {}) {
|
|
@@ -68,8 +100,12 @@ export function managedControlCandidates(options = {}) {
|
|
|
68
100
|
const env = options.env ?? process.env;
|
|
69
101
|
return [...new Set([options.controlRoot, envNamed(env, 'CONTROL_ROOT'), options.dataRoot, envNamed(env, 'DATA_ROOT'), envNamed(env, 'MANAGED_ROOT'), envNamed(env, 'EXTERNAL_ROOT'), options.clientRoot].filter(Boolean))];
|
|
70
102
|
}
|
|
71
|
-
|
|
72
|
-
|
|
103
|
+
// Both layouts are tried, the RustRight roots first (RustRight's `managed_control_candidates`): a host that migrated its roots has its broker there, one that has not has it at the
|
|
104
|
+
// old ones, and the old paths of a migrated host are forwarding links. A path a host does not have is skipped by the probe.
|
|
105
|
+
const current = resolveManagedRoots({ ...options, layout: 'rustright' });
|
|
106
|
+
const previous = resolveManagedRoots({ ...options, layout: 'legacy' });
|
|
107
|
+
const homeKnown = platform === 'win32' || Boolean(options.home ?? homedir());
|
|
108
|
+
return [...new Set([current.controlRoot, current.dataRoot, options.clientRoot, homeKnown ? previous.controlRoot : undefined, previous.dataRoot, current.legacyRoot].filter(Boolean))];
|
|
73
109
|
}
|
|
74
110
|
|
|
75
111
|
/** The pipe RustRight's installer enforces, and the pre-rename one still named by processes started before the cutover (which means the same broker). */
|
|
@@ -26,6 +26,29 @@
|
|
|
26
26
|
"apple": {
|
|
27
27
|
"description": "Table 1-Apple is an unratified draft. Profile is supported by the data model; no Apple rows are shipped.",
|
|
28
28
|
"ratified": false
|
|
29
|
+
},
|
|
30
|
+
"cli": {
|
|
31
|
+
"description": "A command-line tool or agent plugin with no window, no background engine and no paid tier (e.g. Legion). It owes the rows every process that runs on a user's machine needs; window, app-frame, engine-supervision, local-service, licence, entitlement, legal-UI and agent-surface rows are desktop concerns.",
|
|
32
|
+
"ratified": true,
|
|
33
|
+
"ratifiedBy": "Adrian, 2026-11-05, typed in the Legion chat (pulse chat said): \"2 yes tell buggy to fix that in rk for cli tool\", answering whether Legion, a command-line tool, must owe every desktop row M1-M20 (OW-05).",
|
|
34
|
+
"notOwed": {
|
|
35
|
+
"M1": "no window host",
|
|
36
|
+
"M2": "no app frame",
|
|
37
|
+
"M3": "no supervised background engine",
|
|
38
|
+
"M4": "no window-to-engine protocol",
|
|
39
|
+
"M6": "its owner is the desktop daemon; a CLI keeps its data under the settings state root (M10)",
|
|
40
|
+
"M7": "no local services",
|
|
41
|
+
"M12": "no licence or device binding (a paid CLI uses the desktop profile)",
|
|
42
|
+
"M13": "no Pro tier",
|
|
43
|
+
"M14": "no legal or onboarding UI",
|
|
44
|
+
"M22": "no agent surface of its own"
|
|
45
|
+
},
|
|
46
|
+
"ownersDropped": {
|
|
47
|
+
"@rightkit/settings-ui": "desktop settings UI package; a CLI has no UI to own it",
|
|
48
|
+
"@rightkit/logs": "desktop web/UI log view package; a CLI has no UI to own it",
|
|
49
|
+
"@rightkit/qa": "desktop app UI QA package; a CLI has no UI to own it",
|
|
50
|
+
"@rightkit/qa-chrome": "desktop browser QA package; a CLI has no UI to own it"
|
|
51
|
+
}
|
|
29
52
|
}
|
|
30
53
|
},
|
|
31
54
|
"rows": [
|
|
@@ -389,6 +412,138 @@
|
|
|
389
412
|
"registryMax": "0.2.0"
|
|
390
413
|
}
|
|
391
414
|
]
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"id": "M5",
|
|
418
|
+
"name": "Other child processes",
|
|
419
|
+
"profile": "cli",
|
|
420
|
+
"owners": [
|
|
421
|
+
{
|
|
422
|
+
"name": "rightkit-child-process",
|
|
423
|
+
"ecosystem": "cargo",
|
|
424
|
+
"min": "0.5.2",
|
|
425
|
+
"registryMax": "0.5.2"
|
|
426
|
+
}
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"id": "M8",
|
|
431
|
+
"name": "Safe file writes",
|
|
432
|
+
"profile": "cli",
|
|
433
|
+
"owners": [
|
|
434
|
+
{
|
|
435
|
+
"name": "rightkit-fs",
|
|
436
|
+
"ecosystem": "cargo",
|
|
437
|
+
"min": "0.4.4",
|
|
438
|
+
"registryMax": "0.4.4"
|
|
439
|
+
}
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"id": "M9",
|
|
444
|
+
"name": "Database",
|
|
445
|
+
"profile": "cli",
|
|
446
|
+
"owners": [
|
|
447
|
+
{
|
|
448
|
+
"name": "rightkit-db",
|
|
449
|
+
"ecosystem": "cargo",
|
|
450
|
+
"min": "0.5.0",
|
|
451
|
+
"registryMax": "0.5.0"
|
|
452
|
+
}
|
|
453
|
+
]
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"id": "M10",
|
|
457
|
+
"name": "Settings",
|
|
458
|
+
"profile": "cli",
|
|
459
|
+
"owners": [
|
|
460
|
+
{
|
|
461
|
+
"name": "rightkit-app-settings",
|
|
462
|
+
"ecosystem": "cargo",
|
|
463
|
+
"min": "0.2.4",
|
|
464
|
+
"registryMax": "0.2.4"
|
|
465
|
+
}
|
|
466
|
+
]
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"id": "M11",
|
|
470
|
+
"name": "Secrets",
|
|
471
|
+
"profile": "cli",
|
|
472
|
+
"owners": [
|
|
473
|
+
{
|
|
474
|
+
"name": "rightkit-credentials",
|
|
475
|
+
"ecosystem": "cargo",
|
|
476
|
+
"min": "0.4.2",
|
|
477
|
+
"registryMax": "0.4.2"
|
|
478
|
+
}
|
|
479
|
+
]
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"id": "M15",
|
|
483
|
+
"name": "Logging",
|
|
484
|
+
"profile": "cli",
|
|
485
|
+
"owners": [
|
|
486
|
+
{
|
|
487
|
+
"name": "rightkit-logs",
|
|
488
|
+
"ecosystem": "cargo",
|
|
489
|
+
"min": "0.3.3",
|
|
490
|
+
"registryMax": "0.3.3"
|
|
491
|
+
}
|
|
492
|
+
]
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"id": "M16",
|
|
496
|
+
"name": "Crash reporting",
|
|
497
|
+
"profile": "cli",
|
|
498
|
+
"owners": [
|
|
499
|
+
{
|
|
500
|
+
"name": "rightkit-crash",
|
|
501
|
+
"ecosystem": "cargo",
|
|
502
|
+
"min": "0.3.3",
|
|
503
|
+
"registryMax": "0.3.3"
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"id": "M17",
|
|
509
|
+
"name": "HTTP",
|
|
510
|
+
"profile": "cli",
|
|
511
|
+
"owners": [
|
|
512
|
+
{
|
|
513
|
+
"name": "rightkit-http",
|
|
514
|
+
"ecosystem": "cargo",
|
|
515
|
+
"min": "0.3.6",
|
|
516
|
+
"registryMax": "0.3.6"
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"id": "M19",
|
|
522
|
+
"name": "Release tooling",
|
|
523
|
+
"profile": "cli",
|
|
524
|
+
"owners": [
|
|
525
|
+
{
|
|
526
|
+
"name": "@rightkit/release",
|
|
527
|
+
"ecosystem": "npm",
|
|
528
|
+
"min": "0.4.1",
|
|
529
|
+
"registryMax": "0.4.1",
|
|
530
|
+
"allowDev": true
|
|
531
|
+
}
|
|
532
|
+
]
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
"id": "M20",
|
|
536
|
+
"name": "QA",
|
|
537
|
+
"profile": "cli",
|
|
538
|
+
"owners": [
|
|
539
|
+
{
|
|
540
|
+
"name": "rightkit-qa",
|
|
541
|
+
"ecosystem": "cargo",
|
|
542
|
+
"min": "0.7.0",
|
|
543
|
+
"registryMax": "0.7.0",
|
|
544
|
+
"allowDev": true
|
|
545
|
+
}
|
|
546
|
+
]
|
|
392
547
|
}
|
|
393
548
|
],
|
|
394
549
|
"pendingRows": [
|
|
@@ -476,6 +631,13 @@
|
|
|
476
631
|
"allowDev": true
|
|
477
632
|
}
|
|
478
633
|
]
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
"id": "M18",
|
|
637
|
+
"name": "Updates",
|
|
638
|
+
"profile": "cli",
|
|
639
|
+
"ownerPending": "A CLI shipped as a DMG or setup.exe updates itself, but @rightkit/app-update is the desktop updater UI; a CLI updater owner is not chosen yet.",
|
|
640
|
+
"pendingOwners": []
|
|
479
641
|
}
|
|
480
642
|
],
|
|
481
643
|
"applicabilityRecords": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// Mode switching of the ownership gate itself (Report -> Enforce) is a separate step; this check
|
|
9
9
|
// is read-only and never changes ownership mode.
|
|
10
10
|
//
|
|
11
|
-
// right-release ownership-mandatory [--workspace <dir>] [--app <name|dir>]... [--profile desktop|apple]
|
|
11
|
+
// right-release ownership-mandatory [--workspace <dir>] [--app <name|dir>]... [--profile desktop|apple|cli]
|
|
12
12
|
// [--amendment v2.1] [--enforce] [--json]
|
|
13
13
|
//
|
|
14
14
|
// App-side declaration (optional): <app>/rightkit-mandatory.json
|
package/package.json
CHANGED
package/qa-runner.mjs
CHANGED
|
@@ -137,7 +137,7 @@ export function main(argv, { out = (m) => process.stdout.write(`${m}\n`), err =
|
|
|
137
137
|
const opt = (name) => { const i = rest.indexOf(name); return i < 0 ? undefined : rest[i + 1]; };
|
|
138
138
|
try {
|
|
139
139
|
const platform = opt("--platform") ?? HOST_PLATFORM[process.platform];
|
|
140
|
-
const dataRoot = opt("--data-root") ?? resolveManagedRoots({ env }).
|
|
140
|
+
const dataRoot = opt("--data-root") ?? resolveManagedRoots({ env }).gateRoot;
|
|
141
141
|
if (command === "enroll") {
|
|
142
142
|
const r = enrollQaRunner({ dataRoot, platform, runner: opt("--runner") && path.resolve(opt("--runner")), version: opt("--version"), rotate: rest.includes("--rotate"), ...(spawn ? { spawn } : {}) });
|
|
143
143
|
out(`enrolled rightkit-qa ${r.entry.version} for ${platform} (sha256 ${r.entry.sha256}) at ${r.runnerFile}${r.rotated ? " (rotation)" : ""}; approve it for admission with \`right-release qa policy approve-runner --runner ${r.runnerFile} --version ${r.entry.version} --platform ${platform} --set-by <name>\``);
|
package/release-qa-command.mjs
CHANGED
|
@@ -168,7 +168,7 @@ export async function runQa({ stage, platform, releaseIdArg, configPath, deps =
|
|
|
168
168
|
let runnerFile = deps.runnerFile;
|
|
169
169
|
if (!runnerFile) {
|
|
170
170
|
if (!config.qa.runner && isRunnerVersion(config.qa.version)) {
|
|
171
|
-
managedRunner = (deps.resolveManagedRunner ?? resolveManagedQaRunner)({ dataRoot: resolveManagedRoots({ env: deps.env ?? process.env }).
|
|
171
|
+
managedRunner = (deps.resolveManagedRunner ?? resolveManagedQaRunner)({ dataRoot: resolveManagedRoots({ env: deps.env ?? process.env }).gateRoot, platform, version: String(config.qa.version) });
|
|
172
172
|
runnerFile = managedRunner.file;
|
|
173
173
|
} else runnerFile = resolveRunner({ qa: config.qa, appRoot });
|
|
174
174
|
}
|
|
@@ -28,8 +28,9 @@ export function signingAgentPaths(home = os.userInfo().homedir) {
|
|
|
28
28
|
config: path.join(directory, "config.json"), runtime: path.join(directory, "runtime"),
|
|
29
29
|
log: path.join(directory, "requests.jsonl"), plist: path.join(home, "Library/LaunchAgents", `${AGENT_LABEL}.plist`) };
|
|
30
30
|
}
|
|
31
|
-
export function defaultSigningRoots(home = os.userInfo().homedir, managedRoot = resolveManagedRoots({ home }).
|
|
32
|
-
|
|
31
|
+
export function defaultSigningRoots(home = os.userInfo().homedir, managedRoot = resolveManagedRoots({ home }).gateRoot, cargoTargetDirs = []) {
|
|
32
|
+
// Both the gate root (RightKit's data) and the broker's data root stay allowed: a root missing from the list refuses a signing request, and a host's roots differ before and after the managed-roots migration.
|
|
33
|
+
return [...new Set(["/Volumes/D/claude", managedRoot, resolveManagedRoots({ home }).dataRoot, "/Volumes/D/rightkit-build-control",
|
|
33
34
|
path.join(home, "Library/Caches/RightSuite/release"), "/tmp", "/private/tmp", os.tmpdir(), ...cargoTargetDirs])];
|
|
34
35
|
}
|
|
35
36
|
export const within = (root, file) => file === root || file.startsWith(`${root}${path.sep}`);
|
package/rightkit-versions.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@rightkit/qa": "0.7.0",
|
|
51
51
|
"@rightkit/qa-chrome": "0.1.12",
|
|
52
52
|
"@rightkit/react-shell": "0.7.3",
|
|
53
|
-
"@rightkit/release": "0.6.
|
|
53
|
+
"@rightkit/release": "0.6.49",
|
|
54
54
|
"@rightkit/settings-ui": "0.7.1",
|
|
55
55
|
"@rightkit/social-ui": "0.1.0",
|
|
56
56
|
"@rightkit/system-ui": "0.1.0",
|
|
@@ -30,7 +30,7 @@ export function signingAgentPlist({ paths, node = process.execPath, home }) {
|
|
|
30
30
|
}
|
|
31
31
|
export function installSigningAgent({ home = os.userInfo().homedir, username = os.userInfo().username,
|
|
32
32
|
uid = process.getuid?.(), platform = process.platform, run = spawnSync, io = fs, node = process.execPath,
|
|
33
|
-
managedRoot = resolveManagedRoots({ home }).
|
|
33
|
+
managedRoot = resolveManagedRoots({ home }).gateRoot, cargoTargetDirs = [], health = requestSigningAgentSync,
|
|
34
34
|
now = Date.now, sleep = (ms) => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms) } = {}) {
|
|
35
35
|
if (platform !== "darwin") throw new SigningAgentError("MAC_SIGNING_AGENT_PLATFORM", "Signing agent requires macOS");
|
|
36
36
|
requireMacGuiSession({ run, uid });
|
package/snapshot-broker.mjs
CHANGED
|
@@ -47,7 +47,8 @@ export const BROKER_REFUSAL_STATUS = 101;
|
|
|
47
47
|
export const CALLING_GATE_ENV = "RUSTRIGHT_CALLING_GATE";
|
|
48
48
|
|
|
49
49
|
/** The managed `ws` roots a broker pins its generation targets under (BROKER-CONTRACT output pinning). */
|
|
50
|
-
|
|
50
|
+
/** The broker pins outputs under its build directory (`<data root>/build-control`, `rightkit-build-control` on a host that has not migrated): `buildControl` is the resolver's. */
|
|
51
|
+
export const brokerOutputRoots = ({ buildControl }) => [path.join(buildControl, "ws")];
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
54
|
* The longest a read waits for a job that is still live although its client already exited (A7). The client can return before the broker
|
|
@@ -114,8 +115,10 @@ export function createSnapshotBroker({ env = process.env, platform = process.pla
|
|
|
114
115
|
// so no child re-resolves (or spawns) a .cmd (broker-client.mjs). A shim of any other shape refuses with RK_BROKER_CLIENT_UNRESOLVED.
|
|
115
116
|
try { client = resolveBrokerClient(client, { platform }).file; } catch (e) { throw new SnapshotRequestError(e.code ?? BROKER_CLIENT_UNRESOLVED, e.message); }
|
|
116
117
|
const roots = resolveManagedRoots({ env, platform });
|
|
117
|
-
|
|
118
|
-
const
|
|
118
|
+
// `dataRoot` injected names ONE root for everything (a lab or a test); otherwise the pins are RightKit's (gate root) and the outputs the broker's (its build directory).
|
|
119
|
+
const pinsRoot = dataRoot ?? roots.gateRoot;
|
|
120
|
+
const buildControl = dataRoot === undefined ? roots.buildControl : resolveManagedRoots({ env, platform, dataRoot }).buildControl;
|
|
121
|
+
const pins = loadPins({ dataRoot: pinsRoot, platform, gateFile, checkout, spawn });
|
|
119
122
|
// GB-76: carriers a crashed gate left behind are retired on proof (creator dead, nothing live or unknown at the broker under their sub-handle), counted otherwise. Best-effort: a
|
|
120
123
|
// sweep that cannot run never stops a build, and nothing is deleted without proof.
|
|
121
124
|
let carrierSweep = null;
|
|
@@ -125,7 +128,7 @@ export function createSnapshotBroker({ env = process.env, platform = process.pla
|
|
|
125
128
|
controlRoot: roots.controlRoot, commit: { sha: commit.sha, tree: commit.tree }, snapshot: { path: snapshot.path, expectedTree: snapshot.expectedTree },
|
|
126
129
|
declaredInputs: readDeclaredInputs(snapshot.path), handle: ownership.handle, markBrokerSubmit: (callHandle, note) => ownership.markBrokerSubmit(callHandle, note), markBrokerUnsent: typeof ownership.markBrokerUnsent === "function" ? (callHandle, reason) => ownership.markBrokerUnsent(callHandle, reason) : undefined,
|
|
127
130
|
pins: { host: pins.host, keyId: pins.keyId, publicKey: pins.publicKey, brokerDigest: pins.brokerDigest }, pinsSource: pins.source,
|
|
128
|
-
checkout: fs.realpathSync.native(checkout), outputRoots: brokerOutputRoots({
|
|
131
|
+
checkout: fs.realpathSync.native(checkout), outputRoots: brokerOutputRoots({ buildControl }), platform, client,
|
|
129
132
|
receiptOf: async (requestId) => receiptSync({ client, requestId, env, spawn, platform }),
|
|
130
133
|
// The broker's lease status of one sub-handle (SNAPSHOT_LEASE_STATUS, with the bounded wait): what a cancelled call is reconciled against.
|
|
131
134
|
...(typeof lease === "function" ? { leaseStatus: ({ handle, waitMs = 0 }) => lease({ snapshot: snapshot.path, handle, env, platform, spawn, client, waitMs }) } : {}),
|
package/snapshot-git.mjs
CHANGED
|
@@ -171,5 +171,26 @@ export function sealedRepoInfo(checkout) {
|
|
|
171
171
|
/** A single sealed git command against `checkout`'s object database (T is made and removed around it). Returns the spawn result. */
|
|
172
172
|
export function sealedRun(checkout, args, options = {}) {
|
|
173
173
|
const info = options.repo ?? sealedRepoInfo(checkout);
|
|
174
|
-
|
|
174
|
+
// A full tree listing of a commit named by its full object id is immutable: one gate run asked for the same listing 11 times
|
|
175
|
+
// (HeardRight warm check, 0.9 s), so a successful one is reused within this process. Keyed on the object database, the exact
|
|
176
|
+
// arguments and the output encoding; at most TREE_LISTING_MEMO_MAX listings are kept.
|
|
177
|
+
const memoKey = immutableListingKey(info, args, options);
|
|
178
|
+
if (memoKey !== null && treeListingMemo.has(memoKey)) return { ...treeListingMemo.get(memoKey) };
|
|
179
|
+
const result = withSealedGit({ ...info, snapshot: options.snapshot }, (git) => git.run(args, options));
|
|
180
|
+
if (memoKey !== null && result && result.status === 0 && !result.error) {
|
|
181
|
+
if (treeListingMemo.size >= TREE_LISTING_MEMO_MAX) treeListingMemo.delete(treeListingMemo.keys().next().value);
|
|
182
|
+
treeListingMemo.set(memoKey, result);
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const TREE_LISTING_MEMO_MAX = 4;
|
|
188
|
+
const treeListingMemo = new Map();
|
|
189
|
+
/** The memo key of an `ls-tree -r ... --full-tree <full object id>` call, or null for anything else (never cached). */
|
|
190
|
+
function immutableListingKey(info, args, options) {
|
|
191
|
+
if (!Array.isArray(args) || args[0] !== "ls-tree" || !args.includes("-r") || !args.includes("--full-tree")) return null;
|
|
192
|
+
const target = args[args.length - 1];
|
|
193
|
+
if (!/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(String(target))) return null;
|
|
194
|
+
if (args.slice(1, -1).some((a) => !/^-/.test(String(a)))) return null;
|
|
195
|
+
return JSON.stringify([info.commonDir, info.objectFormat, args, options.encoding ?? null, options.maxBuffer ?? null]);
|
|
175
196
|
}
|
package/snapshot.mjs
CHANGED
|
@@ -127,7 +127,7 @@ export function snapshotRoot({ platform = process.platform, env = process.env, h
|
|
|
127
127
|
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
128
128
|
let root; let source;
|
|
129
129
|
if (platform === "darwin" || platform === "win32") {
|
|
130
|
-
const base = resolveManagedRoots({ env: {}, platform, home }).
|
|
130
|
+
const base = resolveManagedRoots({ env: {}, platform, home }).gateRoot;
|
|
131
131
|
root = paths.join(base, "snapshots");
|
|
132
132
|
source = `the host's managed root ${base}`;
|
|
133
133
|
} else {
|
|
@@ -158,7 +158,7 @@ const foldHost = (platform) => (platform === "darwin" || platform === "win32" ?
|
|
|
158
158
|
export function hostManagedRootFor(root, { platform = process.platform, home = os.homedir() } = {}) {
|
|
159
159
|
if (platform !== "darwin" && platform !== "win32") return null;
|
|
160
160
|
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
161
|
-
const managed = resolveManagedRoots({ env: {}, platform, home }).
|
|
161
|
+
const managed = resolveManagedRoots({ env: {}, platform, home }).gateRoot;
|
|
162
162
|
const fold = foldHost(platform);
|
|
163
163
|
return isInside(fold(paths.resolve(root)), fold(paths.resolve(managed)), paths) ? managed : null;
|
|
164
164
|
}
|
|
@@ -594,6 +594,12 @@ function inspectSnapshot({ dir, entries, checkout, commit, platform = process.pl
|
|
|
594
594
|
|
|
595
595
|
// The ledger's entries, keyed like the walk's, must all be here and byte-identical; anything else the walk met is new.
|
|
596
596
|
const held = new Map((ledger ?? []).map((e) => [fold(e.path), e]));
|
|
597
|
+
// A tool-created empty directory the commit's own ignore rules ignore (xcodebuild's `.swiftpm/xcode`) holds no byte and is no ledger entry: dropped here, deepest first so a
|
|
598
|
+
// directory left holding only such directories goes too. One the rules do not ignore stays a candidate and is refused below, as are reserved paths (refused above).
|
|
599
|
+
const ignored = neutralIgnored(dir, candidates.map((c) => c.path));
|
|
600
|
+
for (const d of candidates.filter((c) => c.type === "dir" && ignored.has(c.path) && !held.has(fold(c.path))).sort((a, b) => b.path.length - a.path.length)) {
|
|
601
|
+
if (!candidates.some((c) => c !== d && c.path.startsWith(`${d.path}/`))) candidates.splice(candidates.indexOf(d), 1);
|
|
602
|
+
}
|
|
597
603
|
const seen = new Map(candidates.map((c) => [fold(c.path), c]));
|
|
598
604
|
for (const [key, want] of held) {
|
|
599
605
|
const have = seen.get(key);
|
|
@@ -609,8 +615,7 @@ function inspectSnapshot({ dir, entries, checkout, commit, platform = process.pl
|
|
|
609
615
|
const key = fold(c.path);
|
|
610
616
|
if (!held.has(key) && !(c.type === "dir" && parents.has(key)) && !admitNew) return problem(`${c.path} is not in the commit's tree and not in the stage-output ledger (new stage outputs are admitted only at the end of a stage)`);
|
|
611
617
|
}
|
|
612
|
-
// Every candidate, ledger or new, must be ignored by the commit's own rules, as the neutral oracle judges them.
|
|
613
|
-
const ignored = neutralIgnored(dir, candidates.map((c) => c.path));
|
|
618
|
+
// Every candidate, ledger or new, must be ignored by the commit's own rules, as the neutral oracle judges them (`ignored`, above).
|
|
614
619
|
// Git's own semantics for a directory: `git status` shows nothing for one whose every entry is ignored (or that holds nothing), even
|
|
615
620
|
// when no rule names the directory itself (a root rule `src-tauri/gen/schemas/` leaves `src-tauri/gen` unnamed). Judged deepest
|
|
616
621
|
// first, so a directory counts as ignored exactly when every file and subdirectory below it does; a single unignored file still refuses.
|
package/spawn-ledger.mjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// The gate's spawn ledger (GATE-CONTRACT GC-A27 NN07-NN12, NN16): when RK_GATE_SPAWN_LEDGER names a file, every child process this
|
|
2
|
+
// Node process starts is appended to it as one JSON line {pid, at, ms, sync, cmd, args, cwd, status}. The acceptance runner reads it to
|
|
3
|
+
// prove a run starts no identical process twice, no `cargo fmt`, no broker-carried non-compiling cargo and no repeat install.
|
|
4
|
+
// The variable is RK_GATE_*, which no cache key reads (bin/rightkit-gate.mjs BUILD_ENV_EXCLUDED), so turning it on changes no result.
|
|
5
|
+
// The environment is never recorded. Children inherit the variable, so a nested gate or right-release that installs the ledger appends too.
|
|
6
|
+
import childProcess from "node:child_process";
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import module from "node:module";
|
|
9
|
+
|
|
10
|
+
let installed = false;
|
|
11
|
+
|
|
12
|
+
/** Patch node:child_process once so every caller (default or named import) is recorded. No-op without RK_GATE_SPAWN_LEDGER. */
|
|
13
|
+
export function installSpawnLedger(env = process.env) {
|
|
14
|
+
const file = env.RK_GATE_SPAWN_LEDGER;
|
|
15
|
+
if (installed || typeof file !== "string" || file === "") return false;
|
|
16
|
+
installed = true;
|
|
17
|
+
const write = (entry) => { try { fs.appendFileSync(file, `${JSON.stringify(entry)}\n`); } catch { /* the ledger never fails a run */ } };
|
|
18
|
+
const describe = (cmd, args, options) => {
|
|
19
|
+
const argv = Array.isArray(args) ? args.map(String) : [];
|
|
20
|
+
const opts = Array.isArray(args) ? options : args;
|
|
21
|
+
return { cmd: String(cmd), args: argv.join("\u0000").length > 4000 ? [...argv.slice(0, 40), `... ${argv.length} args`] : argv, cwd: typeof opts?.cwd === "string" ? opts.cwd : process.cwd() };
|
|
22
|
+
};
|
|
23
|
+
for (const name of ["spawnSync", "execFileSync", "execSync"]) {
|
|
24
|
+
const orig = childProcess[name];
|
|
25
|
+
childProcess[name] = function ledgered(cmd, args, options) {
|
|
26
|
+
const started = Date.now();
|
|
27
|
+
let status = null;
|
|
28
|
+
try { const r = orig.apply(this, arguments); status = r && typeof r === "object" && "status" in r ? r.status : 0; return r; }
|
|
29
|
+
catch (error) { status = error?.status ?? "throw"; throw error; }
|
|
30
|
+
finally { write({ pid: process.pid, at: new Date(started).toISOString(), ms: Date.now() - started, sync: true, ...describe(cmd, name === "execSync" ? [] : args, name === "execSync" ? args : options), status }); }
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
for (const name of ["spawn", "execFile", "exec", "fork"]) {
|
|
34
|
+
const orig = childProcess[name];
|
|
35
|
+
childProcess[name] = function ledgered(cmd, args, options) {
|
|
36
|
+
const started = Date.now();
|
|
37
|
+
const child = orig.apply(this, arguments);
|
|
38
|
+
const base = { pid: process.pid, at: new Date(started).toISOString(), sync: false, ...describe(name === "fork" ? process.execPath : cmd, name === "fork" ? [cmd, ...(Array.isArray(args) ? args : [])] : name === "exec" ? [] : args, name === "exec" ? args : options) };
|
|
39
|
+
if (child && typeof child.once === "function") child.once("close", (code, signal) => write({ ...base, ms: Date.now() - started, status: code ?? signal }));
|
|
40
|
+
else write({ ...base, ms: null, status: null });
|
|
41
|
+
return child;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
module.syncBuiltinESMExports();
|
|
45
|
+
return true;
|
|
46
|
+
}
|
package/stage-ledger.mjs
CHANGED
|
@@ -55,7 +55,7 @@ export function neutralIgnored({ dir, paths, run = spawnSync, env = process.env
|
|
|
55
55
|
* Walks `dir` and returns what it holds beyond the commit: `{ entries, problems }`. `tracked` is the set of every path in
|
|
56
56
|
* `ls-tree <commit>` (posix); `dependencyRoots` the `node_modules` directories the gate installed under 5.09a (posix, relative; their
|
|
57
57
|
* bytes are bound by the class A environment digest, not here). `entries` are admissible ledger entries; `problems` name every write
|
|
58
|
-
* that cannot be one (not ignored, a link, a hard link, reserved, an empty directory, a `.git` holding more than the gate's config).
|
|
58
|
+
* that cannot be one (not ignored, a link, a hard link, reserved, an empty directory the commit's ignore rules do not ignore, a `.git` holding more than the gate's config).
|
|
59
59
|
*/
|
|
60
60
|
export function walkSnapshot({ dir, tracked, dependencyRoots = new Set(), run = spawnSync, env = process.env, platform = process.platform }) {
|
|
61
61
|
const f = fold(platform);
|
|
@@ -63,7 +63,7 @@ export function walkSnapshot({ dir, tracked, dependencyRoots = new Set(), run =
|
|
|
63
63
|
const trackedDirs = new Set();
|
|
64
64
|
for (const p of tracked) { const parts = f(p).split("/"); for (let i = 1; i < parts.length; i++) trackedDirs.add(parts.slice(0, i).join("/")); }
|
|
65
65
|
const deps = new Set([...dependencyRoots].map(f));
|
|
66
|
-
const candidates = []; const problems = [];
|
|
66
|
+
const candidates = []; const problems = []; const emptyDirs = [];
|
|
67
67
|
const reserved = (rel) => rel.split("/").find((seg) => LEDGER_RESERVED_SEGMENTS.includes(f(seg)));
|
|
68
68
|
const walk = (abs, rel) => {
|
|
69
69
|
let names;
|
|
@@ -90,9 +90,10 @@ export function walkSnapshot({ dir, tracked, dependencyRoots = new Set(), run =
|
|
|
90
90
|
if (trackedDirs.has(key)) { walk(p, r); continue; }
|
|
91
91
|
const bad = reserved(r);
|
|
92
92
|
if (bad) { problems.push(`${r} is under the reserved path segment ${JSON.stringify(bad)} (a stage output is never written there)`); continue; }
|
|
93
|
-
const before = candidates.length + problems.length;
|
|
93
|
+
const before = candidates.length + problems.length + emptyDirs.length;
|
|
94
94
|
walk(p, r);
|
|
95
|
-
|
|
95
|
+
// A tool-created empty directory (xcodebuild's `.swiftpm/xcode`) holds no byte: it is judged below like a file, admitted when the commit's own ignore rules ignore it.
|
|
96
|
+
if (candidates.length + problems.length + emptyDirs.length === before) emptyDirs.push(r);
|
|
96
97
|
continue;
|
|
97
98
|
}
|
|
98
99
|
if (!st.isFile()) { problems.push(`${r} is neither a regular file nor a directory`); continue; }
|
|
@@ -110,9 +111,10 @@ export function walkSnapshot({ dir, tracked, dependencyRoots = new Set(), run =
|
|
|
110
111
|
};
|
|
111
112
|
walk(dir, "");
|
|
112
113
|
let ignored;
|
|
113
|
-
try { ignored = neutralIgnored({ dir, paths: candidates.map((c) => c.rel), run, env }); }
|
|
114
|
+
try { ignored = neutralIgnored({ dir, paths: [...candidates.map((c) => c.rel), ...emptyDirs], run, env }); }
|
|
114
115
|
catch (e) { return { entries: [], problems: [...problems, `the ignore rules of the commit could not be evaluated: ${e.message}`] }; }
|
|
115
116
|
const ignoredFolded = new Set([...ignored].map(f));
|
|
117
|
+
for (const d of emptyDirs) if (!ignoredFolded.has(f(d))) problems.push(`${d} is an empty directory the commit does not have and the commit's own ignore rules do not ignore (an empty directory is admitted only when they do)`);
|
|
116
118
|
const entries = [];
|
|
117
119
|
for (const c of candidates) {
|
|
118
120
|
// A split package stage writes a declared root output (a DMG, an updater tarball) into the snapshot as a generated entry (row 7.04c R-T2 rule 5): it must be
|