|
| 1 | +# Runtime Live E2E Artifact Preservation Implementation Plan |
| 2 | + |
| 3 | +> **For Claude:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking. |
| 4 | +
|
| 5 | +**Goal:** Preserve and upload live-test temp directories as GitHub Actions artifacts on every runtime live E2E run. |
| 6 | + |
| 7 | +**Architecture:** Add a deterministic temp-root hook to the shared live-test harness, then point both live workflow jobs at job-specific temp roots and upload those directories with `actions/upload-artifact`. Keep default local behavior unchanged when the CI env hook is absent. |
| 8 | + |
| 9 | +**Tech Stack:** Python test harness, GitHub Actions workflow YAML, pytest-style offline workflow checks |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +### Task 1: Add a failing helper test for deterministic temp roots |
| 14 | + |
| 15 | +**Files:** |
| 16 | +- Modify: `tests/test_test_lib_helpers.py` |
| 17 | +- Modify: `scripts/test_lib.py` |
| 18 | + |
| 19 | +- [ ] **Step 1: Write the failing test** |
| 20 | + |
| 21 | +Add a unit test asserting `TestRunner` creates `test_dir` under `SPACEDOCK_TEST_TMP_ROOT` when that env var is set. |
| 22 | + |
| 23 | +- [ ] **Step 2: Run test to verify it fails** |
| 24 | + |
| 25 | +Run: `uv run --with pytest python -m pytest tests/test_test_lib_helpers.py -q` |
| 26 | +Expected: FAIL because `TestRunner` ignores `SPACEDOCK_TEST_TMP_ROOT`. |
| 27 | + |
| 28 | +- [ ] **Step 3: Write minimal implementation** |
| 29 | + |
| 30 | +Update `TestRunner` to use `tempfile.mkdtemp(dir=..., prefix=...)` when the env var is present. |
| 31 | + |
| 32 | +- [ ] **Step 4: Run test to verify it passes** |
| 33 | + |
| 34 | +Run: `uv run --with pytest python -m pytest tests/test_test_lib_helpers.py -q` |
| 35 | +Expected: PASS. |
| 36 | + |
| 37 | +- [ ] **Step 5: Commit** |
| 38 | + |
| 39 | +```bash |
| 40 | +git add tests/test_test_lib_helpers.py scripts/test_lib.py |
| 41 | +git commit -m "test: preserve live test dirs under a configured root" |
| 42 | +``` |
| 43 | + |
| 44 | +### Task 2: Add a failing workflow test for artifact preservation |
| 45 | + |
| 46 | +**Files:** |
| 47 | +- Modify: `tests/test_runtime_live_e2e_workflow.py` |
| 48 | +- Modify: `.github/workflows/runtime-live-e2e.yml` |
| 49 | + |
| 50 | +- [ ] **Step 1: Write the failing test** |
| 51 | + |
| 52 | +Add assertions that each live job sets `KEEP_TEST_DIR`, sets `SPACEDOCK_TEST_TMP_ROOT`, and uploads artifacts on `if: always()`. |
| 53 | + |
| 54 | +- [ ] **Step 2: Run test to verify it fails** |
| 55 | + |
| 56 | +Run: `unset CLAUDECODE && uv run tests/test_runtime_live_e2e_workflow.py` |
| 57 | +Expected: FAIL because the workflow does not yet preserve or upload live temp dirs. |
| 58 | + |
| 59 | +- [ ] **Step 3: Write minimal implementation** |
| 60 | + |
| 61 | +Set the env vars in both live jobs and add upload-artifact steps after the live suite commands. |
| 62 | + |
| 63 | +- [ ] **Step 4: Run test to verify it passes** |
| 64 | + |
| 65 | +Run: `unset CLAUDECODE && uv run tests/test_runtime_live_e2e_workflow.py` |
| 66 | +Expected: PASS. |
| 67 | + |
| 68 | +- [ ] **Step 5: Commit** |
| 69 | + |
| 70 | +```bash |
| 71 | +git add tests/test_runtime_live_e2e_workflow.py .github/workflows/runtime-live-e2e.yml |
| 72 | +git commit -m "ci: upload preserved live test dirs" |
| 73 | +``` |
| 74 | + |
| 75 | +### Task 3: Run focused verification |
| 76 | + |
| 77 | +**Files:** |
| 78 | +- Modify: `tests/README.md` |
| 79 | + |
| 80 | +- [ ] **Step 1: Update docs** |
| 81 | + |
| 82 | +Document that live workflow runs preserve test dirs as artifacts. |
| 83 | + |
| 84 | +- [ ] **Step 2: Run focused verification** |
| 85 | + |
| 86 | +Run: |
| 87 | +- `uv run --with pytest python -m pytest tests/test_test_lib_helpers.py -q` |
| 88 | +- `unset CLAUDECODE && uv run tests/test_runtime_live_e2e_workflow.py` |
| 89 | + |
| 90 | +Expected: both pass. |
| 91 | + |
| 92 | +- [ ] **Step 3: Commit** |
| 93 | + |
| 94 | +```bash |
| 95 | +git add tests/README.md |
| 96 | +git commit -m "docs: document live test artifact preservation" |
| 97 | +``` |
0 commit comments