Improve download recovery and feed tracking - #96
Conversation
📝 WalkthroughWalkthroughThe userscript now detects additional track layouts, records feed checkpoints from explicit playback origins, and provides directional resume and reset controls. The web UI expands promotional-tag cleanup and retries failed downloads with alternative browser modes. ChangesFeed playback tracking
Web UI workflows
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
webui/src/components/App.tsx (1)
418-439: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winClear the previous error before starting a retry.
When
startDownloadstarts a retry, it updatesprogressbut preservesjob.error. If the retry succeeds, later state updates preserve the old error, so the successful download still shows the previous error banner. Seterror: nullin the startup state update.Proposed fix
setJob((prev) => ({ ...prev, + error: null, progress: { stage: 'handling_gates',🤖 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 `@webui/src/components/App.tsx` around lines 418 - 439, Update the startup setJob state update in startDownload to set error to null while resetting progress for a retry, ensuring subsequent successful state updates do not preserve the previous error banner.
🤖 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 `@userscript/sc-gate-dl.user.js`:
- Around line 595-603: Replace the page-wide feedPlaybackActive flag with
playback-session state tied to the feed-card playback origin. Update
recordPlayingFeedTrack and the feed-card click handling near the existing flag
assignment so unrelated global-player or queue playback clears or replaces that
state even while isFeedPage() remains true, while valid playback from the active
feed card continues recording. Add a regression test covering selection of an
unrelated track while staying on a feed route.
In `@webui/src/components/App.tsx`:
- Line 439: Update the download-start flow and retry handling in App.tsx to
persist the effective mode used by each job, using retryBrowserMode when present
and otherwise the mode passed to startDownload. Ensure the retry filter uses
this stored job mode rather than the current browserMode preference, so
asynchronous preference updates cannot hide the failed mode’s alternative.
- Around line 1035-1050: Update the failed job-start catch path near
startDownload to mark the job progress as an error/retryable state when setting
job.error, so the existing retry-button condition using job.progress?.stage ===
'error' renders for /start failures. Preserve normal handling-gates progress for
successful or non-failed flows.
---
Outside diff comments:
In `@webui/src/components/App.tsx`:
- Around line 418-439: Update the startup setJob state update in startDownload
to set error to null while resetting progress for a retry, ensuring subsequent
successful state updates do not preserve the previous error banner.
🪄 Autofix
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 Plus
Run ID: b67f95ee-29bc-4328-84a2-0631b09ba184
📒 Files selected for processing (3)
userscript/sc-gate-dl.user.jswebui/src/components/App.test.tswebui/src/components/App.tsx
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
userscript/sc-gate-dl.test.ts (1)
1-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReplace
node:fswithBun.file.Use
await Bun.file(new URL('./sc-gate-dl.user.js', import.meta.url)).text()to load the userscript. This follows the Bun API guideline and preserves the test contract.🤖 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 `@userscript/sc-gate-dl.test.ts` around lines 1 - 13, Replace the readFileSync-based source loading in sc-gate-dl.test.ts with Bun.file(new URL('./sc-gate-dl.user.js', import.meta.url)).text(), making the surrounding test setup asynchronous as needed while preserving the existing source value and test contract.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@userscript/sc-gate-dl.test.ts`:
- Around line 1-13: Replace the readFileSync-based source loading in
sc-gate-dl.test.ts with Bun.file(new URL('./sc-gate-dl.user.js',
import.meta.url)).text(), making the surrounding test setup asynchronous as
needed while preserving the existing source value and test contract.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1b916b00-7e1d-43e6-a8e0-429bf79b5f46
📒 Files selected for processing (3)
userscript/sc-gate-dl.test.tsuserscript/sc-gate-dl.user.jswebui/src/components/App.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- webui/src/components/App.tsx
Summary
Root cause
The userscript polled SoundCloud's global player and treated any matching loaded feed card as feed-originated playback. Tracks started elsewhere could therefore overwrite a feed checkpoint.
Validation
Summary by CodeRabbit
New Features
Bug Fixes