Extend catalog cascade to GET /library/query so modern Card Catalog sees matched_via#978
Merged
Merged
Conversation
`searchLibraryQueryEndpoint` runs its own field-aware ILIKE primary path, so the Track 1 (CTA) + Track 2 (LML `/lookup`) cascade owned by `searchLibraryBothMode` was unreachable from the modern Card Catalog. That left modern dj-site without `matched_via` chips even after BS#972/#973 wired the cascade onto the classic-experience `/library/` route. When the primary query returns no rows AND the parsed query is a single bareword (no `artist:`/`album:`/`label:` qualifier, no quoted exact, no NOT), fall through to `searchLibraryByCTARaw` + `searchLibraryByTrackRaw` under the existing `CATALOG_TRACK_SEARCH_CTA_ENABLED` / `CATALOG_TRACK_SEARCH_DISCOGS_ENABLED` flags. Apply `genre` / `format` / `on_streaming` filters and the requested `sort` + `order` over the bounded fallback list in-memory before returning. Cascade fallback is single-page (`page > 0` stays empty) so the client doesn't keep scrolling into a bounded list. Both flags default to `false`, so when the operator hasn't opted in the function path is byte-identical to today. Closes #977
Tightens the in-memory filter comment in runCascade so it accurately describes which raw primitive applies which filter (CTA honors on_streaming server-side; only Track 2 needs the in-memory pass). Adds an inline comment in the BS#977 CTA test explaining why 'Bioluminescence' triggers the cascade and how the curated track-to-album map produces the comp library row.
This was referenced May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #977. Follow-up to #973 (which wired the cascade onto
GET /library/).The modern Card Catalog calls
GET /library/query, which runs its ownfield-aware ILIKE primary path in
librarySearchService.searchLibraryand never reaches the Track 1 (CTA) + Track 2 (LML
/lookup) cascadeowned by
libraryService.searchLibraryBothMode. So even though prod isrunning with both
CATALOG_TRACK_SEARCH_*_ENABLED=true, modern dj-siteshowed no chips for
vi scose poisewhile classic-experience search did.Approach
After the primary
db.execute(dataQuery)returns 0 rows AND the parsedquery is a single bareword (no
artist:/album:/label:qualifier,no quoted exact, no
NOT), fall through to:searchLibraryByCTARaw(q, limit, on_streaming)— Track 1, gated byflags.ctaEnabledsearchLibraryByTrackRaw(q, limit)— Track 2, gated byflags.discogsEnabledBoth primitives already return
TaggedLibraryViewEntry[](LibraryArtistViewEntry +matched_via) and were introduced as reusable building blocks in #973. Genre/format/on_streaming filters and the requestedsort+orderapply to the bounded cascade list in-memory before serialization. Cascade fallback is single-page (page > 0returns[]) so the client doesn't paginate into a bounded list.With both flags off (the default), the function path is byte-identical to today.
Trigger detection
Cascade fires when the parsed
SearchCondition[]is exactly:Field-qualified queries like
artist:NonexistentFooskip the cascade even on 0-hit — they signal a structured match intent, not a cross-table track lookup.Test plan
npm run typecheck— cleannpm run lint— 0 errors on touched filesnpm run format:check— cleannpm run test:unit— 1991 / 1991 passtests/integration/library-query.spec.js— all 22 pass (17 pre-existing + 5 new BS#977 cascade cases)tests/integration/library.spec.js— all 60 pass (no regressions on Wire searchLibrary cascade into GET /library/ so catalog clients see matched_via #972/Wire catalog cascade into GET /library/ via fuzzySearchLibrary (BS#972) #973 cascade describes)tests/integration/library.search-ranking.spec.js— all 5 passGET /library/query?q=vi+scose+poiseshould return{ results: [{ id: …, matched_via: [{ source: "discogs_release" | "discogs_master", … }] }], total: 1, page: 0, totalPages: 1 }. Modern Card Catalog chip rendering should turn on automatically (component already wired atdj-site/src/components/experiences/modern/catalog/Results/Result.tsx:111).Related
TaggedLibraryViewEntry+*Rawprimitives)/library/)