Skip to content

fix(sections): log missing collections at debug instead of error - #1904

Merged
Quick104 merged 3 commits into
feat/collections-revampfrom
fix/sections-missing-collection-log
Oct 4, 2026
Merged

Quick104 merged 3 commits into
feat/collections-revampfrom
fix/sections-missing-collection-log

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

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 ERROR fetching section items, and the row still loads empty. Neither API version's output changes.

Approach

  • One helper, sections.LogFetchError, picks the level. It logs at debug only when the error matches catalog.ErrLibraryCollectionNotFound or userstore.ErrCollectionNotFound with errors.Is. All three places that log a failed row use it: FetchAll, the single Home row read and the single library row read.
  • Server collections already returned their sentinel error; personal collections didn't. The Postgres user store returned a plain "collection X not found" error and the SQLite store returned sql.ErrNoRows. Both now wrap userstore.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.
  • Rows of deleted collections stay in the page layouts and profile overrides; this change doesn't remove them. The Home rows list in feat(web): pick collections and build rule rows in the Home row dialog #1895 labels such a row "Collection no longer available".

Only log levels change, so jellycompat, silo-apple, silo-android and the user manual need nothing.

Validation

  • Go: build, gofmt, vet on the touched packages and make lint-changed against feat/api-collection-row-references are clean. In make test-go, one run of TestHandlePlaybackPositionlessStoppedUsesQueuedReportPosition failed 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, apiv2 and api/handlers ran against a freshly migrated PostgreSQL database. The new tests capture log records. For a deleted server collection and a deleted personal collection, through FetchAll and 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 return userstore.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.
  • Two DB-backed handler tests this branch doesn't touch fail on that database, the same way on the base commit: TestAdminSubtitleListPageDB and TestCatalogTransferPersistsJobsAndSignedLink.
  • make verify-local-paths passes. Contract and web checks were not run: no API contract, generated artifact or web file changed.

Risks

  • The SQLite store's GetCollection error no longer matches errors.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 for sql.ErrNoRows or pgx.ErrNoRows.
  • A leftover row of a deleted collection no longer shows up in ERROR logs. Finding such rows from the logs now needs debug logging.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents (implementer, independent reviewer)
  • Model(s): claude-opus-5-5[1m]
  • Involvement: Fully AI-generated, human review pending
  • Adversarial review: An independent reviewer subagent read the full diff and checked every caller of GetCollection and 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

  • Adds sections.LogFetchError in fetcher.go, which classifies missing-collection errors and logs them at DEBUG while other failures stay at ERROR
  • Updates SectionHandler.HomeSectionItems, SectionHandler.LibrarySectionItems, and fetchAllWithRunner to use the shared classifier; failed rows still return empty results
  • Makes userdb.GetCollection and pgstore.PostgresUserStore.GetCollection return errors wrapping userstore.ErrCollectionNotFound so missing collections are detectable with errors.Is
  • Adds a shared conformance contract (storetest.RunGetMissingCollection) plus SQLite, Postgres, and handler tests covering deleted and never-created collections, unrelated failures, and private collections on other profiles
  • Behavioral Change: a previously missing collection logged an ERROR for every section lookup; it now logs a single DEBUG record. Check fetchAllWithRunner and the two single-row handlers in home_views_service.go and library_views_service.go

Macroscope summarized 69f83ba.

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]>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b8540a92-b03f-455a-a87c-698264b5a66d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T14:49:27.818892Z 69f83ba New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@macroscopeapp

macroscopeapp Bot commented Oct 4, 2026

Copy link
Copy Markdown

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:

Validation tasks: reaches #193 S1 and S2 (recorded results unchanged), #1142 C1 and C3 (Not run); changes none

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
@Quick104

Quick104 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Added #193 S2 to the Validation tasks: line: its cross-account reads go through the changed GetCollection lookup and still return 404, so the recorded Pass stands and needs no re-test.

…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]>
Base automatically changed from feat/api-collection-row-references to feat/collections-revamp October 4, 2026 21:41
@Quick104
Quick104 merged commit 2fd00a4 into feat/collections-revamp Oct 4, 2026
13 checks passed
@Quick104
Quick104 deleted the fix/sections-missing-collection-log branch October 4, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant