Files
civitai__civitai/scripts
Zachary Lowden 7826ba9bfb fix(dev-server): one exit-code rule for both test-queue waiters, and a log that admits when it was clipped (#4102)
`exitCodeFor` in the queue module exists to stop a signal-killed run reporting a
shell 255 -- its own comment says so. `test wait` used it; the wrapper behind
`pnpm run test:unit:run` kept a second copy of the rule, `state.exitCode || 1`,
which passes the recorded -1 straight to `process.exit`. Measured through a real
daemon: a run cancelled mid-flight exited 255, where `test wait` on the same run
exited 1. The copy is deleted rather than corrected -- the wrapper now imports
`exitCodeFor` and uses it.

The queue also kept the last 2000 lines of a run and dropped the rest in silence,
so a fragment was byte-for-byte indistinguishable from a whole log. Measured: a
child writing 5000 lines produced 1998 through `test wait` with nothing said. The
window is unchanged; the drop is now counted (`logsDropped` on the run view, and
`dropped` on the log response for callers that fetch logs directly) and both
waiters name the number at the moment the verdict lands.

`scripts/test-unit-run.mjs` now honours `DEV_DAEMON_PORT` like the CLI already
did. That is what makes the verdict testable at all: with the port hardcoded
there was no way to stand a stub daemon beside the shared one, which is why a
decision this load-bearing had no test and was free to drift.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 19:15:02 -05:00
..
2026-06-04 15:58:33 -06:00