Phase A3: harden tracking association (track-id mapping) - #7
Closed
mandarwagh9 wants to merge 1 commit into
Closed
mandarwagh9 wants to merge 1 commit into
mandarwagh9 wants to merge 1 commit into
Conversation
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>
This was referenced Jun 19, 2026
Owner
Author
|
Superseded — all commits from this phase landed on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Phase A3 of the 10× roadmap — robustness hardening of the tracker.
CameraTracker.update()mapped Hungarian row indices back to tracks vialist(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.Changes
_associate_detectionsnow 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.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
ruffclean ·mypyclean · 67 tests pass (was 61).tracking_adapter46% → 85%, total 42% → 49%.🤖 Generated with Claude Code