Skip to content

Phase A3: harden tracking association (track-id mapping) - #7

Closed
mandarwagh9 wants to merge 1 commit into
feat/phaseA-2-worldmodel-fixfrom
feat/phaseA-3-tracking-robustness
Closed

mandarwagh9 wants to merge 1 commit into
feat/phaseA-2-worldmodel-fixfrom
feat/phaseA-3-tracking-robustness

Conversation

@mandarwagh9

Copy link
Copy Markdown
Owner

What & why

Phase A3 of the 10× roadmap — robustness hardening of the tracker.

CameraTracker.update() mapped Hungarian row indices back to tracks via list(self.tracks.keys())[idx] inside its loops — O(n²), and implicitly coupled to dict iteration order matching the cost-matrix build order. It's correct in CPython today, but fragile to any reordering/mutation.

⚠️ Stacked on #6 → #5 → #4. Auto-retargets as the chain merges.

Changes

  • _associate_detections now returns (matched[(track_id, det_idx)], unmatched_track_ids, unmatched_det_indices). update() consumes track ids directly — behaviour-preserving, removes the ordering coupling and the per-match key-list rebuilds.
  • 6 new characterization tests (test_camera_tracker.py) pinning the lifecycle: create → confirm → coast → remove, plus the key multi-track id-mapping case (one detection matches only one of two tracks → correct track updates, the other coasts).

Method

Wrote the characterization tests first, confirmed they pass on the old code (pinning current behaviour), then refactored and confirmed they still pass. No behaviour change.

Verification

  • ruff clean · mypy clean · 67 tests pass (was 61).
  • Coverage: tracking_adapter 46% → 85%, total 42% → 49%.

🤖 Generated with Claude Code

Phase A3 of the 10x roadmap. CameraTracker.update() previously mapped Hungarian
row indices back to tracks via `list(self.tracks.keys())[idx]` inside its loops —
O(n^2) and implicitly coupled to dict iteration order matching the cost-matrix
build order. Correct today, but fragile.

- _associate_detections now returns (matched[(track_id, det_idx)],
  unmatched_track_ids, unmatched_det_indices); update() consumes track ids
  directly. Behaviour-preserving; removes the ordering coupling and the
  per-match key-list rebuilds.
- Add 6 characterization tests for the CameraTracker lifecycle (create → confirm
  → coast → remove), including multi-track id-mapping correctness.

Coverage: tracking_adapter 46%→85%, total 42%→49%. ruff/mypy clean, 67 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mandarwagh9

Copy link
Copy Markdown
Owner Author

Superseded — all commits from this phase landed on main via the merge of #13 (the top of the stack, which contains every phase commit). Closing to tidy up; the work is fully merged.

@mandarwagh9
mandarwagh9 deleted the feat/phaseA-3-tracking-robustness branch June 19, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant