Skip to content

fix(catalog): send boolean filter rules as JSON booleans - #703

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/1253-tv-watch-status-filter
Oct 28, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/1253-tv-watch-status-filter

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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 for watched, in_progress, favorited, in_watchlist, hdr and dolby_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

  • Unit tests: two existing filter-builder tests changed to expect booleans and one TV test added; all three failed before the change.
  • Unit tests and lint for the touched modules, and debug builds: pass. One phone test, ReflowStyleTest > line height flows from settings, fails the same way on origin/main.
  • Android TV emulator (Android 14), remote only. Against a server at silo-server 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.
  • Phone and tablet were checked by the unit tests only, not on a device.

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/main e9c410096, 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

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (T3 Code)
  • Tool(s): Claude Code, Codex CLI, GitHub CLI, Gradle, Android Emulator, adb
  • Model(s): claude-opus-5-5; gpt-6.1-sol (review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: Independent Claude Opus 5.5 and GPT 6.1 Sol reviews of the branch diff (correctness, repo standards, the bug as described). Neither found anything.

Note

Fix catalog boolean filter rules to send JSON booleans

  • Changes CatalogQueryRule.value from String to JsonPrimitive, with constructors for both String and Boolean, so a rule retains its JSON type
  • Updates CatalogFilterQueryBuilder.buildGroups and TvCatalogFacetSelection.toQueryGroups to pass Boolean values for HDR, Dolby Vision, and watch-status rules
  • List<CatalogQueryGroup>.toV2Groups now emits JSON booleans for BOOLEAN_RULE_FIELDS and passes other rules' JsonPrimitive through unchanged
  • Tests assert genre, dynamic-range, and watch-status rule values as JSON primitives
  • Behavioral Change: boolean catalog filter fields (dynamic range, watch status) now serialize as JSON booleans instead of the strings "true"/"false" in V2 query groups — see CatalogApi.kt

Macroscope summarized e3494f7.

@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Oct 27, 2026
@silo-kody

silo-kody Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fee45a8a-8517-4727-b3e4-8c2647dbfd50
Commits

Reviewing files that changed from the base of the PR and between 1897127 and e3494f7.

Files selected for processing: 2
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/catalog/CatalogModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/api/CatalogApi.kt

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Catalog query rules now support JSON primitive values. Shared and Android TV filter builders use Boolean values for HDR, Dolby Vision, and watch-status rules. Tests verify the resulting values.

Changes: Catalog Filter Boolean Values

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: Normal

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: Passed 5
Check name Status Explanation
Title check Passed 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…
Description check Passed 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 desc…
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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.

@macroscopeapp

macroscopeapp Bot commented Oct 27, 2026

Copy link
Copy Markdown

The boolean filter change affects which items Browse shows, but the evidence described covers only Android TV Watch Status = Watched.

  • Watch Status filtering (shared/src/commonMain/kotlin/org/siloserver/silo/catalog/filter/CatalogFilterState.kt, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/library/TvLibraryBrowseFacets.kt): the TV Watched before/after is covered; captures are still needed for Android phone, tablet, and foldable folded and open. Please add before-and-after captures of the same Browse screen with the same data on each.
  • Dynamic Range filtering (HDR/Dolby Vision) (CatalogFilterState.kt, TvLibraryBrowseFacets.kt): the described Watch Status evidence does not show this effect. Please add before-and-after captures of the same Browse screen with the same data on phone, tablet, foldable folded and open, and Android TV.

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

@silo-triage silo-triage Bot added bug Something isn't working impact: usability Core flow broken or severely blocked priority: P2 Limited scope, workaround exists, or polish labels Oct 27, 2026
@coderabbitai coderabbitai Bot added the api-v2 API v2 / Huma program (epic silo-server#135) label Oct 27, 2026
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.
@Rhainland

Copy link
Copy Markdown
Contributor Author

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.

@Rhainland
Rhainland force-pushed the fix/1253-tv-watch-status-filter branch from 1897127 to e3494f7 Compare October 28, 2026 09:50
@silo-kody

silo-kody Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Rhainland

Copy link
Copy Markdown
Contributor Author

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.

@Quick104
Quick104 merged commit 94fc0f4 into Silo-Server:main Oct 28, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma program (epic silo-server#135) bug Something isn't working impact: usability Core flow broken or severely blocked priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants