test: stop two tests failing on timing and megapixels - #1526
Merged
Conversation
Both of these blocked unrelated PRs today and neither is auto-retryable: #1419's contention retry declines find.test.ts as outside its enumerated list, and slow-gate failures cannot be re-checked by a rerun. Each occurrence costs a manual re-run. find.test.ts 'wait captures fresh snapshots while polling' asserted exactly 2 dispatches. The wait loop polls at a 300ms interval against a 350ms budget, and its last sleep consumes whatever remains, so it lands exactly on remainingMs() === 0 — a sleep returning a millisecond early admits a third poll. The count was never assertable. The test's actual subject is that each poll re-captures instead of reusing the first tree, so it now asserts that: at least two captures, every one a snapshot. The sibling assertion at the top of the file is left alone: it takes its count from mockResolvedValueOnce ordering, not from the clock. apps.test.ts built 1206x2622 (iPhone 16 Pro, 3.2 megapixels) source PNGs to prove two rescale ratios. Both sources are now 126x273 — still divisible by 3, so the /3 and 2/3 arithmetic stays exact — with expectations updated to match. Measured on this machine: the density test 1021ms -> 34ms, the retry test 1176ms -> 233ms, the file's test time 2.48s -> 1.00s. Both suites pass: 18/18 find, 54/54 apps. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RXQLYV7etZx3gcXsUsrQJ8
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
Member
Author
|
Clean review at exact head Residual risk: no separately authorized cross-vendor review was performed. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two tests blocked unrelated PRs today. Neither is auto-retryable: #1419's contention retry declines
find.test.tsas outside its enumerated list, and slow-gate failures cannot be re-checked by a rerun. Every occurrence costs someone a manual re-run.find.test.ts— an un-assertable poll countwait captures fresh snapshots while pollingasserted exactly 2 dispatches.The wait loop polls at a 300 ms interval against a 350 ms budget, and its final sleep consumes whatever remains — so it lands on exactly
remainingMs() === 0. A sleep that returns even a millisecond early makeshasTimeRemaining()true and admits a third poll. The count was never assertable; it just usually came out at 2.The test's actual subject is that each poll re-captures rather than reusing the first tree. It now asserts that directly: at least two captures, and every one a
snapshot.The sibling exact-count assertion earlier in the file is deliberately left alone — it takes its count from
mockResolvedValueOnceordering (the match appears in the second tree), not from the clock, so it is deterministic.apps.test.ts— 3.2 megapixels to prove a ratioTwo tests built 1206×2622 source PNGs (iPhone 16 Pro native) purely to verify rescale arithmetic. Both are now 126×273 — still divisible by 3, so the
/3and2/3rescales stay exact — with expectations updated to match.Measured locally:
keeps requested simulator pixel densityretries simulator capture timeoutsVerification
18/18
find.test.ts, 54/54apps.test.ts. Typecheck, lint and oxfmt clean.Neither change weakens what the tests cover: the polling test still proves fresh captures, and both rescale tests still assert exact output dimensions.
Generated by Claude Code