Repository navigation
fix(collections): report MDBList's reason when a list feed refuses - #3481
Conversation
MDBList's /json feed answers a private list with status 200 and an
{"error": "..."} object instead of entries. The sync then failed with a
JSON decoding error that hid the reason. Return the feed's own message,
bounded to 200 characters, and keep the decoding error for anything else.
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. Walkthrough
Merge Risk:
|
|
The Evidence section lacks the screen captures needed to review these visible changes:
The section provides before-and-after message text and explains that the branch has not been deployed, but it does not show the affected screens. Please identify the surface and build or commit for each capture; the stated capture limitation is noted for maintainer review. 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:
|
The feed's message is stored and shown as the sync message, so run it through logredact.RedactSecretAssignments before the length cap, as other free-text diagnostics that cross a boundary do.
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
Related issue: N/A
Validation tasks: none
When an MDBList list is private, every sync of a collection built from it fails with a JSON decoding error instead of saying the list is private. The web app shows that error as the "Sync failed" tooltip on the Collections page and in the admin collection list, so the person who owns the collection can't tell what to fix.
MDBList's
/jsonfeed doesn't use an error status for this. It answers with status 200 and an object in place of the list:{"error": "This List is Private"}fetchMDBListJSONPageonly checks the status code, then decodes the body as a list, so the sync recordsparsing mdblist response: json: cannot unmarshal object into Go value of type []usercollections.mdblistEntry. I hit this on my own server: one personal collection has failed every nightly sync since its list went private.Approach
When the body doesn't decode as a list,
fetchMDBListJSONPagenow checks whether it's an{"error": "..."}object and, if so, returnsmdblist: <message>. Because it's stored and shown as the sync message, the message is trimmed, passed throughlogredact.RedactSecretAssignments, and capped at 200 characters. Any other body that isn't a list still returns the decoding error as before.The fix is in
internal/collectionutil, so it covers every caller of the shared fetcher: library collections, personal collections, Seasonal Picks and Discover rows. No API fields change.On a personal collection, only the first sync on import saves a failure. Sync now and scheduled syncs don't save it, so the collection keeps showing whatever its last saved sync said, and Sync now shows "An unexpected error occurred." for any source. That's a separate problem, fixed in #3487. Admin collection syncs save their failures and show the message this PR fixes.
Validation
go test ./internal/collectionutil/ ./internal/usercollections/: pass. The new table test covers the private-list reply, a secret assignment in the reason, a long reason, an object withouterror, and a body that isn't JSON. Its private-list and long-reason cases fail onmain.go vet ./internal/collectionutil/: clean.mainand on this branch, against the same database. Results are under Evidence.e46eaa917.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3481/
last_sync_messagefromGET /api/v2/collections/{id}after importing the same private list (web app, local build;mainat6aa6791eavs this branch ate46eaa917):parsing mdblist response: json: cannot unmarshal object into Go value of type []usercollections.mdblistEntrymdblist: This List is PrivateThe web app shows this text as the tooltip on "Sync failed". A screenshot can't show a native tooltip, so the evidence page's Collections captures from both builds include a clearly marked box with the tooltip text read from the page, alongside the steps used.
Risks
None identified. The change only rewrites the error text for one kind of failed sync.
Checklist
AI Disclosure