muse-e2e-demo.md
markdown
| 1 | # Muse E2E Demo — Tour de Force |
| 2 | |
| 3 | ## What it proves |
| 4 | |
| 5 | The E2E harness exercises every Muse VCS primitive through real HTTP routes |
| 6 | and a real database in a single deterministic scenario: |
| 7 | |
| 8 | | Step | Operation | Asserts | |
| 9 | |------|-----------|---------| |
| 10 | | 0 | Root commit (C0) | Graph has 1 node, HEAD correct | |
| 11 | | 1 | Mainline commit (C1 — keys) | Checkout executes, HEAD moves | |
| 12 | | 2 | Branch A (C2 — bass) | Graph shows branch from C1 | |
| 13 | | 3 | Branch B (C3 — drums) | Time-travel back to C1, then branch | |
| 14 | | 4 | Merge C2 + C3 → C4 | Auto-merge, two parents, HEAD moves | |
| 15 | | 5 | Conflict merge (C5 vs C6) | 409 with conflict payload | |
| 16 | | 7 | Checkout traversal | C1 → C2 → C4, all transactional | |
| 17 | |
| 18 | ## How to run |
| 19 | |
| 20 | ```bash |
| 21 | docker compose exec maestro pytest tests/e2e/test_muse_e2e_harness.py -v -s |
| 22 | ``` |
| 23 | |
| 24 | The `-s` flag is important — it shows the ASCII graph, JSON dump, and |
| 25 | summary table in the terminal. |
| 26 | |
| 27 | ## Expected output |
| 28 | |
| 29 | ``` |
| 30 | ═══ Step 0: Initialize ═══ |
| 31 | ✅ Root C0 committed, HEAD=c0000000 |
| 32 | |
| 33 | ═══ Step 1: Mainline commit C1 (keys v1) ═══ |
| 34 | ✅ C1 committed + checked out, executed=2 tool calls |
| 35 | |
| 36 | ═══ Step 2: Branch A — bass v1 (C2) ═══ |
| 37 | ✅ C2 committed, HEAD=c2000000, graph has 3 nodes |
| 38 | |
| 39 | ═══ Step 3: Branch B — drums v1 (C3) ═══ |
| 40 | ✅ C3 committed, HEAD=c3000000 |
| 41 | |
| 42 | ═══ Step 4: Merge C2 + C3 ═══ |
| 43 | ✅ Merge commit C4=<uuid>, executed=N tool calls |
| 44 | ✅ Merge commit has parent=..., parent2=... |
| 45 | |
| 46 | ═══ Step 5: Conflict merge demo (C5 vs C6) ═══ |
| 47 | ✅ Conflict detected: N conflict(s) |
| 48 | note: Both sides added conflicting note at pitch=... beat=... |
| 49 | |
| 50 | ═══ Step 7: Checkout traversal ═══ |
| 51 | → Checked out C1: executed=N, hash=... |
| 52 | → Checked out C2: executed=N, hash=... |
| 53 | → Checked out C4 (merge): executed=N, hash=... |
| 54 | ✅ All checkouts transactional |
| 55 | |
| 56 | ════════════════════════════════════════════════════════════ |
| 57 | MUSE LOG GRAPH — ASCII |
| 58 | ════════════════════════════════════════════════════════════ |
| 59 | * c4_merge merge (HEAD) |
| 60 | | \ |
| 61 | | * c3000000 drums v1 |
| 62 | * | c2000000 bass v1 |
| 63 | |/ |
| 64 | * c1000000 keys v1 |
| 65 | * c0000000 root |
| 66 | |
| 67 | ════════════════════════════════════════════════════════════ |
| 68 | SUMMARY |
| 69 | ════════════════════════════════════════════════════════════ |
| 70 | ┌────────────────────────────────┬──────┐ |
| 71 | │ Commits │ 7 │ |
| 72 | │ Merges │ 1 │ |
| 73 | │ Branch heads │ 3 │ |
| 74 | │ Conflict merges attempted │ 1 │ |
| 75 | │ Checkouts executed │ 7 │ |
| 76 | │ Drift blocks │ 0 │ |
| 77 | │ Forced operations │ 7 │ |
| 78 | └────────────────────────────────┴──────┘ |
| 79 | ``` |
| 80 | |
| 81 | ## Architecture |
| 82 | |
| 83 | ``` |
| 84 | tests/e2e/ |
| 85 | ├── __init__.py |
| 86 | ├── muse_fixtures.py # Deterministic IDs, snapshots, payload builder |
| 87 | └── test_muse_e2e_harness.py # The scenario + assertions |
| 88 | |
| 89 | app/api/routes/muse.py # Production routes (variations, head, log, checkout, merge) |
| 90 | app/services/muse_log_render.py # ASCII graph + JSON + summary renderer |
| 91 | ``` |
| 92 | |
| 93 | All routes are production-grade with JWT auth. The test uses the standard |
| 94 | `auth_headers` fixture from `tests/conftest.py`. |