Skip to content

Regression coverage for real-use bugs, and fixes for their live siblings - #16

Merged
mxriverlynn merged 7 commits into
mainfrom
fix/regression-coverage-bigint-sandbox
Sep 22, 2026
Merged

mxriverlynn merged 7 commits into
mainfrom
fix/regression-coverage-bigint-sandbox

Conversation

@mxriverlynn

@mxriverlynn mxriverlynn commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Adds regression tests for the bugs hit in real use of skillwalker, and test-drives fixes for three similar bugs still in the code. The review of past sessions found that several earlier fixes shipped with tests whose fakes or sample data avoided the exact condition that broke. These tests use the real collaborators instead.

Fixes

  • SCIL/ACIL history pages crashed on a perfect score. When every iteration's trainAccuracy is a whole number, DuckDB infers a BIGINT column, and MAX() returns a JS BigInt that c.json can't serialize, so /api/scil and /api/acil returned 500. It's now cast to DOUBLE (run-status.ts).
  • Per-test analytics and run detail pages crashed on whole-dollar costs. ROUND() of a BIGINT stays BIGINT, so a data set where every total_cost_usd is a whole number (e.g. 0) broke /api/analytics/per-test and /api/test-runs/:runId. It's now cast to DOUBLE (analytics.ts).
  • sandbox create said "ready" when sbx run failed. The exit code was never checked. It now throws SandboxError (lifecycle.ts).

New tests

  • packages/web/src/server/app.integration.test.ts: sends real requests through the real Hono app, against Parquet built from real JSONL, with nothing mocked. Covers whole-number scores, accuracies, and costs, plus an empty data directory. Before the two data fixes, four of these routes returned 500. To make this possible, the API wiring moved from index.ts into createApp(dataDir) in app.ts, and index.ts still adds the embedded static assets.
  • packages/cli/src/compiled-binary.smoke.test.ts (new test:smoke script and new CI job): runs make build, then update-analytics-data with the compiled CLI, and queries /api/test-runs from the compiled web server. Both tests fail when build/duckdb.node is missing. Smoke tests are excluded from bun run test and make test because they need build output.
  • command-registration.integration.test.ts: a fake failing sbx on PATH checks that sandbox errors print as one Error: line. This test fails when the SandboxError catch in packages/cli/index.ts is removed.
  • Integration tests in analytics.integration.test.ts and a unit test in lifecycle.test.ts for each fix. Each was observed failing before its fix.

Not in this PR

  • Moving SandboxError under SkillwalkerError is deferred. SkillwalkerError lives in execution, which depends on sandbox-integration, so it first needs a new home lower in the dependency graph.

Checks

  • Unit: 969 passed
  • Integration: 106 passed
  • Smoke: 2 passed on macOS locally and on Linux in CI (the Linux build packages libduckdb.so)
  • Typecheck and format: clean
  • Lint: no errors. 263 warnings vs 262 on main; the extra one is the file's existing (globalThis as any).Bun.spawn idiom.

🤖 Generated with Claude Code

mxriverlynn and others added 7 commits September 22, 2026 14:20
…IL/ACIL scores

When every iteration's trainAccuracy is a whole number (e.g. a run that scores
a perfect 1 on every iteration), DuckDB infers the column as BIGINT and
MAX() returns a JS BigInt, which Hono's c.json cannot serialize. The SCIL and
ACIL history pages then fail with a 500. Cast the aggregate to DOUBLE.

Co-Authored-By: Claude <noreply@anthropic.com>
…ole number

ROUND() of a BIGINT stays BIGINT. When every total_cost_usd in the data set is a
whole number (e.g. early-failing runs that report 0), DuckDB infers BIGINT and
queryPerTest / queryTestRunDetails return a JS BigInt, which breaks JSON
serialization on the per-test analytics and run detail pages. Cast to DOUBLE.

Co-Authored-By: Claude <noreply@anthropic.com>
Route unit tests mock the data layer and fake c.json, so a BigInt or a missing
parquet file never reached real JSON serialization and both crashes shipped.
Extract the API wiring into createApp(dataDir) so an integration test can send
real requests through the real Hono app, backed by parquet built from JSONL with
whole-number scores, accuracies, and costs, plus an empty data directory.

Co-Authored-By: Claude <noreply@anthropic.com>
createSandbox never checked the exit code of the interactive sbx run, so a
failed login or template download still printed "Sandbox is ready" and the next
eval run failed far from the real cause. Throw a SandboxError instead. The test
stubs for sbx run now report exitCode 0, as a real finished process does.

Co-Authored-By: Claude <noreply@anthropic.com>
The CLI catches SandboxError separately from SkillwalkerError, and only the
SkillwalkerError path was tested. Run a sandbox command against a fake sbx on
PATH that fails, and check the output is one Error line with no help text or
stack trace. Confirmed the test fails when the SandboxError catch is removed.

Co-Authored-By: Claude <noreply@anthropic.com>
CI never built or ran ./build/skillwalker, and the staging code's unit tests
stub the Bun runtime, so nothing could catch the compiled binary failing to
load the DuckDB native addon. Add a smoke test that runs update-analytics-data
with the compiled CLI and queries /api/test-runs from the compiled web server,
and a CI job that runs it after make build. Smoke tests are excluded from the
unit and make test runs because they need build output.

Confirmed both tests fail when build/duckdb.node is missing.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@mxriverlynn
mxriverlynn marked this pull request as ready for review September 22, 2026 20:29
@mxriverlynn
mxriverlynn merged commit b8a8fc0 into main Sep 22, 2026
8 checks passed
@mxriverlynn
mxriverlynn deleted the fix/regression-coverage-bigint-sandbox branch September 22, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant