# Fix `EVIDENCE_OUT` default path — workspace-relative, not container-only

**Task**: AZ-901_evidence_out_default_path_fix
**Name**: Change `e2e/runner/conftest.py:56` `EVIDENCE_OUT` default from `/e2e-results/evidence` to a workspace-relative path so Tier-1 host runs don't crash
**Description**: Closes leftover `_docs/_process_leftovers/2026-05-26_evidence_out_default_path.md`. Cycle-3 Step 15 (Performance Test) surfaced this: the default path `/e2e-results/evidence` is the container mount inside the Tier-1 Docker harness; a developer Mac/Linux workstation invoking `python -m pytest e2e/tests/performance/` directly hits `OSError: [Errno 30] Read-only file system: '/e2e-results'` (macOS) or `PermissionError` (Linux). Workaround today: `EVIDENCE_OUT="$(pwd)/e2e-results/..." pytest ...`. Fix: resolve a workspace-relative default when neither `--evidence-out` nor `EVIDENCE_OUT` is set.
**Complexity**: 1 SP
**Dependencies**: None
**Component**: `e2e/runner/conftest.py`
**Tracker**: AZ-901 (https://denyspopov.atlassian.net/browse/AZ-901)
**Epic**: (none — cycle-4 process housekeeping)

## Problem

`e2e/runner/conftest.py:56`:

```python
default=os.environ.get("EVIDENCE_OUT", "/e2e-results/evidence")
```

The default `/e2e-results/evidence` is a container-mount path. Tier-1 Docker harness and the Tier-2 Jetson runner pass `--evidence-out` explicitly, so they're fine. Host-direct `python -m pytest e2e/tests/performance/` invocations (developer machine, no Docker) hit `nfr_recorder.pytest_sessionfinish` which tries `mkdir(evidence_dir)` and crashes.

## Outcome

- Developer can run `python -m pytest e2e/tests/performance/` on a Mac/Linux workstation without setting `EVIDENCE_OUT` and without crashing.
- Docker / Jetson runners continue to work unchanged (they pass `--evidence-out` explicitly).

## Scope

### Included

- Modify `e2e/runner/conftest.py:56` to resolve a workspace-relative default when `EVIDENCE_OUT` is unset.
  - Proposed: `default=os.environ.get("EVIDENCE_OUT", str(Path(__file__).resolve().parents[2] / "e2e-results" / "evidence"))`
- Verify Docker compose files and Jetson scripts that pass `--evidence-out` still work (they should — they override the default).
- Verify `.gitignore` ignores `e2e-results/` at repo root (probably already does — confirm before commit).
- Delete the leftover file `_docs/_process_leftovers/2026-05-26_evidence_out_default_path.md` once the fix lands and the verification AC passes.

### Excluded

- The "lazy fallback inside the recorder" alternative shape — staying with the workspace-relative-default shape for simplicity (Option 1 from the leftover file).
- Refactoring `nfr_recorder.pytest_sessionfinish` — the writer code is fine; only the default path is wrong.
- Adding new evidence-out related env vars or CLI flags.

## Acceptance Criteria

**AC-1: Host-direct pytest works without EVIDENCE_OUT**
Given a clean workspace on macOS or Linux
When `python -m pytest e2e/tests/performance/ -v --tb=short` runs (no `EVIDENCE_OUT` env var, no `--evidence-out` flag)
Then pytest exits 0, evidence is written under `<workspace_root>/e2e-results/evidence/`, and no `OSError` / `PermissionError` is raised

**AC-2: Docker harness unchanged**
Given the Tier-1 Docker compose (`docker-compose.test.jetson.yml`)
When the e2e suite runs inside the container
Then `--evidence-out` is still passed and evidence lands at the container mount path `/e2e-results/evidence/` (no behavioral change)

**AC-3: Jetson harness unchanged**
Given `scripts/run-tests-jetson.sh`
When invoked
Then it still passes `--evidence-out` to pytest and evidence is collected per the existing protocol

**AC-4: gitignore covers workspace-relative path**
Given the fix in place
When a host-direct run produces `<workspace_root>/e2e-results/`
Then `git status` does NOT show `e2e-results/` as untracked (already covered by `.gitignore`, or `.gitignore` is updated as part of this ticket)

**AC-5: Leftover deleted**
Given the fix lands and ACs 1–4 pass
When `ls _docs/_process_leftovers/2026-05-26_evidence_out_default_path.md`
Then the file does not exist

## Unit Tests

| AC Ref | What to Test | Required Outcome |
|--------|-------------|-----------------|
| AC-1 | Run `pytest e2e/tests/performance/` without env vars on host | Exit 0, evidence at `<workspace_root>/e2e-results/evidence/` |

## Constraints

- Backward-compatible — existing callers passing `--evidence-out` or setting `EVIDENCE_OUT` see no change.
- No new dependencies; uses `pathlib.Path` which `conftest.py` already imports (verify before commit).

## References

- Leftover file: `_docs/_process_leftovers/2026-05-26_evidence_out_default_path.md`
- Cycle-3 Step 15 perf report: `_docs/06_metrics/perf_2026-05-26_cycle3-tier1-probe.md` § "Findings worth tracking" item 3
- Conftest: `e2e/runner/conftest.py:56`
