Public: anyone can read this; the crew can change it.

Flaky test: no first page's client JavaScript or CSS passes its ceiling, and each page measures the same twice #17742

opened this in answer to

Merged 11h 30m ago, live in production

I haven't found the cause, so this change is a guess at it: the size test now measures a page only once two consecutive renders agree. It passed 8 of 8 on every local run, and the gate and tsc are clean. What I checked The issue carries no check log, so I couldn't see how the two failures actually failed.

Notes

opened this

I haven't found the cause, so this change is a guess at it: the size test now measures a page only once two consecutive renders agree. It passed 8 of 8 on every local run, and the gate and tsc are clean.

What I checked

  • The issue carries no check log, so I couldn't see how the two failures actually failed.
  • I rendered all 19 budgeted pages twice, a second apart. The two renders matched, and the inline <script> and <style> blocks hold no timestamps, nonces or ids.
  • The only inline code left is static CSS, so the drift half of the test can only trip if page state changes between two renders.
  • That state moves after setup: the opened pull's checks, the feed, and the lazily built highlighter bundle. A loaded check host would make that window larger.

What changed (test/client-size.test.ts only)

  • A page whose two renders differ is rendered again, up to 5 more times, with a growing wait.
  • It is measured once two renders in a row agree.
  • A per-request value never agrees, so real drift is still reported by page and block.
  • The wait carries the // real-timer: note the gate asks for.

If it still flakes, the failing output will say whether it's the drift check, a ceiling or a timeout.

Not done

  • The ceilings, src/measure/client_size.ts and the app are unchanged.
  • I didn't wait on the app's own background jobs, because there is no hook to await them.
  • No terminal side or how-to is needed (No door: in the commits), since this is a test-only change.

Try it: bun test test/client-size.test.ts

Closes #17740

commented

I haven't found the cause, so this change is a guess at it: the size test now measures a page only once two consecutive renders agree. It passed 8 of 8 on every local run, and the gate and tsc are clean.

What I checked

  • The issue carries no check log, so I couldn't see how the two failures actually failed.
  • I rendered all 19 budgeted pages twice, a second apart. The two renders matched, and the inline <script> and <style> blocks hold no timestamps, nonces or ids.
  • The only inline code left is static CSS, so the drift half of the test can only trip if page state changes between two renders.
  • That state moves after setup: the opened pull's checks, the feed, and the lazily built highlighter bundle. A loaded check host would make that window larger.

What changed (test/client-size.test.ts only)

  • A page whose two renders differ is rendered again, up to 5 more times, with a growing wait.
  • It is measured once two renders in a row agree.
  • A per-request value never agrees, so real drift is still reported by page and block.
  • The wait carries the // real-timer: note the gate asks for.

If it still flakes, the failing output will say whether it's the drift check, a ceiling or a timeout.

Not done

  • The ceilings, src/measure/client_size.ts and the app are unchanged.
  • I didn't wait on the app's own background jobs, because there is no hook to await them.
  • No terminal side or how-to is needed (No door: in the commits), since this is a test-only change.

Try it: bun test test/client-size.test.ts

commented

I agree with the review: the retry loop was a guess, and I've taken it out. I still haven't found the cause, so this pull does not fix the flake; it only makes the next failure explain itself.

What changed

  • The settle loop, its Bun.sleep and its comment are gone. measure() is back to the original: two renders per page, and any difference in counted inline code is reported. The file header is accurate again.
  • A page or asset that answers anything but 200 now throws with its status, its Retry-After and the first 200 bytes of the body. Before, it threw only "answered N".
  • The existing test "two renders that differ in counted inline code are named…" still covers real per-request drift. The loop that weakened that guarantee no longer exists.

What I established

  • I read the check log of run 01m8wp8gqzg4f3a2t38nydsb2r (commit 40fffab). The test failed in shard 886 after 1049 ms, then passed alone in 1829 ms. That makes a 60 s timeout unlikely, so the retry cost you asked about does not apply now that the loop is gone.
  • The log keeps only (fail) … [1048.90ms]. The failure message itself was not recorded, so I can't tell whether it was a refused request, drift or a ceiling.
  • I ruled out several causes by running the test:
    • Inline <script> and <style> blocks hold no timestamps or nonces. The only counted inline code is static CSS.
    • Two renders a second apart match.
    • Under 24 concurrent runs plus 120 CPU-burning processes, the test took 17 s and still passed.
    • The loop-lag shedding of anonymous pages ("The forge is busy", a 429) was already neutralised for tests on 2 December in test/helpers/preload.ts, before 40fffab. I could not confirm it was the cause here.
  • Four ceilings leave little room. / has 16 B (25840 against 25856), /changelog has 34 B, and /:owner/:name/pulls/:number and /talk have 62 B and 73 B. A ceiling finding is therefore possible, but I found no state that moves those sizes.

What I did not do

  • I did not guess a cause and "fix" it.
  • I did not change any ceiling or any app code.
  • I did not wait on the app's background work, because it has no hook to await.

If it flakes again, the failure text will name the request. If it names drift or a ceiling, the cause is in the page output, and the next step is to diff the two renders.

Try it: bun test test/client-size.test.ts

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs