@smoothbricks/nx-plugin 0.5.0 → 0.5.2
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 +107 -46
- package/dist/bin/smoo-nx-test-clocks.js +2 -2
- package/dist/bin/smoo-nx-test-walks.js +6 -9
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +25 -15
- package/dist/ensure-built-witness.d.ts +33 -5
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +84 -18
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +33 -14
- package/dist/executors/bounded-exec/cpu-pool.d.ts +14 -7
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +297 -38
- package/dist/executors/bounded-exec/cpu-tokens.d.ts +19 -7
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-tokens.js +21 -7
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +12 -6
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/owned-installation.d.ts +6 -5
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +324 -201
- package/dist/producer-receipts.d.ts +10 -0
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +30 -5
- package/dist/test-walk-policy.d.ts +8 -0
- package/dist/test-walk-policy.d.ts.map +1 -1
- package/dist/test-walk-policy.js +34 -0
- package/dist/workspace-manifest.d.ts +5 -5
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/managed/raw/patches/nx@23.2.1.patch +14 -3
- package/managed/raw/tooling/direnv/developer-links.ts +37 -10
- package/managed/raw/tooling/direnv/devenv.smoo.nix +1 -3
- package/managed/raw/tooling/direnv/linked-snapshots.ts +49 -12
- package/managed/raw/tooling/direnv/repo-path +1 -1
- package/managed/raw/tooling/direnv/setup-environment.ts +2 -0
- package/managed/raw/tooling/git-hooks/pre-push.sh +34 -11
- package/package.json +3 -3
- package/runtime-input.sh +21 -9
- package/src/__tests__/cargo-closure-filesets.ts +94 -0
- package/src/__tests__/counted-cargo.ts +1 -1
- package/src/__tests__/owned-installation.ts +5 -6
- package/src/bin/smoo-nx-test-clocks.ts +2 -2
- package/src/bin/smoo-nx-test-walks.ts +6 -9
- package/src/cargo-closure-filesets.test.ts +63 -0
- package/src/cargo-closure-input.test.ts +2 -2
- package/src/cargo-closure-input.ts +23 -15
- package/src/cargo-closure-key.test.ts +1 -1
- package/src/cargo-resolve-cache.test.ts +1 -1
- package/src/cross-check-policy.test.ts +53 -12
- package/src/ensure-built-witness.test.ts +53 -2
- package/src/ensure-built-witness.ts +103 -18
- package/src/ensure-built.test.ts +79 -5
- package/src/ensure-built.ts +51 -15
- package/src/executors/bounded-exec/cpu-pool.test.ts +132 -4
- package/src/executors/bounded-exec/cpu-pool.ts +300 -46
- package/src/executors/bounded-exec/cpu-tokens.test.ts +60 -15
- package/src/executors/bounded-exec/cpu-tokens.ts +34 -11
- package/src/executors/bounded-exec/executor.test.ts +72 -4
- package/src/executors/bounded-exec/executor.ts +12 -6
- package/src/executors/bounded-exec/run-cpu-pool.test.ts +3 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +5 -4
- package/src/index.ts +4 -0
- package/src/linked-snapshots.nx.test.ts +1 -1
- package/src/nextest-partitions.test.ts +1 -1
- package/src/nx-daemon-validity.test.ts +51 -0
- package/src/owned-installation.test.ts +105 -0
- package/src/owned-installation.ts +335 -93
- package/src/producer-receipts.test.ts +37 -15
- package/src/producer-receipts.ts +29 -5
- package/src/runtime-input.test.ts +22 -1
- package/src/task-results.test.ts +1 -1
- package/src/test-walk-policy.test.ts +35 -0
- package/src/test-walk-policy.ts +32 -0
- package/src/workspace-manifest.ts +5 -5
- package/test-timings.json +94 -92
|
@@ -7,6 +7,16 @@ import { createWorkspaceNxRequire, parseTargetSelector, providerInputProof, sele
|
|
|
7
7
|
import { captureProducerSource, producerOutputPaths, providerReceipt, receiptNode, } from './ensure-built-receipt.js';
|
|
8
8
|
import { censusStart, graphInstallationIdentity, movedNodes, workspaceSnapshot, } from './ensure-built-witness.js';
|
|
9
9
|
import { graphInputContractIdentity } from './graph-input-contract.js';
|
|
10
|
+
/**
|
|
11
|
+
* Where a checkout keeps its producer records, relative to its root: in its own source tree, never in Nx's
|
|
12
|
+
* workspace-data. Under cowshed that directory is build state on the checkout's build volume
|
|
13
|
+
* (specs/cowshed/16_build_volumes.md), and a consumer's read grant of the provider checkout does not reach a volume
|
|
14
|
+
* the checkout only links to (specs/cowshed/04_sandbox.md, "Read grants have one narrow meaning"), so a consumer
|
|
15
|
+
* could never read the receipt it is asked to validate. The directory ignores itself (a `.gitignore` of `*` written
|
|
16
|
+
* with its first record), so in any checkout git never tracks a record and Nx's file walk never hashes one: a record
|
|
17
|
+
* is no source or input of the run that publishes it.
|
|
18
|
+
*/
|
|
19
|
+
export const PRODUCER_RECORDS = join('.cache', 'producer-receipts');
|
|
10
20
|
const runs = new Map();
|
|
11
21
|
function sha(value) {
|
|
12
22
|
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
@@ -19,13 +29,15 @@ function configured(options) {
|
|
|
19
29
|
* its products never replaces the receipt an earlier run published: readers validate that receipt on its own evidence.
|
|
20
30
|
*/
|
|
21
31
|
function recordPath(root, target, disposition) {
|
|
22
|
-
|
|
23
|
-
return join(load('nx/src/utils/cache-directory').workspaceDataDirectoryForWorkspace(root), `producer-${disposition === 'published' ? 'receipt' : 'refusal'}-${sha(target)}.json`);
|
|
32
|
+
return join(root, PRODUCER_RECORDS, `producer-${disposition === 'published' ? 'receipt' : 'refusal'}-${sha(target)}.json`);
|
|
24
33
|
}
|
|
25
34
|
function publish(root, target, record) {
|
|
26
35
|
try {
|
|
27
36
|
const path = recordPath(root, target, record.disposition);
|
|
28
|
-
|
|
37
|
+
const records = dirname(path);
|
|
38
|
+
mkdirSync(records, { recursive: true });
|
|
39
|
+
if (!existsSync(join(records, '.gitignore')))
|
|
40
|
+
writeFileSync(join(records, '.gitignore'), '*\n');
|
|
29
41
|
const temporary = `${path}.${randomUUID()}`;
|
|
30
42
|
try {
|
|
31
43
|
writeFileSync(temporary, JSON.stringify(record), { flag: 'wx', mode: 0o600 });
|
|
@@ -443,6 +455,19 @@ function latestRefusal(root, target) {
|
|
|
443
455
|
}
|
|
444
456
|
}
|
|
445
457
|
function validatedReceipt(root, target) {
|
|
458
|
+
const path = recordPath(root, target, 'published');
|
|
459
|
+
let text;
|
|
460
|
+
try {
|
|
461
|
+
text = readFileSync(path, 'utf8');
|
|
462
|
+
}
|
|
463
|
+
catch (error) {
|
|
464
|
+
// No receipt is a producer that never published one; any other failure is a receipt this reader cannot reach.
|
|
465
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
466
|
+
return { ok: false, detail: `No producer completion receipt at ${path}` };
|
|
467
|
+
if (error instanceof Error)
|
|
468
|
+
return { ok: false, detail: `Cannot read producer completion receipt: ${error.message}` };
|
|
469
|
+
throw error;
|
|
470
|
+
}
|
|
446
471
|
try {
|
|
447
472
|
const record = (() => {
|
|
448
473
|
const _ip0 = (input, _vctx = {}) => 1 === input["version"];
|
|
@@ -863,9 +888,9 @@ function validatedReceipt(root, target) {
|
|
|
863
888
|
})();
|
|
864
889
|
const __is = (input, _vctx = {}) => "object" === typeof input && null !== input && _io0(input, _vctx);
|
|
865
890
|
return input => { input = JSON.parse(input); return __is(input) ? input : null; };
|
|
866
|
-
})()(
|
|
891
|
+
})()(text);
|
|
867
892
|
if (record === null || record.version !== 1)
|
|
868
|
-
return { ok: false, detail:
|
|
893
|
+
return { ok: false, detail: `Corrupt producer completion contract at ${path}` };
|
|
869
894
|
const receipt = record.receipt;
|
|
870
895
|
if (receipt.workspaceRoot !== realpathSync(root) ||
|
|
871
896
|
receipt.producer.version !== 1 ||
|
|
@@ -92,6 +92,14 @@ export type GitAnswer<T> = {
|
|
|
92
92
|
* upstream branch and `refs/remotes/origin/main`, and local `main` when none does.
|
|
93
93
|
*/
|
|
94
94
|
export declare function upstreamBase(root: string): GitAnswer<string>;
|
|
95
|
+
/**
|
|
96
|
+
* The upstream base as a run precondition, checked before Nx hashes anything:
|
|
97
|
+
* only a workspace whose own root package.json declares the test-walk check
|
|
98
|
+
* (this repository) is gated, and a missing main ref fails the run with the
|
|
99
|
+
* check's own reason instead of an error smuggled through a runtime input's
|
|
100
|
+
* byte channel. Workspaces that never declare the check are untouched.
|
|
101
|
+
*/
|
|
102
|
+
export declare function assertUpstreamBasePrecondition(workspaceRoot: string): void;
|
|
95
103
|
/**
|
|
96
104
|
* The files changed since `base`, tracked or untracked, and the new-side line ranges of each change; an untracked
|
|
97
105
|
* file is changed throughout.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-walk-policy.d.ts","sourceRoot":"","sources":["../src/test-walk-policy.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa;IACxB,EAAE;IACF,IAAI;IAIJ,kHAAkH;IAClH,QAAQ;IACR,iEAAiE;IACjE,WAAW;IACX,gGAAgG;IAChG,YAAY;IACZ,oHAAoH;IACpH,YAAY;CACb,CAAC;AAEF,0DAA0D;AAC1D,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sGAAsG;IACtG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gGAAgG;IAChG,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,+EAA+E;AAC/E,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI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AAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAgD5D;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAU1E;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,SAAS,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,CAAA;CAAE,CAAC,CA4BjH"}
|
package/dist/test-walk-policy.js
CHANGED
|
@@ -612,6 +612,19 @@ export function upstreamBase(root) {
|
|
|
612
612
|
break;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
+
if (upstream === 'main') {
|
|
616
|
+
// No upstream ref answered: say so as its own reason rather than letting
|
|
617
|
+
// merge-base fail against a local main that may not exist (a fresh shed
|
|
618
|
+
// has none until it fetches).
|
|
619
|
+
const local = exists('main');
|
|
620
|
+
if (!local.ok)
|
|
621
|
+
return local;
|
|
622
|
+
if (!local.value)
|
|
623
|
+
return {
|
|
624
|
+
ok: false,
|
|
625
|
+
reason: 'no main ref in this shed: neither refs/remotes/main/main, refs/remotes/origin/main nor a local main exists (fetch main, set refs/remotes/main/main, or export NX_BASE)',
|
|
626
|
+
};
|
|
627
|
+
}
|
|
615
628
|
}
|
|
616
629
|
const args = ['merge-base', 'HEAD', upstream];
|
|
617
630
|
const result = git(root, args);
|
|
@@ -622,6 +635,27 @@ export function upstreamBase(root) {
|
|
|
622
635
|
};
|
|
623
636
|
return { ok: true, value: result.stdout.trim() };
|
|
624
637
|
}
|
|
638
|
+
/**
|
|
639
|
+
* The upstream base as a run precondition, checked before Nx hashes anything:
|
|
640
|
+
* only a workspace whose own root package.json declares the test-walk check
|
|
641
|
+
* (this repository) is gated, and a missing main ref fails the run with the
|
|
642
|
+
* check's own reason instead of an error smuggled through a runtime input's
|
|
643
|
+
* byte channel. Workspaces that never declare the check are untouched.
|
|
644
|
+
*/
|
|
645
|
+
export function assertUpstreamBasePrecondition(workspaceRoot) {
|
|
646
|
+
let rootPackage;
|
|
647
|
+
try {
|
|
648
|
+
rootPackage = readFileSync(join(workspaceRoot, 'package.json'), 'utf8');
|
|
649
|
+
}
|
|
650
|
+
catch {
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
if (!rootPackage.includes('smoo-nx-test-walks'))
|
|
654
|
+
return;
|
|
655
|
+
const base = upstreamBase(workspaceRoot);
|
|
656
|
+
if (!base.ok)
|
|
657
|
+
throw new Error(`${TEST_ONE_WALK.id} cannot find the upstream base: ${base.reason}`);
|
|
658
|
+
}
|
|
625
659
|
/**
|
|
626
660
|
* The files changed since `base`, tracked or untracked, and the new-side line ranges of each change; an untracked
|
|
627
661
|
* file is changed throughout.
|
|
@@ -236,7 +236,8 @@ export interface DeveloperLinkSnapshot {
|
|
|
236
236
|
/** A declared checkout whose aliases bind a snapshot of it instead of the live directory. */
|
|
237
237
|
export interface DeveloperLinkSnapshotDeclaration {
|
|
238
238
|
directory: DeveloperLinkDirectory;
|
|
239
|
-
snapshot
|
|
239
|
+
/** A sealed content ID pins an existing snapshot; a target declaration opts into capture at each entry. */
|
|
240
|
+
snapshot: (string & typia.tags.Pattern<'^[0-9a-f]{64}$'>) | DeveloperLinkSnapshot;
|
|
240
241
|
}
|
|
241
242
|
export interface PackageSmooConfig {
|
|
242
243
|
github?: PackageSmooGithub;
|
|
@@ -252,10 +253,9 @@ export interface PackageSmooConfig {
|
|
|
252
253
|
* every checkout gets it. Shell entry links each tree that installed the
|
|
253
254
|
* package, a directory the machine lacks keeps the installed version, and CI
|
|
254
255
|
* links nothing (tooling/direnv/developer-links.ts, which validates the same
|
|
255
|
-
* shape at runtime). A `{ directory, snapshot }` declaration
|
|
256
|
-
* Nx-attested snapshot
|
|
257
|
-
*
|
|
258
|
-
* lockfile/patch-owned and cannot be declared here.
|
|
256
|
+
* shape at runtime). A `{ directory, snapshot: "<64-hex ID>" }` declaration pins a sealed,
|
|
257
|
+
* Nx-attested snapshot in the consumer store until explicitly moved, even when the provider changes or disappears.
|
|
258
|
+
* A snapshot object opts into capture from the current provider. Nx is lockfile/patch-owned and cannot be declared here.
|
|
259
259
|
*/
|
|
260
260
|
developerLinks?: Record<string, DeveloperLinkDirectory | DeveloperLinkSnapshotDeclaration>;
|
|
261
261
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-manifest.d.ts","sourceRoot":"","sources":["../src/workspace-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,2DAA2D;AAC3D,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAE3C,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,CAEnE;AAED,mHAAmH;AACnH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GACvC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GACvB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAEvD,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEhE,qGAAqG;AACrG,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,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W,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAChD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,MAAM;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;CAChF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,CAE3F"}
|
|
@@ -694,10 +694,10 @@ index 0000000000000000000000000000000000000000..28f263f82b7b698ec1bf88943924696b
|
|
|
694
694
|
+export declare function stopDaemonIfWorkspaceGone(): boolean;
|
|
695
695
|
diff --git a/dist/src/daemon/server/restart-checks.js b/dist/src/daemon/server/restart-checks.js
|
|
696
696
|
new file mode 100644
|
|
697
|
-
index 0000000000000000000000000000000000000000..
|
|
697
|
+
index 0000000000000000000000000000000000000000..6bd6df6e26cdbc306b33c01b363dc4b3d4475ada
|
|
698
698
|
--- /dev/null
|
|
699
699
|
+++ b/dist/src/daemon/server/restart-checks.js
|
|
700
|
-
@@ -0,0 +1,
|
|
700
|
+
@@ -0,0 +1,306 @@
|
|
701
701
|
+"use strict";
|
|
702
702
|
+Object.defineProperty(exports, "__esModule", { value: true });
|
|
703
703
|
+exports.relativeServerProcess = exports.DAEMON_VALIDITY_SAFETY_INTERVAL_MS = void 0;
|
|
@@ -721,6 +721,12 @@ index 0000000000000000000000000000000000000000..5f7aa0aa874dfe389388169c8acb0c0a
|
|
|
721
721
|
+// Adapted from nrwl/nx#37113. Kept apart from server.js: importing it starts a server.
|
|
722
722
|
+let daemon;
|
|
723
723
|
+let terminating = false;
|
|
724
|
+
+// The process that starts a daemon owns its restart. A supervisor that keeps
|
|
725
|
+
+// this daemon (cowshed's keeper job) starts it as `start.js --kept` and starts
|
|
726
|
+
+// its successor itself; a successor spawned here would run outside that job,
|
|
727
|
+
+// where its owner cannot prove it. argv, read once at boot, is the launcher's
|
|
728
|
+
+// own word: no client's environment, which this daemon adopts, can change it.
|
|
729
|
+
+const keptByLauncher = process.argv.slice(2).includes('--kept');
|
|
724
730
|
+function registerDaemonForRestartChecks(server, sockets, socketPath) {
|
|
725
731
|
+ daemon = { server, sockets, socketPath };
|
|
726
732
|
+ terminating = false;
|
|
@@ -986,10 +992,15 @@ index 0000000000000000000000000000000000000000..5f7aa0aa874dfe389388169c8acb0c0a
|
|
|
986
992
|
+}
|
|
987
993
|
+function restartDaemon(reason) {
|
|
988
994
|
+ if (!daemon || terminating) return;
|
|
995
|
+
+ logger_1.serverLogger.log(`[Server] Daemon outdated: ${reason}`);
|
|
996
|
+
+ if (keptByLauncher) {
|
|
997
|
+
+ logger_1.serverLogger.log('[Server] Stopping: the process that started this daemon (--kept) starts its successor');
|
|
998
|
+
+ stopDaemon(reason);
|
|
999
|
+
+ return;
|
|
1000
|
+
+ }
|
|
989
1001
|
+ // Do not spawn multiple replacements or answer queued requests while the
|
|
990
1002
|
+ // asynchronous restart releases ownership and starts the successor.
|
|
991
1003
|
+ terminating = true;
|
|
992
|
-
+ logger_1.serverLogger.log(`[Server] Daemon outdated: ${reason}`);
|
|
993
1004
|
+ logger_1.serverLogger.log('[Server] Restarting daemon...');
|
|
994
1005
|
+ (0, shutdown_utils_1.handleServerProcessTerminationWithRestart)({ server: daemon.server, reason, sockets: daemon.sockets });
|
|
995
1006
|
+}
|
|
@@ -66,6 +66,11 @@
|
|
|
66
66
|
* CI never applies them: it builds against the published packages the
|
|
67
67
|
* lockfile names (setup-environment.ts `--links`).
|
|
68
68
|
*
|
|
69
|
+
* A stable declaration names `{ "directory": …, "snapshot": "<64-hex ID>" }`:
|
|
70
|
+
* only the consumer's verified sealed snapshot resolves. Provider HEAD drift
|
|
71
|
+
* is reported and continues with the pin; a missing or invalid pin refuses.
|
|
72
|
+
* The directory is a freshness hint, never an input to pinned execution.
|
|
73
|
+
*
|
|
69
74
|
* A declaration may also ask for a snapshot: `{ "directory": …, "snapshot":
|
|
70
75
|
* { "targets": [...], "artifactModules": [...] } }` binds every alias to a
|
|
71
76
|
* sealed copy of that checkout instead of the live directory, so the
|
|
@@ -118,6 +123,8 @@ import {
|
|
|
118
123
|
import path from 'node:path';
|
|
119
124
|
import type { KeepDeveloperLinksOptions } from '@smoothbricks/nx-plugin/managed-assets';
|
|
120
125
|
import {
|
|
126
|
+
type ProducerProbe,
|
|
127
|
+
pinnedSnapshot,
|
|
121
128
|
pluginProbe,
|
|
122
129
|
recordedSnapshot,
|
|
123
130
|
type SealedSnapshot,
|
|
@@ -415,6 +422,8 @@ export type UnavailableDeclaredLink =
|
|
|
415
422
|
export interface DeclaredLinksPlan {
|
|
416
423
|
readonly changes: readonly DeclaredLinkChange[];
|
|
417
424
|
readonly unavailable: readonly UnavailableDeclaredLink[];
|
|
425
|
+
/** Verified pins whose provider HEAD differs or cannot be inspected; linking still succeeds. */
|
|
426
|
+
readonly reports: readonly string[];
|
|
418
427
|
}
|
|
419
428
|
|
|
420
429
|
/**
|
|
@@ -435,22 +444,24 @@ export interface DeclaredLinksPlan {
|
|
|
435
444
|
export async function planDeclaredLinks(root: string): Promise<DeclaredLinksPlan> {
|
|
436
445
|
const declared = readDeclaredLinks(root);
|
|
437
446
|
if (declared.length === 0) {
|
|
438
|
-
return { changes: [], unavailable: [] };
|
|
447
|
+
return { changes: [], unavailable: [], reports: [] };
|
|
439
448
|
}
|
|
440
449
|
const anchor = linkAnchor(root);
|
|
441
450
|
const canonicalRoot = realpathSync(root);
|
|
442
451
|
const trees = nodeModulesTrees(root);
|
|
443
452
|
const recorded = readDeclaredRecord(root);
|
|
444
|
-
const probe =
|
|
453
|
+
const probe: ProducerProbe = (target, providerRoot) =>
|
|
454
|
+
pluginProbe(snapshotPluginRoot(root, anchor, declared))(target, providerRoot);
|
|
445
455
|
const changes: DeclaredLinkChange[] = [];
|
|
446
456
|
const unavailable: UnavailableDeclaredLink[] = [];
|
|
457
|
+
const reports: string[] = [];
|
|
447
458
|
for (const { name, directory: relative, snapshot } of declared) {
|
|
448
459
|
const source = declaredTarget(root, anchor, relative);
|
|
449
460
|
const contained = containsPath(path.resolve(root), source);
|
|
450
|
-
if (contained) {
|
|
461
|
+
if (contained && typeof snapshot !== 'string') {
|
|
451
462
|
assertOwnedPath(canonicalRoot, path.resolve(canonicalRoot, path.relative(path.resolve(root), source)));
|
|
452
463
|
}
|
|
453
|
-
const reason = unavailableReason(source);
|
|
464
|
+
const reason = typeof snapshot === 'string' ? null : unavailableReason(source);
|
|
454
465
|
if (reason !== null) {
|
|
455
466
|
if (contained) assertNoInheritedBinding(root, anchor, name, relative, source);
|
|
456
467
|
unavailable.push({ kind: 'absent', name, target: source, reason });
|
|
@@ -460,16 +471,20 @@ export async function planDeclaredLinks(root: string): Promise<DeclaredLinksPlan
|
|
|
460
471
|
if (snapshot !== undefined) {
|
|
461
472
|
const outcome = await snapshotBinding(root, name, source, snapshot, probe);
|
|
462
473
|
if (outcome.kind === 'refused') {
|
|
474
|
+
if (typeof snapshot === 'string')
|
|
475
|
+
throw new Error(`smoo.developerLinks ${name}: cannot resolve pinned snapshot ${snapshot}: ${outcome.reason}`);
|
|
463
476
|
const kept = keptSnapshots(root, trees, name, recorded);
|
|
464
477
|
changes.push(...kept.changes);
|
|
465
478
|
unavailable.push({ kind: 'snapshot-refused', name, source, reason: outcome.reason, ...kept.said });
|
|
466
479
|
continue;
|
|
467
480
|
}
|
|
468
481
|
binding = { kind: 'snapshot', target: outcome.directory, id: outcome.id };
|
|
482
|
+
if (outcome.report !== undefined) reports.push(`! smoo.developerLinks ${name}: ${outcome.report}`);
|
|
469
483
|
}
|
|
470
484
|
const target = binding.target;
|
|
471
485
|
// The live checkout a snapshot replaces, by physical identity: a link spelled through another path is the same one.
|
|
472
|
-
const sourcePhysical =
|
|
486
|
+
const sourcePhysical =
|
|
487
|
+
binding.kind === 'snapshot' && typeof snapshot !== 'string' ? realpathSync(source) : undefined;
|
|
473
488
|
for (const tree of trees) {
|
|
474
489
|
const entry = path.join(tree, name);
|
|
475
490
|
const at = path.join(root, entry);
|
|
@@ -488,8 +503,13 @@ export async function planDeclaredLinks(root: string): Promise<DeclaredLinksPlan
|
|
|
488
503
|
const inherited = inheritedContainedBinding(anchor, relative, current);
|
|
489
504
|
const managed = recorded.get(entry)?.target === text;
|
|
490
505
|
if (current === target && text === packageAliasTarget(root, at, target)) continue;
|
|
491
|
-
|
|
492
|
-
|
|
506
|
+
if (
|
|
507
|
+
sourcePhysical !== undefined &&
|
|
508
|
+
foreign &&
|
|
509
|
+
!inherited &&
|
|
510
|
+
!managed &&
|
|
511
|
+
realpathOrNull(current) === sourcePhysical
|
|
512
|
+
) {
|
|
493
513
|
unavailable.push({ kind: 'snapshot-unclaimed', name, path: entry, source });
|
|
494
514
|
continue;
|
|
495
515
|
}
|
|
@@ -498,7 +518,7 @@ export async function planDeclaredLinks(root: string): Promise<DeclaredLinksPlan
|
|
|
498
518
|
changes.push({ path: entry, binding });
|
|
499
519
|
}
|
|
500
520
|
}
|
|
501
|
-
return { changes, unavailable };
|
|
521
|
+
return { changes, unavailable, reports };
|
|
502
522
|
}
|
|
503
523
|
|
|
504
524
|
/**
|
|
@@ -560,6 +580,7 @@ function snapshotPluginRoot(root: string, anchor: string, declared: readonly Dec
|
|
|
560
580
|
const plugin = declared.find(({ name }) => name === '@smoothbricks/nx-plugin');
|
|
561
581
|
if (plugin === undefined) return root;
|
|
562
582
|
const source = declaredTarget(root, anchor, plugin.directory);
|
|
583
|
+
if (typeof plugin.snapshot === 'string') return pinnedSnapshot(root, plugin.name, source, plugin.snapshot).directory;
|
|
563
584
|
return unavailableReason(source) === null ? source : root;
|
|
564
585
|
}
|
|
565
586
|
|
|
@@ -586,6 +607,7 @@ function assertNoInheritedBinding(root: string, anchor: string, name: string, re
|
|
|
586
607
|
* which declarations this machine cannot honour.
|
|
587
608
|
*/
|
|
588
609
|
export function applyDeclaredLinks(root: string, plan: DeclaredLinksPlan): void {
|
|
610
|
+
for (const report of plan.reports) console.error(report);
|
|
589
611
|
for (const unavailable of plan.unavailable) {
|
|
590
612
|
switch (unavailable.kind) {
|
|
591
613
|
case 'absent':
|
|
@@ -732,13 +754,13 @@ const TARGET = /^[^:\s]+:[^:\s]+(?::[^:\s]+)?$/;
|
|
|
732
754
|
interface DeclaredLink {
|
|
733
755
|
readonly name: string;
|
|
734
756
|
readonly directory: string;
|
|
735
|
-
readonly snapshot: SnapshotDeclaration | undefined;
|
|
757
|
+
readonly snapshot: SnapshotDeclaration | string | undefined;
|
|
736
758
|
}
|
|
737
759
|
|
|
738
760
|
/**
|
|
739
761
|
* `smoo.developerLinks` from the root manifest: each package name with its
|
|
740
762
|
* checkout directory, relative, given alone or as `{ directory, snapshot }`
|
|
741
|
-
* where `snapshot` names the provider targets that build it and its native
|
|
763
|
+
* where `snapshot` names a sealed snapshot ID or the provider targets that build it and its native
|
|
742
764
|
* artifact modules (linked-snapshots.ts). Hand-validated, like
|
|
743
765
|
* secret-references.ts validates `smoo.secrets`: this runs before anything is
|
|
744
766
|
* installed. The shape is `PackageSmooConfig.developerLinks` in the
|
|
@@ -773,6 +795,11 @@ function readDeclaredLinks(root: string): DeclaredLink[] {
|
|
|
773
795
|
}
|
|
774
796
|
if (!object) return { name, directory, snapshot: undefined };
|
|
775
797
|
const snapshot: unknown = Reflect.get(declaration, 'snapshot');
|
|
798
|
+
if (typeof snapshot === 'string') {
|
|
799
|
+
if (!/^[0-9a-f]{64}$/.test(snapshot))
|
|
800
|
+
throw new Error(`${manifestPath}: smoo.developerLinks ${name}.snapshot must be 64 lowercase hex digits`);
|
|
801
|
+
return { name, directory, snapshot };
|
|
802
|
+
}
|
|
776
803
|
const targets: unknown =
|
|
777
804
|
typeof snapshot === 'object' && snapshot !== null ? Reflect.get(snapshot, 'targets') : undefined;
|
|
778
805
|
const artifactModules: unknown =
|
|
@@ -537,9 +537,7 @@ in {
|
|
|
537
537
|
# use, so a hook and a shell resolve one binary the same way. The Rust
|
|
538
538
|
# toolchain's store bin then goes ahead of all of it (rustToolchainBin
|
|
539
539
|
# above): the same files the profile links, named by a path no checkout
|
|
540
|
-
# owns.
|
|
541
|
-
# `cargo` link is the jobserver launcher, so the budget reaches builds
|
|
542
|
-
# no Nx executor started.
|
|
540
|
+
# owns.
|
|
543
541
|
# 3. ttsc drives the native TypeScript 7 binary while Nx imports the TypeScript
|
|
544
542
|
# 6 API, so the two must be named separately.
|
|
545
543
|
# 4. ttsc caches in the checkout's .cache/ttsc (the path the CI ttsc-plugin
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* resolved the live directory would then read bytes no key of it describes. A
|
|
9
9
|
* snapshot is copied from one provider state and never changes: a provider
|
|
10
10
|
* change reaches the consumer only as another snapshot under another name.
|
|
11
|
+
* An explicit snapshot ID resolves only from the consumer's existing store;
|
|
12
|
+
* provider HEAD changes are informational and never select another snapshot.
|
|
13
|
+
* Only a capture declaration opts into the provider's current state.
|
|
11
14
|
*
|
|
12
15
|
* What a snapshot holds, laid out as in the provider checkout so relative
|
|
13
16
|
* resolution means what it meant there (exports, tsconfig `paths`, and the
|
|
@@ -23,7 +26,8 @@
|
|
|
23
26
|
* names: the checkout's own build, never a consumer override;
|
|
24
27
|
* - each such package's `node_modules` links. A link into the provider's own
|
|
25
28
|
* `node_modules/.bun` store copies that store entry whole; a link into Bun's
|
|
26
|
-
* global cache
|
|
29
|
+
* global cache, as `bun pm cache` names it in the consumer checkout, stays an
|
|
30
|
+
* absolute link to it. Any other target refuses.
|
|
27
31
|
*
|
|
28
32
|
* Provenance is the provider's own Nx producer receipt. Every declared target
|
|
29
33
|
* must be a probe hit (the read-only `probeBuilt`, which runs and
|
|
@@ -139,6 +143,8 @@ export interface SealedSnapshot {
|
|
|
139
143
|
readonly kind: 'snapshot';
|
|
140
144
|
readonly id: string;
|
|
141
145
|
readonly directory: string;
|
|
146
|
+
/** Informational pin freshness only; never a request to recapture or refuse a verified pin. */
|
|
147
|
+
readonly report?: string;
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
export type SnapshotBinding = SealedSnapshot | { readonly kind: 'refused'; readonly reason: string };
|
|
@@ -156,6 +162,8 @@ type PlanNode =
|
|
|
156
162
|
interface SnapshotPlan {
|
|
157
163
|
readonly name: string;
|
|
158
164
|
readonly root: string;
|
|
165
|
+
/** Bun's immutable install cache the plan's links were classified against (`bunCacheRoot`). */
|
|
166
|
+
readonly cache: string;
|
|
159
167
|
readonly packagePath: string;
|
|
160
168
|
readonly nodes: ReadonlyMap<string, PlanNode>;
|
|
161
169
|
}
|
|
@@ -171,20 +179,20 @@ type ProducerRecord = Extract<EnsureBuiltProbeResult, { readonly disposition: 'h
|
|
|
171
179
|
const PRODUCER_VERSION = 1;
|
|
172
180
|
|
|
173
181
|
/**
|
|
174
|
-
*
|
|
175
|
-
* the
|
|
176
|
-
* refusal names its cause and leaves every binding as it was.
|
|
182
|
+
* A snapshot ID resolves only from the consumer's store. A capture declaration instead probes, copies and attests
|
|
183
|
+
* the provider's current state. A refusal names its cause and leaves every binding as it was.
|
|
177
184
|
*/
|
|
178
185
|
export async function snapshotBinding(
|
|
179
186
|
root: string,
|
|
180
187
|
name: string,
|
|
181
188
|
source: string,
|
|
182
|
-
declaration: SnapshotDeclaration,
|
|
189
|
+
declaration: SnapshotDeclaration | string,
|
|
183
190
|
probe: ProducerProbe,
|
|
184
191
|
): Promise<SnapshotBinding> {
|
|
185
192
|
try {
|
|
193
|
+
if (typeof declaration === 'string') return pinnedSnapshot(root, name, source, declaration);
|
|
186
194
|
const store = snapshotStore(root);
|
|
187
|
-
const plan = planSnapshot(source, name, declaration);
|
|
195
|
+
const plan = planSnapshot(source, name, declaration, bunCacheRoot(root));
|
|
188
196
|
const id = await capture(store, plan, declaration, probe, fingerprintOf(plan));
|
|
189
197
|
return { kind: 'snapshot', id, directory: path.join(store, id, plan.packagePath) };
|
|
190
198
|
} catch (error) {
|
|
@@ -196,6 +204,28 @@ export async function snapshotBinding(
|
|
|
196
204
|
}
|
|
197
205
|
}
|
|
198
206
|
|
|
207
|
+
/** Resolve an explicit content pin, never reading provider bytes or asking its producer to run. */
|
|
208
|
+
export function pinnedSnapshot(root: string, name: string, source: string, id: string): SealedSnapshot {
|
|
209
|
+
if (!/^[0-9a-f]{64}$/.test(id)) throw new SnapshotRefusal(`snapshot pin ${id} must be 64 lowercase hex digits`);
|
|
210
|
+
const sealed = path.resolve(root, SNAPSHOT_STORE, id);
|
|
211
|
+
const receipt = verifySnapshot(sealed);
|
|
212
|
+
if (receipt.name !== name) throw new SnapshotRefusal(`snapshot ${id} contains ${receipt.name}, not ${name}`);
|
|
213
|
+
if (!contained(receipt.packagePath))
|
|
214
|
+
throw new SnapshotRefusal(`snapshot ${id} has an invalid package path ${receipt.packagePath}`);
|
|
215
|
+
const directory = path.join(sealed, receipt.packagePath);
|
|
216
|
+
const head = spawnSync('git', ['-C', source, 'rev-parse', '--verify', 'HEAD'], {
|
|
217
|
+
encoding: 'utf8',
|
|
218
|
+
env: { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' },
|
|
219
|
+
});
|
|
220
|
+
const report =
|
|
221
|
+
head.error !== undefined || head.status !== 0
|
|
222
|
+
? `cannot inspect ${source} HEAD for snapshot pin ${id}: ${head.error?.message ?? head.stderr.trim()}; continuing with the pin`
|
|
223
|
+
: head.stdout.trim() !== receipt.provenance.head
|
|
224
|
+
? `stale pin ${id}: captured HEAD ${receipt.provenance.head} differs from ${source} HEAD ${head.stdout.trim()}; continuing with the pin; move snapshot explicitly to select another build`
|
|
225
|
+
: undefined;
|
|
226
|
+
return { kind: 'snapshot', id, directory, ...(report === undefined ? {} : { report }) };
|
|
227
|
+
}
|
|
228
|
+
|
|
199
229
|
/**
|
|
200
230
|
* The store under `root`. A cowshed checkout keeps it on its build volume: until a refresh has linked it there,
|
|
201
231
|
* an empty directory is left for that refresh to adopt and the capture refuses.
|
|
@@ -236,11 +266,10 @@ export function pluginProbe(from: string): ProducerProbe {
|
|
|
236
266
|
};
|
|
237
267
|
}
|
|
238
268
|
|
|
239
|
-
/** What a snapshot of `source` would hold, read from the provider as it is now. */
|
|
240
|
-
function planSnapshot(source: string, name: string, declaration: SnapshotDeclaration): SnapshotPlan {
|
|
269
|
+
/** What a snapshot of `source` would hold, read from the provider as it is now, with `cache` as Bun's cache. */
|
|
270
|
+
function planSnapshot(source: string, name: string, declaration: SnapshotDeclaration, cache: string): SnapshotPlan {
|
|
241
271
|
const directory = realpathSync(source);
|
|
242
272
|
const root = providerRoot(directory);
|
|
243
|
-
const cache = bunCacheRoot(root);
|
|
244
273
|
const nodes = new Map<string, PlanNode>();
|
|
245
274
|
const pending = [directory];
|
|
246
275
|
const packages = new Map<string, Record<string, unknown>>();
|
|
@@ -307,7 +336,7 @@ function planSnapshot(source: string, name: string, declaration: SnapshotDeclara
|
|
|
307
336
|
addFile(path.join(root, 'package.json'), 'provider');
|
|
308
337
|
for (const specifier of declaration.artifactModules) addFile(nativeArtifact(specifier, directory), 'provider');
|
|
309
338
|
for (const [at, manifest] of packages) assertExportsPublished(at, manifest, root, nodes);
|
|
310
|
-
return { name, root, packagePath: path.relative(root, directory), nodes };
|
|
339
|
+
return { name, root, cache, packagePath: path.relative(root, directory), nodes };
|
|
311
340
|
}
|
|
312
341
|
|
|
313
342
|
/**
|
|
@@ -356,7 +385,12 @@ function providerRoot(directory: string): string {
|
|
|
356
385
|
}
|
|
357
386
|
}
|
|
358
387
|
|
|
359
|
-
/**
|
|
388
|
+
/**
|
|
389
|
+
* Bun's immutable install cache as Bun names it in the consumer checkout `root`. Never in the provider: `bun pm`
|
|
390
|
+
* opens its root manifest for writing just to print a path, and a sandboxed consumer may only read its provider (a
|
|
391
|
+
* cowshed workspace's sibling grant). Every checkout reaches the cache through one literal path (smoothbricks
|
|
392
|
+
* specs/cowshed/03_caches.md, "Link-target caches"), so a provider link into another cache refuses as outside it.
|
|
393
|
+
*/
|
|
360
394
|
function bunCacheRoot(root: string): string {
|
|
361
395
|
const run = spawnSync('bun', ['pm', 'cache'], { cwd: root, encoding: 'utf8' });
|
|
362
396
|
if (run.error !== undefined || run.status !== 0) {
|
|
@@ -560,7 +594,10 @@ async function capture(
|
|
|
560
594
|
attest(relative, bytes, digest, executable, tracked, outputs, plan, provenance);
|
|
561
595
|
census.push({ path: relative, type: 'file', executable, sha256: digest });
|
|
562
596
|
}
|
|
563
|
-
if (
|
|
597
|
+
if (
|
|
598
|
+
fingerprintOf(planSnapshot(path.join(plan.root, plan.packagePath), plan.name, declaration, plan.cache)) !==
|
|
599
|
+
fingerprint
|
|
600
|
+
) {
|
|
564
601
|
throw new SnapshotRefusal(
|
|
565
602
|
`${plan.root} changed while it was copied; nothing was published, so retry once it is quiet`,
|
|
566
603
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Single source of truth for repo-local PATH and installed
|
|
2
|
+
# Single source of truth for repo-local PATH and the installed cowshed's place in it.
|
|
3
3
|
# All tooling that sets up PATH must call this instead of hardcoding paths.
|
|
4
4
|
#
|
|
5
5
|
# Usage:
|
|
@@ -249,6 +249,8 @@ try {
|
|
|
249
249
|
// A refused or unclaimed snapshot is current only when said: the exec that follows names its cause.
|
|
250
250
|
const current =
|
|
251
251
|
plan.changes.length === 0 && plan.unavailable.every((unavailable) => unavailable.kind === 'absent');
|
|
252
|
+
// A stale pin is informational, not a stale install: say it even when devenv skips the exec.
|
|
253
|
+
if (current && plan.reports.length > 0) applyDeclaredLinks(projectRoot, plan);
|
|
252
254
|
process.exit(
|
|
253
255
|
current && !hasStaleDeveloperLinks(projectRoot, ['nx']) && danglingStoreLinks(projectRoot).length === 0 ? 0 : 1,
|
|
254
256
|
);
|