Repository navigation
fix(sections): log missing collections at debug instead of error - #1904
Conversation
A Home or library row whose server or personal collection was deleted already renders empty, but every load logged an ERROR. Rows of a deleted collection now log at debug; any other fetch failure still logs ERROR. Both user stores now report a missing collection as userstore.ErrCollectionNotFound so the fetcher can tell the two apart. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
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. |
|
The validation mapping omits #193 S2. Its cross-account read checks exercise the changed missing-collection lookup; the handler still maps that error to the same 404, so this is no behavior change and needs no re-validation. Suggested line:
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…es' into fix/sections-missing-collection-log
|
Added #193 S2 to the |
…es' into fix/sections-missing-collection-log Brings in the moved feat/collections-revamp base (#1875 personal login sharing, #1887 scrobble lock fix) through the row-references branch. The merge applied cleanly; the missing-collection logging tests pass under the login-wide sharing model without changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: #192, #1137
Validation tasks: reaches #193 S1 and S2 (both Pass, results unchanged), #1142 C1 and C3 (Not run); changes none
Stacked on #1902 (
feat/api-collection-row-references).A Home or library page row can keep pointing at a server or personal collection after that collection is deleted. The row already loads empty, but each load writes an ERROR log. Nothing has failed, and the noise makes real section failures harder to find in the logs.
Rows of a deleted collection now log at debug, with the message
section collection no longer exists. Any other failure still logs ERRORfetching section items, and the row still loads empty. Neither API version's output changes.Approach
sections.LogFetchError, picks the level. It logs at debug only when the error matchescatalog.ErrLibraryCollectionNotFoundoruserstore.ErrCollectionNotFoundwitherrors.Is. All three places that log a failed row use it:FetchAll, the single Home row read and the single library row read.sql.ErrNoRows. Both now wrapuserstore.ErrCollectionNotFound. The error text still contains "not found", which the personal collection handlers match to answer 404, so their responses don't change. That includes the cross-account reads in Collections — Server #193 S1 and S2, which still get 404.Only log levels change, so jellycompat,
silo-apple,silo-androidand the user manual need nothing.Validation
make lint-changedagainstfeat/api-collection-row-referencesare clean. Inmake test-go, one run ofTestHandlePlaybackPositionlessStoppedUsesQueuedReportPositionfailed on the scrobble lock race that fix(jellycompat): serve scrobble lock waiters in arrival order (revamp copy of #1886) #1887 fixes; the jellycompat package passed on rerun, and every other package passed.sections,userdb,userstore,usercollections,apiv2andapi/handlersran against a freshly migrated PostgreSQL database. The new tests capture log records. For a deleted server collection and a deleted personal collection, throughFetchAlland through the Home and library row reads, each row loads empty with one debug record and no ERROR. An unrelated store failure still gives an empty row and one ERROR. A store test shared by both user stores checks that a never-created and a deleted collection both returnuserstore.ErrCollectionNotFound. Restating Collections — Server #193 S1, another profile's Home row for a private collection shows nothing and logs no ERROR, while the owner still sees the title.TestAdminSubtitleListPageDBandTestCatalogTransferPersistsJobsAndSignedLink.make verify-local-pathspasses. Contract and web checks were not run: no API contract, generated artifact or web file changed.Risks
GetCollectionerror no longer matcheserrors.Is(err, sql.ErrNoRows). The two callers that checked for it also match the "not found" text, which the new error keeps. No other caller checks forsql.ErrNoRowsorpgx.ErrNoRows.Checklist
AI Disclosure
GetCollectionand every other caller of the single-row fetch. It ran the new tests verbosely on its own copy of the migrated database to confirm the database tests ran rather than skipped. In a scratch worktree it put the five production files back to the base versions: the store test failed for both stores and the deleted-collection cases failed with ERROR records, while the unrelated-failure case kept passing as intended. It found nothing to fix.🤖 Generated with Claude Code
Note
Log missing collections at debug level in section fetches
sections.LogFetchErrorin fetcher.go, which classifies missing-collection errors and logs them at DEBUG while other failures stay at ERRORSectionHandler.HomeSectionItems,SectionHandler.LibrarySectionItems, andfetchAllWithRunnerto use the shared classifier; failed rows still return empty resultsuserdb.GetCollectionandpgstore.PostgresUserStore.GetCollectionreturn errors wrappinguserstore.ErrCollectionNotFoundso missing collections are detectable witherrors.Isstoretest.RunGetMissingCollection) plus SQLite, Postgres, and handler tests covering deleted and never-created collections, unrelated failures, and private collections on other profilesfetchAllWithRunnerand the two single-row handlers in home_views_service.go and library_views_service.goMacroscope summarized 69f83ba.