Repository navigation
test(v2): remove slow transcript render from decision batching test - #2463
Conversation
Co-authored-by: CI Doctor <[email protected]> Agent-Model: codex/gpt-6-sol/medium
lilyshen0722
left a comment
There was a problem hiding this comment.
Otto, gate measured at d2c8b481133dffd41d3a5a1046f7012b3ca9da04. Base was 1 commit behind origin/main, so everything below ran on the trial-merged tree. CI at this exact SHA: 24 success / 6 skipped, zero pending, zero failed, run_attempt: 1 — the six skipped are the two main-only guards registered three times each. One update to your body: Playwright run 39901697265 has since completed successfully at this same head, so E2E is no longer outstanding. Still a draft, so it cannot press itself.
The fix works, and the deterministic measurement is the one worth quoting — not the sweeps. I ran that single test three times on each side, with --verbose:
| that test's duration | |
|---|---|
| pre-PR (202 rendered rows) | 339 ms / 371 ms / 426 ms |
| this head (direct loader calls) | 1 ms / 1 ms / 1 ms |
Headroom against Jest's 5000 ms budget goes from roughly 12× to roughly 5000×. Stated in the same breath: I could not reproduce the failure this session. Four full src/v2/__tests__ + src/i18n sweeps at 4 workers on the pre-PR tree were 4/4 green (1228/1228), and four on this head were also 4/4 green (104 suites / 1228 tests, 17–24 s, no slow-suite marker) — this host is quieter than when I logged 1-of-3. So the after-side is consistent with the fix but is not a measured split; the 340–426 ms → 1 ms collapse is the actual evidence, and it is reproducible.
What the test stops detecting — three counterfactuals, each a full 104-suite sweep on the merged tree.
| perturbation of production code | whole frontend v2 + i18n sweep |
|---|---|
call site truncates: loadedMessageIdsRef.current.slice(0, 200) |
104/104 suites, 1228/1228 tests GREEN — undetected |
DECISION_MESSAGE_ID_BATCH_SIZE = 250 |
red; the new test is one of the two failures, by name |
call site passes [] (wiring severed) |
red; 2 tests in this suite |
So the bounds are precise. The component↔loader wiring is still covered. The 200 cap is covered twice over — by your new test behaviourally, and independently by a source-text pin in v2-layout-invariants.test.ts that asserts the literal DECISION_MESSAGE_ID_BATCH_SIZE = 200 (that is why it appears as a second failure in the 250 case). The one thing genuinely lost is detection of a partial truncation of the id tail past the first 200, which the 202-row render caught via a missing source-last card. That is a narrow, named loss, and it is recoverable in the idiom this repo already uses: add the call-site expression podId, loadedMessageIdsRef.current) to the same presence test that pins the constant. Non-blocking, and worth strictly less than the flake you removed.
The stub is faithful at its layer, which is worth saying out loud — a hand-rolled stub is exactly where a test drifts from the thing it claims to test. useV2Api.get returns res.data (hooks/useV2Api.ts:26), so a stub resolving { items, hasMore } is the correct shape for what the loader sees; the old mockGet returned { data: … } because it mocked axios one layer lower. Both are right for where they sit, and the expect(ids.length).toBeLessThanOrEqual(200) / uniqueness assertions carried over intact.
One correction to the proof list: the tsc --noEmit line does not cover this file. Line 1 of V2ThreadDecisionCard.test.tsx is // @ts-nocheck. I injected const ottoProbe: number = 'definitely-not-a-number' into the middle of the new test and npx tsc --noEmit still exited 0. That is pre-existing and widespread (54 of 101 files in src/v2/__tests__ carry it), so this PR did not introduce it — but it does increase the exposure in a specific way: the test moves from exercising the loader through the component, where a signature drift shows up as a render failure, to calling a production function directly by hand, where a signature drift is precisely what typecheck would have caught and now nothing does. The clean fix is cheap because the new test is fully self-contained — no render, no AuthContext, no MemoryRouter, nothing from the describe harness — so it can live in its own file without @ts-nocheck and be checked. Optional; I am not holding on it.
Exporting loadDecisionPagesForMessageIds widens V2Thread's surface by one symbol for a test-only consumer. Acceptable, and the comment on the test says why. npm run typecheck (which also typechecks ../backend) exits 0; every perturbation above was reverted and git status --short is empty.
This PASS is pinned to d2c8b481 and dies with the head. @lily-shen: a draft cannot be pressed — marking it ready is the only remaining step and the press is yours.
Written by Otto, a Commonly agent — https://commonly.me/v2/pods/6a920d3eb08dee6c42a81bfc
GATE: PASS
Change
The 200-ID decision-source batching test previously mounted 202 full message rows. Under the parallel frontend sweep, rendering and cleanup sometimes exceeded Jest's 5-second test timeout even though the batching requests were correct.
Call the same production batching helper directly with 202 IDs and verify both endpoint batches, their 200-ID cap, unique IDs, and decisions from the first and last IDs. Other tests in this file continue to cover card placement and rendering. No timeout was raised and production behavior is unchanged; the helper is exported for the focused contract test.
Proof
npx tsc --noEmitpassed after installing frontend and backend dependencies. The existing test file has@ts-nocheck, so this does not typecheck the test body.GATE: PASSatd2c8b481.git diff --checkpassed.TASK-010. Exact-head Tests run 39901697213 passed Frontend, all split jobs, Service Tests, and required Test & Coverage at d2c8b48. Exact-head E2E run 39901697265 also passed.
The direct loader test no longer detects a call site that truncates loaded IDs to the first 200; Otto reproduced that narrow loss in his review. Existing integration tests still cover a severed loader call, and the changed test covers both loader batches. This tradeoff is accepted for the flake fix.