Repository navigation
fix(catalog): send boolean filter rules as JSON booleans - #703
Conversation
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.
|
| Layer / File(s) | Summary |
|---|---|
JSON query-rule values shared/src/commonMain/kotlin/org/siloserver/silo/model/catalog/CatalogModels.kt, shared/src/commonMain/kotlin/org/siloserver/silo/network/api/CatalogApi.kt |
CatalogQueryRule.value now uses JsonPrimitive, with string and Boolean constructors. toV2Groups() preserves non-boolean values and converts Boolean rules to JSON booleans. |
Boolean filter mappings and tests shared/src/commonMain/kotlin/org/siloserver/silo/catalog/filter/CatalogFilterState.kt, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/library/TvLibraryBrowseFacets.kt, shared/src/commonTest/kotlin/org/siloserver/silo/catalog/filter/CatalogFilterQueryBuilderTest.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/library/TvLibraryBrowsePrefsTest.kt |
The shared and Android TV filter builders use Boolean values for HDR, Dolby Vision, and watch-status rules. Tests verify the JSON Boolean values. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
- Silo-Server/silo-android issue 350 covers Android TV validation of watched and unwatched browsing filters. This change updates the Boolean encoding used by those filters.
Possibly related PRs
- Silo-Server/silo-android#702: Both PRs update the catalog-filter contract for Boolean values. This PR changes the rule model and filter builders so Boolean values reach
toV2Groups().
Suggested labels: api-v2
Suggested reviewers: rxwatcher, quick104
Merge Risk: 
Minimal · up to e3494
-
The catalog filters preserve string behavior while sending the required Boolean values, with no remaining merge-blocking risk identified.
Security architecture risk: 
Minimal · up to e3494
-
The inspected changes preserve the existing catalog request path, account scope, and library selection. No material security risk was found in the changed filter handling.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The demonstrated effect is bounded to catalog predicates sent through the existing client request path. No new endpoint, credential authority, or independently selectable identity is introduced by the inspected changes; effective server-side data access remains outside this review's verified scope.
Trust Boundaries and Controls
- observed — Filter values remain request predicates. Library selection is passed separately, and the existing transport retains its fixed catalog endpoints and authentication scope. The converter does not derive those authority-bearing choices from rule values.
-
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the main change: catalog boolean filter rules are now sent as JSON booleans. The changeset matches this. CatalogQueryRule.value becomes a JsonPrimitive, the shared and TV builders emit Boolean values for HDR, Dolby Vision, and watch-status rules, and toV2Groups emits JSON booleans for those fields. The title is specific and uses the conventional fix(scope) form.
Full details: Description check
-
Explanation
The description covers the problem, the approach, validation, evidence, risks, and AI disclosure. It states the Android TV Watch Status error and the server requirement for JSON booleans. It also describes the shared builder and TV builder changes, which match the changeset. The description is detailed and directly related to the changes.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
The boolean filter change affects which items Browse shows, but the evidence described covers only Android TV Watch Status = Watched.
Suggested fix: No code diff; add the missing captures to the Evidence section. Unit tests do not show the visible filtering result. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
The catalog query API requires a JSON boolean for watched, in_progress, favorited, in_watchlist, hdr and dolby_vision. Both the TV filter panel and the shared phone/tablet filter builder built those rules from the string "true", and only the wire encoder's field allowlist turned them into booleans. CatalogQueryRule now carries a JsonPrimitive value, with String and Boolean constructors, and both builders set boolean rules with real booleans. The encoder passes typed values through and keeps its allowlist for any rule still built from a string.
|
Not adding tablet/foldable captures. The fix is in shared filter-state code that builds the query value; no layout changes. Phone, tablet and foldable use the same Browse code. Dynamic Range (HDR/Dolby Vision) goes through the same boolean branch, and the unit tests cover it. The test library has no HDR content to capture. |
1897127 to
e3494f7
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:
|
|
Rebased onto main. #702 has since merged and already sends the six boolean filter fields as JSON booleans, so the wire bug this PR describes is fixed on main. What this PR still adds: both filter builders store typed boolean values instead of strings, plus the TV builder test. The encoder keeps #702's conversion for rules still built from strings. If typed values aren't wanted on top of #702, this can be closed. |
Problem
Related issue: Silo-Server/silo-server#1253
Validation tasks: unblocks #350 C1
On Android TV, Browse → Filter → Watch Status (Watched, In progress, Favorites) shows "An unexpected error occurred.", and Retry fails the same way. The app sends filter values as JSON strings, so a true/false rule goes out as
"value":"true". The server requires a JSON boolean forwatched,in_progress,favorited,in_watchlist,hdranddolby_vision; it answered 500 for this (Silo-Server/silo-server#3173 makes that a 422). Phone and tablet build the same rules through the shared filter builder for Watch Status and Dynamic Range.This change sends real booleans for those fields.
Approach
A catalog rule's value is now a JSON value with string and boolean constructors, and the encoder passes it through unchanged. Every boolean field sends
true/false; strings, numbers and year ranges are encoded as before. The shared builder (phone, tablet) and the TV app's own builder both use it.Validation
ReflowStyleTest > line height flows from settings, fails the same way onorigin/main.e6df1d8ed, Watched, Unwatched and In Progress now return books where the base build showed the error. Against a build with silo-server#3173, Watched returns the watched book and Favorited a valid empty result.Evidence
Evidence: https://evidence.siloserver.org/r/silo-android/pr-703/
Surface and build: Android TV, Audiobooks → Browse → Filter → Watch Status = Watched; before on
origin/maine9c410096, after on this branch; same synthetic library. Phone and tablet not captured (same request change, covered by unit tests).Risks
None identified. A server that predates strict validation already treated a JSON boolean correctly.
Checklist
AI Disclosure
Note
Fix catalog boolean filter rules to send JSON booleans
CatalogQueryRule.valuefromStringtoJsonPrimitive, with constructors for both String and Boolean, so a rule retains its JSON typeCatalogFilterQueryBuilder.buildGroupsandTvCatalogFacetSelection.toQueryGroupsto pass Boolean values for HDR, Dolby Vision, and watch-status rulesList<CatalogQueryGroup>.toV2Groupsnow emits JSON booleans forBOOLEAN_RULE_FIELDSand passes other rules'JsonPrimitivethrough unchangedMacroscope summarized e3494f7.