From c203b70ef95ce2097ff139f0ef8255cdc1fd7f6b Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Sat, 25 Apr 2026 15:26:21 -0400 Subject: [PATCH] docs(ai): queue data-testid hardening + reflect PR #152 + 3-runner setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TODO.md: Promote pytest-xdist to ✅ (PR #151 carries it). Adds three new backlog items: - data-testid hardening for e2e-critical interactive elements (sparked by PR #152's selector drift work) - per-test transactional rollback (next big speedup if needed) - pytest-testmon for PR-time test selection HANDOFF.md: Three open PRs now (#150, #151, #152), all independent. Three Gitea runner agents now registered, so jobs run in parallel. Combined with #151's xdist, the prior 1h 14m wall-clock should drop to ~6-10 min. Updated merge order: #152 first (smallest), #150 next, #151 last. After all three land, enable CI / backend then CI / e2e as required status checks. Co-Authored-By: Claude Opus 4.7 --- .ai/HANDOFF.md | 32 +++++++++++++++++++++++++------- .ai/TODO.md | 5 ++++- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/.ai/HANDOFF.md b/.ai/HANDOFF.md index 771c40b2..26edc7a1 100644 --- a/.ai/HANDOFF.md +++ b/.ai/HANDOFF.md @@ -4,11 +4,16 @@ **Last updated:** 2026-04-25 (America/New_York) -**Active task:** Land two stacked CI PRs (#150 + #151), then enable backend gate on `main`. See [CURRENT_TASK.md](CURRENT_TASK.md). +**Active task:** Land three open CI PRs (#150 + #151 + #152), then enable backend + e2e gates on `main`. See [CURRENT_TASK.md](CURRENT_TASK.md). -**Branch:** Currently on `fix/ci-workflow-config` (PR #150). The xdist work lives on `fix/ci-pytest-xdist` (PR #151), branched from #150. +**Branches:** Three open PRs, all independent of each other for correctness: +- `fix/ci-workflow-config` → PR #150 +- `fix/ci-pytest-xdist` → PR #151 (stacked on #150 for context but mergeable on its own) +- `fix/e2e-test-selectors` → PR #152 -## Two open PRs to land in order +**Runner setup:** Three Gitea Actions agents are now registered on the homelab box, so `backend` / `frontend` / `e2e` jobs run truly in parallel instead of serializing on a single agent. Combined with PR #151's xdist parallelization, the previous 1h 14m wall-clock should drop to ~6–10 min. + +## Three open PRs ### PR #150 — `fix/ci-workflow-config` → main @@ -32,18 +37,31 @@ Carries (on top of #150): **Measured locally:** backend suite goes from `22m 27s` (serial, 1076 passed) → `4m 28s` (8 workers, 1076 passed). Same exit code, same test count. +### PR #152 — `fix/e2e-test-selectors` → main + +Carries: five Playwright e2e selector updates against the current UI. The drift was inherited from the FlowPilot/PSA migration: + +- `Sessions` → `Session History` (page heading) +- `Account Settings` → `Account Management` (page heading) +- `/assistant` → `/pilot` (Phase 1 route rename; redirect still works) +- Flow-session filtering and the Resume button moved behind the "Flow Sessions" tab on `/sessions` (default tab is "AI Sessions") +- `resume.spec.ts` no longer starts at `/trees` — Resume button rendering moved to the session card on `/sessions` + +No product-code changes. Pure test updates. + ## Immediate next steps -1. **Watch PR #150 CI** on its latest sha (`e976fb4`). Both `CI / backend (pull_request)` and `CI / frontend (pull_request)` should be green. Merge if so. -2. **Watch PR #151 CI** after #150 merges. Once #151 is rebased / merged automatically, backend job time on subsequent runs should drop to the 4–6 min range. -3. **Enable backend gate** on `main` branch protection — append `"CI / backend (pull_request)"` to `status_check_contexts`: +1. **Merge PR #152 first.** Smallest, lowest risk, no shared file with the other two PRs. +2. **Merge PR #150 next.** Backend test suite should be fully green (1076 passed, 0 failed, 0 errors). +3. **Merge PR #151 last.** Backend job time drops to ~4–6 min on the runner. +4. **Enable backend gate** on `main` branch protection — append `"CI / backend (pull_request)"` to `status_check_contexts`: ```bash curl -X PATCH -H "Authorization: token $GITEA_TOKEN" \ "https://gitea.resolutionflow.com/api/v1/repos/chihlasm/resolutionflow/branch_protections/main" \ -H "Content-Type: application/json" \ -d '{"status_check_contexts": ["CI / frontend (pull_request)", "CI / backend (pull_request)"]}' ``` -4. **Optional: also gate `CI / e2e (pull_request)`** once that job has run cleanly a few times. The artifact-v3 fix means it can finally run; we haven't verified its actual outcome yet. +5. **Then enable `CI / e2e (pull_request)`** — same PATCH, append to the list. Verify e2e is reliably green for at least one PR run before locking it in. ## Uncommitted state diff --git a/.ai/TODO.md b/.ai/TODO.md index bf7513e8..eb13b867 100644 --- a/.ai/TODO.md +++ b/.ai/TODO.md @@ -5,9 +5,12 @@ ## Up next -- [ ] **Parallelize backend pytest with pytest-xdist.** Currently the backend suite takes ~22 min wall-clock for `1076 passed, 35 deselected` (verified locally 2026-04-25). With `-n auto` on the homelab Gitea Actions runner, this should land in the 3–6 min range depending on core count. Blocker: `test_db` fixture in `backend/tests/conftest.py` does `DROP SCHEMA public CASCADE` per test, which two workers would race on. Standard fix: one database per worker, derived from `PYTEST_XDIST_WORKER` env var inside conftest. The runner has spare CPU, so prioritize once main is green and the 54-failure cleanup has landed. +- [ ] **Parallelize backend pytest with pytest-xdist.** ✅ landing as PR #151. Verified locally: backend suite 22 min → 4m 28s with `-n auto` on the 8-core homelab runner. Per-worker DB isolation via `PYTEST_XDIST_WORKER` in conftest.py. ## Backlog - [ ] **Frontend lint warnings cleanup.** 23 `react-hooks/exhaustive-deps` warnings remain after PR #149 (mostly missing-deps in useEffect). Either fix them or audit them for known-safe ones and add eslint-disable comments. Not blocking CI today. - [ ] **Audit `filterwarnings` ignores added in `wip(handoff): restore backend suite to green`.** Codex added narrow `ResourceWarning` filters for unclosed socket/transport/event-loop noise from pytest-asyncio teardown. Worth periodically reviewing whether those are still needed (e.g. when bumping pytest-asyncio) — if a real warning appears in those forms it would be silenced. +- [ ] **Add `data-testid` attributes to e2e-critical interactive elements.** PR #152 fixed five Playwright tests by chasing UI-text changes (`Sessions` → `Session History`, `Account Settings` → `Account Management`, `/assistant` → `/pilot`, "Flow Sessions" tab, Resume button on session cards). Each was a one-line selector update, but every UI churn re-breaks them. Adding stable `data-testid` attributes on the targeted elements (page heading wrappers, tab nav, primary action buttons) and switching tests to `getByTestId` would make these immune to copy/route renames. Scope it small — start with `SessionHistoryPage` heading, the AI/Flow Sessions tab buttons, the per-session `Resume` button, and the command-palette FlowPilot option. +- [ ] **Per-test transactional rollback in `test_db` fixture.** Bigger engineering than xdist (which we already shipped). Instead of `DROP SCHEMA public CASCADE` per test, wrap each test in a savepoint and rollback at teardown. ~30-40% additional speedup on top of xdist for test-DB-heavy tests. Real refactor; only worth it if the suite gets significantly larger or runs more frequently. +- [ ] **Consider `pytest-testmon` for PR-time test selection.** Tracks which tests touched which source files and only re-runs affected ones. Best for small PRs touching ~few files. Adds cache-invalidation complexity; only worth it if the suite stays painfully long even after xdist.