Repository navigation
Conversation
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
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:
|
|
Artwork clearing is visible: after a partial storage-delete failure, personal collection artwork is now cleared (so the fallback collage can show), and admin collection poster or backdrop artwork is cleared rather than retaining its reference. The Evidence section’s prose does not provide captures or API response excerpts.
Identify the affected surface(s) and the build or commit used for the captures. If UI captures are unavailable, provide before-and-after response excerpts for the same request; the current “Before/After” text describes results but is not a response excerpt. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
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:
|
|
Added before-and-after evidence for the visible-change check. On a local server with filesystem storage, one variant of each image was made undeletable, and the same DELETE ran on |
Quick104
left a comment
There was a problem hiding this comment.
Review of af60b76. One finding below, plus a merge conflict with main. I'm fixing both on this branch, so there's no need to change anything yourself.
Merge conflict. #2817 on main deleted the database tests in admin_collections_service_test.go that CI never ran, and this branch appends a test to the end of that file. I'm rebasing onto main, keeping main's deletions and this PR's new test. The rebase rewrites the branch, so I'll push with --force-with-lease.
af60b76 to
14a079c
Compare
Review summaryReviewed head: 14a079c (af60b76 rebased onto main, plus one commit). The fix is correct. Committing the cleared reference before deleting the displaced revision is the order the replace path already uses, and it's the option #2419 suggested. Addressed
Verification
Left for the maintainers
Validated features: no passed case reaches this code. #193 S6 is recorded as Partial and #194 A3 as Not run. Assigning and replacing artwork are unchanged. User manual: unaffected. The collections pages don't describe clearing artwork or its errors. Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)
|
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:
|
Clearing a personal or admin collection poster/backdrop deleted the stored variants first and the database reference second. A delete that failed partway returned 500 and skipped the update, leaving the collection pointing at partly deleted artwork. Both paths now clear the reference first and then run cleanUpClearedCollectionImage, which sweeps the image directory as best-effort cleanup that only logs on failure. Like replacement cleanup, it re-reads the row and keeps any revision committed after the clear. Closes Silo-Server#2419
…lear Sweeping the whole image directory after the clear could delete a revision that a concurrent upload committed between the re-read and the delete, leaving the row pointing at missing artwork. The clear now removes only the revision it displaced, the same way a replacement does.
…in CI The test needs a database, and no CI list or job selected it, so it always skipped. List it in db-contracts.txt so the DB contracts job runs it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14a079c to
8864cdd
Compare
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:
|
Problem
Closes #2419
Related issue: N/A
Validation tasks: none changed. The fix is on the clear path next to #193 S6 and #194 A3; assigning and replacing artwork are unchanged.
When an admin or a collection owner removes a collection's poster or backdrop and one stored image variant fails to delete, the request returns 500 and the collection keeps pointing at artwork that is now partly gone. Its poster stays broken until someone clears it again and every delete succeeds. This change clears the database reference first and deletes the stored variants afterwards, so a failed delete only leaves unused files behind.
Both clear paths had this order:
DeletePersonalCollectionImagefor personal collections andDeleteAdminCollectionArtworkfor admin collections. The filesystem store fails this way today, becauseFilesystem.Deletestops at the first error. Since #1665, S3 deployments report per-object delete failures too.Approach
Both paths now save the cleared reference, then remove the revision the clear displaced. They reuse
cleanUpReplacedCollectionImage, which already does this after a replacement: it runs after the database update, keeps going if the client disconnects (bounded by the same 30-second timeout), and only logs failures. It deletes only the revision the row held before the clear, never everything else in the directory, so an upload that commits a new revision during the clear keeps its files. If the row points at the same revision again on a fresh read (the same image re-uploaded), nothing is deleted.The endpoint's response changes: a failed cleanup now returns success instead of 500 "Failed to delete images". The issue asked a maintainer to confirm this. The alternative, returning 500 after clearing the reference, would report an error for a request that did what the user asked.
No API schema, client, or jellycompat change. Collages live in a separate directory and are not affected.
Validation
go build ./...,gofmt,go vet ./...,make lint-changed,make verify-local-paths: pass.make test-go: passes exceptTestPlaybackInfoWithoutStripOrToneMapStillHasNoRouteandTestPlaybackInfoSkipsStripWhenRPUCannotBeStrippedininternal/jellycompat, which fail the same way onmain. They appear to depend on the local ffmpeg build.internal/api/handlersagainst a migrated Postgres: everything passes exceptTestAdminSubtitleListPageDBandTestCatalogTransferPersistsJobsAndSignedLink, which fail the same way onmain. They appear to compare local time with UTC and are unrelated to this change.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-2575/
Same DELETE on
mainand on this branch, local server with filesystem storage, with one variant of each image made undeletable. Admin collection poster:The admin backdrop and the personal collection poster behave the same way; the evidence page has all three. There are no screenshots: the test collections have no titles, so the Collections page shows the same empty tile on both builds.
Risks
A failed cleanup now leaves unused files in storage instead of a broken reference. A later clear does not remove them, because it only deletes the revision it displaced. Deleting an admin collection still removes its whole image directory; personal collections have no such sweep, so files left by a failed personal-poster cleanup stay until removed by hand. An upload that commits between the clear's first read and its update has its reference cleared and its files orphaned, but nothing the row references is deleted.
Checklist
AI Disclosure
Note
Fix collection artwork deletion to clear DB reference before deleting variants
removeCollectionImageVariantsanddeleteCollectionImages, which listed and batch-deleted every object under an image prefix before updating the database.partialDeleteStorefixture; the admin test is registered in db-contracts.txt.Macroscope summarized 8864cdd.