Fix two flaky product tests: tasks-card strict locator, header tracker on a destroyed editor #1103

Closed
kayg wants to merge 0 commits from fix/product-flaky-tests into dev
Owner

Two of the three flaky product tests, fixed at their cause. The third did not reproduce, so it is untouched.

1. tasks-card.spec.ts:93 (#1094), test only. page.locator('.tb') matched both the Task article and the Page toolbar (div[role=toolbar] wears the same class): strict-mode violation, 4/10 on base here. The spec now scopes to getByRole('article', { name: 'Task' }) (also for .ttl).

2. trash-search.spec.ts:14 (#1055, #1091), product. Reproduced under CPU load (1/20 on base) with a stack: headings.ts lineAt -> view.domAtPos -> CodeMirror domPosFor reads this.parent.dom, and a destroyed tile has parent = null. The header tracker's requestAnimationFrame callback can fire after the note editor was destroyed (a deleted note's page going to the Trash) and before the tracker is cleaned up. The frame now returns if !v.dom.isConnected (EditorView.destroy() calls dom.remove()).

3. pane-transition.spec.ts:431 (#1087), not changed. Does not reproduce on this base (see the comment for counts), so there is no cause to fix yet and the assertion is left as it is.

Evidence (counts, commands) is in the comment below, not in the tree.

🤖 Generated with Claude Code

Two of the three flaky product tests, fixed at their cause. The third did not reproduce, so it is untouched. **1. `tasks-card.spec.ts:93` (#1094), test only.** `page.locator('.tb')` matched both the Task article and the Page toolbar (`div[role=toolbar]` wears the same class): strict-mode violation, 4/10 on base here. The spec now scopes to `getByRole('article', { name: 'Task' })` (also for `.ttl`). **2. `trash-search.spec.ts:14` (#1055, #1091), product.** Reproduced under CPU load (1/20 on base) with a stack: `headings.ts` `lineAt` -> `view.domAtPos` -> CodeMirror `domPosFor` reads `this.parent.dom`, and a destroyed tile has `parent = null`. The header tracker's `requestAnimationFrame` callback can fire after the note editor was destroyed (a deleted note's page going to the Trash) and before the tracker is cleaned up. The frame now returns if `!v.dom.isConnected` (`EditorView.destroy()` calls `dom.remove()`). **3. `pane-transition.spec.ts:431` (#1087), not changed.** Does not reproduce on this base (see the comment for counts), so there is no cause to fix yet and the assertion is left as it is. Evidence (counts, commands) is in the comment below, not in the tree. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
header: the heading tracker's frame skips an editor that was destroyed (a null tile parent threw 'reading dom' on leaving a deleted note for the Trash) (#1055, #1091)
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
8912cfe83c
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Owner

Evidence, dev-01 x86, base 5fba67585, head 8912cfe83, server binary built from the base (cargo build --locked -j4 --bin calternal, own CARGO_TARGET_DIR), own --output dir per run, all with --repeat-each=10 --workers=1 --retries=0, inside Nix through ~/bin/slot.

Before (base):

  • tasks-card:93 chromium-1440: 4/10 fail, all strict mode violation: locator('.tb') resolved to 2 elements.
  • trash-search row chromium-390, 8 CPU burners alongside: 1/20 fail, Cannot read properties of null (reading 'dom') at domPosFor <- domAtPos <- headings tracker. Without burners: 0/40.
  • pane-transition:431 chromium-390: 0/10 isolated, 0/30 as the whole file (x3), 0/10 with 12 CPU burners and PANE_DUMP=1. #1087 recorded 8/10 on dev-01 for the same case; I could not get it to fail, so I made no change.

After (head): e2e/tasks-card.spec.ts -g "floating capsule", e2e/pane-transition.spec.ts -g "pop: the list", e2e/trash-search.spec.ts, each x10:

project tasks-card pane-transition trash-search
chromium-1440 10/10 10 skipped (phone-only) 10 pass, 30 skipped (phone-only variants)
chromium-390 10/10 10/10 40/40
webkit-1440 10/10 10 skipped 10 pass, 30 skipped
webkit-390 10/10 10/10 40/40 (rerun: first attempt hit a port 3349 clash on the host, no test ran)

Fix #2 under the same load that reproduced it: trash-search row chromium-390, 8 burners, x40: 40/40 pass. At a base rate of about 1 in 20 that is suggestive, not proof; the cause is established from the stack and CodeMirror's source.

Evidence, dev-01 x86, base `5fba67585`, head `8912cfe83`, server binary built from the base (`cargo build --locked -j4 --bin calternal`, own `CARGO_TARGET_DIR`), own `--output` dir per run, all with `--repeat-each=10 --workers=1 --retries=0`, inside Nix through `~/bin/slot`. **Before (base):** - tasks-card:93 chromium-1440: 4/10 fail, all `strict mode violation: locator('.tb') resolved to 2 elements`. - trash-search `row` chromium-390, 8 CPU burners alongside: 1/20 fail, `Cannot read properties of null (reading 'dom')` at `domPosFor` <- `domAtPos` <- headings tracker. Without burners: 0/40. - pane-transition:431 chromium-390: 0/10 isolated, 0/30 as the whole file (x3), 0/10 with 12 CPU burners and `PANE_DUMP=1`. #1087 recorded 8/10 on dev-01 for the same case; I could not get it to fail, so I made no change. **After (head):** `e2e/tasks-card.spec.ts -g "floating capsule"`, `e2e/pane-transition.spec.ts -g "pop: the list"`, `e2e/trash-search.spec.ts`, each x10: | project | tasks-card | pane-transition | trash-search | |---|---|---|---| | chromium-1440 | 10/10 | 10 skipped (phone-only) | 10 pass, 30 skipped (phone-only variants) | | chromium-390 | 10/10 | 10/10 | 40/40 | | webkit-1440 | 10/10 | 10 skipped | 10 pass, 30 skipped | | webkit-390 | 10/10 | 10/10 | 40/40 (rerun: first attempt hit a port 3349 clash on the host, no test ran) | Fix #2 under the same load that reproduced it: trash-search `row` chromium-390, 8 burners, x40: 40/40 pass. At a base rate of about 1 in 20 that is suggestive, not proof; the cause is established from the stack and CodeMirror's source.
Author
Owner

Merged by git into dev at 796d80cba4 (head 8912cfe83c is an ancestor); closing. Housekeeping 14 Nov.

Merged by git into `dev` at 796d80cba4f3 (head 8912cfe83caf is an ancestor); closing. Housekeeping 14 Nov.
kayg closed this pull request 2026-11-13 19:32:30 +00:00
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!1103
No description provided.