Skip to content

rename track_id to tracklet_id for consistency#213

Open
TeunHuijben wants to merge 1 commit intomainfrom
rename-tracklet-id
Open

rename track_id to tracklet_id for consistency#213
TeunHuijben wants to merge 1 commit intomainfrom
rename-tracklet-id

Conversation

@TeunHuijben
Copy link
Copy Markdown
Collaborator

@TeunHuijben TeunHuijben commented May 6, 2026

There was a severe inconsistency in the naming of the TRACKLET_KEY throughout the repo. This wasn't surfaced by the tests, because all conftest and pre-computed graphs had "track_id", and not any other name. This PR: 1) resolved the inconsistency, 2) updates all tests accordingly, 3) speeds up track_id calculation. Claude blurp:

The codebase had two strings for the same concept:

  • DEFAULT_TRACKLET_KEY = "tracklet_id" — the public name exported from funtracks.annotators (what downstream callers like motile_tracker import).
  • "track_id" — hardcoded as the default in Tracks.__init__, plus as string literals in validation, exports, and the annotator registry.

When a caller passed node_name_map={"tracklet_id": "...", ...} (the documented public spelling), the builder loaded the column under graph attribute "tracklet_id" but then called SolutionTracks(graph=...) without forwarding tracklet_attr=. Tracks.__init__ defaulted it to "track_id", didn't find that on the graph, and silently recomputed tracklet IDs from weakly_connected_components under a fresh "track_id" column. The user's original data was orphaned; tracks.features.tracklet_key pointed at the recomputed values — same number of unique tracklets, different assignments.

The fix collapses both failures: one canonical default everywhere (DEFAULT_TRACKLET_KEY), the builder forwards the key actually present in node_props to SolutionTracks(tracklet_attr=...), and a fallback in _setup_core_computed_features lets pre-2.0 saved data (still using the literal "track_id") load without recompute.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 91.52542% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.48%. Comparing base (e7a7f13) to head (1d170fa).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/funtracks/import_export/_validation.py 75.00% 3 Missing ⚠️
src/funtracks/data_model/tracks.py 87.50% 1 Missing ⚠️
src/funtracks/import_export/csv/_import.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #213      +/-   ##
==========================================
+ Coverage   93.31%   93.48%   +0.17%     
==========================================
  Files          59       59              
  Lines        3217     3241      +24     
==========================================
+ Hits         3002     3030      +28     
+ Misses        215      211       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TeunHuijben TeunHuijben marked this pull request as ready for review May 6, 2026 06:44
@TeunHuijben TeunHuijben requested a review from cmalinmayor as a code owner May 6, 2026 06:44
@cmalinmayor cmalinmayor added the ready for initial review PR ready for first review label May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for initial review PR ready for first review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants