@smoothbricks/nx-plugin 0.7.17 → 0.7.19
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 +315 -114
- package/dist/.build-inputs.json +47 -38
- package/dist/built-output-packages.js +1 -1
- package/dist/bun-lock-scope.d.ts +128 -20
- package/dist/bun-lock-scope.d.ts.map +1 -1
- package/dist/bun-lock-scope.js +267 -44
- package/dist/cargo-closure-input.d.ts +8 -6
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +15 -12
- package/dist/cargo-source-hash.d.ts +26 -25
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +84 -105
- package/dist/cargo-toolchain-paths.d.ts +2 -2
- package/dist/cargo-toolchain-paths.js +2 -2
- package/dist/cargo-workspace.d.ts +20 -2
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +43 -22
- package/dist/ensure-built-receipt.d.ts +3 -2
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +3 -2
- package/dist/eslint-config-closure.d.ts +8 -3
- package/dist/eslint-config-closure.d.ts.map +1 -1
- package/dist/eslint-config-closure.js +24 -5
- package/dist/executors/bounded-exec/admission-queue.d.ts +3 -1
- package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -1
- package/dist/executors/bounded-exec/admission-queue.js +9 -10
- package/dist/executors/bounded-exec/awake-clock.d.ts +5 -0
- package/dist/executors/bounded-exec/awake-clock.d.ts.map +1 -0
- package/dist/executors/bounded-exec/awake-clock.js +22 -0
- package/dist/executors/bounded-exec/bounds.d.ts +19 -6
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
- package/dist/executors/bounded-exec/bounds.js +22 -15
- package/dist/executors/bounded-exec/case-gate.d.ts +114 -0
- package/dist/executors/bounded-exec/case-gate.d.ts.map +1 -0
- package/dist/executors/bounded-exec/case-gate.js +342 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +1 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool-thread.js +2 -2
- package/dist/executors/bounded-exec/cpu-pool.d.ts +28 -1
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +102 -16
- package/dist/executors/bounded-exec/cpu-rise.d.ts +73 -0
- package/dist/executors/bounded-exec/cpu-rise.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-rise.js +111 -0
- package/dist/executors/bounded-exec/endpoint-life.d.ts +146 -0
- package/dist/executors/bounded-exec/endpoint-life.d.ts.map +1 -0
- package/dist/executors/bounded-exec/endpoint-life.js +228 -0
- package/dist/executors/bounded-exec/executor.d.ts +1 -1
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +256 -86
- package/dist/executors/bounded-exec/gateway-lease.d.ts +1 -1
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +8 -1
- package/dist/executors/bounded-exec/go-run-summary.d.ts +51 -0
- package/dist/executors/bounded-exec/go-run-summary.d.ts.map +1 -0
- package/dist/executors/bounded-exec/go-run-summary.js +98 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +11 -3
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +125 -47
- package/dist/executors/bounded-exec/lease-wait.d.ts +1 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -1
- package/dist/executors/bounded-exec/lease-wait.js +1 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts +42 -7
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-pool.js +45 -8
- package/dist/executors/bounded-exec/mbx-reservations.d.ts +12 -6
- package/dist/executors/bounded-exec/mbx-reservations.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-reservations.js +190 -284
- package/dist/executors/bounded-exec/parent-grant.d.ts +2 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -1
- package/dist/executors/bounded-exec/parent-grant.js +1 -0
- package/dist/executors/bounded-exec/pool-admission.d.ts +29 -3
- package/dist/executors/bounded-exec/pool-admission.d.ts.map +1 -1
- package/dist/executors/bounded-exec/pool-admission.js +47 -1
- package/dist/executors/bounded-exec/progress-channel.d.ts +38 -0
- package/dist/executors/bounded-exec/progress-channel.d.ts.map +1 -0
- package/dist/executors/bounded-exec/progress-channel.js +113 -0
- package/dist/executors/bounded-exec/progress.d.ts +5 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +31 -1
- package/dist/executors/bounded-exec/ram-temp.d.ts +24 -1
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +123 -16
- package/dist/executors/bounded-exec/reservation-connection.d.ts +90 -0
- package/dist/executors/bounded-exec/reservation-connection.d.ts.map +1 -0
- package/dist/executors/bounded-exec/reservation-connection.js +248 -0
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +3 -0
- package/dist/executors/bounded-exec/runner-sizing.d.ts +9 -5
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-sizing.js +13 -9
- package/dist/executors/bounded-exec/schema.d.ts +7 -2
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/schema.js +17 -1
- package/dist/executors/bounded-exec/suite-minimum.d.ts +21 -0
- package/dist/executors/bounded-exec/suite-minimum.d.ts.map +1 -0
- package/dist/executors/bounded-exec/suite-minimum.js +85 -0
- package/dist/executors/bounded-exec/test-result-writer.d.ts +2 -0
- package/dist/executors/bounded-exec/test-result-writer.d.ts.map +1 -1
- package/dist/executors/bounded-exec/test-result-writer.js +1 -0
- package/dist/executors/bounded-exec/test-results.d.ts +5 -0
- package/dist/executors/bounded-exec/test-results.d.ts.map +1 -1
- package/dist/executors/bounded-exec/test-results.js +2 -2
- package/dist/executors/bounded-exec/verdict.d.ts +39 -10
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +60 -14
- package/dist/executors/cargo-zigbuild/executor.d.ts +10 -8
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +32 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +294 -152
- package/dist/managed-files/ci-workflow.d.ts +4 -1
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +9 -14
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.js +3 -3
- package/dist/managed-files/generator.d.ts +5 -1
- package/dist/managed-files/generator.d.ts.map +1 -1
- package/dist/managed-files/generator.js +22 -7
- package/dist/managed-files/render-memo.d.ts +13 -0
- package/dist/managed-files/render-memo.d.ts.map +1 -0
- package/dist/managed-files/render-memo.js +94 -0
- package/dist/task-results.js +2 -1
- package/dist/test-program.d.ts +11 -6
- package/dist/test-program.d.ts.map +1 -1
- package/dist/test-program.js +39 -35
- package/dist/tool-bins.d.ts +12 -0
- package/dist/tool-bins.d.ts.map +1 -1
- package/dist/tool-bins.js +31 -6
- package/dist/typecheck-test-policy.d.ts +10 -1
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +40 -24
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +135 -42
- package/dist/workspace-index.d.ts +14 -1
- package/dist/workspace-index.d.ts.map +1 -1
- package/dist/workspace-index.js +36 -4
- package/executors.json +2 -0
- package/managed/raw/envrc +24 -0
- package/managed/raw/patches/nx@24.0.3.patch +1851 -221
- package/managed/raw/patches/ttsc@0.37.1.patch +1055 -0
- package/managed/raw/tooling/direnv/developer-links.ts +122 -14
- package/managed/raw/tooling/direnv/devenv.smoo.nix +20 -19
- package/managed/templates/github/actions/save-nix-devenv/action.yml +19 -1
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +68 -11
- package/runtime/nx-publish/.build-inputs.json +2 -2
- package/runtime/nx-publish/cache_adapter.js +293 -3
- package/runtime/nx-publish/nx_publish.js +36 -14
- package/src/built-output-packages.ts +1 -1
- package/src/bun-lock-scope.ts +293 -40
- package/src/cargo-closure-input.ts +20 -12
- package/src/cargo-source-hash.ts +119 -145
- package/src/cargo-toolchain-paths.ts +2 -2
- package/src/cargo-workspace.ts +59 -21
- package/src/ensure-built-receipt.ts +3 -2
- package/src/eslint-config-closure.ts +27 -6
- package/src/executors/bounded-exec/admission-queue.ts +11 -10
- package/src/executors/bounded-exec/awake-clock.ts +20 -0
- package/src/executors/bounded-exec/bounds.ts +41 -19
- package/src/executors/bounded-exec/case-gate.ts +365 -0
- package/src/executors/bounded-exec/cpu-pool-thread.ts +3 -3
- package/src/executors/bounded-exec/cpu-pool.ts +139 -12
- package/src/executors/bounded-exec/cpu-rise.ts +156 -0
- package/src/executors/bounded-exec/endpoint-life.ts +279 -0
- package/src/executors/bounded-exec/executor.ts +341 -123
- package/src/executors/bounded-exec/gateway-lease.ts +6 -0
- package/src/executors/bounded-exec/go-run-summary.ts +137 -0
- package/src/executors/bounded-exec/hang-diagnostics.ts +150 -50
- package/src/executors/bounded-exec/lease-wait.ts +1 -0
- package/src/executors/bounded-exec/mbx-pool.ts +57 -9
- package/src/executors/bounded-exec/mbx-reservations.ts +216 -183
- package/src/executors/bounded-exec/parent-grant.ts +3 -0
- package/src/executors/bounded-exec/pool-admission.ts +59 -2
- package/src/executors/bounded-exec/progress-channel.ts +129 -0
- package/src/executors/bounded-exec/progress.ts +39 -3
- package/src/executors/bounded-exec/ram-temp.ts +137 -17
- package/src/executors/bounded-exec/reservation-connection.ts +221 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +2 -0
- package/src/executors/bounded-exec/runner-sizing.ts +13 -8
- package/src/executors/bounded-exec/schema.json +1 -1
- package/src/executors/bounded-exec/schema.ts +21 -2
- package/src/executors/bounded-exec/suite-minimum.ts +81 -0
- package/src/executors/bounded-exec/test-result-writer.ts +3 -0
- package/src/executors/bounded-exec/test-results.ts +5 -0
- package/src/executors/bounded-exec/verdict.ts +83 -22
- package/src/executors/cargo-zigbuild/executor.ts +30 -19
- package/src/index.ts +357 -166
- package/src/managed-files/ci-workflow.ts +13 -17
- package/src/managed-files/files.ts +3 -3
- package/src/managed-files/generator.ts +21 -6
- package/src/managed-files/render-memo.ts +135 -0
- package/src/test-program.ts +36 -41
- package/src/tool-bins.ts +35 -6
- package/src/typecheck-test-policy.ts +49 -24
- package/src/workspace-config-policy.ts +161 -43
- package/src/workspace-index.ts +40 -5
- package/test-timings.json +157 -141
- package/managed/raw/patches/ttsc@0.36.3.patch +0 -1660
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool-admission.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/pool-admission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,2GAA2G;IAC3G,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"pool-admission.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/pool-admission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EA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GAAG,SAAS,OAAO,EACvC,KAAK,EAAE,SAAS,GAAG,EAAE,EACrB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,IAAI,EAC3B,OAAO,GAAE,OAAsB,EAC/B,QAAQ,UAAO,GACd,SAAS,CAAC,GAAG,CAAC,CAiChB;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAUrE;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;;IAM5B,YAAY,GAAG,EAAE,MAAM,EAEtB;IAED,gFAAgF;IAChF,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAKzD;IAED,kDAAkD;IAClD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3B;CACF"}
|
|
@@ -34,7 +34,7 @@ function tokensFitting(ask, most, room) {
|
|
|
34
34
|
}
|
|
35
35
|
return Math.min(most, Math.floor((room * measured) / ask.memory));
|
|
36
36
|
}
|
|
37
|
-
export function admit(queue, available, memory, holding = NOTHING_HELD) {
|
|
37
|
+
export function admit(queue, available, memory, holding = NOTHING_HELD, lendable = true) {
|
|
38
38
|
const grants = [];
|
|
39
39
|
if (holding.alone) {
|
|
40
40
|
return { grants, waiting: queue.length === 0 ? null : 'alone' };
|
|
@@ -45,6 +45,9 @@ export function admit(queue, available, memory, holding = NOTHING_HELD) {
|
|
|
45
45
|
if (request.alone === true && holding.holders + grants.length > 0) {
|
|
46
46
|
return { grants, waiting: 'alone' };
|
|
47
47
|
}
|
|
48
|
+
if (request.lend === true && !lendable) {
|
|
49
|
+
return { grants, waiting: 'settle' };
|
|
50
|
+
}
|
|
48
51
|
const oversized = memory !== null && request.memory > memory.capacity;
|
|
49
52
|
const room = memory === null ? Number.POSITIVE_INFINITY : memory.capacity - held;
|
|
50
53
|
if (request.memory > room && !(oversized && held === 0)) {
|
|
@@ -65,3 +68,46 @@ export function admit(queue, available, memory, holding = NOTHING_HELD) {
|
|
|
65
68
|
}
|
|
66
69
|
return { grants, waiting: null };
|
|
67
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Where a request joins the queue (specs/cowshed/05_gateway.md, "Without mbx, every Nx run budgets itself"). A leaf the
|
|
73
|
+
* kernel killed, run again alone, has waited once already and goes ahead of the leaves that have not run. A leaf goes
|
|
74
|
+
* behind the leaves and ahead of every lent request: a case is lent only a token no leaf waits for. A lent request goes
|
|
75
|
+
* among the lent ones behind those whose leaves have as much work left or more, so a free token goes to the leaf that
|
|
76
|
+
* would otherwise end last, in arrival order among equals.
|
|
77
|
+
*/
|
|
78
|
+
export function place(queue, ask) {
|
|
79
|
+
const before = (found) => (found === -1 ? queue.length : found);
|
|
80
|
+
if (ask.alone === true) {
|
|
81
|
+
return before(queue.findIndex((waiting) => waiting.alone !== true));
|
|
82
|
+
}
|
|
83
|
+
if (ask.lend !== true) {
|
|
84
|
+
return before(queue.findIndex((waiting) => waiting.lend === true));
|
|
85
|
+
}
|
|
86
|
+
const left = ask.left ?? 0;
|
|
87
|
+
return before(queue.findIndex((waiting) => waiting.lend === true && (waiting.left ?? 0) < left));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The token-time a pool's tokens stood idle beside a starved hold: a leaf holding fewer tokens than it asked that
|
|
91
|
+
* cannot ask for more, or a case waiting for a lent token. The pool tells it the idle count and whether a hold is
|
|
92
|
+
* starved at each change, on its own clock; what is counted is the idle count over the time a starved hold stood.
|
|
93
|
+
*/
|
|
94
|
+
export class IdleBesideStarved {
|
|
95
|
+
#at;
|
|
96
|
+
#idle = 0;
|
|
97
|
+
#starved = false;
|
|
98
|
+
#tokenMs = 0;
|
|
99
|
+
constructor(now) {
|
|
100
|
+
this.#at = now;
|
|
101
|
+
}
|
|
102
|
+
/** From `now` on, `idle` tokens are free and a hold is `starved` or none is. */
|
|
103
|
+
observe(now, idle, starved) {
|
|
104
|
+
this.#tokenMs = this.tokenMs(now);
|
|
105
|
+
this.#at = now;
|
|
106
|
+
this.#idle = idle;
|
|
107
|
+
this.#starved = starved;
|
|
108
|
+
}
|
|
109
|
+
/** The token-milliseconds counted up to `now`. */
|
|
110
|
+
tokenMs(now) {
|
|
111
|
+
return this.#tokenMs + (this.#starved ? this.#idle * (now - this.#at) : 0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A run's progress channel: a running test reports its own forward motion on it, and each record restarts the idle
|
|
3
|
+
* bound as a finished test does (specs/cowshed/08_testing.md, "Integration tests (real substrate)"). An agent harness
|
|
4
|
+
* that enforces its own no-progress bound over what its run does (a span written, a byte of output) reports each
|
|
5
|
+
* movement that check sees, so a long test that keeps moving is not ended because it is the last test still running.
|
|
6
|
+
* CPU is never a record: a compile inside a test reports nothing and is still ended at the bound, where the pre-signal
|
|
7
|
+
* snapshot names it (cpu-rise.ts).
|
|
8
|
+
*
|
|
9
|
+
* The channel is a Unix stream socket the executor serves for one run, in a fresh 0700 directory, and names in the
|
|
10
|
+
* command's environment as {@link PROGRESS_SOCKET_ENV}. Each line a client writes is one record and must be
|
|
11
|
+
* {@link PROGRESS_RECORD}; anything else is a broken reporter, said and failed, never read as progress. A client may
|
|
12
|
+
* write one record per connection or many. The server ends its side when the client ends its own, after every record
|
|
13
|
+
* the client wrote was read, so a client that waits for that end knows its records counted.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PROGRESS_SOCKET_ENV = "BOUNDED_EXEC_PROGRESS_SOCKET";
|
|
16
|
+
/** The one record: something the test watches moved. */
|
|
17
|
+
export declare const PROGRESS_RECORD = "moved";
|
|
18
|
+
export interface ProgressChannel {
|
|
19
|
+
/** The socket's path, as the command's environment names it. */
|
|
20
|
+
readonly socket: string;
|
|
21
|
+
/** Ends every connection and removes the socket's directory; the error that left something behind, or null. */
|
|
22
|
+
close(): Promise<string | null>;
|
|
23
|
+
}
|
|
24
|
+
export interface ProgressHandlers {
|
|
25
|
+
/** A record was read. */
|
|
26
|
+
readonly moved: () => void;
|
|
27
|
+
/** A client wrote something that is not a record; its connection is ended. */
|
|
28
|
+
readonly invalid: (detail: string) => void;
|
|
29
|
+
}
|
|
30
|
+
/** Serve one run's progress channel; a channel that cannot be served is the run's refusal, never a silent bound. */
|
|
31
|
+
export declare function serveProgressChannel(handlers: ProgressHandlers): Promise<{
|
|
32
|
+
ok: true;
|
|
33
|
+
channel: ProgressChannel;
|
|
34
|
+
} | {
|
|
35
|
+
ok: false;
|
|
36
|
+
error: string;
|
|
37
|
+
}>;
|
|
38
|
+
//# sourceMappingURL=progress-channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-channel.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/progress-channel.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAClE,wDAAwD;AACxD,eAAO,MAAM,eAAe,UAAU,CAAC;AAOvC,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+GAA+G;IAC/G,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,yBAAyB;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAUD,oHAAoH;AACpH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA2EhF"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { rm } from 'node:fs/promises';
|
|
2
|
+
import { createServer } from 'node:net';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { ownedSocketDirectory } from '../../testing.js';
|
|
5
|
+
/**
|
|
6
|
+
* A run's progress channel: a running test reports its own forward motion on it, and each record restarts the idle
|
|
7
|
+
* bound as a finished test does (specs/cowshed/08_testing.md, "Integration tests (real substrate)"). An agent harness
|
|
8
|
+
* that enforces its own no-progress bound over what its run does (a span written, a byte of output) reports each
|
|
9
|
+
* movement that check sees, so a long test that keeps moving is not ended because it is the last test still running.
|
|
10
|
+
* CPU is never a record: a compile inside a test reports nothing and is still ended at the bound, where the pre-signal
|
|
11
|
+
* snapshot names it (cpu-rise.ts).
|
|
12
|
+
*
|
|
13
|
+
* The channel is a Unix stream socket the executor serves for one run, in a fresh 0700 directory, and names in the
|
|
14
|
+
* command's environment as {@link PROGRESS_SOCKET_ENV}. Each line a client writes is one record and must be
|
|
15
|
+
* {@link PROGRESS_RECORD}; anything else is a broken reporter, said and failed, never read as progress. A client may
|
|
16
|
+
* write one record per connection or many. The server ends its side when the client ends its own, after every record
|
|
17
|
+
* the client wrote was read, so a client that waits for that end knows its records counted.
|
|
18
|
+
*/
|
|
19
|
+
export const PROGRESS_SOCKET_ENV = 'BOUNDED_EXEC_PROGRESS_SOCKET';
|
|
20
|
+
/** The one record: something the test watches moved. */
|
|
21
|
+
export const PROGRESS_RECORD = 'moved';
|
|
22
|
+
const CHANNEL_DIRECTORY = 'bounded-progress-';
|
|
23
|
+
const CHANNEL_SOCKET = 'p.sock';
|
|
24
|
+
/** How much of a refused line its refusal quotes. */
|
|
25
|
+
const QUOTED_CHARS = 80;
|
|
26
|
+
function describe(error) {
|
|
27
|
+
return error instanceof Error ? error.message : String(error);
|
|
28
|
+
}
|
|
29
|
+
function quoted(line) {
|
|
30
|
+
return JSON.stringify(line.length > QUOTED_CHARS ? `${line.slice(0, QUOTED_CHARS)}…` : line);
|
|
31
|
+
}
|
|
32
|
+
/** Serve one run's progress channel; a channel that cannot be served is the run's refusal, never a silent bound. */
|
|
33
|
+
export async function serveProgressChannel(handlers) {
|
|
34
|
+
let directory;
|
|
35
|
+
try {
|
|
36
|
+
directory = await ownedSocketDirectory(CHANNEL_DIRECTORY, CHANNEL_SOCKET);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
return { ok: false, error: `its directory could not be made: ${describe(error)}` };
|
|
40
|
+
}
|
|
41
|
+
const socketPath = join(directory, CHANNEL_SOCKET);
|
|
42
|
+
const clients = new Set();
|
|
43
|
+
const serve = (client) => {
|
|
44
|
+
clients.add(client);
|
|
45
|
+
client.on('close', () => clients.delete(client));
|
|
46
|
+
// A client that dies mid-record (its test was killed) loses that record with its connection; nothing else is read.
|
|
47
|
+
client.on('error', () => { });
|
|
48
|
+
client.setEncoding('utf8');
|
|
49
|
+
let partial = '';
|
|
50
|
+
const refuse = (detail) => {
|
|
51
|
+
partial = '';
|
|
52
|
+
client.destroy();
|
|
53
|
+
handlers.invalid(detail);
|
|
54
|
+
};
|
|
55
|
+
client.on('data', (text) => {
|
|
56
|
+
const lines = (partial + text).split('\n');
|
|
57
|
+
partial = lines.pop() ?? '';
|
|
58
|
+
for (const line of lines) {
|
|
59
|
+
if (line !== PROGRESS_RECORD) {
|
|
60
|
+
refuse(`a progress record is the line ${PROGRESS_RECORD}, not ${quoted(line)}`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
handlers.moved();
|
|
64
|
+
}
|
|
65
|
+
// No prefix longer than the record can still become one.
|
|
66
|
+
if (partial.length > PROGRESS_RECORD.length) {
|
|
67
|
+
refuse(`a progress record is the line ${PROGRESS_RECORD}, not ${quoted(partial)}`);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
client.on('end', () => {
|
|
71
|
+
if (partial !== '')
|
|
72
|
+
refuse(`a progress connection ended inside a record: ${quoted(partial)}`);
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
const server = createServer(serve);
|
|
76
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: listen is this process's own bind of a path in its fresh directory; the kernel answers it with the listening callback or an error, and no peer takes part
|
|
77
|
+
const listened = await new Promise((settle) => {
|
|
78
|
+
server.once('error', settle);
|
|
79
|
+
server.listen(socketPath, () => {
|
|
80
|
+
server.off('error', settle);
|
|
81
|
+
settle(null);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
const close = async () => {
|
|
85
|
+
const failures = [];
|
|
86
|
+
for (const client of clients)
|
|
87
|
+
client.destroy();
|
|
88
|
+
if (listened === null) {
|
|
89
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: every accepted connection was destroyed just above, so the server closes without waiting on a peer
|
|
90
|
+
const closed = await new Promise((settle) => server.close(settle));
|
|
91
|
+
if (closed !== undefined)
|
|
92
|
+
failures.push(`its socket did not close: ${closed.message}`);
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
await rm(directory, { recursive: true, force: true });
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
failures.push(`its directory was not removed: ${describe(error)}`);
|
|
99
|
+
}
|
|
100
|
+
return failures.length === 0 ? null : `the progress channel at ${socketPath}: ${failures.join('; ')}`;
|
|
101
|
+
};
|
|
102
|
+
if (listened !== null) {
|
|
103
|
+
const left = await close();
|
|
104
|
+
return {
|
|
105
|
+
ok: false,
|
|
106
|
+
error: `it could not listen at ${socketPath}: ${listened.message}${left === null ? '' : `; ${left}`}`,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
server.on('error', (error) => {
|
|
110
|
+
handlers.invalid(`the progress channel at ${socketPath} failed: ${error.message}`);
|
|
111
|
+
});
|
|
112
|
+
return { ok: true, channel: { socket: socketPath, close } };
|
|
113
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { GoRunSummary } from './go-run-summary.js';
|
|
1
2
|
import type { NativeTestResult } from './test-result-writer.js';
|
|
2
3
|
/**
|
|
3
4
|
* What a run's output says about its forward motion: whether a test finished, and which tests the runner said
|
|
4
|
-
* are running and has not said finished. `idleTimeoutMs` re-arms only on a finished test
|
|
5
|
+
* are running and has not said finished. In the output, `idleTimeoutMs` re-arms only on a finished test; a running test
|
|
6
|
+
* reports its own progress on the run's progress channel instead (progress-channel.ts).
|
|
5
7
|
*
|
|
6
8
|
* Output alone is not progress. nextest repeats a `SLOW` line for every test still running at each slow-timeout
|
|
7
9
|
* period, and a hung test may print a heartbeat, so a bound on silence never fires on either. A finished test is
|
|
@@ -31,6 +33,8 @@ export interface RunProgress {
|
|
|
31
33
|
/** The tests the runner reported running and has not reported finished, in the order it first named them. */
|
|
32
34
|
inFlight(): string[];
|
|
33
35
|
error(): string | null;
|
|
36
|
+
/** The Go run so far, by its top-level tests; null for a command that runs no Go tests. */
|
|
37
|
+
goSummary(): GoRunSummary | null;
|
|
34
38
|
}
|
|
35
39
|
export type OutputStream = 'stdout' | 'stderr';
|
|
36
40
|
export declare function createRunProgress(command?: string, closed?: (result: NativeTestResult) => void): RunProgress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/progress.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/progress.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,WAAW;IAC1B,gGAAgG;IAChG,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC5D,6GAA6G;IAC7G,QAAQ,IAAI,MAAM,EAAE,CAAC;IACrB,KAAK,IAAI,MAAM,GAAG,IAAI,CAAC;IACvB,2FAA2F;IAC3F,SAAS,IAAI,YAAY,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA6E/C,wBAAgB,iBAAiB,CAAC,OAAO,SAAK,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,GAAG,WAAW,CA4NxG;AAED,2FAA2F;AAC3F,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAuBtG;AACD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAmB1D"}
|
|
@@ -93,6 +93,10 @@ export function createRunProgress(command = '', closed) {
|
|
|
93
93
|
const running = new Set();
|
|
94
94
|
const packages = new Map();
|
|
95
95
|
const goOutput = new Map();
|
|
96
|
+
// A Go run prints no count: its events are summed here, by top-level test, for the summary its output ends with.
|
|
97
|
+
const goVerdicts = new Map();
|
|
98
|
+
const goPackages = new Set();
|
|
99
|
+
const goFailedPackages = [];
|
|
96
100
|
const decoders = {
|
|
97
101
|
stdout: new StringDecoder('utf8'),
|
|
98
102
|
stderr: new StringDecoder('utf8'),
|
|
@@ -117,6 +121,7 @@ export function createRunProgress(command = '', closed) {
|
|
|
117
121
|
switch (event.Action) {
|
|
118
122
|
case 'start':
|
|
119
123
|
packages.set(event.Package, new Set());
|
|
124
|
+
goPackages.add(event.Package);
|
|
120
125
|
return false;
|
|
121
126
|
case 'run':
|
|
122
127
|
packages.get(event.Package)?.add(event.Test);
|
|
@@ -125,11 +130,20 @@ export function createRunProgress(command = '', closed) {
|
|
|
125
130
|
case 'fail':
|
|
126
131
|
case 'skip':
|
|
127
132
|
case 'bench':
|
|
128
|
-
if (event.Test === undefined)
|
|
133
|
+
if (event.Test === undefined) {
|
|
129
134
|
packages.delete(event.Package);
|
|
135
|
+
goPackages.add(event.Package);
|
|
136
|
+
// A package that fails with no failed test of its own did not get to run them: a build, a TestMain.
|
|
137
|
+
if (event.Action === 'fail' &&
|
|
138
|
+
![...goVerdicts.values()].some((test) => test.package === event.Package && test.status === 'fail'))
|
|
139
|
+
goFailedPackages.push(event.Package);
|
|
140
|
+
}
|
|
130
141
|
else {
|
|
131
142
|
packages.get(event.Package)?.delete(event.Test);
|
|
132
143
|
const id = `${event.Package}::${event.Test}`;
|
|
144
|
+
// A subtest's verdict is its parent's, which Go reports after it: only the parent is counted.
|
|
145
|
+
if (event.Action !== 'bench' && !event.Test.includes('/'))
|
|
146
|
+
goVerdicts.set(id, { package: event.Package, test: event.Test, status: event.Action });
|
|
133
147
|
if (event.Action !== 'bench' && goResults)
|
|
134
148
|
closed?.({
|
|
135
149
|
id,
|
|
@@ -259,6 +273,22 @@ export function createRunProgress(command = '', closed) {
|
|
|
259
273
|
return progressed;
|
|
260
274
|
},
|
|
261
275
|
error: () => failure,
|
|
276
|
+
goSummary: () => {
|
|
277
|
+
if (!goResults)
|
|
278
|
+
return null;
|
|
279
|
+
const verdicts = [...goVerdicts.values()];
|
|
280
|
+
const count = (status) => verdicts.filter((test) => test.status === status).length;
|
|
281
|
+
return {
|
|
282
|
+
passed: count('pass'),
|
|
283
|
+
failed: count('fail'),
|
|
284
|
+
skipped: count('skip'),
|
|
285
|
+
packages: goPackages.size,
|
|
286
|
+
failedTests: verdicts
|
|
287
|
+
.filter((test) => test.status === 'fail')
|
|
288
|
+
.map((test) => ({ package: test.package, test: test.test })),
|
|
289
|
+
failedPackages: [...goFailedPackages],
|
|
290
|
+
};
|
|
291
|
+
},
|
|
262
292
|
inFlight: () => [
|
|
263
293
|
...running,
|
|
264
294
|
...[...packages].flatMap(([name, tests]) => tests.size === 0 ? [name] : [...tests].map((test) => `${name} ${test}`)),
|
|
@@ -189,6 +189,11 @@ export interface RamTempLease {
|
|
|
189
189
|
* another attach, or none, is not this lease's volume: its free space is some other filesystem's.
|
|
190
190
|
*/
|
|
191
191
|
attach: string;
|
|
192
|
+
/**
|
|
193
|
+
* The I/O Registry entry of the disk that attach is on, which the volume's marker named and the registry proved when
|
|
194
|
+
* the lease was taken: the disk a release of a lease whose volume lost its mount detaches.
|
|
195
|
+
*/
|
|
196
|
+
registryEntry: string;
|
|
192
197
|
}
|
|
193
198
|
export interface RamUnavailable {
|
|
194
199
|
readonly kind: 'ram-unavailable';
|
|
@@ -321,6 +326,18 @@ export declare class RamTempVolume {
|
|
|
321
326
|
*/
|
|
322
327
|
release(lease: RamTempLease, keep: boolean, subtrees: SubtreeOwner): Promise<Result<string[], RamTempError>>;
|
|
323
328
|
private releaseLease;
|
|
329
|
+
/**
|
|
330
|
+
* Release a lease whose volume went from the mountpoint while its task held it. A volume that lost its mount leaves its
|
|
331
|
+
* disk attached and mounted nowhere: no path reaches its files and no lease can be taken on it, yet its pages stay
|
|
332
|
+
* resident until it is detached (on 2026-11-10 a restart of fseventsd stranded the user's 8 GiB disk so, owned by no
|
|
333
|
+
* lease). The lease's own registry entry, which the registry proved when the lease was taken, makes the disk this
|
|
334
|
+
* volume's: the release detaches it through the gateway's registry-bound `ram-detach`, under a detach claim no other
|
|
335
|
+
* caller passes, and the lease is said lost with what became of its disk. A disk mounted anywhere is left as it is and
|
|
336
|
+
* named, and one already gone is said so; nothing is forced.
|
|
337
|
+
*/
|
|
338
|
+
private releaseLost;
|
|
339
|
+
/** The RAM disk of this volume's user and size that registry entry `entry` registers, as one read finds it; else null. */
|
|
340
|
+
private diskOf;
|
|
324
341
|
/**
|
|
325
342
|
* Wait out another caller's creation or detach. Liveness of its owner is its pid's, so a crashed
|
|
326
343
|
* owner whose pid was reused holds every caller here; past each `CLAIM_WAIT_NOTICE_MS` on the same
|
|
@@ -408,7 +425,13 @@ export declare class RamTempVolume {
|
|
|
408
425
|
* directory, and a task still gone. Any other is left for a fresh look, never removed.
|
|
409
426
|
*/
|
|
410
427
|
private unchanged;
|
|
411
|
-
/**
|
|
428
|
+
/**
|
|
429
|
+
* Check the root the volume mounts below, detach what earlier creators left, then attach and provision the volume. An
|
|
430
|
+
* unmounted mountpoint with contents is never mounted over and its files never touched: the volume is unavailable.
|
|
431
|
+
* Only the disk the ledger records as kept is still detached first, by that registry entry, since a lost mount
|
|
432
|
+
* strands it beside such a directory: tasks that held leases on it may have written there after the loss. With no
|
|
433
|
+
* kept record the refusal inspects nothing on the host.
|
|
434
|
+
*/
|
|
412
435
|
private provisionVolume;
|
|
413
436
|
/**
|
|
414
437
|
* Provision the leased disk, record it in the ledger as the kept volume's disk, and keep it once its volume is mounted
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ram-temp.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/ram-temp.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAe,KAAK,UAAU,EAAgC,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAW5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqIpD;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,QAA6C,CAAC;AASlF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,8EAA8E;AAC9E,eAAO,MAAM,8BAA8B,QAA2C,CAAC;AAEvF,yFAAyF;AACzF,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3E;AAeD;;;GAGG;AACH,eAAO,MAAM,aAAa,IAAI,CAAC;AAQ/B,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IAC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6 +485,7 @@ export class RamTempVolume {
|
|
|
485
485
|
directory: value.directory,
|
|
486
486
|
mountpoint: this.paths.mountpoint,
|
|
487
487
|
attach: value.volume.attach,
|
|
488
|
+
registryEntry: value.volume.registryEntry,
|
|
488
489
|
},
|
|
489
490
|
held: [...value.held, ...settled.value.held].map((lease) => lease.text),
|
|
490
491
|
reaped: [...settled.value.reaped],
|
|
@@ -519,7 +520,15 @@ export class RamTempVolume {
|
|
|
519
520
|
const directory = await this.make(op);
|
|
520
521
|
return {
|
|
521
522
|
ledger: next,
|
|
522
|
-
value: {
|
|
523
|
+
value: {
|
|
524
|
+
ok: true,
|
|
525
|
+
value: {
|
|
526
|
+
directory,
|
|
527
|
+
mountpoint: this.paths.mountpoint,
|
|
528
|
+
attach: volume.attach,
|
|
529
|
+
registryEntry: volume.registryEntry,
|
|
530
|
+
},
|
|
531
|
+
},
|
|
523
532
|
};
|
|
524
533
|
});
|
|
525
534
|
if (!placed.ok) {
|
|
@@ -585,7 +594,7 @@ export class RamTempVolume {
|
|
|
585
594
|
// A lease that went while its task held it is said, never released as though it were there.
|
|
586
595
|
const held = leaseOn(lease, volume);
|
|
587
596
|
if ('lost' in held) {
|
|
588
|
-
return { ledger, value: { kind: 'lost', detail: held.lost } };
|
|
597
|
+
return { ledger, value: { kind: 'lost', detail: held.lost, stranded: volume?.attach !== lease.attach } };
|
|
589
598
|
}
|
|
590
599
|
if (ledger.lifecycle !== null) {
|
|
591
600
|
return { ledger, value: { kind: 'wait', claim: ledger.lifecycle } };
|
|
@@ -604,7 +613,9 @@ export class RamTempVolume {
|
|
|
604
613
|
case 'lost':
|
|
605
614
|
return {
|
|
606
615
|
ok: false,
|
|
607
|
-
error:
|
|
616
|
+
error: value.stranded
|
|
617
|
+
? await this.releaseLost(op, lease, value.detail)
|
|
618
|
+
: { kind: 'lease-lost', lease: lease.directory, mountpoint: lease.mountpoint, detail: value.detail },
|
|
608
619
|
};
|
|
609
620
|
case 'wait': {
|
|
610
621
|
const yielded = await this.yieldTo(op, value.claim, waited);
|
|
@@ -656,6 +667,83 @@ export class RamTempVolume {
|
|
|
656
667
|
}
|
|
657
668
|
}
|
|
658
669
|
}
|
|
670
|
+
/**
|
|
671
|
+
* Release a lease whose volume went from the mountpoint while its task held it. A volume that lost its mount leaves its
|
|
672
|
+
* disk attached and mounted nowhere: no path reaches its files and no lease can be taken on it, yet its pages stay
|
|
673
|
+
* resident until it is detached (on 2026-11-10 a restart of fseventsd stranded the user's 8 GiB disk so, owned by no
|
|
674
|
+
* lease). The lease's own registry entry, which the registry proved when the lease was taken, makes the disk this
|
|
675
|
+
* volume's: the release detaches it through the gateway's registry-bound `ram-detach`, under a detach claim no other
|
|
676
|
+
* caller passes, and the lease is said lost with what became of its disk. A disk mounted anywhere is left as it is and
|
|
677
|
+
* named, and one already gone is said so; nothing is forced.
|
|
678
|
+
*/
|
|
679
|
+
async releaseLost(op, lease, lost) {
|
|
680
|
+
const said = (detail) => ({
|
|
681
|
+
kind: 'lease-lost',
|
|
682
|
+
lease: lease.directory,
|
|
683
|
+
mountpoint: lease.mountpoint,
|
|
684
|
+
detail: `${lost}; ${detail}`,
|
|
685
|
+
});
|
|
686
|
+
const entry = lease.registryEntry;
|
|
687
|
+
let waited = null;
|
|
688
|
+
for (;;) {
|
|
689
|
+
const found = await this.diskOf(entry);
|
|
690
|
+
if (!found.ok)
|
|
691
|
+
return said(`its disk (registry ${entry}) could not be read: ${describeRamTempError(found.error)}`);
|
|
692
|
+
const disk = found.value;
|
|
693
|
+
if (disk === null)
|
|
694
|
+
return said(`its disk (registry ${entry}) is no longer attached`);
|
|
695
|
+
if (disk.mountpoints.length > 0) {
|
|
696
|
+
return said(`its disk ${disk.physical} (registry ${entry}) is mounted at ${disk.mountpoints.join(', ')}, so this release left it attached`);
|
|
697
|
+
}
|
|
698
|
+
const stranded = `its disk ${disk.physical} (registry ${entry}) stayed attached with its mount at ${lease.mountpoint} lost`;
|
|
699
|
+
const taken = await this.locked(op, 'release', async (ledger) => ledger.lifecycle !== null
|
|
700
|
+
? { ledger, value: ledger.lifecycle }
|
|
701
|
+
: { ledger: { ...ledger, lifecycle: { kind: 'detach', owner: op.owner } }, value: null });
|
|
702
|
+
if (!taken.ok) {
|
|
703
|
+
const why = taken.error.kind === 'lock-denied' ? taken.error.detail : describeRamTempError(taken.error);
|
|
704
|
+
return said(`${stranded}, and no detach claim could be taken: ${why}`);
|
|
705
|
+
}
|
|
706
|
+
if (taken.value !== null) {
|
|
707
|
+
// Another caller is creating or detaching: look at the disk again once it has.
|
|
708
|
+
const yielded = await this.yieldTo(op, taken.value, waited);
|
|
709
|
+
if (!yielded.ok) {
|
|
710
|
+
const why = yielded.error.kind === 'lock-denied' ? yielded.error.detail : describeRamTempError(yielded.error);
|
|
711
|
+
return said(`${stranded}, and waiting on another caller's ${taken.value.kind} failed: ${why}`);
|
|
712
|
+
}
|
|
713
|
+
waited = yielded.value;
|
|
714
|
+
continue;
|
|
715
|
+
}
|
|
716
|
+
const command = await this.runDetach(op, disk.physical, entry);
|
|
717
|
+
if (!command.ok)
|
|
718
|
+
return said(`${stranded}, and its detach failed: ${describeRamTempError(command.error)}`);
|
|
719
|
+
if (command.value.pending !== undefined) {
|
|
720
|
+
return said(`${stranded}; its detach still runs in the gateway (${commandText(command.value)})`);
|
|
721
|
+
}
|
|
722
|
+
const detached = detachOutcome(command.value, disk, 'hdiutil detach (lost mount)');
|
|
723
|
+
return said(detached.ok
|
|
724
|
+
? `${stranded}, and this release detached it`
|
|
725
|
+
: `${stranded}, and its detach failed: ${describeRamTempError(detached.error)}`);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
/** The RAM disk of this volume's user and size that registry entry `entry` registers, as one read finds it; else null. */
|
|
729
|
+
async diskOf(entry) {
|
|
730
|
+
const registry = await this.commands.run('/usr/sbin/ioreg', ['-r', '-c', 'IOHDIXHDDriveOutKernel', '-l', '-w0']);
|
|
731
|
+
if (registry.status !== 0)
|
|
732
|
+
return failed('ioreg (RAM disks)', commandText(registry));
|
|
733
|
+
const table = await this.commands.run('/sbin/mount', []);
|
|
734
|
+
if (table.status !== 0)
|
|
735
|
+
return failed('mount (mount table)', commandText(table));
|
|
736
|
+
const disks = ramDisksIn(registry.stdout, table.stdout);
|
|
737
|
+
if (!disks.ok)
|
|
738
|
+
return failed('ioreg (RAM disks)', disks.error);
|
|
739
|
+
const disk = disks.value.find((candidate) => candidate.entry === entry && candidate.uid === this.paths.uid && candidate.sectors === this.sectors);
|
|
740
|
+
if (disk === undefined)
|
|
741
|
+
return { ok: true, value: null };
|
|
742
|
+
const { physical } = disk;
|
|
743
|
+
return physical === null
|
|
744
|
+
? failed('ioreg (RAM disks)', `registry entry ${entry} has published no whole disk`)
|
|
745
|
+
: { ok: true, value: { ...disk, physical } };
|
|
746
|
+
}
|
|
659
747
|
/**
|
|
660
748
|
* Wait out another caller's creation or detach. Liveness of its owner is its pid's, so a crashed
|
|
661
749
|
* owner whose pid was reused holds every caller here; past each `CLAIM_WAIT_NOTICE_MS` on the same
|
|
@@ -1310,24 +1398,43 @@ export class RamTempVolume {
|
|
|
1310
1398
|
}
|
|
1311
1399
|
return confirmed;
|
|
1312
1400
|
}
|
|
1313
|
-
/**
|
|
1401
|
+
/**
|
|
1402
|
+
* Check the root the volume mounts below, detach what earlier creators left, then attach and provision the volume. An
|
|
1403
|
+
* unmounted mountpoint with contents is never mounted over and its files never touched: the volume is unavailable.
|
|
1404
|
+
* Only the disk the ledger records as kept is still detached first, by that registry entry, since a lost mount
|
|
1405
|
+
* strands it beside such a directory: tasks that held leases on it may have written there after the loss. With no
|
|
1406
|
+
* kept record the refusal inspects nothing on the host.
|
|
1407
|
+
*/
|
|
1314
1408
|
async provisionVolume(op) {
|
|
1409
|
+
let unowned;
|
|
1315
1410
|
try {
|
|
1316
|
-
const [
|
|
1317
|
-
|
|
1318
|
-
return {
|
|
1319
|
-
ok: false,
|
|
1320
|
-
error: {
|
|
1321
|
-
kind: 'ram-unavailable',
|
|
1322
|
-
reason: 'unproven-owner',
|
|
1323
|
-
detail: `${this.paths.mountpoint} is an unmounted directory with unowned contents; nothing removed or hidden by a new mount`,
|
|
1324
|
-
},
|
|
1325
|
-
};
|
|
1326
|
-
}
|
|
1411
|
+
const [mount, parent] = await Promise.all([stat(this.paths.mountpoint), stat(join(this.paths.mountpoint, '..'))]);
|
|
1412
|
+
unowned = mount.dev === parent.dev && (await readdir(this.paths.mountpoint)).length !== 0;
|
|
1327
1413
|
}
|
|
1328
1414
|
catch (error) {
|
|
1329
1415
|
if (errorCode(error) !== 'ENOENT')
|
|
1330
1416
|
return failed('provenance', errorText(error));
|
|
1417
|
+
unowned = false;
|
|
1418
|
+
}
|
|
1419
|
+
if (unowned) {
|
|
1420
|
+
const read = await this.readLedger();
|
|
1421
|
+
if (!read.ok) {
|
|
1422
|
+
return read;
|
|
1423
|
+
}
|
|
1424
|
+
if (read.value.ledger.kept !== null) {
|
|
1425
|
+
const strays = await this.reclaimStrays(op, this.holdersPass());
|
|
1426
|
+
if (!strays.ok) {
|
|
1427
|
+
return strays;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
return {
|
|
1431
|
+
ok: false,
|
|
1432
|
+
error: {
|
|
1433
|
+
kind: 'ram-unavailable',
|
|
1434
|
+
reason: 'unproven-owner',
|
|
1435
|
+
detail: `${this.paths.mountpoint} is an unmounted directory with unowned contents; nothing removed or hidden by a new mount`,
|
|
1436
|
+
},
|
|
1437
|
+
};
|
|
1331
1438
|
}
|
|
1332
1439
|
const root = await rootReadiness(this.paths);
|
|
1333
1440
|
if (!root.ok) {
|
|
@@ -1747,7 +1854,7 @@ async function removeMountDirectories(directories) {
|
|
|
1747
1854
|
function leaseOn(lease, volume) {
|
|
1748
1855
|
if (volume === null) {
|
|
1749
1856
|
return {
|
|
1750
|
-
lost: `no marked volume is mounted at ${lease.mountpoint} any more: it was detached while the task held its lease`,
|
|
1857
|
+
lost: `no marked volume is mounted at ${lease.mountpoint} any more: it was unmounted or detached while the task held its lease`,
|
|
1751
1858
|
};
|
|
1752
1859
|
}
|
|
1753
1860
|
if (volume.attach !== lease.attach) {
|