Skip to content

fix(masters): countdown priority, URL cache hygiene, narrow exceptions (v2.4.3)#104

Merged
ChuckBuilds merged 4 commits intoChuckBuilds:mainfrom
sarjent:feat/masters-post-tournament-improvements
Apr 20, 2026
Merged

fix(masters): countdown priority, URL cache hygiene, narrow exceptions (v2.4.3)#104
ChuckBuilds merged 4 commits intoChuckBuilds:mainfrom
sarjent:feat/masters-post-tournament-improvements

Conversation

@sarjent
Copy link
Copy Markdown
Contributor

@sarjent sarjent commented Apr 16, 2026

Summary

  • Prioritize countdown in off-season phase: masters_countdown was the last entry in the off-season mode list, giving it the least screen time. Moved it to the top and repeated it so it dominates after the post-tournament window closes — matching the expected behavior that "the countdown kicks in" once tournament results are no longer shown.
  • Normalize URL-based headshot cache keys: When player_id is absent, the cache key previously used the raw URL (high cardinality, leaks query params in logs). Now uses a 12-char SHA-256 prefix as a stable key. Disk filename logic for player_id is unchanged.
  • Narrow broad except Exception in headshot download: Replace catch-all with (requests.exceptions.RequestException, UnidentifiedImageError, OSError) so only expected HTTP/image/file errors are masked. Adds required imports for requests.exceptions and PIL.UnidentifiedImageError.
  • ASCII-only comment: Replace non-ASCII × multiplication sign with x in inline comment to satisfy Ruff RUF003.

Test plan

  • Confirm off-season display leads with countdown (not buried after course tour / fun facts)
  • Confirm headshot cache keys are stable across plugin restarts when player_id is absent
  • Confirm a bad headshot URL logs a WARNING with the hashed key (not the raw URL)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Enhanced off-season display rotation with updated countdown frequency.
  • Bug Fixes

    • Improved timestamp accuracy in event date calculations.
    • Refined exception handling for network and image processing.
  • Chores

    • Updated to version 2.4.3.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fc1094ce-db63-4121-a102-505c9537544f

📥 Commits

Reviewing files that changed from the base of the PR and between 97693e4 and ff39c38.

📒 Files selected for processing (5)
  • plugins.json
  • plugins/masters-tournament/logo_loader.py
  • plugins/masters-tournament/manager.py
  • plugins/masters-tournament/manifest.json
  • plugins/masters-tournament/masters_data.py
✅ Files skipped from review due to trivial changes (3)
  • plugins/masters-tournament/manifest.json
  • plugins/masters-tournament/logo_loader.py
  • plugins.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • plugins/masters-tournament/masters_data.py
  • plugins/masters-tournament/manager.py

📝 Walkthrough

Walkthrough

Released version 2.4.3 of the masters-tournament plugin with metadata updates. Changes include refined exception handling for image processing, added microsecond normalization to computed fallback timestamps, and increased off-season countdown mode frequency in rotation.

Changes

Cohort / File(s) Summary
Version and Metadata Updates
plugins.json, plugins/masters-tournament/manifest.json
Bumped masters-tournament version from 2.4.2 to 2.4.3, updated last_updated date to 2026-04-16, and added new version entry in manifest with release metadata.
Exception Handling Refinement
plugins/masters-tournament/logo_loader.py
Narrowed exception handling in get_player_headshot from blanket Exception catch to specific tuple of (requests.exceptions.RequestException, UnidentifiedImageError, OSError) for network, image decode, and filesystem errors. Added corresponding imports.
Datetime Precision Fix
plugins/masters-tournament/masters_data.py
Explicitly zero microsecond in _computed_fallback_meta() when normalizing Thursday midnight EDT reference, ensuring computed end timestamp precision.
Off-Season Mode Configuration
plugins/masters-tournament/manager.py
Added two additional "masters_countdown" entries to the off-season phase mode priority list, increasing countdown mode frequency in off-season rotation.

Possibly related PRs

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately captures the three main changes: countdown priority adjustment, URL cache key normalization, and narrowed exception handling, plus version bump (v2.4.3).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
plugins/masters-tournament/manager.py (1)

173-184: Trailing masters_countdown at line 183 is now redundant.

With the two new top-of-list entries (lines 174–175), masters_countdown now appears 3 times in the off-season rotation. Per the PR description ("move … to the top … and repeat it"), the pre-existing trailing entry on line 183 looks like a leftover from the prior ordering. If the intent is ~2/8 dominance, drop the trailing one; if 3/9 is deliberate, a brief comment would help future readers.

Suggested tidy-up (if the trailing one is leftover)
         "masters_course_overview",
         "masters_tournament_stats",
-        "masters_countdown",
     ],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/masters-tournament/manager.py` around lines 173 - 184, The
"off-season" rotation array contains "masters_countdown" three times (two
consecutive entries at the top plus a trailing one) which appears redundant;
edit the off-season list in manager.py to remove the trailing
"masters_countdown" entry (or, if you intended three occurrences, add a brief
comment next to the array to explain the 3/9 weighting). Specifically update the
"off-season" array where "masters_countdown" is repeated so the final rotation
reflects the intended frequency (either remove the last "masters_countdown" or
document the deliberate triple occurrence).
plugins/masters-tournament/masters_data.py (1)

280-287: Midnight-EDT normalization is correct; consider preserving microseconds.

Math checks out: _masters_thursday() returns 12:00 UTC; replace(hour=4, minute=0, second=0) yields 04:00 UTC = 00:00 EDT on Thursday, and + 3d23h59m59s lands on Sunday 23:59:59 EDT — consistent with _parse_tournament_meta's padded end_date.

Minor nit: replace(hour=4, minute=0, second=0) does not reset microsecond. _masters_thursday constructs the datetime with no microsecond argument so it's 0 in practice, but explicitly zeroing it (microsecond=0) would make this robust to future changes to that helper.

Optional hardening
-        thu_midnight_edt = start.replace(hour=4, minute=0, second=0)
+        thu_midnight_edt = start.replace(hour=4, minute=0, second=0, microsecond=0)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/masters-tournament/masters_data.py` around lines 280 - 287, The
replace call that normalizes `_masters_thursday()` to EDT uses replace(hour=4,
minute=0, second=0) but doesn't clear microseconds; update the normalization so
`thu_midnight_edt = start.replace(hour=4, minute=0, second=0, microsecond=0)`
(affecting the variable `thu_midnight_edt` in this block) to ensure microseconds
are explicitly zeroed and keep behavior consistent with `_parse_tournament_meta`
and future changes to `_masters_thursday`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@plugins/masters-tournament/manager.py`:
- Around line 173-184: The "off-season" rotation array contains
"masters_countdown" three times (two consecutive entries at the top plus a
trailing one) which appears redundant; edit the off-season list in manager.py to
remove the trailing "masters_countdown" entry (or, if you intended three
occurrences, add a brief comment next to the array to explain the 3/9
weighting). Specifically update the "off-season" array where "masters_countdown"
is repeated so the final rotation reflects the intended frequency (either remove
the last "masters_countdown" or document the deliberate triple occurrence).

In `@plugins/masters-tournament/masters_data.py`:
- Around line 280-287: The replace call that normalizes `_masters_thursday()` to
EDT uses replace(hour=4, minute=0, second=0) but doesn't clear microseconds;
update the normalization so `thu_midnight_edt = start.replace(hour=4, minute=0,
second=0, microsecond=0)` (affecting the variable `thu_midnight_edt` in this
block) to ensure microseconds are explicitly zeroed and keep behavior consistent
with `_parse_tournament_meta` and future changes to `_masters_thursday`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5be00441-0f8b-4711-87db-8a838192bf4c

📥 Commits

Reviewing files that changed from the base of the PR and between 5988d7e and d1c6550.

📒 Files selected for processing (6)
  • plugins.json
  • plugins/masters-tournament/logo_loader.py
  • plugins/masters-tournament/manager.py
  • plugins/masters-tournament/manifest.json
  • plugins/masters-tournament/masters_data.py
  • plugins/masters-tournament/masters_helpers.py

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/masters-tournament/manager.py`:
- Line 174: The inline comment containing "3×" still uses the non-ASCII
multiplication sign and triggers Ruff RUF003; replace the Unicode '×' with the
ASCII 'x' (i.e., change "3×" to "3x") in the comment near the masters_countdown
reference (search for the comment containing "masters_countdown" or the exact
"3× out of 10 entries" text) so the PR matches the stated intent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 60c23fa3-57d6-4d4e-a440-353b1ca1af6a

📥 Commits

Reviewing files that changed from the base of the PR and between d1c6550 and 29b20e9.

📒 Files selected for processing (2)
  • plugins/masters-tournament/manager.py
  • plugins/masters-tournament/masters_data.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins/masters-tournament/masters_data.py

Comment thread plugins/masters-tournament/manager.py Outdated
@sarjent
Copy link
Copy Markdown
Contributor Author

sarjent commented Apr 16, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sarjent
Copy link
Copy Markdown
Contributor Author

sarjent commented Apr 19, 2026

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

sarjent and others added 4 commits April 19, 2026 11:13
Replace catch-all Exception with specific types — RequestException,
UnidentifiedImageError, OSError — so only expected HTTP/image/file
errors are masked; add missing imports for requests.exceptions and
PIL.UnidentifiedImageError.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move masters_countdown to the top of the off-season PHASE_MODES list
and repeat it so it gets dominant screen time after the post-tournament
window closes, matching user expectation that "the countdown kicks in"
after tournament results are no longer displayed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add comment to off-season PHASE_MODES explaining the deliberate 3/10
  countdown frequency (~30% screen time)
- Zero microseconds in _computed_fallback_meta thu_midnight_edt
  normalization for consistency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sarjent sarjent force-pushed the feat/masters-post-tournament-improvements branch from 97693e4 to ff39c38 Compare April 19, 2026 16:13
@ChuckBuilds ChuckBuilds merged commit abbf490 into ChuckBuilds:main Apr 20, 2026
1 check passed
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.

2 participants