@vzn/vx 0.0.332 → 0.0.333

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.332",
3
+ "version": "0.0.333",
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.332",
25
- "@vzn/vx-linux-arm64": "0.0.332",
26
- "@vzn/vx-darwin-x64": "0.0.332",
27
- "@vzn/vx-darwin-arm64": "0.0.332"
24
+ "@vzn/vx-linux-x64": "0.0.333",
25
+ "@vzn/vx-linux-arm64": "0.0.333",
26
+ "@vzn/vx-darwin-x64": "0.0.333",
27
+ "@vzn/vx-darwin-arm64": "0.0.333"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -1268,10 +1268,11 @@ const TRACER_RETRY_LINE =
1268
1268
  * On Linux the task runs under strace, which only REPORTS what the sandbox
1269
1269
  * denied. strace failing on its own (`ptrace(PTRACE_LISTEN,…): Input/output
1270
1270
  * error`, after a build that had finished) turned green work red on CI five
1271
- * times (STATUS Next 24): its exit was the task's. Since B-11 it is not —
1272
- * strace runs detached (`-DD`), and a tracer that dies leaves the command
1273
- * running untraced — but the trace then stops short, and a denial after it
1274
- * goes unreported. So an attempt whose stderr carries strace's own word is
1271
+ * times (STATUS Next 24): its exit was the task's. Since B-11 strace runs
1272
+ * detached (`-DD`), yet under `--seccomp-bpf` (strace 6.8 implies
1273
+ * `--kill-on-exit`) a tracer that dies still SIGKILLs the command: exit
1274
+ * 137 on CI (M-18). Untraced or killed, the trace stopped short and a
1275
+ * denial after it goes unreported. So an attempt whose stderr carries strace's own word is
1275
1276
  * run once more, whatever its exit, unless the run is stopping: the sandbox kept its writes to what it
1276
1277
  * declared, so a second run redoes, not doubles, it.
1277
1278
  */
@@ -1329,8 +1330,13 @@ function collectRecords(
1329
1330
  }
1330
1331
  }
1331
1332
 
1332
- /** strace's own message, a line of a traced task's stderr. */
1333
- const STRACE_OWN_ERROR = /^strace: /
1333
+ /**
1334
+ * strace's own message, a line of a traced task's stderr. strace names
1335
+ * itself by its argv[0], the absolute path vx runs it by
1336
+ * (`/usr/bin/strace: ptrace(PTRACE_LISTEN,…)` on CI), so a bare
1337
+ * `strace: ` never matched there and the retry never fired.
1338
+ */
1339
+ const STRACE_OWN_ERROR = /^(?:[^\s:]*\/)?strace: /
1334
1340
 
1335
1341
  /**
1336
1342
  * One attempt of `runSandboxed`.
@@ -1437,7 +1443,7 @@ async function runSandboxedOnce(
1437
1443
  // Read whatever the capture setting: a line of strace's own says
1438
1444
  // the trace stopped short.
1439
1445
  const lines = (partial + chunk).split('\n')
1440
- partial = (lines.pop() ?? '').slice(0, 64)
1446
+ partial = (lines.pop() ?? '').slice(0, 512)
1441
1447
  if (lines.some((l) => STRACE_OWN_ERROR.test(l))) straceSpoke = true
1442
1448
  args.onStderr?.(chunk)
1443
1449
  },
@@ -252,7 +252,37 @@ function upstreamBuildOnWorker(tasks: GeneratedTask[]): void {
252
252
  * task again beside the member's own (D-45).
253
253
  */
254
254
  const RUNS_MEMBERS =
255
- /(^|[\s;&|(])(turbo|nx|lerna|ultra|wireit|nps|moon|rush|vx)(\s|$)|\s(-r|--recursive|--filter|-F|--workspaces|-ws|--workspace|-w|-C|--dir|--cwd|--prefix|--if-present|--parallel|--stream)(\s|=|$)|\bworkspaces?\s+(foreach|run)\b|\bvp\s+run\s|\bcd\s/
255
+ /(^|[\s;&|(])(turbo|nx|lerna|ultra|wireit|nps|moon|rush|vx)(\s|$)|\bworkspaces?\s+(foreach|run)\b|\bvp\s+run\s|\bcd\s/
256
+
257
+ /** A workspace flag, read only where a package manager takes it (`pmRunsMembers`). */
258
+ const MEMBER_FLAG =
259
+ /^(-r|--recursive|--filter|-F|--workspaces|-ws|--workspace|-w|-C|--dir|--cwd|--prefix|--if-present|--parallel|--stream)(=|$)/
260
+
261
+ /**
262
+ * The workspace flags are a package manager's: on the program it runs they
263
+ * mean something else, and berry's `bench` (`yarn node -r ./setup.ts …`,
264
+ * node's `--require`) was left out as running the members (D-81). With no
265
+ * manager named, a `run` verb is one.
266
+ */
267
+ function pmRunsMembers(script: string): boolean {
268
+ for (const segment of script.split(/&&|\|\||[;|()]/)) {
269
+ const words = segment.trim().split(/\s+/)
270
+ let i = words.findIndex((w) => /^(pnpm|npm|yarn|bun)$/.test(w))
271
+ // npm/cli runs itself: `node . run test --workspaces`.
272
+ if (i < 0) i = words.indexOf('run')
273
+ if (i < 0) continue
274
+ // `exec`, `dlx` and `x` take the manager's flags up to the program name.
275
+ let program = false
276
+ for (i++; i < words.length; i++) {
277
+ const w = words[i]!
278
+ if (MEMBER_FLAG.test(w)) return true
279
+ if (program && !w.startsWith('-')) break
280
+ if (w === 'node') break
281
+ if (w === 'exec' || w === 'dlx' || w === 'x') program = true
282
+ }
283
+ }
284
+ return false
285
+ }
256
286
 
257
287
  /** A package manager running a script by name: `pnpm build`, `npm run x`, `bun run x`. */
258
288
  const RUNS_SCRIPT =
@@ -267,7 +297,9 @@ function runningMembers(scripts: Readonly<Record<string, unknown>>): Set<string>
267
297
  const text = Object.entries(scripts).filter(
268
298
  (e): e is [string, string] => typeof e[1] === 'string',
269
299
  )
270
- const out = new Set(text.filter(([, v]) => RUNS_MEMBERS.test(` ${v}`)).map(([n]) => n))
300
+ const out = new Set(
301
+ text.filter(([, v]) => RUNS_MEMBERS.test(` ${v}`) || pmRunsMembers(v)).map(([n]) => n),
302
+ )
271
303
  for (let grew = true; grew;) {
272
304
  grew = false
273
305
  for (const [n, v] of text) {