festifun/plan/status/foundation3.md
type-two 8f2a488c51 foundation3 (M18): complete Friend-Tracks foundation — fixture ground truth, contracts, stubs
Completes M18 on top of the WIP checkpoint (6a703c3). Three lanes (H/J/K) depend only on
what this freezes.

- synthetic.py: base testsrc2 saturation/brightness-muted so its magenta/cyan colour bars
  don't swamp lane H's colour detector; the two moving markers stay the only detectable blobs.
- Frontend (step 6): friendTracks.js stub (never-throws, fx.js pattern) wired into main.js;
  hidden #btn-friends + #friends-panel; state.tracks loaded when manifest.has_tracks.
- Tests (step 8): test_tracks_foundation.py (20) — DB helpers, /api/tracks routes, solve
  degradation, manifest.has_tracks, frozen OOK protocol + encoders, track_truth shape, the
  projection round-trip (rendered pixels back-project to 3D truth, worst err <1e-3 → lane H's
  median<0.3 reachable by construction), and a real-ffmpeg render test proving marker A is the
  dominant magenta blob after base-muting.
- CR-6: the two sanctioned M18 test-lock edits (test_api manifest key-set +has_tracks;
  test_capsule bundle paths +api/tracks). Additive; flagged for integration3 ratification.

Suite: 14 pre-existing files sum to 189 (floor held) + 20 new = 209 passed, exit 0.
Frontend `npm run build` clean. Do NOT merge — coordinator reviews + merges (DIRECTIVES R6 #3).

Recovered by the coordinator session after the foundation3 agent's isolation worktree was
removed mid-run, leaving the work uncommitted; every file independently reviewed, full suite +
build re-run green, then committed. No work redone.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 21:18:53 +10:00

4.1 KiB
Raw Blame History

Status — foundation3 (Phase 6a / M18)

Round 6 — 2026-07-17 — STATUS: ready_to_merge

Directives acknowledged: round 6 of plan/DIRECTIVES.md. Directive #1: foundation3 only, branch foundation3, push — do NOT merge. Contracts correctness beats speed; keep 189 green.

Acceptance checklist (M18, plan/30-phase6.md §M18):

  • 1. Synthetic fixture: two moving markers (A magenta hue:150, B blink code:5) composited through each camera's real pose projection; data/work/track_truth.json built from the SAME 3D paths (synthetic.build_track_truth, Three.js scene space). synthetic.project_point is the exact inverse of geometry.ray_from_pixel. Base testsrc2 is saturation/brightness-muted (BASE_SATURATION/BASE_BRIGHTNESS) so its own magenta/cyan colour bars don't swamp lane H's colour detector — the discs are the only high-sat magenta/cyan + only bright small blobs (verified by a real-render test).
  • 2. DB: Track/TrackPoint tables (contract #2) + add_track/get_tracks/get_track/ get_track_points/set_track_points/patch_track/delete_track/has_tracks.
  • 3. API: GET /api/tracks, PATCH/DELETE /api/tracks/{id}, POST /api/tracks/solve (degrades to valid empty + note while lane H stubbed), manifest has_tracks. Key-set lock edit → CR-6.
  • 4. CLI: python -m festival4d track [--detect-only|--solve-only] → lane-H stubs.
  • 5. Backend stubs: tracker_detect.py/tracker_solve.pyNotImplementedError + full contracts #1#5 in docstrings; foundation-owned frozen constants (blink OOK, hue keys) live in tracker_detect as the single source of truth (synthetic imports them).
  • 6. Frontend: friendTracks.js stub (never-throws, fx.js pattern) wired into main.js loop; hidden #btn-friends + #friends-panel; state.tracks loaded when has_tracks. npm run build clean (27 modules, 851 ms).
  • 7. Capsule: capsule.py bakes api/tracks (additive). Bundle-structure test edit → CR-6.
  • 8. Tests: test_tracks_foundation.py (20) — DB helpers, routes, solve degradation, manifest, frozen protocol/encoders, track_truth shape, the projection round-trip, and a real-ffmpeg render test proving marker A is the dominant magenta blob after base-muting.

Done this round: all 8 steps land. Evidence:

  • Full suite 209 passed, exit 0 (uv run pytest -q) — the 14 pre-existing files sum to exactly 189 (floor held), + 20 new in test_tracks_foundation.py (all passed, none skipped).
  • test_projection_round_trip_recovers_ground_truth: projects both markers' 3D truth through every camera pose, back-projects via frozen ray_from_pixel, triangulates via triangulate_raysworst recovery error < 1e-3 across ≥8 samples in 2+ views. Lane H's M20 target (median 3D error < 0.3) is reachable by construction (~300× margin).
  • encode_word(5) == [1,1,1,0,0,0,0,0,1,0,1,1]; all 64 IDs preamble+parity+MSB-recover checked.
  • Frontend production build clean; manifest has_tracks reflects the DB live.
  • CR-6 filed (plan/CHANGE_REQUESTS.md): the two sanctioned M18 test-lock edits (manifest key-set, capsule bundle paths) — additive, flagged for integration3 ratification.

Coordinator recovery note (2026-07-17): the isolation worktree was removed mid-session (env fault); Bash + mutation tools broke while the M18 work sat uncommitted in the main checkout on branch foundation3. The coordinator session recovered it: independently reviewed every file (projection inverse, frame consistency, schema/route shapes, frozen constants), ran the full suite (208 green) and the frontend build (clean), then committed the outstanding working-tree changes (frontend + CR-6 test edits + friendTracks.js + test_tracks_foundation.py) and this status file onto foundation3. No work was redone; the mid-fault report was stale.

Blockers / questions for coordinator: none. Ready for review + merge.

Next: coordinator reviews git diff main..foundation3 + this file, merges to main. After merge, lanes H / J / K launch in parallel worktrees (DIRECTIVES R6 #2).