@vzn/vx 0.0.339 → 0.0.341
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 +1 -1
- package/package.json +5 -5
- package/src/cache/output-index.ts +14 -2
- package/src/cli/foreign-flags.ts +68 -0
- package/src/exec/executor.ts +4 -4
- package/src/exec/local-executor.ts +11 -1
- package/src/orchestrator/run.ts +9 -4
package/README.md
CHANGED
|
@@ -120,7 +120,7 @@ Give a task a cache block (what it reads, what it writes):
|
|
|
120
120
|
|
|
121
121
|
```ts
|
|
122
122
|
// packages/app/vx.config.ts
|
|
123
|
-
import { defineProject } from '@vzn/vx'
|
|
123
|
+
import { defineProject } from '@vzn/vx/config'
|
|
124
124
|
|
|
125
125
|
export default defineProject({
|
|
126
126
|
tasks: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.341",
|
|
4
4
|
"description": "A fast, correct task runner and build cache for JavaScript monorepos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
23
23
|
"optionalDependencies": {
|
|
24
|
-
"@vzn/vx-linux-x64": "0.0.
|
|
25
|
-
"@vzn/vx-linux-arm64": "0.0.
|
|
26
|
-
"@vzn/vx-darwin-x64": "0.0.
|
|
27
|
-
"@vzn/vx-darwin-arm64": "0.0.
|
|
24
|
+
"@vzn/vx-linux-x64": "0.0.341",
|
|
25
|
+
"@vzn/vx-linux-arm64": "0.0.341",
|
|
26
|
+
"@vzn/vx-darwin-x64": "0.0.341",
|
|
27
|
+
"@vzn/vx-darwin-arm64": "0.0.341"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@anthropic-ai/sandbox-runtime": "^0.0.76"
|
|
@@ -67,6 +67,8 @@ export class OutputIndex {
|
|
|
67
67
|
* hash refreshes rather than appends).
|
|
68
68
|
*/
|
|
69
69
|
replaceFileRows(hash: string, rows: ReadonlyArray<[string, number, number, number]>): void {
|
|
70
|
+
// A stamp taken for the rows this replaces describes their files, not these.
|
|
71
|
+
this.pendingStamps.delete(hash)
|
|
70
72
|
this.deleteOutputFiles.run(hash)
|
|
71
73
|
for (const [rel, size, mode, mtime] of rows) {
|
|
72
74
|
this.insertOutputFile.run(hash, rel, size, mode, mtime)
|
|
@@ -83,8 +85,9 @@ export class OutputIndex {
|
|
|
83
85
|
// warm-hit path (called up to 3× per hit) reuses one statement instead of
|
|
84
86
|
// recompiling on every call.
|
|
85
87
|
// A reader in the same process (`vx watch`'s next cycle, a test) sees
|
|
86
|
-
// the stamps taken, not only the ones flushed
|
|
87
|
-
|
|
88
|
+
// the stamps taken, not only the ones flushed: overlaid below from
|
|
89
|
+
// memory. A flush here committed a transaction per read, and a restore
|
|
90
|
+
// reads its rows twice.
|
|
88
91
|
const placeholders = hashes.map(() => '?').join(',')
|
|
89
92
|
const stmt = this.db.query(
|
|
90
93
|
`SELECT entry_hash, path, size_bytes, mode, mtime_ms, ino, ctime_ms FROM output_files WHERE entry_hash IN (${placeholders})`,
|
|
@@ -114,6 +117,15 @@ export class OutputIndex {
|
|
|
114
117
|
row.ino = r.ino
|
|
115
118
|
row.ctimeMs = r.ctime_ms
|
|
116
119
|
}
|
|
120
|
+
const pending = this.pendingStamps.get(r.entry_hash)
|
|
121
|
+
if (pending !== undefined) {
|
|
122
|
+
for (const [rel, ino, ctime] of pending) {
|
|
123
|
+
if (rel !== r.path) continue
|
|
124
|
+
row.ino = ino
|
|
125
|
+
row.ctimeMs = ctime
|
|
126
|
+
break
|
|
127
|
+
}
|
|
128
|
+
}
|
|
117
129
|
list.push(row)
|
|
118
130
|
}
|
|
119
131
|
return out
|
package/src/cli/foreign-flags.ts
CHANGED
|
@@ -163,6 +163,74 @@ export const FOREIGN_FLAGS: readonly ForeignFlag[] = [
|
|
|
163
163
|
vx: '`--exclude-dependencies`',
|
|
164
164
|
to: () => ['--exclude-dependencies'],
|
|
165
165
|
},
|
|
166
|
+
{
|
|
167
|
+
runner: 'turbo',
|
|
168
|
+
names: ['--color'],
|
|
169
|
+
value: false,
|
|
170
|
+
outcome: 'refuse',
|
|
171
|
+
vx: 'set `FORCE_COLOR=1`',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
runner: 'turbo',
|
|
175
|
+
names: ['--no-color'],
|
|
176
|
+
value: false,
|
|
177
|
+
outcome: 'refuse',
|
|
178
|
+
vx: 'set `NO_COLOR=1`',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
runner: 'turbo',
|
|
182
|
+
names: ['--heap', '--trace'],
|
|
183
|
+
value: true,
|
|
184
|
+
outcome: 'refuse',
|
|
185
|
+
vx: "use `--profile[=<path>]` for vx's own trace",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
runner: 'turbo',
|
|
189
|
+
names: ['--login'],
|
|
190
|
+
value: true,
|
|
191
|
+
outcome: 'refuse',
|
|
192
|
+
vx: 'vx has no login: a remote cache is a plugin (`turboCache()` from @vzn/vx-migrate)',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
runner: 'turbo',
|
|
196
|
+
names: ['--no-update-notifier'],
|
|
197
|
+
value: false,
|
|
198
|
+
outcome: 'refuse',
|
|
199
|
+
vx: 'vx prints no update notice: drop it',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
runner: 'turbo',
|
|
203
|
+
names: ['--skip-infer'],
|
|
204
|
+
value: false,
|
|
205
|
+
outcome: 'refuse',
|
|
206
|
+
vx: 'vx runs the binary it is: drop it',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
runner: 'turbo',
|
|
210
|
+
names: ['--root-turbo-json'],
|
|
211
|
+
value: true,
|
|
212
|
+
outcome: 'refuse',
|
|
213
|
+
vx: '`turbo()` reads the `turbo.json` at the workspace root: move it there',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
runner: 'turbo',
|
|
217
|
+
names: [
|
|
218
|
+
'--experimental-otel-enabled',
|
|
219
|
+
'--experimental-otel-protocol',
|
|
220
|
+
'--experimental-otel-endpoint',
|
|
221
|
+
'--experimental-otel-timeout-ms',
|
|
222
|
+
'--experimental-otel-interval-ms',
|
|
223
|
+
'--experimental-otel-header',
|
|
224
|
+
'--experimental-otel-resource',
|
|
225
|
+
'--experimental-otel-metrics-run-summary',
|
|
226
|
+
'--experimental-otel-metrics-task-details',
|
|
227
|
+
'--experimental-otel-use-remote-cache-token',
|
|
228
|
+
],
|
|
229
|
+
value: true,
|
|
230
|
+
shown: '`--experimental-otel-*`',
|
|
231
|
+
outcome: 'refuse',
|
|
232
|
+
vx: 'telemetry is a plugin: `otel()` from @vzn/vx-otel in vx.workspace.ts',
|
|
233
|
+
},
|
|
166
234
|
{
|
|
167
235
|
runner: 'nx',
|
|
168
236
|
names: ['--parallel'],
|
package/src/exec/executor.ts
CHANGED
|
@@ -143,10 +143,10 @@ export interface ExecuteRequest {
|
|
|
143
143
|
* Aborted when the run stops (Ctrl-C, SIGTERM, SIGHUP or an embedder's
|
|
144
144
|
* `RunOptions.signal`) or when `timeoutMs` elapses. An executor ends its
|
|
145
145
|
* work and returns: a child an executor spawned is not one core can
|
|
146
|
-
* reach (H-10, H-12).
|
|
147
|
-
*
|
|
148
|
-
* 2 s) after the abort, then
|
|
149
|
-
* abandons it (H-14).
|
|
146
|
+
* reach (H-10, H-12). One already aborted is work not to start (B-55).
|
|
147
|
+
* A non-zero exit after the timeout's abort is recorded `timedOut`. Core
|
|
148
|
+
* waits the kill grace (`VX_KILL_GRACE_MS`, 2 s) after the abort, then
|
|
149
|
+
* settles the attempt without `execute` and abandons it (H-14).
|
|
150
150
|
*/
|
|
151
151
|
readonly signal?: AbortSignal
|
|
152
152
|
/** See `RunOptions.liveChildren`: the run's SIGINT/SIGTERM registry. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// plugin claims the task, so it sits at the TAIL of every executor list
|
|
5
5
|
// (owner, 2026-09-05). An executor plugin places work ELSEWHERE; its
|
|
6
6
|
// absence is "here".
|
|
7
|
-
import { runCommand } from './runner.js'
|
|
7
|
+
import { runCommand, signalExitCode } from './runner.js'
|
|
8
8
|
import { runSandboxed } from './sandbox-runtime.js'
|
|
9
9
|
import type { TaskExecutor } from './executor.js'
|
|
10
10
|
|
|
@@ -24,6 +24,16 @@ export function localExecutor(): TaskExecutor {
|
|
|
24
24
|
const executor: TaskExecutor = {
|
|
25
25
|
name: 'local',
|
|
26
26
|
async execute(req) {
|
|
27
|
+
// A stop that landed before the spawn (during the output clean, the
|
|
28
|
+
// request's build) leaves nothing to kill yet: a command spawned now
|
|
29
|
+
// runs after the teardown swept the run's children, and held the run
|
|
30
|
+
// to the signal's bound.
|
|
31
|
+
if (req.signal?.aborted === true) {
|
|
32
|
+
const reason: unknown = req.signal.reason
|
|
33
|
+
const signal = reason === 'SIGINT' || reason === 'SIGHUP' ? reason : 'SIGTERM'
|
|
34
|
+
const exitCode = signalExitCode(signal)
|
|
35
|
+
return { exitCode, durationMs: 0, stdout: '', stderr: '', signal, violations: [] }
|
|
36
|
+
}
|
|
27
37
|
const common = {
|
|
28
38
|
command: req.command,
|
|
29
39
|
cwd: req.cwd,
|
package/src/orchestrator/run.ts
CHANGED
|
@@ -908,7 +908,7 @@ async function runOnBus(
|
|
|
908
908
|
// change the run's exit code — the run already happened.
|
|
909
909
|
// Written again after the keep-alive wait: a kept server's crash or a
|
|
910
910
|
// Ctrl-C there is the process's exit, and the first write said ok.
|
|
911
|
-
const summarize = async (runOk: boolean): Promise<void> => {
|
|
911
|
+
const summarize = async (runOk: boolean, final = list): Promise<void> => {
|
|
912
912
|
if (options.summarize === undefined) return
|
|
913
913
|
try {
|
|
914
914
|
const wrote = await writeRunSummary({
|
|
@@ -921,7 +921,7 @@ async function runOnBus(
|
|
|
921
921
|
totalMs,
|
|
922
922
|
ok: runOk,
|
|
923
923
|
...(stoppedBy !== undefined && { exitCode: signalExitCode(stoppedBy) }),
|
|
924
|
-
outcomes:
|
|
924
|
+
outcomes: final,
|
|
925
925
|
flaky,
|
|
926
926
|
})
|
|
927
927
|
log.status(`vx: summary written to ${wrote}`)
|
|
@@ -1113,8 +1113,13 @@ async function runOnBus(
|
|
|
1113
1113
|
)
|
|
1114
1114
|
}
|
|
1115
1115
|
await terminateChildren(() => keepAlive.children)
|
|
1116
|
-
|
|
1117
|
-
|
|
1116
|
+
// The server that ended the session on its own, not cleanly, failed:
|
|
1117
|
+
// the rewritten summary said `ok: false` over every task `success`
|
|
1118
|
+
// and `failed: 0`, and so did the outcomes `--report` renders (C-53).
|
|
1119
|
+
if (!stopRun.signal.aborted && first.code !== 0) failServer(node.id, first.code)
|
|
1120
|
+
const final = [...outcomes.values()]
|
|
1121
|
+
await summarize(ok && first.code === 0, final)
|
|
1122
|
+
return { ok: ok && first.code === 0, outcomes: final }
|
|
1118
1123
|
}
|
|
1119
1124
|
|
|
1120
1125
|
return { ok, outcomes: list }
|