Repository navigation
fix(metadata): clear a rating or date when an edit sends null - #2275
Conversation
Clearing a rating or date in Edit Metadata sent null, which the v2 metadata PATCH treated like an omitted field, so the old value came back after a reload. Explicit null now clears the ten nullable members: the four ratings, release, first and last air dates, air time, air timezone, and season or episode air date. Clearing a rating also deletes the item's stored score for that source, which title pages fall back to, and clearing an episode air date recomputes the series air dates. Null on other members and all of v1 keep treating null as omission. Closes #2238 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to No blocking issue is established for the metadata-clearing change; it is mergeable after normal checks. Pre-merge checks |
|
Problem
Closes #2238
Related issue: N/A
Validation tasks: unblocks #1211 C1; touches #1210 C1 (not yet run)
An admin who empties a rating or date in Edit Metadata and saves sees the old value come
back after a reload. The dialog sends the cleared field as
null, but the server treatednulllike an omitted field and left the column alone. The save still recorded thefield's lock, so a later metadata refresh wouldn't correct the value either. This change
makes an explicit
nullclear the field.Approach
PATCH /api/v2/admin/items/{id}/metadatanow tellsnullapart from omission for theten members whose columns are nullable: the four ratings,
release_date,first_air_date,last_air_date,air_time,air_timezone, andair_date. Humadecodes both to a nil pointer, so the handler reads the raw body to find the
nullmembers, as the account policy PATCH does. Switching the request to
Patch[T]wouldsplit it from the type v1 shares.
catalog.MetadataUpdatecarries the cleared fields ina
Clearlist, and the item, season, and episode repositories set their own columns toNULL. This follows the contract's PATCH rule. The schema already marked these membersnullable, so the OpenAPI document changes only in descriptions.
Clearing a rating also deletes the item's stored per-source score for that source
(
imdb,tmdb,rt_critic,rt_audience) in the same transaction. Metadata pluginssuch as MDBList store those rows, and the title page's ratings list falls back to them
when the column is empty, so without this the cleared rating would still show there. The
existing trigger clears the TMDB vote count copied from the
tmdbrow. Clearing anepisode's air date recomputes the series air dates, as an air-date edit already does.
nullon any other member still leaves the value unchanged, and frozen v1 still treatsnullas omission. The web dialog already sentnullfor these fields. Its only changeis sending
nullinstead of""for a cleared air timezone; the server accepts either.Neither the Apple nor the Android app calls this endpoint, and jellycompat has no
item-update endpoint, so no client follow-up is needed. The user manual already says to
change a field and save, so it needs no update.
Two scenario acceptance tests asserted that
nullpreserves the air timezone and seasonand episode air dates. Their null cases now expect those fields cleared, and the
item-curation case is renamed from
null_preservestoexplicit_nulls.Validation
main: clearing IMDb, then the releasedate, in the dialog returned 200, and both values came back after a reload, at desktop
and phone width. On the same sandbox rebuilt from this branch, with the same item, data,
and steps, both stayed cleared and the stored row held
NULL.page's ratings and deleted the plugin-stored
imdbandtmdbrows and the TMDB votecount, leaving a plugin's own
letterboxdrow. Clearing the air date of a series'latest aired episode moved the series' last air date back to the previous episode.
{"title": null}left the title unchanged.series air-date recompute, listed in
scripts/ci/db-contracts.txt. The extended v2transport test covers which
nullmembers become clears. Both fail with clearingdisabled. A new dialog test covers sending
nullfor cleared fields.make test-db-contractsagainst a fresh migrated PostgreSQL 18 + pgvector database:all 131 pass.
go build,gofmt,go vet, andmake lint-changed(golangci-lint v2.12.2) areclean.
make test-gopasses exceptTestAdminResourceCapabilitiesAndScopeand twojellycompat Dolby Vision playback tests, which fail the same way on
mainon the macOSmachine used here.
verify-apiv2-openapi,verify-apiv2-web-types,verify-apiv2-contract,verify-apiv2-fixtures,verify-scenario-catalogs, the router artifact test, routeinventory, local paths, and case collisions pass.
pass. Three other cases in those suites (
empty_clears,exact_item,episode_identity) fail the same way onmain, because their expectations predate thederived search vectors and series air dates.
Evidence
Desktop and phone-width captures of the Edit Metadata dialog before and after, recordings
of both desktop runs, the API checks, and the test results.
Evidence: https://evidence.siloserver.org/r/silo-server/issue-2238/
Risks
nullfor one of the ten members to mean "leave it" will nowclear the field. The web dialog is the only caller and sends
nullonly for fields theuser emptied.
tmdbsource row and vote count, so theitem drops out of the vote-ranked discovery rows. The web editor's rating lock keeps a
refresh from restoring it until the field is unlocked.
Follow-ups found in review, both present on
main: #2277 (a blank date returns 500, andnullon members that can't be cleared is silently ignored; it should follow this PR) and #2278 (three other cases in the curation scenario suites have stale expectations).Checklist
AI Disclosure
🤖 Generated with Claude Code