@vzn/vx 0.0.447 → 0.0.449

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx",
3
- "version": "0.0.447",
3
+ "version": "0.0.449",
4
4
  "description": "The fastest 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.447",
25
- "@vzn/vx-linux-arm64": "0.0.447",
26
- "@vzn/vx-darwin-x64": "0.0.447",
27
- "@vzn/vx-darwin-arm64": "0.0.447"
24
+ "@vzn/vx-linux-x64": "0.0.449",
25
+ "@vzn/vx-linux-arm64": "0.0.449",
26
+ "@vzn/vx-darwin-x64": "0.0.449",
27
+ "@vzn/vx-darwin-arm64": "0.0.449"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -7,6 +7,7 @@
7
7
  // a later run replays. Moved out of execute-task.ts 2026-09-09 as pure
8
8
  // code motion.
9
9
 
10
+ import { lstatSync, realpathSync } from 'node:fs'
10
11
  import path from 'node:path'
11
12
  import {
12
13
  type CacheLayer,
@@ -16,7 +17,7 @@ import {
16
17
  WORKSPACE_OUTPUT_PREFIX,
17
18
  } from '../cache/index.js'
18
19
  import type { TaskNode } from '../graph/index.js'
19
- import { asTrees, span, taskGlob, wholeSubtreePrefixes } from '../util/index.js'
20
+ import { asTrees, span, staticPrefix, taskGlob, wholeSubtreePrefixes } from '../util/index.js'
20
21
  import type { Logger } from './logger.js'
21
22
  import type { TaskInputComponent } from './task-hash.js'
22
23
 
@@ -129,12 +130,15 @@ export async function saveMiss(a: SaveMissArgs): Promise<{ landed: Promise<void>
129
130
  // `cache.outputs` is not a write grant; `exec.sandbox.allow.write` is.
130
131
  const sandboxed = node.config.exec?.sandbox !== undefined
131
132
  const grantsWrite = (node.config.exec?.sandbox?.allow?.write?.length ?? 0) > 0
133
+ const linkedOut = outputDirLinkedOut(node.projectDir, a.outputs)
132
134
  log.status(
133
135
  `[vx] ${node.id}: cache.outputs matched no files (${[...a.outputs, ...a.wsOutputs].join(', ')}) — ` +
134
136
  `an empty artifact is saved; a later hit restores nothing` +
135
- (sandboxed && !grantsWrite
136
- ? ` — the task is sandboxed and declares no exec.sandbox.allow.write, so its writes never reached disk`
137
- : ''),
137
+ (linkedOut !== undefined
138
+ ? ` — ${linkedOut.dir} is a symlink to ${linkedOut.target}, outside the project, and vx keeps only outputs inside it: make ${linkedOut.dir} a directory`
139
+ : sandboxed && !grantsWrite
140
+ ? ` — the task is sandboxed and declares no exec.sandbox.allow.write, so its writes never reached disk`
141
+ : ''),
138
142
  )
139
143
  }
140
144
  const save = async (): Promise<void> => {
@@ -262,3 +266,43 @@ function markWritten(
262
266
  a.gitFilesCache?.invalidateWorkspacePartition()
263
267
  }
264
268
  }
269
+
270
+ /**
271
+ * The first output directory a pattern names that is a symlink resolving
272
+ * outside the project: every file under it is dropped as out of the
273
+ * project, and the empty-artifact warning blamed the glob (M-61).
274
+ */
275
+ function outputDirLinkedOut(
276
+ projectDir: string,
277
+ outputs: readonly string[],
278
+ ): { dir: string; target: string } | undefined {
279
+ const realProject = realpathOrNull(projectDir) ?? projectDir
280
+ // `dist` names the tree `dist/**`: the same reading the resolver gives.
281
+ for (const pattern of asTrees(outputs.filter((o) => !o.startsWith('!')))) {
282
+ const literal = staticPrefix(pattern)
283
+ .split('/')
284
+ .filter((p) => p !== '' && p !== '.')
285
+ for (let i = 1; i <= literal.length; i++) {
286
+ const dir = literal.slice(0, i).join('/')
287
+ const abs = path.join(projectDir, dir)
288
+ try {
289
+ if (!lstatSync(abs).isSymbolicLink()) continue
290
+ } catch {
291
+ break
292
+ }
293
+ const target = realpathOrNull(abs)
294
+ if (target !== null && target !== realProject && !target.startsWith(realProject + path.sep)) {
295
+ return { dir, target }
296
+ }
297
+ }
298
+ }
299
+ return undefined
300
+ }
301
+
302
+ function realpathOrNull(p: string): string | null {
303
+ try {
304
+ return realpathSync(p)
305
+ } catch {
306
+ return null
307
+ }
308
+ }
@@ -29,8 +29,9 @@ export function teardownTimeoutMs(): number {
29
29
 
30
30
  /**
31
31
  * The SIGTERM→SIGKILL grace a run grants a child that ignores SIGTERM: the
32
- * one-shot timeout escalation (`exec/runner.ts`) and the end-of-run
33
- * persistent shutdown (`orchestrator/persistent.ts`) share it. Two seconds
32
+ * one-shot timeout escalation (`exec/runner.ts`), the signal teardown
33
+ * (`orchestrator/signals.ts`) and the end-of-run persistent shutdown
34
+ * (`orchestrator/persistent.ts`) share it. Two seconds
34
35
  * is generous for a real server's cleanup and is what every run waits when
35
36
  * a child wedges. `VX_KILL_GRACE_MS` overrides it, read per call and bounded
36
37
  * like the teardown deadline (out of range falls back to the default): the