Skip to content

fix(collections): show unavailable counts and preserve navigation - #638

Open
Quick104 wants to merge 3 commits into
mainfrom
fix/c24-count-status-r2
Open

Quick104 wants to merge 3 commits into
mainfrom
fix/c24-count-status-r2

Conversation

@Quick104

@Quick104 Quick104 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Android drops collection count availability, so a failed count can appear as a stale number. This change shows Count unavailable while keeping the collection accessible.

Related issue: Silo-Server/silo-server#2722
Validation tasks: changes #5 C1, C4, C7; changes #6 C1, C4, C7

Approach

Preserve item_count_status across personal and library collection models. Explicit unavailable or unknown status suppresses the number; omitted status preserves older-server behavior. Available zero displays as zero, including on TV personal cards. Most-items sorting puts unavailable counts after known counts.

Membership requests and navigation remain independent of summary counts and capability loading. TV library cards continue to omit summary counts, and the TV detail count comes from actual visible members after paging finishes. Membership and saved collections remain uncapped.

Validation

  • The wire regression fails on the base because decoding drops the status and passes with this change. Focused tests cover compatibility, zero, unknown status, conversions, sorting, recovery and actual membership loading.
  • The full Android gate passed 6,094 tests, supply-chain checks, debug lint, release vital lint and phone/TV debug builds before the final TV subtitle correction. Six focused tests, TV lint, supply-chain checks and a fixture-free TV APK build passed at the final head.
  • Synthetic captures use actual product components on phone, tablet, a Pixel Fold closed and open, and TV. Refresh captures show recovered numeric counts. Authentication, normal navigation, server repair and physical devices were not exercised.
  • Direct validation-task reads found no recorded passes for the affected Android cases. Project-wide board access was unavailable.

Evidence

The evidence page identifies source commits, fixture APKs, normal builds and the limits of component verification. Phone, tablet and foldable source is unchanged by the final TV-only correction.

Evidence: https://evidence.siloserver.org/r/silo-android/collection-count-availability-r2/

Risks

Status handling works without a capability fetch. Release should coordinate with the server's additive contract. Authenticated integration and server-side definition repair still need release validation.

Server contract and budget fix: Silo-Server/silo-server#2728. Apple parity: Silo-Server/silo-apple#844. User manual: Silo-Server/siloserver.org#259, draft docs PR Silo-Server/siloserver.org#260. No merge or ongoing PR monitor is part of this batch.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section covers every affected form factor and states its limits.

AI Disclosure

  • Harness: Codex in T3 Code
  • Tool(s): Codex; T3 Code MCP; Claude Code (review); Gradle; Kotlin/JUnit; Android Emulator; ADB; agent-device
  • Model(s): gpt-6.1-sol; claude-opus-5-5
  • Involvement: AI-assisted
  • Adversarial review: Claude Opus 5.5 reviewed the coordinated server policy. Isolated Codex review read the complete final client diff and found no outstanding in-scope findings. Post-PR claude-opus-5-5 review completed at fffe857: no verified findings; nothing posted.

Note

Handle unavailable collection item counts and preserve catalog totals

  • Adds a CollectionCountState (Legacy, Exact, Unavailable) derived from the new nullable item_count_status field on Collection and LibraryCollection models, with only the exact string "available" mapping to Exact and null mapping to Legacy.
  • New shared helpers in CollectionCountText.kt format badges, count lines, and row subtitles based on count availability; phone, TV, and library collection screens use them instead of inline formatting.
  • CollectionDetailViewModel.kt no longer overrides the catalog total with the collection item count, and detail state stays manageable when the server reports an unavailable count.
  • V2 API models now decode item_count_status, and the status is preserved through all SectionApi conversion paths. Adds wire, mapping, and detail-viewmodel tests, plus 17 new locale string catalogs.
  • Behavioral Change: exact zero counts now render as 0 instead of the smart-collection label, and count values marked unavailable are suppressed in count lines; TV subtitles keep the plain collection kind for Legacy counts.

Macroscope summarized f8fc16f.

@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Oct 19, 2026
@silo-kody

silo-kody Bot commented Oct 19, 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 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 83 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

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: b400d1a7-ee50-415f-8c49-46c116ad73bc
Commits

Reviewing files that changed from the base of the PR and between fffe857 and f8fc16f.

Files selected for processing: 56

  • .silo-translations
  • .silo-translations-files
  • android-shared/silo-locales.properties
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/ui/components/CollectionCountText.kt
  • android-shared/src/androidMain/res/values-ar/strings_catalog.xml
  • android-shared/src/androidMain/res/values-b+zh+Hans/strings_catalog.xml
  • android-shared/src/androidMain/res/values-b+zh+Hant/strings_catalog.xml
  • android-shared/src/androidMain/res/values-bg/strings_catalog.xml
  • android-shared/src/androidMain/res/values-ca/strings_catalog.xml
  • android-shared/src/androidMain/res/values-cs/strings_catalog.xml
  • android-shared/src/androidMain/res/values-da/strings_catalog.xml
  • android-shared/src/androidMain/res/values-de/strings_catalog.xml
  • android-shared/src/androidMain/res/values-el/strings_catalog.xml
  • android-shared/src/androidMain/res/values-es/strings_catalog.xml
  • android-shared/src/androidMain/res/values-et/strings_catalog.xml
  • android-shared/src/androidMain/res/values-fi/strings_catalog.xml
  • android-shared/src/androidMain/res/values-fr/strings_catalog.xml
  • android-shared/src/androidMain/res/values-hi/strings_catalog.xml
  • android-shared/src/androidMain/res/values-hr/strings_catalog.xml
  • android-shared/src/androidMain/res/values-hu/strings_catalog.xml
  • android-shared/src/androidMain/res/values-in/strings_catalog.xml
  • android-shared/src/androidMain/res/values-it/strings_catalog.xml
  • android-shared/src/androidMain/res/values-iw/strings_catalog.xml
  • android-shared/src/androidMain/res/values-ja/strings_catalog.xml
  • android-shared/src/androidMain/res/values-ko/strings_catalog.xml
  • android-shared/src/androidMain/res/values-lt/strings_catalog.xml
  • android-shared/src/androidMain/res/values-lv/strings_catalog.xml
  • android-shared/src/androidMain/res/values-ms/strings_catalog.xml
  • android-shared/src/androidMain/res/values-nb/strings_catalog.xml
  • android-shared/src/androidMain/res/values-nl/strings_catalog.xml
  • android-shared/src/androidMain/res/values-pl/strings_catalog.xml
  • android-shared/src/androidMain/res/values-pt-rBR/strings_catalog.xml
  • android-shared/src/androidMain/res/values-pt-rPT/strings_catalog.xml
  • android-shared/src/androidMain/res/values-ro/strings_catalog.xml
  • android-shared/src/androidMain/res/values-ru/strings_catalog.xml
  • android-shared/src/androidMain/res/values-sk/strings_catalog.xml
  • android-shared/src/androidMain/res/values-sl/strings_catalog.xml
  • android-shared/src/androidMain/res/values-sv/strings_catalog.xml
  • android-shared/src/androidMain/res/values-th/strings_catalog.xml
  • android-shared/src/androidMain/res/values-tr/strings_catalog.xml
  • android-shared/src/androidMain/res/values-uk/strings_catalog.xml
  • android-shared/src/androidMain/res/values-vi/strings_catalog.xml
  • android-shared/src/androidMain/res/values/strings_catalog.xml
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/components/CollectionPosterCard.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionDetailViewModel.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionsScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/LibraryCollectionsScreen.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionDetailViewModelTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/collections/TvCollectionsScreen.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/personal/CollectionCount.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/personal/PersonalDataModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/section/SectionModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/api/SectionApi.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/apiv2/CatalogV2Models.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/apiv2/CollectionCountWireTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/viewmodel/CollectionCountAvailabilityTest.kt

No actionable comments were generated in the recent review.

Walkthrough

Collection count status now flows through API models and shared collection models. Shared helpers expose available counts and labels. Sorting and collection screens use those values, while detail loading leaves the total unchanged until item loading updates it.

Changes: Collection Count Availability

Layer / File(s) Summary
Count status and shared model contract
shared/src/commonMain/kotlin/org/siloserver/silo/model/personal/*, shared/src/commonMain/kotlin/org/siloserver/silo/model/section/SectionModels.kt, shared/src/commonMain/kotlin/org/siloserver/silo/network/api/*, shared/src/commonMain/kotlin/org/siloserver/silo/network/apiv2/CatalogV2Models.kt, shared/src/commonTest/kotlin/org/siloserver/silo/network/apiv2/CollectionCountWireTest.kt, shared/src/commonTest/kotlin/org/siloserver/silo/viewmodel/CollectionCountAvailabilityTest.kt
Shared helpers expose available counts and labels. API models and library collection conversions carry count status. Tests cover status decoding, labels, defaults, and preservation through response shapes.
Sorting and member loading
shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/CollectionsViewModel.kt, shared/src/commonTest/kotlin/org/siloserver/silo/viewmodel/CollectionCountAvailabilityTest.kt, androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionDetailViewModel.kt, androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionDetailViewModelTest.kt
Most-items sorting places collections without an available count after those with one. Detail loading no longer sets the total from collection metadata. Tests cover sorting, refresh, and loading actual members when counts are unavailable.
Collection count labels
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionsScreen.kt, androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/LibraryCollectionsScreen.kt, androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibrariesScreen.kt, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/collections/TvCollectionsScreen.kt
Collection subtitles, badges, and metadata use the shared item count label.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: rhainland

Merge Risk: Minimal · previous review fffe8

No actionable merge-blocking issue was established for the collection count changes. Normal release checks and server integration validation remain appropriate.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 14 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Title check Passed The title clearly summarizes the primary changes: displaying unavailable collection counts and preserving navigation behavior.
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.
Description check Passed The pull request description directly explains the collection count availability changes, affected platforms, behavior, validation, risks, and related issues. It is consistent with the changeset.
Finishing Touches

🧪 Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
ℹ️ Recent review info

⚙️ Run configuration

  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9a33d2bb-6e52-4c7b-86ba-3a35b8b243f7
📥 Commits

Reviewing files that changed from the base of the PR and between b1e5774 and fffe857.

📒 Files selected for processing: 15

  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionDetailViewModel.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionsScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/LibraryCollectionsScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibrariesScreen.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionDetailViewModelTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/collections/TvCollectionsScreen.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/personal/CollectionCount.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/personal/PersonalDataModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/section/SectionModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/api/CollectionApi.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/api/SectionApi.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/apiv2/CatalogV2Models.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/CollectionsViewModel.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/apiv2/CollectionCountWireTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/viewmodel/CollectionCountAvailabilityTest.kt
💤 Files with no reviewable changes: 1

  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionDetailViewModel.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.

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude Code (claude-opus-5-5)

Three findings on this head. I'm fixing all three in a merge of main on this branch, so there's no need to change them yourself. The branch also conflicts with main: the i18n work (#868–#916) moved these labels into the translation catalog, and #979 replaced InlineLibraryCollectionCard with the shared CollectionPosterCard. The merge carries the status handling onto both, with the new text in the catalog.

Main moved the collection count labels into the translation catalog and
replaced the inline library card with CollectionPosterCard. The status
handling now runs on both, with "Count unavailable" in the catalog.

A missing item_count_status keeps today's rendering, including "Smart"
for an uncounted 0; "available" makes the count exact; any other status
reads "Count unavailable". Drop the unread count_availability capability
and the client-side most_items group sort, which is a separate change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. and removed size/L 200–499 added + deleted lines (all files); change volume, not priority. labels Nov 19, 2026
@Quick104

Copy link
Copy Markdown
Contributor Author

Silo-Server/silo-server#2728 now also sends item_count_status on the cards of a row of collections (section_type: collection_posters, collections[] in the section responses). A card with unavailable has item_count: 0 as a placeholder, so a row card should show "Count unavailable" the same way the collection lists do, rather than "0 titles".

🤖 Claude Code in T3 Code (claude-opus-5-5)

@Quick104

Copy link
Copy Markdown
Contributor Author

This PR is no longer needed: Silo-Server/silo-server#2728, the server change that was going to send item_count_status, was closed on 2026-11-19 in favor of a server-only fix for Silo-Server/silo-server#2722 that adds no count-status field to /api/v2. Server main has no item_count_status, and no open server PR adds it, so every collection on this branch would land in the Legacy state, which renders the way main does today. I recommend closing it.

The PR has no Closes lines. Silo-Server/silo-server#2722 stays open for the server-only fix; main doesn't resolve it. The one change here that doesn't depend on the field, dropping the summary count from the collection detail total, only removes a brief flash before the catalog total replaces it, so it doesn't need a PR of its own.

🤖 Claude Code in T3 Code (claude-opus-5-5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: P2 Limited scope, workaround exists, or polish size/XXXL 3000+ added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant