Skip to content

fix: resolve 3 syntax bugs blocking pytest collection#150

Open
Deepthit-23 wants to merge 1 commit into
Devnil434:mainfrom
Deepthit-23:main
Open

fix: resolve 3 syntax bugs blocking pytest collection#150
Deepthit-23 wants to merge 1 commit into
Devnil434:mainfrom
Deepthit-23:main

Conversation

@Deepthit-23

@Deepthit-23 Deepthit-23 commented Jun 13, 2026

Copy link
Copy Markdown

Summary

  • Replace em dash (U+2013) with hyphen in tracker.py docstring (SyntaxError)
  • Remove duplicate merged __init__ docstring in tracker.py (unterminated string literal)
  • Fix settings.REDIS_URLsettings.redis_url across codebase — pydantic BaseSettings normalizes field names to lowercase

Files Changed

  • services/tracking/tracker.py
  • scripts/inspect_tracks.py
  • tests/test_inspect_tracks.py
  • apps/backend/dependencies.py
  • benchmark.py
  • scripts/export_finetuning_dataset.py

Test Results

  • Before: 0 tests collected (3 collection errors)
  • After: 215 tests pass

Closes #149

Summary by CodeRabbit

Release Notes

  • New Features

    • Added max_interpolation_gap parameter to tracker configuration for enhanced control over trajectory interpolation behavior.
  • Chores

    • Updated internal Redis configuration handling.
    • Updated test assertions to match configuration updates.

…place em dash (U+2013) with hyphen in tracker.py docstring- Remove duplicate merged __init__ docstring in tracker.py - Fix settings.REDIS_URL -> settings.redis_url across codebase(pydantic BaseSettings normalizes field names to lowercase)Fixes #<149>
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR fixes three syntax and attribute errors that block test collection (issue #149). It normalizes Redis URL configuration references from uppercase REDIS_URL to lowercase redis_url across backend and CLI entry points, updates the Tracker class with a new interpolation control parameter and corrected docstring syntax.

Changes

Settings Normalization and Tracker Fixes

Layer / File(s) Summary
Backend and benchmark Redis URL defaults
apps/backend/dependencies.py, benchmark.py
Redis client initialization and PipelineBenchmark.__init__ now reference settings.redis_url (matching Pydantic BaseSettings normalization) instead of the non-existent uppercase settings.REDIS_URL.
CLI scripts Redis URL defaults
scripts/inspect_tracks.py, scripts/export_finetuning_dataset.py
DEFAULT_REDIS_URL and --redis-url argument defaults updated from settings.REDIS_URL to settings.redis_url to match the actual settings object attribute names.
Tracker interpolation parameter and docstring fixes
services/tracking/tracker.py
Tracker.__init__ adds max_interpolation_gap parameter (default 10) for frame interpolation constraints, docstring is rewritten to document both DeepSort and interpolation behavior, and em dash character in Tracker.update docstring is corrected to standard hyphen.
Test assertions for Redis URL
tests/test_inspect_tracks.py
Test assertions updated to validate settings.redis_url (lowercase) instead of the non-existent settings.REDIS_URL in JSON payload and text rendering test cases.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through settings with care,
Fixed REDIS_URL attributes here and there,
Uppercase to lowercase, a simple correction,
Tracker's new parameter adds interpolation direction,
Syntax bugs squashed—the tests run fair! 🐰✨

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning Title mentions resolving syntax bugs blocking pytest but the actual changes encompass settings field normalization updates across multiple files beyond just syntax fixes. Update title to accurately reflect all changes, such as 'fix: resolve pytest collection errors and normalize settings field names' or clarify scope in description.
Out of Scope Changes check ⚠️ Warning Changes to benchmark.py and apps/backend/dependencies.py update settings.REDIS_URL to settings.redis_url but these files are not mentioned in issue #149 objectives. Verify whether settings normalization applies globally and document if broader refactoring was intentional, or limit changes to only files specified in issue #149.
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed All three coding objectives from issue #149 are met: em dash replaced with hyphen, duplicate docstring removed, and settings.REDIS_URL changed to settings.redis_url across affected files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
services/tracking/tracker.py (1)

238-238: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: gap_frames is undefined.

The variable gap_frames is referenced in the condition but is never defined before this line. This will cause a NameError at runtime when a track briefly disappears and then reappears (the interpolation path).

The current test suite likely doesn't exercise trajectory gaps, which is why the 215 tests pass despite this bug. However, this will crash in production when the interpolation logic is triggered.

🔧 Proposed fix: Calculate gap_frames before using it

Insert the calculation before line 238:

         prev_traj = prev.trajectory if prev else []
         # ── Trajectory ────────────────────────────────────────────────
         interpolated_points = []
         max_gap = self.max_interpolation_gap  # <-- Replaced self.config string access
+        gap_frames = self._frame_id - prev.last_seen_frame - 1 if prev else 0
 
         if prev is not None and 0 < gap_frames <= max_gap:

This calculates the number of frames between the last seen frame and the current frame, which is what the interpolation logic needs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/tracking/tracker.py` at line 238, The condition references
gap_frames which is never defined; before the line "if prev is not None and 0 <
gap_frames <= max_gap:" compute gap_frames as the number of frames between the
track's last seen frame and the current frame (for example: gap_frames =
current_frame - prev.last_seen_frame - 1 or use whatever names your loop uses
for the current frame index), then use that variable in the existing if. Ensure
this computation is placed after confirming prev is not None (or use prev
safely) and yields an integer; no other logic changes are required.
🧹 Nitpick comments (1)
services/tracking/tracker.py (1)

87-88: 💤 Low value

Optional: Remove "Returns: None" from init docstring.

__init__ methods always implicitly return None, so documenting it is redundant. Python docstring conventions typically omit the Returns section for constructors.

✨ Optional cleanup
             reid_similarity_threshold: Minimum confidence needed to reconnect an ID via ReID.
             max_interpolation_gap: Maximum frame gap size allowed to fill missing trajectories.
-
-        Returns:
-            None

         Example:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/tracking/tracker.py` around lines 87 - 88, Remove the redundant
"Returns: None" section from the __init__ docstring in the class defined in
services/tracking/tracker.py (the __init__ method around the shown diff); keep
any parameter descriptions or other docstring content intact but delete the
"Returns:" block since constructors implicitly return None.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@services/tracking/tracker.py`:
- Line 238: The condition references gap_frames which is never defined; before
the line "if prev is not None and 0 < gap_frames <= max_gap:" compute gap_frames
as the number of frames between the track's last seen frame and the current
frame (for example: gap_frames = current_frame - prev.last_seen_frame - 1 or use
whatever names your loop uses for the current frame index), then use that
variable in the existing if. Ensure this computation is placed after confirming
prev is not None (or use prev safely) and yields an integer; no other logic
changes are required.

---

Nitpick comments:
In `@services/tracking/tracker.py`:
- Around line 87-88: Remove the redundant "Returns: None" section from the
__init__ docstring in the class defined in services/tracking/tracker.py (the
__init__ method around the shown diff); keep any parameter descriptions or other
docstring content intact but delete the "Returns:" block since constructors
implicitly return None.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6b0b857-4885-4c46-ad22-e7a20b59a22c

📥 Commits

Reviewing files that changed from the base of the PR and between 088dd9e and cfaab74.

📒 Files selected for processing (6)
  • apps/backend/dependencies.py
  • benchmark.py
  • scripts/export_finetuning_dataset.py
  • scripts/inspect_tracks.py
  • services/tracking/tracker.py
  • tests/test_inspect_tracks.py

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.

[Bug]: 3 syntax bugs blocking pytest collection (tracker.py + inspect_tracks.py)

1 participant