Discover and process all US TV shows dynamically via TVMaze schedule API#66
Conversation
…e API 📺 - Modified `scripts/fetch-rt.js` and `scripts/google-verify.js` to dynamically fetch US TV show names from the TVMaze schedule API for today and the next 7 days. - Introduced `fetchWithTimeout` helper function with 15-second network timeout in both scripts. - Added unit test in `test/googleVerify.test.js` to verify TVMaze schedule show name extraction. - Verified that all unit/integration tests pass.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughBoth TV show processing scripts add timeout-controlled TVMaze requests and discover additional US shows from upcoming schedules. A unit test validates extraction of distinct, non-empty schedule show names. ChangesTVMaze network discovery
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Script as TV show processing script
participant Schedule as TVMaze US schedule API
participant ShowSet as showSet
participant TVMaze as TVMaze show and episode APIs
Script->>Schedule: Fetch upcoming schedules
Schedule-->>Script: Return schedule items
Script->>ShowSet: Add valid show names
Script->>TVMaze: Fetch show metadata and episodes with timeouts
TVMaze-->>Script: Return show and episode data
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review the code |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/googleVerify.test.js (1)
68-95: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueTest exercises duplicated inline logic rather than the production implementation.
This test validates a standalone copy of the scheduling logic, meaning it will continue to pass even if the actual implementation in the scripts is broken or modified. Consider extracting the schedule parsing block into a shared utility function so that both the scripts and the test exercise the exact same code.
🤖 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 `@test/googleVerify.test.js` around lines 68 - 95, The test currently duplicates the schedule parsing logic instead of invoking production code. Extract the parsing block into a shared utility, update the relevant scheduling script to use it, and change the “TVMaze schedule discovery parses show names correctly” test to call that utility while preserving the existing filtering and deduplication behavior.
🤖 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.
Inline comments:
In `@scripts/fetch-rt.js`:
- Around line 113-115: Replace the UTC-based date formatting after local date
mutation in scripts/fetch-rt.js lines 113-115 and scripts/google-verify.js lines
212-214 with local year, month, and day formatting, preserving the existing date
iteration so each query matches the intended local calendar date.
---
Nitpick comments:
In `@test/googleVerify.test.js`:
- Around line 68-95: The test currently duplicates the schedule parsing logic
instead of invoking production code. Extract the parsing block into a shared
utility, update the relevant scheduling script to use it, and change the “TVMaze
schedule discovery parses show names correctly” test to call that utility while
preserving the existing filtering and deduplication behavior.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6c3bdf8b-d6d2-4431-bf79-81309d3db3e2
📒 Files selected for processing (3)
scripts/fetch-rt.jsscripts/google-verify.jstest/googleVerify.test.js
| const d = new Date(); | ||
| d.setDate(d.getDate() + i); | ||
| const dateStr = d.toISOString().slice(0, 10); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Timezone misalignment skips the current local day during schedule discovery.
Both scripts mix local date mutation (getDate(), setDate()) with UTC string formatting (toISOString()). If the script runs in a timezone where the local date lags behind UTC (e.g., US evenings), toISOString() evaluates to the next calendar day. This mismatch causes the discovery loop to completely skip the current local day's schedule.
scripts/fetch-rt.js#L113-L115: Format local year, month, and day to ensure the query date strictly matches the local date iteration.scripts/google-verify.js#L212-L214: Apply the exact same local date formatting fix to ensure consistent date boundaries here.
🛠️ Proposed fix for both files
- const d = new Date();
- d.setDate(d.getDate() + i);
- const dateStr = d.toISOString().slice(0, 10);
+ const d = new Date();
+ d.setDate(d.getDate() + i);
+ const dateStr = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const d = new Date(); | |
| d.setDate(d.getDate() + i); | |
| const dateStr = d.toISOString().slice(0, 10); | |
| const d = new Date(); | |
| d.setDate(d.getDate() + i); | |
| const dateStr = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; |
📍 Affects 2 files
scripts/fetch-rt.js#L113-L115(this comment)scripts/google-verify.js#L212-L214
🤖 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 `@scripts/fetch-rt.js` around lines 113 - 115, Replace the UTC-based date
formatting after local date mutation in scripts/fetch-rt.js lines 113-115 and
scripts/google-verify.js lines 212-214 with local year, month, and day
formatting, preserving the existing date iteration so each query matches the
intended local calendar date.
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. ❌ Failed to clone repository into sandbox. Please try again. |
The Google verification and Rotten Tomatoes fetch scripts are updated to dynamically fetch and process all US TV shows from the TVMaze schedule API over an 8-day window (today + 7 days) rather than being limited to the single hardcoded show "Sofia the First: Royal Magic". This ensures full and up-to-date schedule verification and pre-caching for all active US television shows.
PR created automatically by Jules for task 1232259988698646920 started by @DisabledAbel
Summary by CodeRabbit