Skip to content

fix: preserve metadata overrides and upload job state#167

Open
Audionut wants to merge 5 commits into
mainfrom
fix/metadata-override
Open

fix: preserve metadata overrides and upload job state#167
Audionut wants to merge 5 commits into
mainfrom
fix/metadata-override

Conversation

@Audionut

@Audionut Audionut commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added a season-episode CLI/app release override (including help text and flag alias support).
    • Added metadata overrides editing to the UI for common metadata fields and options.
  • Bug Fixes
    • Ensures the explicitly selected category takes priority over TMDB-derived inference.
    • Applies metadata overrides consistently across previews, preparation, screenshot workflows, uploads, and tracker workflows (including retries), so results reflect the selected overrides.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Audionut, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 17 minutes and 43 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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

🚦 How do rate 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 see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f5a1439-d210-4b30-85d5-b5d404ed531e

📥 Commits

Reviewing files that changed from the base of the PR and between 2b44b45 and 6a635a1.

📒 Files selected for processing (17)
  • gui/frontend/src/app.test.ts
  • gui/frontend/src/app.tsx
  • gui/frontend/src/hooks/useScreenshots.ts
  • gui/frontend/src/hooks/useUploadImages.ts
  • gui/frontend/src/types.ts
  • gui/frontend/src/utils/helpers.test.ts
  • gui/frontend/src/utils/helpers.ts
  • internal/core/core.go
  • internal/core/upload_review.go
  • internal/core/upload_review_test.go
  • internal/metadata/media_details.go
  • internal/metadata/media_details_test.go
  • internal/webserver/app_routes.go
  • internal/webserver/backend.go
  • internal/webserver/backend_repo_test.go
  • internal/webserver/jobs.go
  • pkg/api/services.go
📝 Walkthrough

Walkthrough

Adds a --season-episode CLI release override, threads MetadataOverrides through the request stack, updates frontend metadata editing and propagation, and changes tracker-upload cleanup errors to record without changing terminal job status.

Changes

CLI UseSeasonEpisode flag and override signature keying

Layer / File(s) Summary
CLI flag, request building, and core signature
cmd/upbrr/cli_options.go, cmd/upbrr/main.go, internal/core/core.go, cmd/upbrr/cli_options_test.go, internal/core/description_builder_test.go
UseSeasonEpisode is added to CLI options and request building, the season-episode flag is registered and aliased, help text is updated, TMDB/category precedence changes when both are present, and the core override signature now includes useSeasonEpisode.

MetadataOverrides end-to-end propagation

Layer / File(s) Summary
Type definitions and normalization helpers
gui/frontend/src/types.ts, gui/frontend/src/utils/helpers.ts, gui/frontend/src/utils/index.ts, gui/frontend/src/utils/helpers.test.ts, pkg/api/core.go, pkg/api/services.go
MetadataOverrides, MetadataOverrideEditState, and MetadataOverrideTouchedState types are added; normalizeMetadataOverrides is introduced; normalizeReleaseOverrides copies additional fields; the helpers are re-exported; and request/override docs and normalization tests are updated.
Browser runtime bridge
gui/frontend/src/utils/runtime.ts, gui/frontend/src/utils/runtime.test.ts
Browser bridge wrappers gain metadataOverrides parameters and forward them as MetadataOverrides in app-call payloads; the runtime bridge tests are updated for the new payload shapes and argument positions.
Webserver routes, backend, and job state
internal/webserver/app_routes.go, internal/webserver/backend.go, internal/webserver/jobs.go, internal/webserver/backend_repo_test.go
App routes decode and forward MetadataOverrides, backend methods accept and pass them into api.Request, and dupe/tracker job state stores them for execution and retry; backend repo tests are updated for the new call signatures.
Guiapp methods and upload cleanup
internal/guiapp/app.go, internal/guiapp/dupe_jobs.go, internal/guiapp/upload_jobs.go, internal/guiapp/run_options_test.go, internal/guiapp/app_core_test.go
Wails-exposed methods accept metadataOverrides, job creation and retry paths persist and reuse them, per-request core calls include them, and tracker-upload cleanup now records errors without changing terminal status; guiapp tests are updated to the new arity and behavior.
Frontend state, hooks, UI, and tests
gui/frontend/src/app.tsx, gui/frontend/src/hooks/useScreenshots.ts, gui/frontend/src/hooks/useUploadImages.ts, gui/frontend/src/pages/input/index.tsx, gui/frontend/src/pages/menu_images/index.tsx, gui/frontend/src/app.test.ts
Frontend state tracks metadata edits/touched flags, normalized metadata overrides are passed through fetch, screenshot, upload, dupe-check, and tracker-upload flows, InputPage adds metadata override controls, MenuImagesPage forwards overrides, hooks accept the new state, and app tests are updated.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

🐇 I hop through flags and metadata hues,
season-episode and overrides to choose.
From burrow to bridge, the data streams glide,
With cleanup that records and keeps status inside.
Soft ears up, the tests all sing—
A tidy little warren of wiring.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% 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 accurately summarizes the main changes around metadata override propagation and tracker upload job state 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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/metadata-override

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.

@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 `@gui/frontend/src/app.tsx`:
- Around line 1443-1476: The metadata override builder in metadataOverrideState
is still serializing cleared text fields as empty strings. Update the
Distributor and OriginalLanguage handling so touched-but-empty edits are treated
as unset (not emitted in overrides), letting normalizeMetadataOverrides drop
them and revert to auto behavior. Use the existing metadataTouched,
metadataEdits, and normalizeMetadataOverrides flow to ensure only non-empty text
overrides are written.

In `@gui/frontend/src/hooks/useScreenshots.ts`:
- Around line 144-145: The screenshot follow-up mutations in useScreenshots are
using the live metadataOverrideState at click time, which can drift from the
snapshot used when the screenshots were loaded. Capture and reuse the same
normalized override snapshot from the initial load path (the call that uses
normalizeMetadataOverrides in useScreenshots) for the save/delete/update flows,
and thread that snapshot through the relevant handlers instead of reading
current overrides again. Make sure the handlers around the follow-up calls in
useScreenshots all reference the same loaded override state so the UI plan and
the mutation target stay aligned.
🪄 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: 62da0244-2c1d-469b-b193-fc8cd46688c1

📥 Commits

Reviewing files that changed from the base of the PR and between a93a008 and a8c2a83.

📒 Files selected for processing (28)
  • cmd/upbrr/cli_options.go
  • cmd/upbrr/cli_options_test.go
  • cmd/upbrr/main.go
  • gui/frontend/src/app.test.ts
  • gui/frontend/src/app.tsx
  • gui/frontend/src/hooks/useScreenshots.ts
  • gui/frontend/src/hooks/useUploadImages.ts
  • gui/frontend/src/pages/input/index.tsx
  • gui/frontend/src/pages/menu_images/index.tsx
  • gui/frontend/src/types.ts
  • gui/frontend/src/utils/helpers.test.ts
  • gui/frontend/src/utils/helpers.ts
  • gui/frontend/src/utils/index.ts
  • gui/frontend/src/utils/runtime.test.ts
  • gui/frontend/src/utils/runtime.ts
  • internal/core/core.go
  • internal/core/description_builder_test.go
  • internal/guiapp/app.go
  • internal/guiapp/app_core_test.go
  • internal/guiapp/dupe_jobs.go
  • internal/guiapp/run_options_test.go
  • internal/guiapp/upload_jobs.go
  • internal/webserver/app_routes.go
  • internal/webserver/backend.go
  • internal/webserver/backend_repo_test.go
  • internal/webserver/jobs.go
  • pkg/api/core.go
  • pkg/api/services.go

Comment thread gui/frontend/src/app.tsx
Comment thread gui/frontend/src/hooks/useScreenshots.ts Outdated

@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

🤖 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 `@gui/frontend/src/hooks/useScreenshots.ts`:
- Line 65: The screenshot flow only snapshots MetadataOverrides in
useScreenshots, so later preview/capture/upload work can still read live
idOverrideState and releaseOverrideState from app.tsx and drift from the loaded
plan. Update the plan-loading path to persist the full override tuple together
with the loaded plan, using the existing loadedMetadataOverridesRef and the
related screenshot workflow entry points, then make screenshot
preview/capture/upload-candidate reuse that stored snapshot instead of current
override state. Keep the loaded ID and release overrides bound to the same
snapshot across the remaining screenshot steps.
🪄 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: 17bc02d6-da06-429d-a0df-6b67204e5496

📥 Commits

Reviewing files that changed from the base of the PR and between a8c2a83 and 2b44b45.

📒 Files selected for processing (3)
  • gui/frontend/src/app.test.ts
  • gui/frontend/src/app.tsx
  • gui/frontend/src/hooks/useScreenshots.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • gui/frontend/src/app.test.ts
  • gui/frontend/src/app.tsx

Comment thread gui/frontend/src/hooks/useScreenshots.ts Outdated
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