oliver-zehentleitner / maity

e2e helpers restore the viewport after run.a11y; fix the flaky snapshot test

Sign in to report

tsk-7eq8y3gymek2 Done An agent

The a11y step leaves 1280x900, so a later phone test checked desktop. test_public_snapshot …under_the_project_lock fails about 1 in 70 on main (cause on main, routes/admin.py).

From the jour fixe of 2026-11-09 (round jfx-6h6k3m2q5sdg).

Notes

  1. An agent · Nov 10, 2026, 16:38 UTC

    Plan for tsk-7eq8y3gymek2 (unr9). Two PRs, web first, then hub. Review through vuur. Checked against main 0fc713bd.

    Part 1, web e2e (`claude/e2e-a11y-viewport`):

    • Run.a11y (web/tools/e2e.py:116) reads the step's viewport (page.viewport_size) and colour scheme (matchMedia('(prefers-color-scheme: dark)')) before its three axe passes, and restores both after them. Until now it always ended at 1280×900, light.
    • Test: tools/test_e2e_harness.py takes Run.a11y out of e2e.py's syntax tree and runs it on a stand-in page, from 390×844 dark, 360×780 light and 1280×900 light. Each time the passes run at their own sizes and schemes, and the page ends where it started. On main's e2e.py the two non-desktop cases fail (both end at 1280×900 light).
    • A full e2e run is going now. Any step that relied on the reset to desktop after an a11y pass would turn red there. If one does, it gets an explicit set_viewport_size of its own, and I will name each one.
    • Open PRs on web/tools/e2e.py: none at this moment. I will check again before the push.

    Part 2, hub (`claude/hub-snapshot-flake`):

    • test_public_snapshot.py has two …under_the_project_lock tests (the card's name fits both).
    • #1572 already fixed one race there: a page worker's renders were counted.
    • routes/admin.py on main (157 lines: /admin/users, /admin/statistics) renders nothing and takes no project row. So I have no cause yet that the code shows.
    • I am reproducing on main: 140 runs of both tests, keeping every failure's output. I will name the cause from an actual failure, then fix it with a test that is red before the fix.
    • If 140 runs give no failure, I will say so, with the count, and ask for the log the 1 in 70 came from.
  2. An agent · Nov 10, 2026, 17:16 UTC

    Part 2 of tsk-7eq8y3gymek2: the flaky snapshot test is #1572's race, already fixed on main. No code change.

    Counting rule: one run is one pytest -q -p no:cacheprovider tests/test_public_snapshot.py -k under_the_project_lock (the two …under_the_project_lock tests), in a loop of 140 runs, run through tools/run_slot.sh for the second loop. A run counts as a failure when pytest exits non-zero, and its log is kept.

    • Before #1572, 17e144a4 (the commit just before f022f529): 4 failures in 140 runs (runs 18, 42, 85 and 129).
    • Three are test_a_member_change_no_page_shows_renders_nothing_under_the_project_lock: assert rendered == [], "Left contains one more item: ('project_views', 'prj-…')".
    • One is test_a_card_event_renders_no_other_card_s_page_under_the_project_lock: "Left contains one more item: ('project_views', 'prj-…')".
    • That is about 1 in 70 per test, as the card says.
    • On main 1ba23178 (with #1572): 0 failures in 140 runs.

    The cause is the one #1572 reproduced and fixed ("the snapshot tests count only the writers' renders, not a page worker's pass"). Every client of the World fixture starts a maity-public-pages worker, and its first pass renders project_views again for each public project. Before #1572 the spy counted that render too. The extra item in every failure above is exactly that render.

    routes/admin.py (/admin/users, /admin/statistics) renders nothing and takes no project row, so it is not the cause. The card came from the jour fixe of 2026-11-09, a day before #1572 merged.

  3. An agent · Nov 11, 2026, 02:44 UTC

    #1614 main merge, on vuur's go (108093).

    • New head: 37790f4fa5d99d3a5044b5d7c9d47c46eea5643e, pushed to claude/e2e-a11y-viewport (fast-forward from 14fc8345a, no force).
    • Parents: 14fc8345a (the reviewed head) and 6e6c70ba7 (origin/main). A merge commit, no rebase.
    • Remerge-diff: git show --remerge-diff --format= HEAD | wc -c → 0 bytes. The merge resolved nothing by hand, so the approved diff is unchanged.
    • Local checks on the merge: make check in web exit 0 (web/tools/test_e2e_harness.py "all ok", including the a11y restore cases); web/tools/check.py --write 0 findings and no file changed; tools/changelog.py check 30 fragments, all valid; ktw-lint --strict . and ktw-lint --strict web 0 errors, 0 warnings.
    • CI: running on 37790f4f. I add the result here when it finishes.
  4. An agent · Nov 11, 2026, 02:56 UTC

    #1614 CI on the merge head 37790f4fa: green. All 3 workflow runs on that SHA are completed and successful.

    • ci, run 42948030367: success. Jobs: changes, web, web-e2e, hub-dist, changelog and ci-ok all succeeded. The other 13 jobs were skipped by the path filter: no hub, cli, helm or vendor files are in the diff. web-e2e ran in full against the merged web/tools/e2e.py and succeeded; it was not cancelled this time.
    • ktw-lint, run 42948030093: success (., web, hub, cli).
    • audit, run 42948030183: success (pip-audit).

    Remerge-diff 0 bytes (see nte-as3d5d3dqpfz), so the 2/2 approvals on 14fc8345 carry.