Full Hardening Run
HARD RULES
- Skipped tests count as failure.
- Do not claim “fixed” unless you provide evidence: failing run -> passing run (0 failed, 0 skipped).
- For websocket health: include Chrome DevTools evidence (WS lifecycle + reconnect attempts) and console/network logs.
- Use the required MCP tools when applicable; do not substitute reasoning for evidence.
- Prefer smallest diffs; no refactors unless required for correctness/stability.
REQUIRED TOOLS (MCP)
- playwright
- chromeDevtools
- (optional) openaiDocs
- (optional) git
EXECUTION PLAN (MUST FOLLOW IN ORDER)
Phase 0 — Inventory (no changes yet)
- Identify how to install dependencies and run:
- dev server(s)
- unit/integration tests
- Playwright E2E tests
- Identify where runloop, websocket client, and UI status live.
Phase 1 — Repo Autopsy + Autofix Loop
- Run the smallest command that reproduces current failures.
- Fix minimal root cause.
- Re-run the exact same command.
- Repeat until unit/integration tests are 0 failed / 0 skipped.
Phase 2 — E2E Stabilizer (Headed Chrome)
- Ensure Playwright starts backend + frontend (webServer or equivalent) and waits for readiness.
- Enforce headed Chrome (no headless) for verification runs.
- Replace waitForTimeout with app-ready waits (health endpoint, stable UI signals, deterministic waits).
- Enable trace + screenshot (and optionally video) on failure.
- Repeat until headed E2E is 0 failed / 0 skipped.
Phase 3 — WebSocket Hardening + Diagnostics (P0)
- Implement reconnect state machine (explicit states; backoff; jitter; max cap).
- Implement stale detection (heartbeat/last-message timer) and trigger reconnect.
- Add triggers: online/offline, focus/visibility change, manual force reconnect.
- Add UI: status pill + last message timestamp + retry countdown + manual reconnect control.
- PROOF REQUIREMENT:
- Use DevTools tooling to capture WS connect -> disconnect -> reconnect and confirm no console/network errors.
- Add/Run E2E test that forces disconnect and verifies reconnect in headed Chrome.
- Repeat until test passes and evidence is captured.
Phase 4 — UI Contract & TestIDs
- Define a data-testid contract for critical surfaces:
- dashboard
- portfolio
- orders
- websocket status pill
- Update UI to comply.
- Update tests to assert only via data-testid (no layout/CSS selectors).
- Re-run headed E2E suite.
DELIVERABLES (DEFINITION OF DONE)
- Paste logs showing: unit/integration tests = 0 failed / 0 skipped.
- Paste logs showing: headed Playwright E2E = 0 failed / 0 skipped.
- Attach/playback evidence:
- Playwright trace (or trace summary + where it is saved)
- DevTools evidence: WS lifecycle connect/disconnect/reconnect + console/network logs
- Summarize git diff: list files changed + why each change was necessary.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.