Skip to content

test(bindx): fix the chronic author-select flake, capture failure screenshots, cover collectFieldsData - #90

Open
matej21 wants to merge 2 commits into
mainfrom
test/browser-flake-and-cycle-coverage
Open

test(bindx): fix the chronic author-select flake, capture failure screenshots, cover collectFieldsData#90
matej21 wants to merge 2 commits into
mainfrom
test/browser-flake-and-cycle-coverage

Conversation

@matej21

@matej21 matej21 commented Aug 25, 2026

Copy link
Copy Markdown
Member

Two test-only changes.

The chronic browser flake

Article with Author Select > changing author enables save and updates display has failed on roughly half of all CI attempts since 2026-08-20, on branches that touch nothing near it — 10 of 18 attempts in one sweep on 2026-08-24, and again today on the merge commit for #89. It has been reading as a regression signal on unrelated PRs.

The popover was opened once, outside the clickUntil retry loop:

el(`${tid('article-with-author-select')} [aria-haspopup="dialog"]`).click()
waitFor(() => janeOption().exists)
clickUntil(() => janeOption(), () => …includes('Jane'))

A click that lands while the option list is remounting is lost and dismisses the popover. From then on janeOption() does not exist, so every remaining attempt throws inside the target callback (swallowed by design) and settles for nothing. The budget burns without a single real try — which is why the failure always costs the full ~15s and why raising the budget would not have helped.

Now the popover is opened inside the retry callback, and only when the option is not already present, so a dismissed popover is reopened instead of toggled shut.

Screenshots on failure

ci.yml has always uploaded /tmp/browser-test-*.png on failure, but nothing in the harness ever called screenshot() — the artifact was empty on every red run, which is part of why this flake stayed unexplained for a week. waitFor now captures on timeout; clickUntil passes capture: false for the intermediate polls it expects to fail and retry.

collectFieldsData cycle coverage

Follow-up to #88. collectFieldsData is the other public entry into relation collection and reaches collectHasOneOperation exactly as collectUpdateData does, so it walks a hasOne cycle and — without the guard from #89 — overflows the stack. It had no coverage because nothing in the persist pipeline routes through it: a fields-scoped persist uses BatchPersister's own scalar-only variant instead. Verified the new case fails with the RangeError when the guard is reverted.

Verification

  • bun run test:browser locally: 66 pass / 0 fail; the author-select file alone drops from ~15s worst case to 4s
  • screenshot-on-timeout confirmed end to end — a forced timeout produced /tmp/browser-test-<ts>.png and named it in the error
  • bun test tests/unit/persistence/relationCycleCollection.test.ts: 4 pass; the new case fails with RangeError against the pre-fix(bindx): stop nested collection recursing through relation cycles #89 collector

Note for a follow-up, not changed here: MutationCollector.collectFieldsData has no caller anywhere in the monorepo.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EmqgPtZvAfpvWKymfFZCEX

matej21 and others added 2 commits August 25, 2026 17:41
`collectFieldsData` is the other public way into relation collection, and
it reaches `collectHasOneOperation` the same way `collectUpdateData`
does — so it walks a hasOne cycle and, without the in-progress guard,
overflows the stack. It had no coverage because nothing in the persist
pipeline routes through it: a fields-scoped persist uses BatchPersister's
own scalar-only variant instead.

Refs #88

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EmqgPtZvAfpvWKymfFZCEX
`Article with Author Select > changing author enables save` failed on
roughly half of all CI attempts since 2026-08-20, on branches with
nothing to do with it.

The popover was opened once, outside the retry loop. A click that lands
while the option list is remounting is lost *and* dismisses the popover,
so every remaining `clickUntil` attempt found no option to click: the
whole budget burned without a single real try, and the test spent 15s
waiting for an outcome nothing could produce.

Open the popover inside the retry callback instead, and only when the
option is not already there — so a dismissed popover is reopened rather
than toggled shut.

Also make `waitFor` screenshot the page when it times out. CI has always
uploaded `/tmp/browser-test-*.png` on failure, but nothing ever wrote
one, so the artifact was empty on every red run. `clickUntil` opts out
for its intermediate polls, which are expected to fail and retry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EmqgPtZvAfpvWKymfFZCEX
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