Flaky E2E: season preview's caption sometimes doesn't appear within 10 s #177
Labels
No labels
area/ai
area/backend
area/frontend
area/infra
area/scheduler
area/wled
good-first-issue
priority/high
priority/low
priority/medium
security
type/bug
type/chore
type/ci-cd
type/docs
type/feature
type/qa
v1.0.0
v1.1.0
v1.2.0
v2.0.0
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/Iris-WLED#177
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened
In PR #174's first CI run (run 10973, job 56007),
e2e/season-preview.spec.ts› "stepping and playing move the caption" failed:getByTestId('season-caption')was not visible after 10 s. The page heading had rendered, so the page was up but its data hadn't arrived. The same test passed in #172's CI, in local runs, and in #174's rerun after rebasing. Nothing in #174 touches the frontend.Evidence
for-rangeis in flight, and it has no error branch that hides the caption other than the error message.This is a working theory: a slow
for-rangeresponse under write contention, outlasting the 10 s wait. It isn't proven. The container log doesn't show the page's ownfor-rangerequest at all, which fits a request still blocked when the test gave up.Options
for-rangeresponse explicitly (page.waitForResponse) with a longer timeout, and then for the caption. A longer timeout alone would hide a real slowdown.plan_for_range(60)on a realistic database, and consider WAL mode (PRAGMA journal_mode=WAL) so reads don't block on writes. WAL has backup implications, because a snapshot must include or checkpoint the-walfile.services/backup.pywould need checking, and so would the production spec's backup advice (Rhoving/iac-repo#527 §9, which says the database uses rollback-journal mode).Record every recurrence here, with its run id.
Probable root cause found, while investigating a similar E2E failure on #180 (the watchdog Settings test).
GET /api/v1/schemes?year=had an N+1 settings read.list_schemescalled_enrich_scheme(s, db)withoutruntime, so each of a year's ~108 schemes re-queried the settings table and re-validatedRuntimeSettings. Both the calendar and the Settings page call that endpoint.list_schemesat 77.8% of CPU samples, withsettings_service._load_rowsthe innermost hot frame at 57.9%.96bd1f2), settings are read once per request, and a regression test counts the reads. At 1 CPU with 8 workers, the season-preview "stepping and playing" test stopped failing after the fix, across 13 fresh-container runs.I'll close this once #180 is merged and a few more CI runs pass without it recurring. The profile also named the next costs under heavier contention:
list_schemespydantic validation,review_summary, andget_recurrence_horizon, which re-reads YAML on every call. Those are filed separately.