Skip to content

fix(metadata): reset fields the provider has no value for - #3939

Merged
Quick104 merged 9 commits into
Silo-Server:mainfrom
Rhainland:fix/3581-reset-clears-blank-fields
Nov 12, 2026
Merged

Quick104 merged 9 commits into
Silo-Server:mainfrom
Rhainland:fix/3581-reset-clears-blank-fields

Conversation

@Rhainland

@Rhainland Rhainland commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #3581
Related issue: N/A
Validation tasks: changes #1210 C2; changes #1211 C2

Reset to Provider in Edit Metadata kept a value an admin had typed whenever the provider had no value for that field. The dialog says a reset overwrites manual edits, and the locks did go, but a typed tagline on a title with no provider tagline stayed, now unlocked. The only way to remove it was another manual edit, which locked the field again. This affects admins and curators resetting movies, series, seasons or episodes.

The dialog cleared the locks and then ran an ordinary refresh. A refresh keeps a stored value when a provider sends an empty one, because it can't tell a value the provider lacks from one it failed to send, so the reset inherited that rule.

Approach

Reset is now its own refresh mode: POST /api/v2/admin/items/{id}/refresh-metadata accepts mode: "reset", and getAdminCatalogCapabilities reports item_metadata_reset. The web dialog sends one reset instead of unlocking first.

  • A reset clears the target's locks in the same write and empties every lockable field, the credits and the rating sources before the providers' values merge in, so a field no provider has ends up empty. Items reuse the clearing that match corrections already do (fix(metadata): clear the old match's values when a match is corrected #3577).
  • Because emptying fields is only safe when the providers answered, a reset fails and leaves the target unchanged when a provider in the chain errors, including a search and a fallback-language lookup. A not-found answer, or an enrichment provider that isn't set up, doesn't fail it. A season or episode reset fetches its fallback-language text before it empties the row.
  • A reset of an item pinned unmatched fails, because no provider describes it. A reset whose write merges the item onto another existing item leaves that item's edits and locks alone.
  • Seasons and episodes: the target row is emptied and unlocked once its providers answered, including when they don't list it, and then the normal child write stores the provider's values. A series reset leaves its seasons' and episodes' locks alone.
  • A reset through a library whose metadata language isn't the item's own keeps the base row's title, overview and tagline. That write only fetches the other language for the localization rows, so emptying the base text would lose text the provider has. In that setup a typed tagline on the base row stays, unlocked.
  • /api/v1 is unchanged and still rejects reset.

Apple and Android have no Reset to Provider action, so they need nothing for this. Jellyfin compatibility is unaffected.

Validation

  • Go: metadata, catalog, adminjob, apiv2 and handlers packages pass, including new Postgres contract tests (added to scripts/ci/db-contracts.txt) for item locks, season and episode resets, an unlisted episode, a reset in another language and a provider outage.
  • Web: Edit Metadata and refresh menu tests pass; frontend build and typecheck pass.
  • make lint-changed: 0 issues. verify-apiv2-openapi, verify-apiv2-web-types, verify-apiv2-contract, verify-apiv2-fixtures, verify-route-inventory and verify-local-paths pass.
  • Local build, same database before and after: the real TMDB plugin pointed at a mock that returns no tagline. Results are under Evidence.
  • Not run locally: the full make test-go and make test-web suites.
  • Maintainer review fixes (91ecf8b, 34ecd8f): new unit tests for a locked field's fallback text, for fallback-lookup failures on items, seasons and episodes, and for a lookup failing in another of the series' languages, plus a Postgres test for a reset that merges onto another item. Each failed on the head before its fix and passes now. The metadata, catalog, adminjob, apiv2 and handlers packages pass against Postgres.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3939/

Surface and build: web app, Edit Metadata on a movie, desktop 1440px and phone 390px. Before is main at 51b1e0a, after is this branch. Steps: type a tagline and save (the overview lock turns on), then Reset to Provider, then reload.

Step Before After
Tagline after the reset "Typed by admin" kept, unlocked empty ("No tagline"), unlocked
Overview edited, then reset (control) provider overview restored provider overview restored

API, same item, after this change:

# save a tagline with the overview lock, then reset
PATCH /api/v2/admin/items/{id}/metadata {"tagline":"Typed by curl","locked_fields":[1]}
POST  /api/v2/admin/items/{id}/refresh-metadata {"mode":"reset"}
job: {"kind":"item_refresh","state":"succeeded"}
item: {"tagline":null,"overview":"Provider overview from the TMDB mock.","locked_fields":[]}

# same, with the TMDB provider unreachable
job: {"kind":"item_refresh","state":"failed"}   # "reset to provider: tmdb did not answer"
item: {"tagline":"Kept during outage","overview":"Provider overview from the TMDB mock.","locked_fields":[1]}

Risks

  • During a rolling upgrade, an older node that picks up a reset job runs it as a plain quick refresh, so that reset leaves the edits and locks in place until it is run again on an upgraded node.
  • An enrichment provider that has used up its quota fails resets until the quota recovers. This is the guard working as intended: it can't tell an outage from a missing value.
  • A season or episode reset empties and unlocks the row in its own write, after the providers answered, and the provider's values follow in the normal season and episode write. If that second write fails, the row stays empty and unlocked, and the job can still report success when it wrote another row. The next refresh fills in the provider's values. Making both one transaction would mean threading a transaction through the season and episode bulk upserts.
  • If a node dies after a reset commits but before its job is marked done, another node runs the reset again when it recovers the job. An edit saved in between is reset too. Preventing that needs a durable record that the job's reset already ran.
  • No migration.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (via T3 Code); Codex CLI for code review
  • Tool(s): Claude Code (Bash, file edits, subagents), Playwright, GitHub CLI, Codex CLI
  • Model(s): claude-opus-5-5; gpt-6.1-sol (code review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: independent reviews of the full diff by claude-opus-5-5 and gpt-6.1-sol on correctness, standards and spec. They found that a reset in another language wiped the base row's text, that an unlisted season or episode was not reset while the job succeeded, and that credits and rating sources survived a reset. All four are fixed, with tests. A second review of the fixes by both models found nothing further beyond a missing season check in one test, which was added. Not changed: the web reads no capability before sending reset, because the web app ships in the same server binary as the API it calls.

Note

Add "Reset to Provider" metadata mode that clears fields providers lack

  • Adds a reset refresh mode for items, seasons, and episodes. A reset replaces edited values with provider data, removes stored locks, clears credits and prior metadata the providers no longer supply, and returns an error instead of a silent no-op when providers fail, do not answer, or the item is pinned. The reset stops after providers return results and does not carry over to a different row when a rebind occurs, so a rebinding reset leaves the destination item's edits and locks intact.
  • Wires the mode end to end: ItemRefreshModeReset and ResetTargetForLibrary in item_refresh.go, the item_metadata_reset capability and reset mode in the admin API and openapi.json, and the EditMetadataDialog reset button now requests reset mode directly instead of first clearing locked fields via a separate update. Repository support includes ResetEdits on season and episode repos and ClearPeopleTx in item_repo.go.
  • Reset lookups treat a provider outage, no-metadata answer, or NotFound as insufficient data that keeps stored edits and locks, while other provider errors fail the reset (resetProviderFailure in reset_to_provider.go).
  • Behavioral Change: the reset button in EditMetadataDialog.tsx no longer issues a metadata update before refreshing, and item_metadata_reset is now a required field in the refreshAdminItemMetadata request schema, so older clients or servers without the capability need the documented compatibility handling.

Macroscope summarized aa6ed8f.

Reset to Provider unlocked the item and ran an ordinary refresh, which keeps
a stored value whenever a provider sends it empty. An edited tagline on an
item whose provider has none therefore survived the reset, unlocked.

Make reset its own refresh mode. The refresh-metadata job now accepts
mode "reset" for movies, series, seasons and episodes. It clears the target's
locks in the same write and empties every lockable field before the
providers' values merge in, so a field no provider has ends up empty. Because
a refresh can't tell a missing value from a failed lookup, a reset fails and
leaves the target unchanged when a provider in the chain does not answer.
A not-found answer or an unconfigured enrichment provider doesn't fail it.

The web dialog sends the reset instead of unlocking first, and
getAdminCatalogCapabilities reports item_metadata_reset.

Closes Silo-Server#3581
A reset through a library in another language than the item's own emptied
the base row's title, overview and tagline, which that write never
replaces. It now keeps them, for items, seasons and episodes alike.

A season or episode the providers answer for but don't list is now reset
too, instead of keeping its edits and locks while the job reports success.
Credits and rating sources the providers no longer list are cleared, as
the other fields are.
@silo-triage silo-triage Bot added the size/XL 500–999 added + deleted lines (all files); change volume, not priority. label Nov 10, 2026
@silo-kody

silo-kody Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

This organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing.

Next included review available in 22 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 43107feb-7323-4e76-8ddb-45f7a9aef80a
Commits

Reviewing files that changed from the base of the PR and between 72d19c5 and aa6ed8f.

Files selected for processing: 10

  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • internal/apiv2/admin_catalog_item_metadata.go
  • internal/metadata/language_fallback.go
  • internal/metadata/reset_to_provider_db_test.go
  • internal/metadata/reset_to_provider_test.go
  • internal/metadata/service.go
  • internal/metadata/target_refresh_test.go
  • scripts/ci/db-contracts.txt
  • web/src/api/v2/schema.ts
Walkthrough

The admin catalog API and web dialog now support Reset to Provider. The metadata service resets provider-managed metadata for items, seasons, and episodes, including clearing locks and values omitted by providers. Reset operations include provider-failure handling and persistence changes.

Changes: Reset to Provider

Layer / File(s) Summary
Reset capability and API contract
contracts/api/v2/*, docs/admin-catalog-api.md, internal/apiv2/admin_catalog_item_metadata.go, internal/apiv2/admin_catalog_items.go, web/src/api/v2/schema.ts
The API contract and capability response add item_metadata_reset and the reset refresh mode. The documentation and fixture describe the capability and reset behavior.
Reset request routing
internal/adminjob/item_refresh.go, internal/adminjob/item_refresh_test.go, internal/api/handlers/admin_item_metadata_service.go, internal/apiv2/admin_catalog_item_metadata_test.go, web/src/components/EditMetadataDialog.tsx, web/src/components/EditMetadataDialog.test.tsx, web/src/hooks/queries/items.ts
The handler and job executor accept reset mode and dispatch it to the reset operation. The dialog submits a reset refresh directly instead of first clearing locks with a separate update.
Item reset and persistence
internal/metadata/reset_to_provider.go, internal/metadata/service.go, internal/metadata/types.go, internal/metadata/bulk_enrichment.go, internal/catalog/item_repo.go, internal/metadata/reset_to_provider_test.go, internal/metadata/reset_to_provider_db_test.go, internal/metadata/identify_sticky_db_test.go, scripts/ci/db-contracts.txt
The item reset clears locks and replaces provider-managed metadata, credits, and rating sources, including values omitted by providers. The service carries reset steps through persistence and handles provider failures. Tests cover omissions, errors, language behavior, and item persistence.
Season and episode reset
internal/catalog/season_episode_locks.go, internal/metadata/service.go, internal/metadata/reset_to_provider.go, internal/metadata/reset_to_provider_db_test.go, internal/metadata/fallback_episode_test.go, internal/metadata/language_fallback.go, internal/metadata/local_artwork_precedence_test.go, internal/metadata/match_ignore_test.go, internal/metadata/season_backdrop_test.go, internal/metadata/target_refresh_test.go
Season and episode reset operations clear edits and locks on the target row. Child refresh applies provider results and handles reset-specific provider errors; related fetch call sites and tests use the updated reset argument.

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

Severity of issue fixed: Low

Sequence Diagram(s)

sequenceDiagram
  participant EditMetadataDialog
  participant CreateItemMetadataRefresh
  participant ItemRefreshExecutor
  participant MetadataService
  EditMetadataDialog->>CreateItemMetadataRefresh: Submit refresh with mode reset
  CreateItemMetadataRefresh->>ItemRefreshExecutor: Create metadata refresh job
  ItemRefreshExecutor->>MetadataService: Call ResetTargetForLibrary
Loading

Possibly related issues

  • Silo-Server/silo-server issue 1209: The parent issue tracks manual metadata editing and Reset to Provider behavior; this change addresses reset of values providers omit.
  • Silo-Server/silo-server issue 1210: This issue validates server-side reset behavior, including lock clearing and handling omitted provider values.
  • Silo-Server/silo-server issue 1211: This issue validates the web-admin reset flow changed by this pull request.

Possibly related PRs

Suggested reviewers: quick104, blurbery

Merge Risk: Moderate · previous review 72d19

Reset on a season or episode can wipe edits and locks even when a metadata provider failed, contradicting the documented guarantee. Fix the provider-failure ordering before merging.

Security architecture risk: Moderate · up to 72d19

Reset remains restricted to authorized users, but a season or episode reset can clear saved values before replacement metadata is stored. A subsequent write failure can leave the target partly reset while the operation appears successful, creating a bounded data-loss and recovery risk.

Retained concerns

  • Medium · reliability · observed: Season and episode resets commit destructive clearing before replacement persistence. Cancellation, interruption, or a subsequent database write failure can therefore leave the target empty and unlocked without its provider values. Replacement failures can also be reported as success: persistence logs unsuccessful writes but returns true, which the refresh treats as an update. The episode clear-and-air-date transaction protects only the clearing step, not the complete reset. Compared with the base behavior, this adds exposure of stored field values to the existing multi-step refresh failure boundary and weakens rollback and operator recovery guarantees.
Security review details

Security Blast Radius

  • observed — Delegated curation is checked against the requested target's root catalog item and associated library memberships. Refresh target, representative file, folder, and scan path are resolved server-side. Acting administrators retain their pre-existing unrestricted curation authority; reset does not introduce that authority.

Trust Boundaries and Controls

  • observed — The API continues to require PermissionMetadataCuration before delegating to the refresh job. Compared with the supplied base, reset changes the permitted operation's persistence semantics rather than weakening this authorization boundary.

Resilience and Maintainability Implications

  • inferred — The material risk is failure containment of an authorized destructive operation, not an established privilege-escalation path. Because child clearing commits independently and write errors need not fail the refresh, job completion is not reliable evidence that the full replacement transition succeeded.

Hardening Proposals

  • proposed — Stage the required provider results before destructive persistence, then commit child clearing and replacement as one transaction. Propagate replacement failures to the durable job outcome so interruption and recovery cannot silently strand a partially reset target.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: resetting fields that the provider does not supply.
Linked Issues check Passed Issue #3581 requires Reset to Provider to restore provider state, including empty provider values, without changing ordinary refresh behavior. The PR adds a dedicated reset mode, sends it from Edit Me…
Out of Scope Changes check Passed The API mode, capability, persistence changes, provider-error handling, language handling, web changes, documentation, and tests support the Reset to Provider behavior in #3581. The changes also prese…
Description check Passed The description is specific and on-topic. It explains the problem (Reset to Provider kept typed values when providers had no value), the approach (a new reset refresh mode, the item_metadata_reset cap…
Full details: Linked Issues check

Explanation

Issue #3581 requires Reset to Provider to restore provider state, including empty provider values, without changing ordinary refresh behavior. The PR adds a dedicated reset mode, sends it from Edit Metadata, clears resettable edits before provider values merge, and preserves edits when providers do not answer. Tests cover missing taglines, provider failures, language handling, and item, season, and episode targets. The reported quick and complete refresh paths remain unchanged.

Full details: Out of Scope Changes check

Explanation

The API mode, capability, persistence changes, provider-error handling, language handling, web changes, documentation, and tests support the Reset to Provider behavior in #3581. The changes also preserve API v1 behavior and ordinary refresh behavior. No unrelated change is established by the supplied pull request summary.

Full details: Description check

Explanation

The description is specific and on-topic. It explains the problem (Reset to Provider kept typed values when providers had no value), the approach (a new reset refresh mode, the item_metadata_reset capability, and the web dialog change), the validation performed, the risks, and the evidence. It matches the changeset, which adds the reset mode across the API, metadata service, catalog repositories, and web dialog.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

err := pgx.BeginTxFunc(ctx, r.pool, pgx.TxOptions{}, func(tx pgx.Tx) error {
var seriesID string
query := clearChildEditsSQL(episodesTable, resetColumns(episodeLockedColumns, keepText), false) + ` WHERE content_id = $1 RETURNING series_id`
if err := tx.QueryRow(ctx, query, contentID).Scan(&seriesID); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules high

Episode reset acquires the episode lock before the series lock

Locking the episode before the series reverses curation's parent-first order and can deadlock concurrent transactions. Read and lock the series first, recheck and clear the episode, then recompute series air dates.

Kody rule violation: Lock parent rows before membership changes and recompute from a fresh statement

Prompt for LLM
File internal/catalog/season_episode_locks.go, line 150:

Episode reset acquires the episode lock before the series lock

Lock the parent series before updating the episode, then recompute its air dates in a subsequent statement. The current update locks the episode first and only afterward updates the series, reversing the parent-first order used by curation and allowing the two transactions to deadlock. Read the series ID first, acquire its row lock, and recheck the episode before clearing it.

Kody rule violation: [Lock parent rows before membership changes and recompute from a fresh statement](https://kodus.siloserver.org/settings/code-review/1247142351/kody-rules/9b908000-f91d-4ebd-b7ea-eb7cab8c6f81?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this. Every episode write here takes the locks in the same order this reset does, episode row first and series row second: the episode upsert locks its row and then calls refreshSeriesAirDates, and UpdateMetadata and ClearSeriesChildEditsTx update the episode before the recompute. Locking the series first in the reset alone would reverse that order against a concurrent upsert of the same episode, which is the deadlock this comment is about.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a fair correction. Given the episode-first ordering you described, changing only the reset path to lock the series first could introduce the lock-order inversion I warned about.

I withdraw the suggestion as stated. If parent-first locking is needed, it should be addressed consistently across all competing write paths, rather than in reset alone.

Comment thread internal/metadata/service.go Outdated
Comment on lines +3133 to +3135
} else if req.resetToProvider {
if err := s.clearUnlistedCredits(ctx, contentID, item, mergeLocked); err != nil {
return nil, err

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug critical

A failed item reset can permanently delete credits

clearUnlistedCredits commits ReplacePeople separately, so an item write failure leaves the metadata and locks intact but deletes the credits. Move credit deletion into the same transaction as the item reset.

Prompt for LLM
File internal/metadata/service.go, lines 3133-3135:

A failed item reset can permanently delete credits

`clearUnlistedCredits` commits a separate `ReplacePeople` transaction before the item and lock transaction begins, so an item write failure leaves the original metadata and locks but permanently deletes its credits. Move the credit deletion into the same transaction as the item reset.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 04d8169. A reset now clears the credits only after its item write commits, at the point where a refresh stores the credits the providers list, so a failed item write leaves them alone.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. Moving credit clearing after the item write addresses the reported case: a failed item write should no longer delete credits.

The item and credit writes are still separate, so a failure during the later credit write could leave the reset partially applied. I haven’t independently verified the commit.

Comment thread internal/metadata/service.go Outdated
Comment on lines +4744 to +4748
if reset != nil && !resetApplied && (canonical || !resetLanguageListed) {
if err := reset.apply(ctx, s, !canonical); err != nil {
return err
}
resetApplied = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug critical

Child reset commits cleared edits before the provider write

A provider upsert failure after reset.apply can permanently erase edits and still leave the job reporting success if another row was written. Commit the reset and target provider write atomically, and propagate target write failures.

Prompt for LLM
File internal/metadata/service.go, lines 4744-4748:

Child reset commits cleared edits before the provider write

A season or episode reset commits the empty fields and removed locks before persisting the provider result, so a subsequent upsert failure permanently loses the original edits and can still leave the job reporting success if another row was written. Commit the reset and target provider write atomically and propagate target write failures.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Known and named in the PR as a limit. The row is emptied only after its providers answered, so if the following upsert fails, the row holds empty values with no locks, which is what the admin asked the reset to leave behind for those fields; the next refresh writes the provider's values. Making the clear and the upsert one transaction would mean threading a transaction through the season and episode bulk upserts, which is outside this fix.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. Waiting until the providers answer prevents an outage from clearing the row, but it does not protect against a database write failure afterward. In that case, the reset can leave fields empty and unlocked even when the provider supplied values; a later refresh may repair them, but only if it runs and succeeds.

I agree that making the clear and upsert atomic may be outside this fix. At minimum, though, the job should report a failure if the target’s provider write fails, rather than success because another row was written. If that is also deferred, I’d document both the potential data loss and the misleading success status as explicit limitations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that it should be stated. The PR's Risks section now names both parts: the row can stay empty and unlocked if the season or episode write fails after the reset, and the job can still report success in that case.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. The Risks section explicitly covers both the possible loss of edits and the misleading success status. I’ll treat this as a documented limitation of the current fix, not a claim that the underlying issue is resolved.

Comment thread internal/metadata/service.go Outdated
Comment on lines +4744 to +4748
if reset != nil && !resetApplied && (canonical || !resetLanguageListed) {
if err := reset.apply(ctx, s, !canonical); err != nil {
return err
}
resetApplied = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Reset skips children when neither provider lists the target

When both providers return empty lists or not-found responses, reset.apply is skipped and ErrMetadataNotFound is returned, leaving the child's edits and locks intact. Apply the reset after successful provider responses even when both lists are empty.

Prompt for LLM
File internal/metadata/service.go, lines 4744-4748:

Reset skips children when neither provider lists the target

When both providers return empty lists or not-found responses, this branch skips `reset.apply` and returns `ErrMetadataNotFound`, leaving the unlisted season or episode's edits and locks intact. Apply the reset after successful provider responses even when both result lists are empty.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is deliberate. When the providers return nothing at all for the series' seasons and episodes, the reset can't tell an empty answer from a broken one, so it fails (ErrMetadataNotFound) and keeps the edits and locks, the same way an item reset with no metadata fails. When the providers return data but don't list the target row, the row is reset; the DB test covers that case.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. The suggestion is a false positive: preserving edits and locks when both result lists are empty is the intended safety behavior, consistent with an item reset that receives no metadata.

When providers return data but omit the target child, the reset does apply, and the database test covers that case. No change is needed.

// fails keeps them.
onOpenChange(false);
refreshMutation.mutate({ item, mode: "quick" });
refreshMutation.mutate({ item, mode: "reset" });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Reset fails against servers that do not support the new mode

Sending mode: "reset" without checking item_metadata_reset causes validation errors on older servers. Gate the action on the advertised capability or provide a compatible fallback.

Prompt for LLM
File web/src/components/EditMetadataDialog.tsx, line 198:

Reset fails against servers that do not support the new mode

The dialog always sends `mode: "reset"` without checking `item_metadata_reset`, so a newer web client connected to an older server receives a validation error and can no longer reset metadata. Gate the action on the advertised capability or preserve a compatible fallback for older servers.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this. The web app is built into the same server binary as the API it calls, so it never talks to a server older than itself. The capability is there for other clients.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. If the web app and API always come from the same server binary, the web app does not need to gate this action on item_metadata_reset. The capability remains useful for independently deployed clients.

I withdraw the suggestion; no change is needed. Would you like me to save the same-binary deployment constraint as repository context for future reviews?

A failed item write kept the item's values and locks but had already
deleted its credits. Clear them after the write commits, where a refresh
stores the credits the providers list.
@silo-kody

silo-kody Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Comment thread internal/metadata/service.go Outdated
Comment on lines +3158 to +3159
if req.resetToProvider {
if err := s.clearUnlistedCredits(ctx, contentID, item, mergeLocked); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug critical

Reset can delete credits written by a concurrent refresh

Revises an earlier Kody suggestion on internal/metadata/service.go:3133 (2026-11-10 23:27 UTC).

A concurrent refresh can write newer provider credits after unlockProviderDedup, only for clearUnlistedCredits to delete them based on an older result. Serialize the deletion with competing writes or include it in the item transaction.

Prompt for LLM
File internal/metadata/service.go, lines 3158-3159:

**Revises an earlier Kody suggestion** on `internal/metadata/service.go:3133` (2026-11-10 23:27 UTC).

Reset can delete credits written by a concurrent refresh

Releasing the provider deduplication lock before deleting credits allows a concurrent refresh to write newer provider credits that this reset then deletes based on its older empty result. Serialize the credit deletion with competing item and credit writes or include it in the item transaction.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ba78070. The credits the providers no longer list are now deleted inside the transaction that writes the item and drops its locks, so a refresh that writes credits after that transaction commits keeps them.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. Moving the deletion into the item transaction addresses the reported race: credits written by a refresh after that transaction commits will no longer be deleted by the reset’s earlier cleanup.

I haven’t independently verified commit ba7807087.

Comment thread internal/metadata/service.go Outdated
Comment on lines +3158 to +3161
if req.resetToProvider {
if err := s.clearUnlistedCredits(ctx, contentID, item, mergeLocked); err != nil {
return nil, err
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Credit deletion failure leaves the reset partially committed

Revises an earlier Kody suggestion on internal/metadata/service.go:3133 (2026-11-10 23:27 UTC).

If ReplacePeople fails, the item and lock reset have already committed while the old credits remain. Commit the item reset and credit deletion in the same transaction.

Prompt for LLM
File internal/metadata/service.go, lines 3158-3161:

**Revises an earlier Kody suggestion** on `internal/metadata/service.go:3133` (2026-11-10 23:27 UTC).

Credit deletion failure leaves the reset partially committed

If `ReplacePeople` fails, the item and lock reset have already committed while the old credits remain, so the reported failure leaves a partially applied reset. Commit the item reset and credit deletion in the same transaction; this revises the earlier suggestion because moving the deletion after the item write only reverses the partial-failure case.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ba78070: the credit delete is part of the item transaction, so the item, its locks and its credits commit or fail together. A Postgres test covers it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. Moving the credit deletion into the item transaction addresses the partial-commit scenario described in the suggestion. The PostgreSQL test also provides coverage for the fix.

Clearing them after the item write let a concurrent refresh's newer
credits be deleted, and a failed delete left the reset half applied.
The credits the providers no longer list now go in the transaction that
writes the item and drops its locks.
@silo-kody

silo-kody Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

⚠️ Note: some checks couldn't be completed in this run, so auto-approval (when enabled) was skipped. Check the details at https://kodus.siloserver.org/pull-requests and then comment @kody review on this PR to retry once the issue is resolved.

@coderabbitai coderabbitai Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase bug Something isn't working enhancement New feature or request go Pull requests that update go code impact: usability Core flow broken or severely blocked javascript Pull requests that update javascript code labels Nov 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 86ddc619-c95f-4473-ae7e-fb46bfea14dd
Commits

Reviewing files that changed from the base of the PR and between 51b1e0a and b35efab.

Files selected for processing: 29

  • contracts/api/v2/fixtures/admin_catalog_capabilities.json
  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • internal/adminjob/item_refresh.go
  • internal/adminjob/item_refresh_test.go
  • internal/api/handlers/admin_item_metadata_service.go
  • internal/apiv2/admin_catalog_item_metadata.go
  • internal/apiv2/admin_catalog_item_metadata_test.go
  • internal/apiv2/admin_catalog_items.go
  • internal/catalog/item_repo.go
  • internal/catalog/season_episode_locks.go
  • internal/metadata/bulk_enrichment.go
  • internal/metadata/fallback_episode_test.go
  • internal/metadata/identify_sticky_db_test.go
  • internal/metadata/language_fallback.go
  • internal/metadata/local_artwork_precedence_test.go
  • internal/metadata/match_ignore_test.go
  • internal/metadata/reset_to_provider.go
  • internal/metadata/reset_to_provider_db_test.go
  • internal/metadata/reset_to_provider_test.go
  • internal/metadata/season_backdrop_test.go
  • internal/metadata/service.go
  • internal/metadata/target_refresh_test.go
  • internal/metadata/types.go
  • scripts/ci/db-contracts.txt
  • web/src/api/v2/schema.ts
  • web/src/components/EditMetadataDialog.test.tsx
  • web/src/components/EditMetadataDialog.tsx
  • web/src/hooks/queries/items.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

Comment thread contracts/api/v2/openapi.json Resolved
Comment thread docs/admin-catalog-api.md Resolved
ItemChangeEvents: served,
ItemMatchHints: reg.deps.AdminCatalogMatch != nil,
ItemMetadata: served,
ItemMetadataReset: reg.deps.AdminItemMetadata != nil,

@coderabbitai coderabbitai Bot Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Data Integrity & Integration · Heavy lift

Expose reset discovery to delegated curators.

Delegated curators can submit metadata refreshes, but getAdminCatalogCapabilities requires ClassActingAdmin. They cannot check item_metadata_reset as the refresh schema requires, so clients following that contract cannot offer reset to them. Expose this capability through a discovery operation they can read. (raw.githubusercontent.com)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partly addressed in 72d19c5, without a new endpoint. The registry only allows metadata_curation operations on item-scoped paths, so a curator-readable discovery document would be its own design rather than part of this fix. The refresh schema and docs now say how a client that can't read getAdminCatalogCapabilities detects support: it sends reset, and a server without it rejects the value with 422.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rhainland Thanks for clarifying. Sending reset provides a fallback for an intentional reset, but it does not provide discovery before the request.

I understand that curator-readable discovery needs a separate design. Would you like me to open a follow-up issue for it?


Learnings used

Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-19T23:34:11.654Z
Learning: Source excerpt:
# Silo Server

## API contract rules

At the 1.0 lock the additive-only rules bind `/api/v2`:

- New features expose capability endpoints for feature detection rather than relying on version
  sniffing.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-11-03T15:25:23.345Z
Learning: Source excerpt:
# Silo Server

## API contract rules

At the 1.0 lock the additive-only rules bind `/api/v2`:

- New features expose capability endpoints for feature detection rather than relying on version
  sniffing.

You are interacting with an AI system.

Comment thread internal/metadata/reset_to_provider.go Resolved
A plugin reports an unknown title with a NotFound status rather than an
HTTP 404 message, so a reset failed on it. Treat both as an answer, as
the person refresh already does. Also state in the API description and
docs that a reset in another language keeps the item's own text, and how
a client that can't read the capability detects support.
@silo-kody

silo-kody Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

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

⚠️ Outside diff range comments (1)

Major · Fail child resets when series identity search fails. · service.go:4841-4850

internal/metadata/service.go:4841-4850
Major · Data Integrity & Integration · Quick win

Fail child resets when series identity search fails.

If a series identity search fails with a non-not-found error, stored provider IDs can still let the child fetch succeed. The reset then clears the target’s values and locks despite the provider failure. Propagate reset-specific search failures before applying the reset, while preserving the existing exceptions and ordinary refresh behavior.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 41576823-9acf-4d35-98bd-f0f967b5d829
Commits

Reviewing files that changed from the base of the PR and between b35efab and 72d19c5.

Files selected for processing: 6

  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • internal/apiv2/admin_catalog_item_metadata.go
  • internal/metadata/reset_to_provider.go
  • internal/metadata/reset_to_provider_test.go
  • web/src/api/v2/schema.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread contracts/api/v2/openapi.json Resolved
// enrichment provider that is not set up. An outage or a spent quota fails the
// reset before it writes, and the target keeps its values and locks.
func resetProviderFailure(reset bool, p Provider, lookup string, err error) error {
if !reset || providerDoesNotKnow(err) || enrichmentProviderNotSetUp(p, err) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Data Integrity & Integration · Quick win

Supported by static analysis

Script executed:

#!/bin/bash
rg -n -C 5 'handleProvider404|applyProvider404sToAccumulator|sameRunStaleProviderIDs|clearPreviousMatch' internal/metadata/service.go
rg -n -C 5 'func .*clearPreviousMatch|func .*mergeProviderIDs' internal/metadata

Repository: Silo-Server/silo-server

Length of output: 10777


Script executed:

cat -n internal/metadata/reset_to_provider.go | sed -n '1,110p'
cat -n internal/metadata/service.go | sed -n '340,440p'
cat -n internal/metadata/service.go | sed -n '2000,2130p'
cat -n internal/metadata/service.go | sed -n '2860,2905p'
cat -n internal/metadata/service.go | sed -n '2950,3030p'
cat -n internal/metadata/service.go | sed -n '3120,3160p'
cat -n internal/metadata/merge.go | sed -n '245,275p;320,410p'
rg -n -C 5 'func .*GetMetadata|func .*Slug|providerDoesNotKnow|func .*persistItemAndProviderIDs' internal/metadata/plugin_provider.go internal/metadata/reset_to_provider.go internal/metadata

Repository: Silo-Server/silo-server

Length of output: 42020


Script executed:

rg -n 'func .*GetMetadata|func .*Slug|func isProvider404|func isDurableProviderSlug|func .*persistItemAndProviderIDs|func .*loadDurableProviderIDs|func .*refreshTarget' internal/metadata --glob '*.go' --glob '!**/*_test.go'
cat -n internal/metadata/plugin_provider.go | sed -n '1,210p'
cat -n internal/metadata/merge.go | sed -n '248,265p;320,375p'
rg -n -C 3 'isProvider404|isDurableProviderSlug' internal/metadata --glob '*.go' --glob '!**/*_test.go'

Repository: Silo-Server/silo-server

Length of output: 17520


Script executed:

cat -n internal/metadata/plugin_provider.go | sed -n '245,315p'
cat -n internal/metadata/service.go | sed -n '280,300p;1310,1380p;3370,3565p;3700,3795p'
rg -n -C 3 'ProviderIDs|provider_ids' internal/metadata/plugin_provider.go | sed -n '1,100p'
rg -n -C 2 'providerIDsStruct|itemToMetadataResult|canonicalIdentityProviderIDs|loadDurableProviderIDs' internal/metadata/service.go internal/metadata/merge.go --glob '*.go'

Repository: Silo-Server/silo-server

Length of output: 31481


Script executed:

cat -n internal/metadata/service.go | sed -n '1470,1540p;1810,1905p;1940,2005p;3560,3595p'
rg -n 'func .*ReplaceByContentID|func providerIDMapFromRows|func .*mergePluginProviderIDs' internal/catalog/provider_id_repo.go internal/metadata --glob '*.go' --glob '!**/*_test.go'
cat -n internal/catalog/provider_id_repo.go | sed -n '1,240p'

Repository: Silo-Server/silo-server

Length of output: 22343


Script executed:

cat -n internal/metadata/service.go | sed -n '298,340p;1374,1408p;1903,1940p;9238,9275p'
cat -n internal/catalog/provider_id_repo.go | sed -n '220,255p;350,445p'
cat -n internal/metadata/plugin_provider.go | sed -n '620,645p'

Repository: Silo-Server/silo-server

Length of output: 12406


Script executed:

rg -n -C 3 'accumulatedIDs :=|maps.Copy\(accumulatedIDs|prepareProcessRequest\(' internal/metadata/service.go

Repository: Silo-Server/silo-server

Length of output: 2593


Remove a plugin ID rejected by NotFound.

If a plugin rejects its own stored ID with gRPC NotFound, reset continues but handleProvider404 does not remove the ID. The ID can remain stored and be sent on later refreshes.

Handle this rejection and suppress the rejected plugin ID through persistence. Recognizing NotFound alone is not enough: same-run stale tracking excludes noncanonical plugin IDs.

Comment thread web/src/api/v2/schema.ts Resolved

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of 72d19c5. The approach holds: a separate reset mode that drops locks in the item's own write and fails when a provider errors is the right boundary. Four findings below are rare paths where a reset still loses data or reports success without resetting, and one is a maintainer decision. Replies in the CodeRabbit threads cover the pinned-item and fallback-failure points. I'm fixing every finding except the maintainer decision in commits on this branch, so there's no need to change them yourself.

🤖 Claude Code (claude-opus-5-5)

Comment thread internal/metadata/service.go Resolved
Comment thread internal/metadata/service.go Resolved
Comment thread internal/metadata/reset_to_provider.go Resolved
Comment thread internal/metadata/service.go Resolved
}
}
if err := e.refresher.RefreshTargetForLibrary(ctx, refreshTargetType, refreshContentID, req.ScanFolderID); err != nil {
refreshTarget := e.refresher.RefreshTargetForLibrary

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer decision: a recovered reset job runs the reset a second time.

Trigger: the reset commits, its node dies before the job is marked done, an admin saves a new edit, and RequeueStaleRunning hands the job to another node, which calls ResetTargetForLibrary again.

Impact: the second run removes the edit and lock saved in between. Before this PR, a recovered job repeated an ordinary refresh, and the unlock had happened once in the browser.

The window is narrow: a node death right after the commit, plus an edit before the stale timeout. Closing it needs a durable marker that the job's reset already ran, written in the reset's transaction. I'm leaving this one for the maintainers to decide and not changing it. Codex found this one.

Reset to Provider still lost data or claimed success on a few paths:

- A reset that merged the item onto another existing item (rebind, local-ID
  promotion, re-anchor) dropped that item's locks, fields and credits. It
  now resets only the row it was asked for, as replacesShow and the
  conflict-recovery retry already do.
- Locked fields were never fetched in the fallback language, so the reset
  emptied a locked overview the provider has in that language.
- A failed fallback-language lookup or search was ignored, so the reset
  emptied text that provider would have supplied. Both now fail the reset,
  and a season or episode reset fetches its fallback text before it empties
  the target.
- A reset of an item pinned unmatched, or a season or episode reset whose
  providers listed nothing in the series' language, reported success
  without resetting. Both now fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. and removed size/XL 500–999 added + deleted lines (all files); change volume, not priority. labels Nov 12, 2026
@silo-kody

silo-kody Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104

Quick104 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer review summary

Reviewed 72d19c5. Fixes are pushed in 91ecf8b, 34ecd8f and aa6ed8f. This summary describes aa6ed8f.

The approach is right. Making Reset to Provider its own refresh mode lets the item write drop the locks and empty unlisted fields in one transaction, and failing when a provider errors keeps an outage from wiping data. That fixes #3581 at the layer that owns it, not in the dialog.

Addressed in 91ecf8b, 34ecd8f and aa6ed8f

  • A reset that merged the item onto another existing item (rebind, local-ID promotion, re-anchor) wiped that item's edits, locks and credits. A reset now only affects the row it was asked for, the same rule replacesShow and the conflict-recovery retry follow.
  • A locked field never got its fallback-language text, so the reset emptied it.
  • A failed fallback-language lookup or search didn't fail the reset. Both now do, and a season or episode reset fetches fallback text before it empties the row.
  • A reset of an item pinned unmatched, or a season or episode reset whose providers listed nothing in the series' language, reported success without resetting. Both now fail. The mode description and docs/admin-catalog-api.md cover the new failure cases.
  • A lookup failing in another of the series' languages failed a season or episode reset after it had already reset and written the row (raised by Kody on 91ecf8b). Only the pass that empties the row, or one that writes its base text, now requires every provider to answer.

Six new tests (five unit, one Postgres) failed on the head before their fix and pass on aa6ed8f. The metadata, catalog, adminjob, apiv2 and handlers packages pass against Postgres, and make lint-changed reports no issues. The PR's own new tests call code this PR adds, so they can't run on main. The author's before/after on a local build is the evidence for the original fix, and these changes don't alter what it shows.

Left for the maintainers

  • Recovered reset jobs run twice (maintainer decision, in the review thread). A job recovered after a node death runs the reset again and clears any edit saved in between. Closing that needs a durable marker written in the reset's transaction. The PR's Risks section now lists it.
  • Season and episode resets aren't atomic (disclosed by the author). The row is emptied in its own transaction before the season and episode write. If that write fails, the row stays empty and unlocked until the next refresh.
  • Already in Silo before this PR: a plugin's gRPC NotFound for its own stored ID doesn't remove that ID (handleProvider404 only recognizes HTTP 404), on ordinary refreshes too. Whether it should is a design question outside this PR.

Checks

  • Validated features: no passed case changes. The new behavior only runs for mode: "reset". Credits, rating sources, enrichment error handling and child-lock clearing for everything else go through refactored code with the same behavior.
  • Validation tasks: changes #1210 C2; changes #1211 C2 (updated in the body). Both C2 cases are failed and blocked on other issues, so this PR doesn't unblock them.
  • User manual: no change needed. The Metadata guide already says Reset to Provider clears every lock and replaces manual edits with provider data, and this PR makes that true.
  • Apple and Android: neither app has Reset to Provider. Jellyfin compatibility doesn't use this endpoint.
  • Second opinion: gpt-6.1-sol reviewed 72d19c5 independently. Its five findings are four of the fixes above and the recovered-job decision.

Fit: 9/10 · Readiness: 8/10 — conditional (assuming CI is green)

Fit: it fixes a correctness bug in a 1.0 feature at the right layer. The new reset mode and capability field are the smallest contract change that does it. Readiness: the fixes are proven by tests that failed before them. The recovered-job case and the disclosed non-atomic season and episode reset still hold it below ready.

🤖 Claude Code (claude-opus-5-5)

Comment thread internal/metadata/service.go Outdated
Comment on lines 4762 to 4764
providerIDs, err := s.resolveSeriesRefreshProviderIDs(ctx, series, folderID, language, skipLocal, reset != nil)
if err != nil {
return err

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Later language search failures leave a child reset partially applied

A later language search failure can return an error after earlier results have been committed and the target's locks cleared. Fetch and validate all languages before applying the reset and persisting results.

Prompt for LLM
File internal/metadata/service.go, lines 4762-4764:

Later language search failures leave a child reset partially applied

A reset covering multiple library languages can commit the first language and clear the target's locks before a later language's search fails, returning an error after the target has changed. Fetch and validate all languages before applying the reset and persisting their results.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 34ecd8f, a different way than suggested. Every language pass was held to the reset's every-provider-answered rule, so a lookup failing in a later language failed the job after the series-language pass had already reset and written the row. Only the pass that empties the row, or one that writes its base text, needs that rule. Another language's write keeps the base text and, like any refresh, keeps a stored value a provider sends empty, so its failures can't empty anything. Those passes now fail softly, as an ordinary refresh does, and fetching every language before writing isn't needed. TestResetTargetForLibrary_OtherLanguageFailureDoesNotFailTheReset failed on 91ecf8b ("tmdb seasons did not answer") and passes now.

🤖 Claude Code (claude-opus-5-5)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification. The fix applies the every-provider-answered rule only to passes that could empty the row or write its base text; failures in other-language passes now fail softly, like an ordinary refresh.

The regression test also captures the reported failure on 91ecf8b515 and passes with the fix in 34ecd8ff48.

A season or episode reset held every language pass to its
every-provider-answered rule, so a lookup failing in a later language
failed the job after the series-language pass had already reset and
written the row. Only the pass that empties the row, or one that writes
its base text, needs that rule; another language's write keeps a stored
value a provider sends empty, so its failures can't empty anything.

Also cover the season fallback-failure case and check exact lock sets in
the reset tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

// stored value a provider sends empty, so a lookup that fails there
// can't empty anything and fails as softly as an ordinary refresh's,
// even after the reset committed.
strict := reset != nil && (canonical || (!resetApplied && !resetLanguageListed))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug critical

Partial secondary-language results overwrite canonical episode fields

Skip the secondary-language write after a provider failure, or preserve language-independent fields when persisting incomplete results.

Prompt for LLM
File internal/metadata/service.go, line 4768:

Partial secondary-language results overwrite canonical episode fields

A secondary-language provider failure can now be ignored while another provider returns partial results, which are persisted over the canonical episode's runtime, air date, and ratings with zero or null values. Skip the secondary-language write when a provider fails, or preserve language-independent fields when persisting incomplete results.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this here. This is how every season and episode refresh already works, not something the reset adds. On main (51b1e0a, refreshSeriesChildTarget), every language pass treats a failed lookup softly and writes what the answering providers returned, and so did the old Reset to Provider (unlock, then a quick refresh). A reset's secondary passes now behave the same way. That write keeps a stored value a provider sends empty, so after a provider failure it can only replace a non-text field with a real value from a provider that did answer. It never empties a field or brings back an admin edit. Whether a partial secondary-language answer should skip the base row's non-text fields on every refresh is a separate question, outside this PR.

🤖 Claude Code (claude-opus-5-5)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. If the secondary-language write preserves existing values when a provider returns empty fields, then the reported data-loss scenario is not introduced by this PR. I’ll withdraw the suggestion for this PR; whether partial secondary-language results should update canonical non-text fields can be considered separately.

@silo-kody

silo-kody Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104
Quick104 merged commit b754844 into Silo-Server:main Nov 12, 2026
24 of 26 checks passed
Quick104 added a commit to Rhainland/silo-server that referenced this pull request Nov 13, 2026
…vider

Reset to Provider empties a season's or episode's lockable fields so a
field the provider has no value for ends up empty. The title details
this branch stores are not lockable, so a reset kept an edited sort
title, original title, tagline or season ID, as an item's reset kept its
tagline before Silo-Server#3939. Empty them too. A reset in another language than
the series' own keeps the text ones, as it keeps the title and overview.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104 added a commit that referenced this pull request Nov 14, 2026
…rs (#3938)

* fix(metadata): store the season and episode fields Edit Metadata offers

Edit Metadata offered a season's and an episode's sort title, original
title and tagline, and a season's provider IDs, but the rows had no
columns for them, so the server answered 200 and dropped the values.
Seasons and episodes now store them, the item detail returns them, a
catalog seed carries them, and an Identify that replaces the show empties
them like the locked fields. No provider writes them, so they need no lock.

Content rating stays a series field: it decides age limits, so the dialog
no longer offers it on seasons and episodes.

Closes #3583

* fix(metadata): empty season and episode title details on Reset to Provider

Reset to Provider empties a season's or episode's lockable fields so a
field the provider has no value for ends up empty. The title details
this branch stores are not lockable, so a reset kept an edited sort
title, original title, tagline or season ID, as an item's reset kept its
tagline before #3939. Empty them too. A reset in another language than
the series' own keeps the text ones, as it keeps the title and overview.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* style(catalog): join the cleared child columns instead of concatenating in a loop

Fixes the perfsprint concat-loop finding in clearChildEditsSQL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Quick <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase bug Something isn't working enhancement New feature or request go Pull requests that update go code impact: usability Core flow broken or severely blocked javascript Pull requests that update javascript code size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Reset to Provider keeps an edited tagline when the provider has none

2 participants