# Worker recovery and synthetic browser acceptance

## Worker recovery
- Treat an iteration limit, SIGTERM, provider failure, or an incomplete response as an internal workflow event.
- Before doing anything else, inspect the worktree and preserve useful uncommitted changes.
- Continue directly in the primary agent unless a new worker can be assigned a genuinely narrow, independent task. Never loop by repeatedly resuming an exhausted context.

## Synthetic browser server setup
1. Build a fresh fixture in a private temporary directory.
2. Ensure the fixture database and any runtime token file meet the server’s private-file requirements before starting the server.
3. Use a generated, non-disclosed local token; never reuse or print a production credential.
4. Prove readiness with an actual same-origin browser API request, not merely an HTTP dashboard response.
5. Use a fixed fixture time range in browser tests. Browser wall-clock dates can silently exclude all fixture observations.

## Interpreting a hidden-chart failure
If the API/table shows correctly populated synthetic rows but a chart locator is hidden:
- Check whether the parent Explorer tab/view was opened.
- Check selector count and whether the test targets the active feature panel.
- Capture `hidden` property/attribute, computed `display`/`visibility`, bounding rectangle, `offsetParent`, and every hidden ancestor.
- Inspect the chart instance and its reported width/height separately from DOM visibility.
- Inspect every write site for chart visibility, table fallback, loading/error/empty paths, panel activation, and resize observers.
- If width is non-zero but height is zero, set an explicit responsive minimum height and resize on the next animation frame after visibility; do not remove the assertion or force the interaction.
- Do not falsely mark the visible-chart criterion as passed solely because an ECharts instance exists.
- After two distinct repairs fail, record the exact test and error rather than expanding scope or changing API contracts.

## Sequential isolated browser matrix
Use this when suites need incompatible server modes:
1. Classify every failure as wrong fixture/server mode, stale contract, or actual regression.
2. Run each group with a new owner-private `/tmp` directory, fixture DB, generated page, random loopback port, token, queue, and process-local environment.
3. Keep shared-state groups at one worker; stop the server and delete the temp directory before the next group.
4. Separate standard UI, write/capture queue, prototype flag, auth/session, and current feature flag when their fixtures differ.
5. Migrate obsolete Basic/Bearer bootstrap tests to the approved Same-Origin CSRF + HttpOnly session contract and verify credentials do not appear in HTML, JS, URLs, or browser storage.
6. Aggregate independently green group counts as the complete browser acceptance; never treat a mixed-mode monolithic run as meaningful.

## Test-environment contamination
- Before Python import tests, remove browser-only variables such as test instance ID, action inbox, test URL, DB override, and API token path.
- Never weaken a fail-closed production check to accommodate leaked test variables.
- If a full run is demonstrably invalid due to harness contamination, document it and perform one clean replacement run.
