@vzn/vx 0.0.61 → 0.0.62

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.61",
3
+ "version": "0.0.62",
4
4
  "description": "An open, extensible monorepo task runner.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,10 +17,10 @@
17
17
  "node": ">=18"
18
18
  },
19
19
  "optionalDependencies": {
20
- "@vzn/vx-linux-x64": "0.0.61",
21
- "@vzn/vx-linux-arm64": "0.0.61",
22
- "@vzn/vx-darwin-x64": "0.0.61",
23
- "@vzn/vx-darwin-arm64": "0.0.61"
20
+ "@vzn/vx-linux-x64": "0.0.62",
21
+ "@vzn/vx-linux-arm64": "0.0.62",
22
+ "@vzn/vx-darwin-x64": "0.0.62",
23
+ "@vzn/vx-darwin-arm64": "0.0.62"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -29,6 +29,8 @@ export interface SummarizeArgs {
29
29
  totalMs: number
30
30
  /** The run's verdict — the same value the CLI turns into the exit code. */
31
31
  ok: boolean
32
+ /** The process's exit code where it is not `ok ? 0 : 1`: a stopping signal's. */
33
+ exitCode?: number
32
34
  outcomes: readonly TaskOutcome[]
33
35
  /** What `detectFlaky` found this run; the footer's Flaky section, typed. */
34
36
  flaky?: readonly FlakyFinding[]
@@ -96,12 +98,13 @@ export async function writeRunSummary(args: SummarizeArgs): Promise<string> {
96
98
  // parser must not be told less than a human is.
97
99
  const aborted = args.outcomes.filter((o) => !isGroupTask(o.node) && o.status === 'aborted')
98
100
  const flakyById = new Map((args.flaky ?? []).map((f) => [f.taskId, f]))
101
+ const exitCode = args.exitCode ?? (args.ok ? 0 : 1)
99
102
  const payload = {
100
103
  runId: args.runId,
101
104
  // The run-level verdict, first: a consumer gating on this artifact must
102
105
  // not have to re-derive it by re-implementing the bucket rules.
103
- ok: args.ok,
104
- exitCode: args.ok ? 0 : 1,
106
+ ok: exitCode === 0,
107
+ exitCode,
105
108
  startedAt: new Date(args.startedAtMs).toISOString(),
106
109
  endedAt: new Date(args.endedAtMs).toISOString(),
107
110
  totalMs: args.totalMs,
@@ -58,6 +58,7 @@ import { prepareRun, type PreparedRun } from './prepare.js'
58
58
  import { acquireRunLock } from './run-lock.js'
59
59
  import {
60
60
  forwardedSignal,
61
+ type StopSignal,
61
62
  forwardSignals,
62
63
  SIGNAL_SHUTDOWN_GRACE_MS,
63
64
  terminateChildren,
@@ -456,7 +457,7 @@ async function runOnBus(
456
457
  // handler exited before any outcome landed, and a Ctrl-C'd run then read
457
458
  // in `vx last` as FAILED with 0 tasks (item 854). An embedder's abort is
458
459
  // its own call and keeps its record.
459
- let stoppedBySignal = false
460
+ let stoppedBy: StopSignal | undefined
460
461
  let leftRun = (): void => {}
461
462
  const runLeft = new Promise<void>((resolve) => {
462
463
  leftRun = resolve
@@ -468,7 +469,7 @@ async function runOnBus(
468
469
  liveChildren,
469
470
  persistentRegistry,
470
471
  stop: (signal) => {
471
- stoppedBySignal = true
472
+ stoppedBy = signal
472
473
  stopRun.abort(signal)
473
474
  },
474
475
  done: runLeft,
@@ -903,7 +904,10 @@ async function runOnBus(
903
904
 
904
905
  // Optional artifacts. Errors are surfaced to the user but don't
905
906
  // change the run's exit code — the run already happened.
906
- if (options.summarize !== undefined) {
907
+ // Written again after the keep-alive wait: a kept server's crash or a
908
+ // Ctrl-C there is the process's exit, and the first write said ok.
909
+ const summarize = async (runOk: boolean): Promise<void> => {
910
+ if (options.summarize === undefined) return
907
911
  try {
908
912
  const wrote = await writeRunSummary({
909
913
  target: options.summarize,
@@ -913,7 +917,8 @@ async function runOnBus(
913
917
  startedAtMs: endedAtMsAtStart,
914
918
  endedAtMs,
915
919
  totalMs,
916
- ok,
920
+ ok: runOk,
921
+ ...(stoppedBy !== undefined && { exitCode: signalExitCode(stoppedBy) }),
917
922
  outcomes: list,
918
923
  flaky,
919
924
  })
@@ -923,6 +928,7 @@ async function runOnBus(
923
928
  log.status(`vx: failed to write summary: ${msg}`)
924
929
  }
925
930
  }
931
+ await summarize(ok)
926
932
  if (options.profile !== undefined) {
927
933
  try {
928
934
  const wrote = await writeRunProfile({
@@ -964,7 +970,7 @@ async function runOnBus(
964
970
  withTelemetry: telemetry !== undefined,
965
971
  })
966
972
  try {
967
- if (!stoppedBySignal) cache.recordRunBundle(records)
973
+ if (stoppedBy === undefined) cache.recordRunBundle(records)
968
974
  } catch (err) {
969
975
  // History is observability: a full cache disk at the very end must
970
976
  // not turn a finished run's verdict into a stack and exit 1 (seen as
@@ -1105,6 +1111,7 @@ async function runOnBus(
1105
1111
  )
1106
1112
  }
1107
1113
  await terminateChildren(() => keepAlive.children)
1114
+ await summarize(ok && first.code === 0)
1108
1115
  return { ok: ok && first.code === 0, outcomes: list }
1109
1116
  }
1110
1117