fix: stabilize flaky checkbox-toggle + SQLITE_BUSY E2E tests (#292)#293
Merged
Conversation
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
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.
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.
TestActionButtons—SQLITE_BUSYSQLite's
busy_timeoutdefaults to 0, so a read racing a concurrent write fails immediately with "database is locked". The library now opens every SQLite connection withbusy_timeout=5000(newsqliteDSNhelper ininternal/source, used bySQLiteSourceand 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/_NoFullReloadandTestLvtSourceMarkdownToggle/ToggleBack: the server toggled correctly and broadcastchecked(visible in WS frames), but the checkbox's.checkedproperty never updated. Root cause: the client's morphdom pass preserves live<input>state over server-rendered values — backwards for a server-authoritativelvt-on:click="Toggle"checkbox.Fixed generically upstream in
@livetemplate/clientv0.14.3 (livetemplate/client#135): anlvt-on:clickcheckbox/radio is now server-authoritative by default. This PR bumps@livetemplate/client0.11.9 → 0.14.3and rebuilds the embedded bundle — no per-template attribute needed. Documented in livetemplate#461.(Chose the upstream fix over sprinkling
data-lvt-force-updateon 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.Clickto JS.click()(CDP click is unreliable for delegated handlers in headless Docker Chrome, asaction_buttons_e2e_test.goalready documents) and replaced fixed sleeps withwaitForDOMpolling for the actual expected state.Verification
Local Docker Chrome against
@livetemplate/client@0.14.3(attributes removed, relying on auto-detection):TestActionButtons, all sixTestAutoTasks_*, both markdown toggle tests green on repeat runs. Full-tags=cisuite green.🤖 Generated with Claude Code