Repository navigation
test(e2e): wait out editor races in delete-test - #13474
Merged
Merged
Conversation
tiensonqin
self-requested a review
September 30, 2026 03:48
tiensonqin
approved these changes
Sep 30, 2026
tiensonqin
force-pushed
the
test/e2e-delete-race
branch
from
September 30, 2026 03:48
b359f90 to
ba452b3
Compare
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.
What failed in CI
delete-testinclj-e2e/test/logseq/e2e/outliner_basic_test.clj(the "Test outliner-rtc" job) failed in 16 of the 151 failed Clojure E2E runs between 2026-09-17 and 2026-09-26: 2 on master and 14 on 12 pull request branches. By shape:"b1"against nil, with the block count right (35220039274 on master, 35998744494 on master, 35426168039). The test read the editor before it mounted; fix: bump page updated-at on insert, move, and delete #13402 (1e07062b8) added the wait for it, and none of the later failures has this shape."b1"against nil and line 139(= 1 4), nothing deleted (35854621210, 35865923401, 35871795647, 35899209725).TimeoutErrorwaiting for.editor-wrapper textareaafter the second delete (36224325707, 36229883846, 36244461624)."b1"against"b2"and line 140(= 1 2), b3 deleted and b2 left (36056373275, 36228900562).The last 3 shapes come from 2 races in the test's steps.
1b33bbf40(wait-edit-content "b1") polls for the final content and leaves both in place: after either race "b1" never comes.The 2 races
The test types b1 to b4, deletes b4 (
b/delete-blocks:util/exit-edit, then Backspace), presses Shift+ArrowUp twice to select b3 and b2, and deletes them.run-edit-block-fn!infrontend/db/transact.cljs), and the test presses Shift+ArrowUp right away. In the probe on master, b3's editor mounted 34 to 535 ms after the Backspace (median 60 ms), and the first Shift+ArrowUp went down 106 to 170 ms after it. In 6 of 180 iterations the editor came after that first press (365 to 535 ms), and all 6 ended with b1 and b2 on the page and b2 in editing; no passing iteration had a late editor. The early press is lost. b3 was then selected alone, by the second Shift+ArrowUp or, when the editor came after both presses (5 of the 6), by the Escape of the secondb/delete-blocks, so the second delete removed b3 only.util/exit-editpresses Escape, then presses it again if the editor is still visible. Escape saves the block before it leaves editing (escape-editinginfrontend/handler/editor.cljs), so the editor stays for a while after the key: median 50 ms, up to 288 ms in the probe. In 8 of 180 iterations on master the editor left 119 to 205 ms after the first Escape: still visible at the second check, gone when the second Escape went down 212 to 220 ms after the first. That Escape reached the page, and the window keydown handler cleared b4's selection (hide-context-menu-and-clear-selectioninfrontend/components/container.cljs). Backspace then deleted nothing, the Shift+ArrowUp presses found neither an editor nor a selection, the second delete deleted nothing, and the wait for the textarea timed out with 4 blocks on the page. In 1 more iteration the second Escape went down while the textarea was still mounted, and the selection held.What changes
delete-testwaits for b3's editor,(util/wait-edit-content "b3"), before the Shift+ArrowUp presses.util/exit-editpresses Escape once and waits up to 1 s for the editor to leave. It presses a second Escape only if the editor is still there after that wait, as when the first Escape closed a popup inside the editor.exit-editis called directly in 12 test namespaces, and throughdouble-esc,b/open-last-blockandb/delete-blocksin more. To see which calls rely on the second Escape, I ran the 20 namespaces of the e2e matrix other thanrtc-basic-test(it logs in to a sync server), plusundo-redo-test, once with this change and a log line inexit-edit. All 21 passed. 125 calls pressed Escape, in 15 namespaces. In 124 of them the editor left within the wait, 107 to 135 ms after the call began, the key press included. 1 call pressed the second Escape: indisallow-adding-page-tag-to-normal-pagesthe editor stayed after the first Escape, and the second, 1.1 s later, ended editing. That test types " #Page", which opens the hashtag search, and while such an editor action is openeditor-on-hideonly stops the Escape (read in code). That is the case the second Escape is for, and it now costs up to 1 s. Thertc-extranamespaces need the sync server and were not run; read in code, they callexit-editafter typing, slash commands, undo and redo, the kinds of calls that left within the wait in this run.Tests
Local runs against 1 web build of master
16c4ed1a0, made with the defines and--debugofclj-e2e.yml, served to 2 checkouts that differ only inclj-e2e: master and this branch. Runs alternated between them, up to 4 at a time on 1 machine.outliner-basic-test/deleteon a fresh page 20 times per run, and records in the page when each key went down and when the editor textarea mounted and left. 9 runs per build, 180 iterations each. Master: 166 pass, 6 end with b1 and b2 (race 1), 8 end with 4 blocks and no editor (race 2); 9 of 9 runs fail. This branch: 180 of 180 pass; 9 of 9 runs pass. The timings in the section above come from the master runs.outliner-basic-testnamespace (26 tests), 15 runs per build. Master: 14 pass, and 1 failedmove-up-down-test(a lost move,["b1" "b3" "b4" "b2"]). This branch: 14 pass, and 1 faileddelete-end-test(line 150: b2 in editing and 3 blocks). Read in code, ArrowUp at the first row saves the block through the worker before it moves editing to b2 (move-cross-boundary-up-down), so a Delete pressed in between lands at the end of b3. This PR leaves that test alone; it has no failure in the CI runs above.delete-testpassed in all 30. It runs once per namespace run, and at master's probe rate of 14 failures in 180, about 3 in 10 sets of 15 runs have none, so these runs cannot separate the builds; the probe does.exit-editdirectly and run without a sync server:editor-basic-test(72 tests),commands-basic-test(31),reference-basic-test(5),library-basic-test(2),graph-navigation-basic-test(8),block-property-basic-test(14),view-basic-test(7),tag-basic-test(3),undo-redo-test(3). All pass.wally.replandLocator$FilterOptionsunused in thensform ofutil.clj).Allow edits from maintainers.