Commit Graph
1 Commits
Author SHA1 Message Date
clawbot 6d8709be51 test(#1735): /api/perf/async-migrations handler tests + tighter reader-yield assertion + orphan-tx test doc
Group F from PR #1735 round-1 review (must-fix #11, #12, #13).

#11 — Add cmd/server/async_migrations_handler_test.go covering the four
states of /api/perf/async-migrations:
  - success with rows: 200 + JSON array
  - empty list: 200 + '[]' (not 'null', so warmup-banner.js can iterate)
  - readAsyncMigrations error: HTTP 500 + JSON error body (not silently
    empty — that was the round-1 must-fix)
  - nil db (server pre-DB-init): 200 + '[]'

#13 (kent-beck BLOCKER) — TestChunkedBackfill_YieldsToReaderBetweenBatches:
the original threshold (12K rows, 500ms reader-latency bound) was loose
enough that a single-tx fake whose total wall time was <500ms could pass.
Tightened to:
  - sample BASELINE reader latency BEFORE backfill starts (avg of 5
    probes)
  - sample BEST reader latency during backfill
  - assert bestDuring < 80ms absolute AND ratio < 5x baseline (with 5ms
    floor to avoid sub-ms flakiness)
A single-tx implementation that holds the writer the entire wall time
would push the during-latency ratio into the 50-100x range and fail
deterministically. Comment in the test body explains why.

#12 — TestChunkedBackfill_OrphanTxTerminates: doc-only — explain why the
orphan insert and seedTransmissions run in separate transactional
contexts (orphan has no observation row; can't share seed's tx; the
backfill loop is committed-state-only so the split has no effect on
what's being asserted).
2026-06-16 20:03:54 +00:00