Skip to content

fix: stabilize flaky checkbox-toggle + SQLITE_BUSY E2E tests (#292)#293

Merged
adnaan merged 1 commit into
mainfrom
fix-292-flaky-e2e
Jun 20, 2026
Merged

fix: stabilize flaky checkbox-toggle + SQLITE_BUSY E2E tests (#292)#293
adnaan merged 1 commit into
mainfrom
fix-292-flaky-e2e

Conversation

@adnaan

@adnaan adnaan commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #292 — three browser E2E tests that flaked in the cross-repo "Test Tinkerdown against Core Changes" job. Two distinct, unrelated root causes (a third item surfaced two more tests sharing cause #2).

1. TestActionButtonsSQLITE_BUSY

SQLite's busy_timeout defaults to 0, so a read racing a concurrent write fails immediately with "database is locked". The library now opens every SQLite connection with busy_timeout=5000 (new sqliteDSN helper in internal/source, used by SQLiteSource and the schema probe), and the test's own verification connection gets the same pragma. The read now waits for the action's write to commit. Unit test asserts the pragma actually takes effect.

2. Checkbox toggles never reflected the server's new state

TestAutoTasks_BasicToggle / _NoFullReload and TestLvtSourceMarkdownToggle / ToggleBack: the server toggled correctly and broadcast checked (visible in WS frames), but the checkbox's .checked property never updated. Root cause: the client's morphdom pass preserves live <input> state over server-rendered values — backwards for a server-authoritative lvt-on:click="Toggle" checkbox.

Fixed generically upstream in @livetemplate/client v0.14.3 (livetemplate/client#135): an lvt-on:click checkbox/radio is now server-authoritative by default. This PR bumps @livetemplate/client 0.11.9 → 0.14.3 and rebuilds the embedded bundle — no per-template attribute needed. Documented in livetemplate#461.

(Chose the upstream fix over sprinkling data-lvt-force-update on every toggle template, since the whole ecosystem — lvt toggle component, datatable, tinkerdown — writes this pattern expecting server authority.)

E2E hardening

Switched auto-task interactions from chromedp.Click to JS .click() (CDP click is unreliable for delegated handlers in headless Docker Chrome, as action_buttons_e2e_test.go already documents) and replaced fixed sleeps with waitForDOM polling for the actual expected state.

Verification

Local Docker Chrome against @livetemplate/client@0.14.3 (attributes removed, relying on auto-detection): TestActionButtons, all six TestAutoTasks_*, both markdown toggle tests green on repeat runs. Full -tags=ci suite green.

🤖 Generated with Claude Code

Three browser E2E tests flaked in the cross-repo job; two distinct,
unrelated root causes (plus three more tests sharing cause #2):

1. TestActionButtons — SQLITE_BUSY. SQLite's busy_timeout defaults to 0,
   so a read that races a concurrent write fails immediately with
   "database is locked". The library now opens every SQLite connection
   with busy_timeout=5000 (internal/source: new sqliteDSN helper used by
   both SQLiteSource and the schema probe), and the test's own
   verification connection gets the same pragma — the read waits for the
   action's write to commit instead of failing.

2. Checkbox toggles never reflected the server's new state
   (TestAutoTasks_BasicToggle/_NoFullReload, TestLvtSourceMarkdownToggle/
   ToggleBack). The client's morphdom pass preserves live <input> state
   over server-rendered values; for a server-authoritative
   lvt-on:click="Toggle" checkbox that's backwards, so the server's toggle
   never reflected in the DOM. Fixed upstream in @livetemplate/client
   v0.14.3 (livetemplate/client#135): an lvt-on:click checkbox/radio is now
   server-authoritative by default. Bump @livetemplate/client 0.11.9 →
   0.14.3 and rebuild the embedded bundle; no per-template attribute is
   needed — the framework handles it generically for every server-driven
   toggle.

Also hardened the auto-task E2E interactions: switch from chromedp.Click
to JS .click() (CDP click is unreliable for delegated handlers in headless
Docker Chrome, as action_buttons_e2e_test.go already documents) and
replace fixed sleeps with waitForDOM polling for the actual expected state.

Verified locally against Docker Chrome with @livetemplate/client@0.14.3:
TestActionButtons, all six TestAutoTasks, both markdown toggle tests green
on repeat runs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HyPY7btbvCZiLKkh9wSKJx
@adnaan adnaan merged commit 3d5940e into main Jun 20, 2026
4 checks passed
@adnaan adnaan deleted the fix-292-flaky-e2e branch June 20, 2026 08:21
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.

Flaky E2E: TestActionButtons (SQLITE_BUSY) + TestAutoTasks toggle/reload timeouts

1 participant