Skip to content

Simplify playlist cap handling#97

Merged
antonio-orionus merged 2 commits into
mainfrom
simplify-playlist-cap
Jun 12, 2026
Merged

Simplify playlist cap handling#97
antonio-orionus merged 2 commits into
mainfrom
simplify-playlist-cap

Conversation

@antonio-orionus

@antonio-orionus antonio-orionus commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • remove per-profile playlist probe caps from the profile schema, built-ins, draft serialization, and editor UI
  • keep the global playlist probe limit as the only Quick Download cap policy
  • add fixture E2E coverage for Quick Download playlist happy path, queue-loaded cap flow, and cap increase retry
  • fix bulk Quick Download queueing so active-profile video items use the probe-resolved URL instead of stale wizard state

Verification

  • bunx vitest run --project node tests/unit/download-profiles.test.ts tests/unit/download-profile-draft.test.ts tests/unit/queue-submission.test.ts
  • bunx vitest run --project jsdom tests/renderer/download-profile-editor.test.tsx tests/renderer/probe-orchestrator.test.tsx tests/renderer/playlist-probe-limit-selector.test.tsx
  • bun run build && xvfb-run -a bunx playwright test tests/e2e/fixture-workflows.spec.ts --config playwright.config.ts --workers=1
  • bun run check

User-facing changes

  • Removed per-profile "Playlist probe cap" control from the Download Profile Editor (Advanced options) — users can no longer set playlist probe caps on individual profiles.
  • Quick Download behavior: bulk/playlist Quick Download now queues active-profile video items using the probe-resolved webpage URL (avoids stale wizard-state URLs).
  • Global policy only: playlist probe limit is now a single global cap (settings.common.playlistProbeLimit) rather than per-profile caps.

Internal / refactor changes

  • Schema & types: removed playlistProbeCap from downloadProfileSchema and the inferred DownloadProfile type.
  • Draft flow: deleted DownloadProfilePlaylistCap, removed playlistCap from DownloadProfileDraft, eliminated the set-playlist-cap action and related draft-to-profile mapping.
  • Built-ins: baseProfile() no longer sets playlistProbeCap (removed default 'confirm').
  • Queue submission: prepareActiveProfileQueueSubmission now prefers probe.webpageUrl over state.wizardUrl when constructing queued job URLs.
  • Tests & E2E: added E2E fixture coverage for Quick Download playlist happy path, capped-queue flow, and cap-increase retry; refactored E2E helpers (configureSmallFileQuickProfile, expectOrderedM3u) and updated renderer/unit tests to reflect schema and behavior changes.

Risk areas

  • Schema breaking change: removing playlistProbeCap from DownloadProfile is a backward-incompatible change — loading older saved profiles or external consumers that expect this property may fail or ignore behavior. Consider migration or graceful handling when importing older profiles.
  • Behavioral change in URL resolution: queued jobs now prefer probe.webpageUrl; verify this doesn't regress workflows that relied on the original wizard URL (mixed/mirrored URL edge cases).
  • IPC / Electron concerns: E2E and queueing changes touch Quick Download workflows and app settings; ensure IPC messages that carry profile data or queue items tolerate the absent property and updated URL semantics.
  • Release/build: consumers of the exported DownloadProfile type or schema (plugins, tooling, saved state) must be audited; bumping the schema may require a migration notice.
  • No dependency or security library changes in this PR, but any downstream code assuming per-profile caps should be reviewed.

Tests / checks to run

  • Unit: bunx vitest --project node — tests/unit/download-profiles.test.ts, tests/unit/download-profile-draft.test.ts, tests/unit/queue-submission.test.ts
  • Renderer: bunx vitest --project jsdom — tests/renderer/download-profile-editor.test.tsx, tests/renderer/probe-orchestrator.test.tsx, tests/renderer/playlist-probe-limit-selector.test.tsx
  • E2E: bun run build && xvfb-run -a bunx playwright test tests/e2e/fixture-workflows.spec.ts --config playwright.config.ts --workers=1
  • Full static checks: bun run check

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c1cc00ce-e89b-4506-be33-04efb1edbcb4

📥 Commits

Reviewing files that changed from the base of the PR and between ecd6c47 and c3b74f7.

📒 Files selected for processing (1)
  • tests/e2e/fixture-workflows.spec.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Cold start (windows)
  • GitHub Check: Cold start (macos-arm64)
  • GitHub Check: Cold start (linux)
  • GitHub Check: Build Windows installer
  • GitHub Check: check
  • GitHub Check: check
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Favor strict typing, exhaustive checks, and discriminated unions. Use any and unknown as escape hatches only — if you reach for one, justify it.
Use type inference from Zod schemas: define z.enum([...])type Foo = z.infer<…>const FOOS = fooSchema.options instead of redeclaring as TypeScript union literals.

Files:

  • tests/e2e/fixture-workflows.spec.ts
tests/**

⚙️ CodeRabbit configuration file

Prioritize meaningful coverage, determinism, and whether tests validate behavior. Do not nitpick formatting or implementation style unless it makes the test unreliable.

Files:

  • tests/e2e/fixture-workflows.spec.ts
🔇 Additional comments (1)
tests/e2e/fixture-workflows.spec.ts (1)

12-12: LGTM!

Also applies to: 30-30


📝 Walkthrough

Walkthrough

Removes playlistProbeCap from download profiles: schema and built-in profiles updated, draft state/actions and editor UI stripped of playlist-cap handling, queue submission prefers probe webpage URLs for video probes, and unit/renderer/E2E tests updated or added to reflect these changes.

Changes

Remove playlistProbeCap feature

Layer / File(s) Summary
Schema and data model cleanup
src/shared/schemas.ts, src/shared/downloadProfiles.ts, src/renderer/src/store/wizard/downloadProfileDraft.ts
Removes playlistProbeCap from the DownloadProfile schema, eliminates the exported DownloadProfilePlaylistCap type, removes the playlistCap field from DownloadProfileDraft, and drops the property from built-in profiles.
Draft state and actions
src/renderer/src/store/wizard/downloadProfileDraft.ts
Removes the set-playlist-cap action variant, deletes the playlistCapToControlValue helper, and removes playlist-cap initialization and handling from draft creation, updates, and serialization.
Editor component UI removal
src/renderer/src/components/wizard/DownloadProfileEditor.tsx
Removes DownloadProfilePlaylistCap import, deletes PLAYLIST_CAP_OPTIONS, removes playlistCap destructuring, and removes the "Playlist probe cap" ProfileSelect control from Advanced options.
Queue submission URL preference
src/renderer/src/store/wizard/queueSubmission.ts
Updates video-probe queue item construction to prefer probe.webpageUrl over state.wizardUrl when building the entry url.
Unit tests updates
tests/unit/download-profile-draft.test.ts, tests/unit/queue-submission.test.ts
Adds assertion that serialized profiles lack playlistProbeCap, removes playlistProbeCap from fixtures, and adds a test asserting probe webpage URL is used when wizard URL is stale.
Renderer tests adjustments
tests/renderer/download-profile-editor.test.tsx, tests/renderer/probe-orchestrator.test.tsx
Adds test verifying the balanced profile editor does not render playlist-cap controls; updates queued-job expectation to use probe webpageUrl.
E2E test refactoring and playlist workflows
tests/e2e/fixture-workflows.spec.ts
Introduces helpers for small-file profile setup, output directory computation, and ordered M3U validation; refactors single-video and bulk tests and adds playlist quick-download, capped-playlist, and capped-playlist-retry E2E tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Suggested labels

enhancement

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: removing per-profile playlist cap handling and simplifying to a single global policy.
Description check ✅ Passed The description includes a clear summary, verification steps with specific commands, but is missing the base branch confirmation checkbox, type classification, and 'bun run check' confirmation checkbox from the template.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch simplify-playlist-cap

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.

@antonio-orionus

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Action 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.

@antonio-orionus

antonio-orionus commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

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.

@coderabbitai coderabbitai Bot added the enhancement New feature or request label Jun 12, 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: 2

🤖 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 `@tests/e2e/fixture-workflows.spec.ts`:
- Line 31: The extraction of video IDs with the regex
/\[(ARX[0-9A-Z]{8})\]\.mp4/ inside the orderedIds assignment assumes a specific
fixture catalog format; make this explicit by extracting the regex into a
well-named constant (e.g., FIXTURE_VIDEO_ID_REGEX or VIDEO_ID_PATTERN) and/or
adding a one-line comment above the orderedIds declaration that documents the
expected ID format ("IDs are bracketed and start with 'ARX' followed by 8
alphanumeric uppercase chars, followed by .mp4"). Update the orderedIds line to
reference the new constant so the coupling is obvious and easily reusable.
- Around line 28-32: Remove the redundant per-ID containment loop that checks
for each videoId in expectedIds against m3u; keep the extraction that builds
orderedIds via [...m3u.matchAll(/\[(ARX[0-9A-Z]{8})\]\.mp4/g)].map(match =>
match[1]) and the assertion expect(orderedIds).toEqual([...expectedIds]) to
validate both presence and ordering (i.e., delete the for (const videoId of
expectedIds) { expect(m3u).toContain(`[${videoId}].mp4`) } block).
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bb39143c-ef48-448f-8e4d-c386cf5e6e63

📥 Commits

Reviewing files that changed from the base of the PR and between 9ebc3ca and ecd6c47.

📒 Files selected for processing (10)
  • src/renderer/src/components/wizard/DownloadProfileEditor.tsx
  • src/renderer/src/store/wizard/downloadProfileDraft.ts
  • src/renderer/src/store/wizard/queueSubmission.ts
  • src/shared/downloadProfiles.ts
  • src/shared/schemas.ts
  • tests/e2e/fixture-workflows.spec.ts
  • tests/renderer/download-profile-editor.test.tsx
  • tests/renderer/probe-orchestrator.test.tsx
  • tests/unit/download-profile-draft.test.ts
  • tests/unit/queue-submission.test.ts
💤 Files with no reviewable changes (2)
  • src/shared/schemas.ts
  • src/shared/downloadProfiles.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Favor strict typing, exhaustive checks, and discriminated unions. Use any and unknown as escape hatches only — if you reach for one, justify it.
Use type inference from Zod schemas: define z.enum([...])type Foo = z.infer<…>const FOOS = fooSchema.options instead of redeclaring as TypeScript union literals.

Files:

  • src/renderer/src/store/wizard/queueSubmission.ts
  • tests/unit/download-profile-draft.test.ts
  • tests/renderer/download-profile-editor.test.tsx
  • tests/renderer/probe-orchestrator.test.tsx
  • tests/unit/queue-submission.test.ts
  • src/renderer/src/components/wizard/DownloadProfileEditor.tsx
  • src/renderer/src/store/wizard/downloadProfileDraft.ts
  • tests/e2e/fixture-workflows.spec.ts
src/renderer/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Do not add @radix-ui/* dependencies — this project uses @base-ui/react via the base-nova registry, not Radix primitives.

Files:

  • src/renderer/src/store/wizard/queueSubmission.ts
  • src/renderer/src/components/wizard/DownloadProfileEditor.tsx
  • src/renderer/src/store/wizard/downloadProfileDraft.ts
src/{shared,main,renderer}/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

New shared modules go under src/shared/ so renderer + main both import without IPC. Modules with electron/node-only deps stay in src/main/services/ or src/renderer/... and surface their seam via re-exports of pure helpers.

Files:

  • src/renderer/src/store/wizard/queueSubmission.ts
  • src/renderer/src/store/wizard/downloadProfileDraft.ts
src/{main,renderer}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Emit updater:available with { version, currentVersion, installChannel } IPC payload 5s after launch. Renderer shows <UpdateBanner> between title bar and content; per-platform UX from resolveAction(channel, platform).

Files:

  • src/renderer/src/store/wizard/queueSubmission.ts
  • src/renderer/src/components/wizard/DownloadProfileEditor.tsx
  • src/renderer/src/store/wizard/downloadProfileDraft.ts
src/renderer/**

⚙️ CodeRabbit configuration file

Review React/UI code for state correctness, accessibility, i18n regressions, unsafe DOM usage, IPC misuse, race conditions, and user-facing error handling. Avoid style-only nitpicks unless they affect maintainability.

Files:

  • src/renderer/src/store/wizard/queueSubmission.ts
  • src/renderer/src/components/wizard/DownloadProfileEditor.tsx
  • src/renderer/src/store/wizard/downloadProfileDraft.ts
tests/unit/**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Pure helpers with no I/O must live in their own module with a fixture-driven test alongside. Pattern: tests/fixtures/yt-dlp-stderr/<kind>/*.txt + tests/unit/yt-dlp-errors.test.ts.

Files:

  • tests/unit/download-profile-draft.test.ts
  • tests/unit/queue-submission.test.ts
tests/**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

When adding idempotent IPC registration (ipcMain.removeHandler(), autoUpdater.removeAllListeners()), add the method as vi.fn() to matching vi.mock('electron') blocks — otherwise tests fail at module-load.

Files:

  • tests/unit/download-profile-draft.test.ts
  • tests/renderer/download-profile-editor.test.tsx
  • tests/renderer/probe-orchestrator.test.tsx
  • tests/unit/queue-submission.test.ts
tests/**

⚙️ CodeRabbit configuration file

Prioritize meaningful coverage, determinism, and whether tests validate behavior. Do not nitpick formatting or implementation style unless it makes the test unreliable.

Files:

  • tests/unit/download-profile-draft.test.ts
  • tests/renderer/download-profile-editor.test.tsx
  • tests/renderer/probe-orchestrator.test.tsx
  • tests/unit/queue-submission.test.ts
  • tests/e2e/fixture-workflows.spec.ts
tests/renderer/**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Renderer-local state and component contracts belong in renderer tests. Do not use renderer tests as acceptance tests for download, probe, queue, or filesystem workflows.

Files:

  • tests/renderer/download-profile-editor.test.tsx
  • tests/renderer/probe-orchestrator.test.tsx
src/renderer/src/**/*.{css,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/renderer/src/**/*.{css,tsx}: Font is Poppins (@fontsource/poppins, weights 400/500/600/700). Do not reintroduce Outfit or Geist.
Use CSS tokens from src/renderer/src/styles.css--border-strong (darker border), --text-subtle (muted label), dark mode --border: hsla(0,0%,100%,0.07).
Apply glow patterns: primary buttons shadow-[0_4px_14px_var(--brand-glow)], active radio shadow-[0_0_0_2px_var(--brand-dim)], section labels text-[9px] font-bold uppercase tracking-[0.12em] text-[var(--text-subtle)], back/ghost buttons border-[1.5px] border-[var(--border-strong)].

Files:

  • src/renderer/src/components/wizard/DownloadProfileEditor.tsx
src/renderer/src/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

src/renderer/src/**/*.tsx: Use shadcn/ui primitives and composition (Field, InputGroup, ButtonGroup, ToggleGroup, Card, Alert, Empty, Separator, Badge) before inventing custom controls. Install via npx shadcn@latest add <component>.
Custom React primitives are acceptable only when shadcn has no fitting component or the component encodes Arroxy-specific product behavior.

Files:

  • src/renderer/src/components/wizard/DownloadProfileEditor.tsx
🔇 Additional comments (12)
src/renderer/src/store/wizard/downloadProfileDraft.ts (1)

9-59: LGTM!

Also applies to: 109-137, 140-195, 214-237

src/renderer/src/components/wizard/DownloadProfileEditor.tsx (1)

7-7: LGTM!

Also applies to: 222-244, 606-741

src/renderer/src/store/wizard/queueSubmission.ts (1)

189-192: LGTM!

tests/unit/download-profile-draft.test.ts (1)

93-104: LGTM!

tests/unit/queue-submission.test.ts (1)

77-90: LGTM!

Also applies to: 136-140

tests/renderer/download-profile-editor.test.tsx (1)

25-34: LGTM!

tests/e2e/fixture-workflows.spec.ts (5)

35-60: LGTM!


62-76: LGTM!


78-111: LGTM!


113-142: LGTM!


173-189: LGTM!

Also applies to: 232-265

tests/renderer/probe-orchestrator.test.tsx (1)

193-218: LGTM!

Comment thread tests/e2e/fixture-workflows.spec.ts Outdated
Comment thread tests/e2e/fixture-workflows.spec.ts Outdated
@antonio-orionus

Copy link
Copy Markdown
Owner Author

CodeRabbit triage update:

  • Fixed 2 current low-value E2E helper comments in tests/e2e/fixture-workflows.spec.ts.
  • Changes: extracted the fixture M3U video ID regex to a named constant and removed the redundant per-ID containment loop.
  • Commit: c3b74f7
  • Local validation: xvfb-run -a bunx playwright test tests/e2e/fixture-workflows.spec.ts --config playwright.config.ts --workers=1 and bun run check passed.
  • Skipped findings: none.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

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.

@antonio-orionus antonio-orionus merged commit d66211e into main Jun 12, 2026
11 checks passed
@antonio-orionus antonio-orionus deleted the simplify-playlist-cap branch June 12, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant