Skip to content

ci(perf): fix Playwright/mypy caching and add timeouts to prevent hangs - #352

Merged
paruff merged 2 commits into
mainfrom
ci/drop-unused-playwright-from-integration-tests
Aug 19, 2026
Merged

ci(perf): fix Playwright/mypy caching and add timeouts to prevent hangs#352
paruff merged 2 commits into
mainfrom
ci/drop-unused-playwright-from-integration-tests

Conversation

@paruff

@paruff paruff commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

Started as a single Playwright-removal fix; grew into a full CI suite audit after that fix broke tests and a separate job was found hung for 1h16m with no timeout to kill it.

  • Integration Tests: restored the Playwright install (wrongly removed in an earlier commit — 3 PDF export tests transitively need it via application code, not a direct test-file import), added actions/cache for ~/.cache/ms-playwright so the ~150-300MB browser download only happens once per cache key.
  • E2E Tests: same caching pattern applied — had the identical uncached-download problem (~8 min/run).
  • Typecheck: added .mypy_cache caching — this was the actual critical path of the whole PR-gate suite (~16 min cold, zero cache persistence across runs previously, and every job runs in parallel so this alone determined total wall time).
  • Every job in every workflow (37 across 9 files): added timeout-minutes. Root cause of the observed hour-plus hang — only 2 of 37 jobs had any timeout; GitHub defaults to 360 minutes when unset, so any hang (interactive apt/dpkg prompt, network stall) blocks a PR indefinitely with zero automatic recovery. Sized off this session's observed real durations for ci-quality.yml, conservative defaults elsewhere.

Expected outcome: total PR-gate wall time drops from ~16-18 min to roughly the new longest job (ZAP Scan, ~7-8 min) — plus no more silent multi-hour hangs.

Test plan

  • All 9 workflow files: valid YAML (yaml.safe_load)
  • pre-commit run across all changed files — clean
  • Confirmed no duplicate/missing timeout-minutes (job count == timeout-minutes line count per file)
  • Confirmed pre-existing timeouts (docker-publish build-image, post-deployment security) untouched
  • Confirm this PR's own Integration/E2E/Typecheck jobs pass and show real time savings

paruff added 2 commits August 19, 2026 18:12
tests-integration ran playwright install --with-deps chromium — a
multi-minute apt-get + browser-binary download with zero caching —
before every run, despite zero integration-marked tests importing
Playwright anywhere in the repo (grep confirmed across tests/ and
core/tests/). Browser-driving coverage already lives in the
tests-e2e job, which keeps its own copy of this step.
Reverts the previous commit's premise: grepping test files for
"import playwright" missed that core/tests/test_exports.py's PDF
export tests call application code (core/views/__init__.py, sync_
playwright + chromium.launch) that needs a real browser, even though
the test file itself never imports playwright directly. Removing the
install step broke 3 previously-passing tests (confirmed on this PR's
own CI run: test_pdf_export_returns_200/content_type_is_pdf/
includes_financing_section all failed with the browser executable
missing).

The actual fix for the slow step is caching ~/.cache/ms-playwright
keyed on the pinned playwright version (1.62.0) so the ~150-300MB
browser download only happens once per cache key instead of every
run. System deps (apt-get, not cacheable across fresh runner VMs)
still install every run via the lighter `install-deps` on cache hit.
@paruff
paruff merged commit 8dbe59f into main Aug 19, 2026
20 of 31 checks passed
@paruff paruff changed the title ci(perf): drop unused Playwright install from Integration Tests ci(perf): fix Playwright/mypy caching and add timeouts to prevent hangs Aug 19, 2026
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.

1 participant