Skip to content

feat: improve feed tracking and gate handling - #91

Merged
D3SOX merged 9 commits into
masterfrom
agent/separate-gate-download-progress
Aug 1, 2026
Merged

feat: improve feed tracking and gate handling#91
D3SOX merged 9 commits into
masterfrom
agent/separate-gate-download-progress

Conversation

@D3SOX

@D3SOX D3SOX commented Aug 1, 2026

Copy link
Copy Markdown
Owner

What changed

SoundCloud feed position controls

  • track the farthest-up/newest and farthest-down/oldest played tracks independently on every playback
  • migrate the previous single saved position into both boundaries
  • provide separate resume buttons for both boundaries
  • show one dedicated Cancel scrolling button while searching instead of replacing both resume buttons
  • display checkpoints as Artist — Track Title by matching the exact track URL and excluding uploader links
  • keep manual track lookup, reset controls, deep scrolling, and target highlighting
  • cache resolved feed-card URLs, debounce feed mutation scans, and skip unchanged playback URLs
  • delete saved userscript state with GM_deleteValue
  • bump the userscript to version 1.10.2

Gate and download workflow

  • use the sequence SoundCloud → Gate → Download → Metadata → Done
  • keep gate URL entry, browser preparation, social gates, and Bandcamp track selection in the Gate step
  • activate Download only when the file transfer starts
  • normalize transfer progress to 0–100%
  • report byte progress for direct downloads
  • show the MB counter only once, below the progress bar
  • move artwork preparation into the Metadata step

DownloadGater Spotify support

  • handle honor-system Spotify gates without OAuth
  • open the requested Spotify page in a new tab
  • wait for DownloadGater's confirmation button, close only the newly opened tab, and confirm the action
  • support confirmation labels such as I followed, I saved it, I opened it, and I've done it
  • retry cleanly and report the Spotify gate as part of the Gate step
  • share the popup/confirmation implementation with DownloadGater Instagram gates

Why

Feed tracking previously stored only one direction at a time, and its broad title selector could display the uploader twice. During deep scrolling, both resume buttons also turned into duplicate cancel buttons.

Gate automation was shown as download progress on a whole-job percentage scale, so Download could become active before any transfer and only move through roughly 75–85%. DownloadGater Spotify gates stopped with an unsupported-OAuth error even though the site only requires opening its Spotify link and confirming the honor-system step.

These changes make the saved feed boundaries, UI stages, transfer progress, and DownloadGater behavior match what the user is actually doing.

Validation

  • bun test — 32 tests passed
  • bunx tsc --noEmit -p webui/tsconfig.json
  • bunx biome check src/server.ts src/directDownload.ts src/hypeddit.ts src/droploud.ts src/gaterush.ts src/downloadgater.ts
  • node --check userscript/sc-gate-dl.user.js
  • git diff --check
  • live DownloadGater validation with limoncello-paint-the-town-red-84870: advanced from Spotify to SoundCloud and left no Spotify tab open
  • GitHub Actions lint check passed

Summary by CodeRabbit

  • New Features

    • Added SoundCloud feed navigation with saved playback checkpoints, resume support, search, cancellation, reset, and status reporting.
    • Added visual highlighting for tracks found during feed navigation.
    • Added clearer download workflow stages for gate handling, downloading, audio processing, and metadata editing.
  • Improvements

    • Download progress now begins at 0%, reflects transfer progress when available, and completes at 100%.
    • Improved Spotify and Instagram gate handling with confirmation and retry behavior.
    • Progress displays now separate gate handling from download activity.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@D3SOX, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 54952730-b194-49e8-a4cc-359ca2b8d04f

📥 Commits

Reviewing files that changed from the base of the PR and between 879153c and eff0426.

📒 Files selected for processing (1)
  • src/downloadgater.ts
📝 Walkthrough

Walkthrough

The PR adds shared gate automation, byte-based download progress, separate gate and download WebUI stages, and SoundCloud feed-position tracking with navigation controls.

Changes

Download and gate flow

Layer / File(s) Summary
Shared gate handling and progress stages
src/downloadgater.ts, src/server.ts, src/ytdlp.ts, src/droploud.ts, src/gaterush.ts, src/hypeddit.ts
Spotify and Instagram use shared popup handling. Gate preparation reports handling_gates.
Byte-based download progress
src/directDownload.ts, src/downloadgater.ts, src/droploud.ts, src/gaterush.ts, src/hypeddit.ts, src/hypedditHttp.ts, src/ytdlp.ts
Downloads start at 0%, report direct 0–100% transfer progress, and complete at 100%. Direct downloads use content-length metadata and throttled updates.
Server progress normalization
src/server.ts
Downloading percentages use valid byte totals and remain clamped to 0–100%.
Gate and download workflow UI
webui/src/components/App.tsx
The WebUI separates gate handling, downloading, audio processing, and metadata editing. Transfer metrics appear only during downloading.

SoundCloud feed navigation

Layer / File(s) Summary
Feed checkpoint tracking
userscript/sc-gate-dl.user.js
The userscript detects feed cards, records played tracks, persists checkpoints, and tracks feed navigation changes.
Feed navigator and controls
userscript/sc-gate-dl.user.js
The userscript adds deep scrolling, URL and checkpoint search, cancellation, reset controls, status reporting, and track highlighting.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DownloadGater
  participant GatePopup
  participant Server
  participant WebUI
  DownloadGater->>Server: emit handling_gates progress
  DownloadGater->>GatePopup: open target and invoke action
  GatePopup-->>DownloadGater: expose confirmation state
  DownloadGater->>GatePopup: confirm completion and close popup
  Server->>WebUI: send gate or download progress over SSE
  WebUI-->>WebUI: render gate handling or byte progress
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies two primary changes: SoundCloud feed tracking and gate handling.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/separate-gate-download-progress

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

@D3SOX
D3SOX marked this pull request as ready for review August 1, 2026 09:08
@D3SOX D3SOX changed the title feat: add feed tracking and separate download progress feat: improve feed tracking and gate handling Aug 1, 2026

@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.

Actionable comments posted: 3

🧹 Nitpick comments (2)
userscript/sc-gate-dl.user.js (1)

394-409: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Grant and use GM_deleteValue for the checkpoint.

The metadata grants GM_getValue and GM_setValue, but not GM_deleteValue. Add // @grant GM_deleteValue; otherwise the fallback keeps the stored null value.

🤖 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.user.js` around lines 394 - 409, Update the userscript
metadata to grant GM_deleteValue, then modify resetFeedCheckpoints to call
GM_deleteValue for FEED_CHECKPOINT_KEY when available instead of storing null
with GM_setValue; preserve the localStorage fallback and existing
status/navigation updates.

Source: Linters/SAST tools

src/downloadgater.ts (1)

268-338: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the shared popup-confirm pattern.

handleSpotifyStep duplicates the open-popup/wait/close/confirm sequence already implemented in handleInstagramStep (Line 363-434 in this file). Both methods: capture pagesBefore, click an action button, poll for a new page within a deadline, wait for a confirm button to become enabled, close the popup, then click confirm. The main differences are the button-text regexes, timeouts, and attempt counts.

Extract a shared private helper (for example handleHonorSystemPopupStep(page, options)) that takes the action-button regex, confirm-button regex, popup-wait timeout, and max attempts as parameters. This removes the duplication and keeps future gate-handling fixes (for example, popup detection tweaks) in one place instead of two divergent copies.

Note also that handleInstagramStep checks hasDownloadButton(page) explicitly inside its loop, while handleSpotifyStep relies only on detectPane(page) !== 'spotify'. Since detectPane already treats a visible download button as the 'download' pane, this asymmetry is not a functional bug, but a shared helper would naturally unify the two checks.

🤖 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 `@src/downloadgater.ts` around lines 268 - 338, Extract the duplicated
popup-and-confirm flow from handleSpotifyStep and handleInstagramStep into a
shared private helper, such as handleHonorSystemPopupStep. Parameterize the
action-button pattern, confirmation-button pattern, popup wait timeout, and
maximum attempts, while preserving each method’s existing behavior and
pane/download checks. Update both step handlers to call the helper so popup
detection, waiting, closing, and confirmation remain centralized.
🤖 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 `@src/server.ts`:
- Around line 208-223: The downloading progress logic in the server update flow
must preserve YtDlpDownloader’s supplied percent when extra.downloadBytes or
extra.totalBytes is unavailable. Update the fallback in the stage ===
'downloading' branch so it does not force non-completion updates to 0% or
completion updates to 100%; retain the existing byte-based calculation when
valid byte values are provided, then pass the preserved stagePercent to
jobStore.updateProgress.

In `@userscript/sc-gate-dl.user.js`:
- Around line 527-562: Reduce repeated full-feed scans by caching each card’s
resolved track URL in a WeakMap reused by findFeedCard and other callers. In
userscript/sc-gate-dl.user.js lines 527-562, debounce the MutationObserver
callback with a short timer and clear that timer in finish; in lines 479-492,
retain the last recorded playing URL and return early when the interval observes
no change. Apply the shared cache so repeated scans reuse parsed card URLs.
- Around line 431-444: Update the fallback branch of shouldAdvanceCheckpoint to
compute the indices of card and savedCard from cards, and return false when
either index is -1. Only apply the existing direction-based comparison after
both cards are confirmed present in the feedCards() result.

---

Nitpick comments:
In `@src/downloadgater.ts`:
- Around line 268-338: Extract the duplicated popup-and-confirm flow from
handleSpotifyStep and handleInstagramStep into a shared private helper, such as
handleHonorSystemPopupStep. Parameterize the action-button pattern,
confirmation-button pattern, popup wait timeout, and maximum attempts, while
preserving each method’s existing behavior and pane/download checks. Update both
step handlers to call the helper so popup detection, waiting, closing, and
confirmation remain centralized.

In `@userscript/sc-gate-dl.user.js`:
- Around line 394-409: Update the userscript metadata to grant GM_deleteValue,
then modify resetFeedCheckpoints to call GM_deleteValue for FEED_CHECKPOINT_KEY
when available instead of storing null with GM_setValue; preserve the
localStorage fallback and existing status/navigation updates.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 189af043-7897-4186-aae7-983df8de5554

📥 Commits

Reviewing files that changed from the base of the PR and between 78282d4 and 1422855.

📒 Files selected for processing (8)
  • src/directDownload.ts
  • src/downloadgater.ts
  • src/droploud.ts
  • src/gaterush.ts
  • src/hypeddit.ts
  • src/server.ts
  • userscript/sc-gate-dl.user.js
  • webui/src/components/App.tsx

Comment thread src/server.ts
Comment thread userscript/sc-gate-dl.user.js
Comment thread userscript/sc-gate-dl.user.js

@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)
src/downloadgater.ts (1)

268-372: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fallback popup matcher can select a stale tab.

At Line 314, the fallback matcher searches all pages for options.popupUrlPattern, but it does not exclude pages already present in pagesBefore. The primary matcher at Line 308 excludes pagesBefore pages. If the primary matcher times out and a leftover tab from an earlier failed attempt still matches the URL pattern, the fallback selects and closes that stale tab instead of correctly detecting that no new popup opened for this attempt.

Add the same pagesBefore exclusion to the fallback matcher.

🐛 Proposed fix to exclude stale pages from the fallback matcher
 			popup ??= pages.find(
 				(candidate) =>
 					candidate !== page &&
+					!pagesBefore.has(candidate) &&
 					new RegExp(options.popupUrlPattern, 'i').test(candidate.url()),
 			);
🤖 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 `@src/downloadgater.ts` around lines 268 - 372, Update the fallback popup
search in handleHonorSystemPopupStep to exclude every page already contained in
pagesBefore, matching the primary candidate filter. Ensure stale tabs matching
options.popupUrlPattern cannot be selected or closed, while newly opened
matching popups remain eligible.
🧹 Nitpick comments (4)
src/downloadgater.ts (1)

724-729: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Redundant percent calculation; see consolidated comment.

downloadPercent is computed here from receivedBytes/totalBytes, but src/server.ts's emitProgress always recalculates the same ratio from the extra.downloadBytes/extra.totalBytes fields whenever totalBytes > 0 (which is exactly when this branch runs), discarding the value passed here. See the consolidated comment for the shared fix across files.

🤖 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 `@src/downloadgater.ts` around lines 724 - 729, Remove the redundant
downloadPercent calculation in the download progress flow and stop passing the
discarded value to emitProgress. Preserve the existing received/total MB display
and rely on the centralized ratio calculation in emitProgress using the download
byte fields.
src/gaterush.ts (1)

575-580: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Redundant percent calculation; see consolidated comment.

downloadPercent is computed here from receivedBytes/totalBytes, but src/server.ts's emitProgress always recalculates the same ratio from extra.downloadBytes/extra.totalBytes whenever totalBytes > 0, discarding this value. See the consolidated comment for the shared fix.

🤖 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 `@src/gaterush.ts` around lines 575 - 580, Remove the redundant downloadPercent
calculation near emitProgress in the download flow, since emitProgress
recalculates the ratio from downloadBytes and totalBytes. Update the call and
related data flow to use the consolidated calculation while preserving the
existing zero-total behavior and progress reporting.
src/hypedditHttp.ts (1)

288-297: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Redundant percent calculation; see consolidated comment.

This call always has totalBytes > 0 (guarded at Line 289), so src/server.ts's emitProgress always recalculates the same ratio from extra.downloadBytes/extra.totalBytes and discards the value computed here. See the consolidated comment for the shared fix.

🤖 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 `@src/hypedditHttp.ts` around lines 288 - 297, Update the progress callback
invocation in the download flow around the `lastEmit` and `totalBytes > 0` guard
to stop calculating and passing the redundant `(receivedBytes / totalBytes) *
100` percentage. Preserve the existing byte values in the callback metadata and
rely on `src/server.ts`'s `emitProgress` to derive the percentage from
`downloadBytes` and `totalBytes`.
src/hypeddit.ts (1)

719-723: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Redundant percent calculation; see consolidated comment.

downloadPercent is computed here from receivedBytes/totalBytes, but src/server.ts's emitProgress always recalculates the same ratio from extra.downloadBytes/extra.totalBytes whenever totalBytes > 0, discarding this value. See the consolidated comment for the shared fix.

🤖 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 `@src/hypeddit.ts` around lines 719 - 723, Remove the redundant local
downloadPercent calculation in the download progress flow surrounding
emitProgress, since src/server.ts's emitProgress recalculates it from
downloadBytes and totalBytes. Update the call to rely on the consolidated
calculation while preserving the existing downloading message and progress data.
🤖 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 `@src/downloadgater.ts`:
- Around line 268-372: Update the fallback popup search in
handleHonorSystemPopupStep to exclude every page already contained in
pagesBefore, matching the primary candidate filter. Ensure stale tabs matching
options.popupUrlPattern cannot be selected or closed, while newly opened
matching popups remain eligible.

---

Nitpick comments:
In `@src/downloadgater.ts`:
- Around line 724-729: Remove the redundant downloadPercent calculation in the
download progress flow and stop passing the discarded value to emitProgress.
Preserve the existing received/total MB display and rely on the centralized
ratio calculation in emitProgress using the download byte fields.

In `@src/gaterush.ts`:
- Around line 575-580: Remove the redundant downloadPercent calculation near
emitProgress in the download flow, since emitProgress recalculates the ratio
from downloadBytes and totalBytes. Update the call and related data flow to use
the consolidated calculation while preserving the existing zero-total behavior
and progress reporting.

In `@src/hypeddit.ts`:
- Around line 719-723: Remove the redundant local downloadPercent calculation in
the download progress flow surrounding emitProgress, since src/server.ts's
emitProgress recalculates it from downloadBytes and totalBytes. Update the call
to rely on the consolidated calculation while preserving the existing
downloading message and progress data.

In `@src/hypedditHttp.ts`:
- Around line 288-297: Update the progress callback invocation in the download
flow around the `lastEmit` and `totalBytes > 0` guard to stop calculating and
passing the redundant `(receivedBytes / totalBytes) * 100` percentage. Preserve
the existing byte values in the callback metadata and rely on `src/server.ts`'s
`emitProgress` to derive the percentage from `downloadBytes` and `totalBytes`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 669534f7-c5b2-480d-a653-36594aa9e1f7

📥 Commits

Reviewing files that changed from the base of the PR and between 1422855 and 74e317c.

📒 Files selected for processing (9)
  • src/directDownload.ts
  • src/downloadgater.ts
  • src/droploud.ts
  • src/gaterush.ts
  • src/hypeddit.ts
  • src/hypedditHttp.ts
  • src/server.ts
  • src/ytdlp.ts
  • userscript/sc-gate-dl.user.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/droploud.ts
  • userscript/sc-gate-dl.user.js
  • src/directDownload.ts

@D3SOX

D3SOX commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai rate limit

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Your plan includes PR reviews subject to rate limits. More reviews will be available in 38 minutes.

@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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (2)
src/downloadgater.ts (2)

357-359: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Close the gate page when shared handling fails.

Line [357] throws after retries. downloadAudio closes the page only after handleDownload succeeds. This throw bypasses page.close(), so repeated failed gate attempts can leak browser pages.

Move page cleanup into a finally block covering the full gate and download flow.

🤖 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 `@src/downloadgater.ts` around lines 357 - 359, Update the gate/download flow
around downloadAudio and handleDownload so page.close() executes in a finally
block covering retries, successful handling, and errors thrown after retries.
Preserve the existing error propagation while ensuring every gate page is closed
when shared handling fails.

304-351: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Require the expected popup before confirming the gate.

Line [308] accepts any new non-blank page. This makes the popupUrlPattern check at Line [318] ineffective when a new page exists. If no popup opens, the code can still click the confirmation button at Line [349]. The handler can advance without opening the required Spotify or Instagram page.

Filter candidates by popupUrlPattern, and skip confirmation when no matching popup is found.

Proposed fix
-				popup = pages.find(
-					(candidate) =>
-						candidate !== page &&
-						!pagesBefore.has(candidate) &&
-						candidate.url() !== 'about:blank',
-				);
-				popup ??= pages.find(
+				popup = pages.find(
 					(candidate) =>
 						candidate !== page &&
 						!pagesBefore.has(candidate) &&
-						new RegExp(options.popupUrlPattern, 'i').test(candidate.url()),
+						new RegExp(options.popupUrlPattern, 'i').test(candidate.url()),
 				);
...
+			if (!popup) {
+				await timeout(500);
+				continue;
+			}
🤖 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 `@src/downloadgater.ts` around lines 304 - 351, Update the popup detection loop
to only assign `popup` to new pages whose URLs match `options.popupUrlPattern`,
removing the fallback that accepts any non-blank page. Before the confirmation
wait and `page.evaluate` click in the surrounding gate handler, return or
otherwise skip confirmation when no matching popup is found, while preserving
confirmation only for a detected, open popup.
🤖 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 `@src/downloadgater.ts`:
- Around line 725-730: Update the in-progress emitProgress call in the download
flow to calculate progress as receivedBytes divided by totalBytes, convert it to
a percentage, and clamp the result between 0 and 100 before passing it instead
of the constant 0. Preserve the existing progress message and byte metadata.

---

Outside diff comments:
In `@src/downloadgater.ts`:
- Around line 357-359: Update the gate/download flow around downloadAudio and
handleDownload so page.close() executes in a finally block covering retries,
successful handling, and errors thrown after retries. Preserve the existing
error propagation while ensuring every gate page is closed when shared handling
fails.
- Around line 304-351: Update the popup detection loop to only assign `popup` to
new pages whose URLs match `options.popupUrlPattern`, removing the fallback that
accepts any non-blank page. Before the confirmation wait and `page.evaluate`
click in the surrounding gate handler, return or otherwise skip confirmation
when no matching popup is found, while preserving confirmation only for a
detected, open popup.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ad143bf-d53c-4b90-b423-d5333790153b

📥 Commits

Reviewing files that changed from the base of the PR and between 74e317c and 879153c.

📒 Files selected for processing (5)
  • src/downloadgater.ts
  • src/droploud.ts
  • src/gaterush.ts
  • src/hypeddit.ts
  • src/hypedditHttp.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/hypedditHttp.ts

Comment thread src/downloadgater.ts
@D3SOX
D3SOX merged commit 3a73758 into master Aug 1, 2026
2 checks passed
@D3SOX
D3SOX deleted the agent/separate-gate-download-progress branch August 1, 2026 09:39
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.

1 participant