Skip to content

test(app): parse the whole note before checking live preview's widgets - #57

Merged
bketelsen merged 1 commit into
mainfrom
fix/preview-flake
Oct 19, 2026
Merged

bketelsen merged 1 commit into
mainfrom
fix/preview-flake

Conversation

@bketelsen

Copy link
Copy Markdown
Contributor

Fixes the flaky src/app/preview.test.tsx > live preview > draws every kind of widget in a note. It failed in CI on #49 (af142bc) and #56 (a138f77) with expected .cm-pv-bullet to have a length of 1 but got 0 at line 84, while the same tree passed on other runs.

Cause

CodeMirror's first parse of a document has a 20 ms budget (Work.Apply in @codemirror/language), and the rest is parsed in idle time 100–500 ms later. On a busy CI runner, with the whole suite in parallel on 4 vCPUs and the failing test taking 800–1000 ms, the first tree could end before the note's list on line 14. Live preview then drew the tag, inline code and footnote on line 3, but no bullet yet, and the test looked before the idle parse arrived.

I reproduced it: making Date.now run fast, so the first parse is cut short, fails the test exactly as CI did. The tag, code and footnote assertions pass and the bullet gets 0.

Fix

The test's open() now forces the whole note's parse (forceParsing(view, doc.length, 10_000) in act) before any assertion. Live preview redraws on the new tree, so the synchronous checks see every widget. With this change the test passes under the forced short parse. The app is unchanged: in a browser, the end of a long note simply draws a moment later.

make ui-check: 94 files and 772 tests pass. Biome's one warning is an existing one in src/spike/drive.tsx.

🤖 Generated with Claude Code

CodeMirror's first parse stops after 20 ms (Work.Apply) and finishes in
idle time. On a busy CI runner the tree could end before the note's
list, so 'draws every kind of widget in a note' found the tag on line 3
but no bullet on line 14. open() now forces the full parse first.
Shrinking the parse budget (a fast Date.now) reproduced the CI failure
exactly; with this change the test passes under it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bketelsen
bketelsen merged commit b9de20a into main Oct 19, 2026
4 checks passed
@frostyard-machines
frostyard-machines deleted the fix/preview-flake branch October 26, 2026 00:19
bketelsen pushed a commit that referenced this pull request Nov 23, 2026
frostui v0.10.1 scrolls an Info dialog's body under its fixed title and
Close button (frostyard/frostui#51, #57). The Conflicts dialog lists one
row per flagged file with no height of its own: on v0.10.0 a long list
ran below a 1280x800 window, out of reach.

TestConflictsDialogScrollsAt1280x800 opens it with 40 conflicts and
scrolls with the wheel until the last file is in view below a fixed
Close; on v0.10.0 the dialog is 1632 DIPs tall and the test fails.
TestShortcutsDialogScrollsAt1280x800 checks that Keyboard shortcuts,
which keeps its own 420-DIP scroll box, still scrolls to its last row
inside the new scrolling body. About is short and needs no check.

go-sources.json (make flatpak-sources) and AGENTS.md follow the bump.

Co-authored-by: frostyard-machines <[email protected]>
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