Skip to content

fix(collections): refresh smart collection counts after a scan - #3707

Merged
Quick104 merged 3 commits into
Silo-Server:mainfrom
blurbery:fix/smart-collection-stale-count
Nov 9, 2026
Merged

Quick104 merged 3 commits into
Silo-Server:mainfrom
blurbery:fix/smart-collection-stale-count

Conversation

@blurbery

@blurbery blurbery commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #3697
Related issue: #192
Validation tasks: unblocks #193 S4; unblocks the #3697 part of #194 A2 (still blocked by #3694, #3695, #3696); unblocks #195 W4; unblocks Silo-Server/silo-apple#20 C4, Silo-Server/silo-apple#21 C4, Silo-Server/silo-android#5 C4, Silo-Server/silo-android#6 C4

After a library scan adds or removes titles, a server smart collection's card keeps its old title count for up to an hour for admins and other accounts with no library or rating limits. The collection itself already lists the new titles. The stale number shows on the Collections page, the library Collections tab and the admin list, and the apps and Jellyfin-compatible clients read the same value.

Unrestricted viewers get the stored library_collections.item_count_cached. SmartCountRefresher only recounted it shortly after startup, hourly, and when an admin saved the collection. Nothing recounted it when a scan changed a library. With this change the stored count follows the scan about 10 seconds after it finishes.

Approach

Scans already publish scan_complete with the library ID on the catalog channel (the ingest executor, and the item and library refresh jobs). The node that publishes it now also hands it to a new catalog.SmartCountScheduler. After a 10 second delay, the scheduler recounts the smart collections whose rule draws from a changed library, plus those whose rule draws from every library. Libraries that change during the delay are recounted in the same pass, and a library that changes during a recount is recounted again afterwards.

I used the publish-side observer on cache.ObservedEventBus rather than a subscription for two reasons:

  • A subscription runs on every API node, so each scan would be recounted once per node.
  • Without Redis the bus delivers nothing, and Redis is optional in integrated and api modes. The observer runs only on the node that ran the scan, with or without Redis, and the count lands in Postgres where every node reads it.

ObservedEventBus held a single observer that a second registration replaced, and the plugin event dispatcher already uses it. It now keeps a list, so the dispatcher and the count refresh both see every publish.

The recount itself is the existing per-collection query. Its cost per scan is one count per affected smart collection, not one per file.

Jellyfin-compatible clients get the fix with no extra change, because a BoxSet's ChildCount reads the same stored count. The API contract is unchanged, so silo-apple and silo-android need no follow-up. The user manual doesn't describe when the count refreshes, so it needs no change. I updated the two architecture docs that described the hourly-only refresh and the single observer.

Validation

  • Focused Go tests for internal/catalog and internal/cache pass, including the new scheduler and observer cases.
  • On a local Postgres with migrations applied, the new DB contract test (listed in scripts/ci/db-contracts.txt) and TestServerCollectionCountsFollowTheViewerDB pass.
  • go vet on the touched packages, gofmt and make verify-local-paths are clean.
  • make lint-changed and the full gate were left to CI. The full local lint is too heavy for my machine.
  • Manual run on a local server in integrated mode with no Redis: added two titles to a library and scanned, then added one more and removed one, scanning after each. The steps and counts are in Evidence.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3707/

Surface and build: admin collections list (GET /api/v1/admin/collections) next to a live preview of the same rule. Before is upstream main 4018816da, after is this branch, on the same local database and collection. On main, after two titles were added and the scan finished, the stored count stayed at 1 while the rule matched 3, and nothing else recounts it before the hourly refresh. On this branch the stored count matched the rule about 10 seconds after each scan, both when a title was added (3 to 4) and when one was removed (4 to 3).

Risks

  • The delay starts at the first change, not the last. During a long autoscan import, every matching smart collection is recounted about every 10 seconds until the import ends, including every rule that draws from all libraries. Recounts never overlap, and each query keeps its existing 30 second timeout.
  • Open fix(collections): bound count queries and retain recovery access #2728 rewrites internal/catalog/smart_count_refresher.go. My edit there is small and additive (a RefreshLibraries entry point that filters the existing loop), so it should rebase cleanly either way.
  • These still wait for the hourly refresh, as before:
    • deleting a library or running a full metadata refresh, neither of which publishes scan_complete;
    • date-based rules such as "added in the last 7 days" moving on;
    • a scan that finishes in the first seconds after startup, before the router registers the observer (the startup refresh covers it).
  • Separate from this change: the refresher counts the rule's library_ids only, while the collection's member list also intersects them with the collection's own libraries, so the two can differ for a collection whose rule names other libraries.

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 (desktop app)
  • Tool(s): GitHub CLI, Git
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted. AI-assisted with Claude Opus. I directed the task and designed the work.
  • Adversarial review: a separate subagent reviewed the diff for races in the observer list and the scheduler, lost changes, blocking the publisher, library matching and test flakiness, and ran the scheduler and observer tests under -race. It found no code defects. It flagged two architecture docs that still described the hourly-only count and a single observer, and both are fixed here.

Note

Refresh smart collection counts after library scans

  • Adds SmartCountScheduler, which batches changed library IDs and triggers SmartCountRefresher.RefreshLibraries after a 10-second delay, so scans no longer wait up to an hour for counts to update. See smart_count_scheduler.go
  • The router registers a publish observer for catalog-channel scan_complete events when the event bus supports observation. See router.go
  • cache.ObservedEventBus now supports multiple observers invoked in registration order, instead of only the latest one. See observed_bus.go
  • Library-scoped refresh skips collections whose rules do not draw from the changed libraries. A recount with an unchanged count no longer updates the collection row or its revision.
  • Behavioral Change: non-scan changes can still leave counts stale for up to an hour, and recounts for different libraries can finish out of order; unchanged counts no longer advance the collection revision

Macroscope summarized db4ec3a.

A server smart collection's stored count, which unrestricted viewers
see on its card, only refreshed at startup, hourly and when an admin
saved the collection. After a scan added or removed titles it stayed
stale for up to an hour while the collection itself listed the new
members.

The node that runs a scan now observes its own scan_complete publish
and, about 10 seconds later, recounts the smart collections whose rule
draws from that library (or from every library). Observing the publish
rather than subscribing counts each scan once on a multi-node
deployment and still works without Redis. ObservedEventBus now keeps a
list of observers so this does not replace the plugin event
dispatcher's.

Closes Silo-Server#3697
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 9, 2026
@silo-kody

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

This organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

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: 9bf2c91b-4971-4c60-b041-4dd2cf3181e3
Commits

Reviewing files that changed from the base of the PR and between 850c8d2 and db4ec3a.

Files selected for processing: 3

  • docs/architecture/collection-posters.md
  • internal/catalog/smart_count_refresher.go
  • internal/catalog/smart_count_refresher_db_test.go

No actionable comments were generated in the recent review.

Walkthrough

The router now schedules smart collection count refreshes after relevant catalog scans. The refresh targets collections that draw from the scanned libraries, batches library changes, and runs after a 10-second delay. The event bus now supports multiple publish observers.

Changes: Smart collection count refresh

Layer / File(s) Summary
Multiple publish observers
internal/cache/observed_bus.go, internal/cache/observed_bus_test.go
ObservedEventBus now adds non-nil observers without replacing existing ones. It calls observers in registration order after the wrapped publish, including when that publish returns an error. The test checks delivery to two observers.
Selective and coalesced count refresh
internal/catalog/smart_count_refresher.go, internal/catalog/smart_count_scheduler.go, internal/catalog/smart_count_scheduler_test.go, internal/catalog/smart_count_refresher_db_test.go, scripts/ci/db-contracts.txt
RefreshLibraries refreshes collections whose rules include a requested library or draw from all libraries. The scheduler batches distinct positive library IDs and processes changes that arrive during a refresh in a later batch. Tests cover batching and database-backed count updates.
Scan event wiring and refresh timing
internal/api/router.go, docs/architecture/collection-posters.md, docs/architecture/redis-event-bus.md
The router observes catalog scan_complete events with integer library IDs and schedules a refresh after 10 seconds. Documentation describes scan, save, and hourly refresh triggers, and the event bus’s multiple-observer behavior.

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

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant ScanPublisher
  participant ObservedEventBus
  participant RouterObserver
  participant SmartCountScheduler
  participant SmartCountRefresher
  participant library_collections
  ScanPublisher->>ObservedEventBus: Publish scan_complete event
  ObservedEventBus->>RouterObserver: Deliver published event
  RouterObserver->>SmartCountScheduler: LibraryChanged(libraryID)
  SmartCountScheduler->>SmartCountRefresher: RefreshLibraries(pending library IDs)
  SmartCountRefresher->>library_collections: Refresh matching cached counts
Loading

Possibly related issues

  • Collections Server validation tracker, case S4: it covers smart collection rules reflecting library content changes, which this change refreshes after scans.
  • Collections Web admin validation tracker, case A2: it records stale collection results after library changes, related to this scan-triggered refresh.
  • Collections Web validation tracker, case W4: it covers smart collection membership after library changes, related to the same scan-triggered refresh.

Possibly related PRs

  • Silo-Server/silo-server#3547: It removes ObservedEventBus and its observer API, which this change uses to schedule scan-triggered refreshes.

Suggested reviewers: quick104, rhainland

Merge Risk: Minimal · previous review 850c8

This change refreshes smart collection counts about 10 seconds after a relevant library scan. No actionable merge-blocking risk was found. The database contract test was not run in this review, so CI should confirm it.

Security architecture risk: Low · up to 850c8

The change reuses existing count calculations and access controls without introducing a new public endpoint or permission. Notifications are coalesced locally, and periodic refreshes remain as recovery paths. Failed refreshes can still leave counts stale, and incomplete coverage prevents a stronger assurance.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — A valid local scan-completion event can trigger count writes for all stored smart collections drawing from that library, including definitions drawing from every library. Its direct database effect is updating cached counts, not changing collection membership or access policy.

Trust Boundaries and Controls

  • observed — The new callback filters the channel and event type, parses an integer payload, and rejects non-positive IDs through LibraryChanged. Redis subscription receipt does not traverse the local observer list. These are internal routing controls, not authentication of arbitrary event producers.

Resilience and Maintainability Implications

  • observed — Observers execute synchronously on the publishing goroutine. The inspected plugin callback filters events and offers them to a nonblocking queue; the new scheduler callback only records a pending ID and signals a buffered channel. Count queries run separately in the scheduler loop rather than in the publisher.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title "fix(collections): refresh smart collection counts after a scan" names the main change. The changeset adds a delayed recount of stored smart collection counts after a library scan publishes …
Linked Issues check Passed [#3697] Objective: the stored smart collection count for unrestricted viewers should match the collection's members soon after a scan changes a library the collection draws from.

Implementation at he…
Out of Scope Changes check Passed Every reviewed change ties to #3697 or supports its implementation:
- internal/api/router.go: registers the scan observer and starts the scheduler. Directly required.
- `internal/catalog/smart_count…
Docstring Coverage Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Description check Passed The description is specific and on-topic. It explains the problem (stale smart collection counts after library scans), the approach (a new SmartCountScheduler triggered by scan_complete publishes, plu…
Full details: Title check

Explanation

The title "fix(collections): refresh smart collection counts after a scan" names the main change. The changeset adds a delayed recount of stored smart collection counts after a library scan publishes scan_complete, and the PR objectives state the same goal. The title is specific and concise, and it follows a conventional commit style.

Full details: Linked Issues check

Explanation

[#3697] Objective: the stored smart collection count for unrestricted viewers should match the collection's members soon after a scan changes a library the collection draws from.

Implementation at head:

  • internal/api/router.go registers a publish observer on cache.ObservedEventBus for cache.ChannelCatalog and cache.EventScanComplete. The observer parses the library ID and calls SmartCountScheduler.LibraryChanged. The diff confirms this registration.
  • catalog.SmartCountScheduler waits 10 seconds, then refreshes the pending libraries. Changes during the delay join the same pass. Changes during a refresh trigger a later pass.
  • SmartCountRefresher.RefreshLibraries refreshes smart collections whose rule names a changed library or names no libraries, using the existing count query.

Tests: scheduler coalescing test, observer multi-registration test, and DB test TestSmartCountRefreshFollowsScannedLibraryDB, which checks the stored count moves 1 to 0 after a library change. The author also reports a manual run without Redis that matched the rule after additions and removals.

Restricted viewers already compute live counts, so no change is needed for them.

Residual gaps, both reported by the PR:

  • Library deletion, full metadata refresh, and date-based rule changes still wait for the hourly refresh. The issue frames the fix around scans, so these are not blocking.
  • The refresher counts the rule's library_ids, while membership also intersects with the collection's own libraries. Collections whose rule names other libraries can still differ. This is pre-existing and does not affect the issue's reproduction, which uses a rule over the scanned library.

Uncertainty: the no-Redis path depends on the event bus being an ObservedEventBus in that mode. docs/architecture/redis-event-bus.md states that observers run with or without Redis, and the plugin dispatcher already relies on this. I did not inspect the wiring code. I did not run the tests. The verdict relies on the PR summary, the router.go diff, and the architecture document.

Full details: Out of Scope Changes check

Explanation

Every reviewed change ties to #3697 or supports its implementation:

  • internal/api/router.go: registers the scan observer and starts the scheduler. Directly required.
  • internal/catalog/smart_count_scheduler.go and its test: delay and coalescing logic. Directly required.
  • internal/catalog/smart_count_refresher.go: RefreshLibraries filters the existing refresh loop. RefreshAll keeps its behavior. Directly required.
  • internal/cache/observed_bus.go and its test: the observer slot now holds a list. This is required because the plugin event dispatcher uses the same observer. Replacing the single observer would drop one of the two consumers.
  • internal/catalog/smart_count_refresher_db_test.go and scripts/ci/db-contracts.txt: test coverage and CI registration for the new refresh behavior.
  • docs/architecture/collection-posters.md and docs/architecture/redis-event-bus.md: describe the new refresh trigger and the multi-observer behavior. Supporting documentation.

The Jellyfin-compatible ChildCount change is a consequence of the same stored count. It adds no code. No unrelated change appears in the reviewed evidence.

This verdict uses the whole-PR summary and the router.go diff. I did not read the full diff of every file.

Full details: Docstring Coverage

Explanation

Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 7 files. (3 skipped: 3 unsupported.)

Full details: Description check

Explanation

The description is specific and on-topic. It explains the problem (stale smart collection counts after library scans), the approach (a new SmartCountScheduler triggered by scan_complete publishes, plus ObservedEventBus multi-observer support), validation steps, and risks. It matches the changeset in the raw summary, which covers the router wiring, scheduler, refresher, observed bus, tests, and architecture docs.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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: 443e6630-c7fa-4f06-9879-42c256500f9a
Commits

Reviewing files that changed from the base of the PR and between 4018816 and 850c8d2.

Files selected for processing: 10

  • docs/architecture/collection-posters.md
  • docs/architecture/redis-event-bus.md
  • internal/api/router.go
  • internal/cache/observed_bus.go
  • internal/cache/observed_bus_test.go
  • internal/catalog/smart_count_refresher.go
  • internal/catalog/smart_count_refresher_db_test.go
  • internal/catalog/smart_count_scheduler.go
  • internal/catalog/smart_count_scheduler_test.go
  • scripts/ci/db-contracts.txt

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

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish labels Nov 9, 2026

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

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)

Review of 850c8d2. The approach holds: observing the publish counts each scan once on the node that ran it, with or without Redis, and the scheduler's coalescing and re-arm logic is sound. There are two findings on the lines below. I'm fixing both in a commit on this branch, so there's no need to change anything yourself.

Maintainer decision: #3547, which is also open, removes cache.ObservedEventBus, and this PR's scan hook is built on it. Whichever of the two lands second needs rework. The maintainers will settle the order; nothing here needs to change for it.

A write to a library_collections row advances the collection's
revision, which ends open catalog cursors and fails editor saves.
Recounting after every scan made that happen every few seconds during an
import, even when the count was unchanged. Write the count only when it
differs.

The DB test no longer fails on another test's uncountable smart
collection: CI runs the DB contract packages in parallel on one
database, and the refresh recounts every collection that names no
library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Nov 9, 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 ❌

@Quick104

Quick104 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Review summary

Reviewed head: db4ec3a (850c8d2 plus a review fix commit and a doc note).

Addressed

  • Recounts ended open cursors and failed editor saves. Every count write advanced the collection's revision, even when the count hadn't changed. refreshOne now writes only when the count differs. The DB test checks that an unchanged recount leaves the revision alone. That check failed on 850c8d2 and passes now.
  • The DB test flaked in CI. It failed whenever another test's uncountable all-library smart collection was in the shared database. It now asserts its own counts only.

Left for the maintainers

Checks

  • New tests: the scheduler and observer tests pass under -race (3 runs each). The DB test passes on a freshly migrated database and alongside TestServerCollectionCountsFollowTheViewerDB. The collection tests in internal/api/handlers, internal/catalog and internal/jellycompat pass. The new tests call new functions, so they can't run on main. The original stale-count behavior rests on the author's live run.
  • Cross-provider review (gpt-6.1-sol, one round) raised the cursor/revision issue, now fixed, and the overlapping-refresh race, noted above.
  • Validated features: not checked. The validation board couldn't be read from this environment, so the Validation tasks: line in the description is unverified.
  • User manual: no change needed. The collections guide already says a smart collection keeps itself up to date.
  • Apple and Android: no API change, so no client follow-up. Jellyfin-compatible clients read the same stored count.

Fit: 9/10 · Readiness: 8/10 — conditional (assuming CI is green)

Fit: it fixes a wrong number on a core 1.0 surface at the point where scans already announce changes, and it adds no setting or API surface. Readiness: the fix is sound and its tests hold. The open item is the merge order with #3547, plus the absence of a test that fails on main for the stale count itself.

Comment thread internal/api/router.go
scheduler.LibraryChanged(libraryID)
}
})
go scheduler.Run(appCtx)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

kody code-review Bug high

Concurrent refreshes can overwrite a post-scan count with an older result

The new scheduler runs concurrently with the hourly and save-triggered refreshes, so an older preview can finish its update after a post-scan preview and restore the stale count for another hour. Serialize refreshes across nodes or make the update conditional on the collection definition and a monotonic refresh generation.

Prompt for LLM
File internal/api/router.go, line 2309:

Concurrent refreshes can overwrite a post-scan count with an older result

The new scheduler runs concurrently with the hourly and save-triggered refreshes, so an older preview can finish its update after a post-scan preview and restore the stale count for another hour. Serialize refreshes across nodes or make the update conditional on the collection definition and a monotonic refresh generation.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor

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)

The ordering is possible, but the window is narrow and it doesn't regress anything. The scheduler recounts at least 10 seconds after scan_complete. For an older result to land after it, a startup or hourly count of that same collection has to take its snapshot before the scan's writes commit and still be running 10 seconds after the publish. Each count runs sequentially with a 30-second timeout, so that takes an unusually slow count query. When it does happen, the collection shows the count it would have shown on main, and the next hourly pass corrects it. The same ordering already exists between the hourly pass and the recount on save, with no scan involved, so a fix belongs in the refresher for every writer, not in this PR. Leaving this open for the maintainers.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The race is real, but I agree that fixing every count writer can reasonably be a follow-up, if maintainers accept the residual risk.

The 10-second delay narrows the window for a single scan, but it is not a general guarantee that an older recount must run for 10 seconds after a scan finishes. The scheduler batches from the first notification: a second scan can finish just before the batch runs, leaving little delay between that scan and its recount. Recounts from schedulers on different nodes can also overlap.

The current update in internal/catalog/smart_count_refresher.go checks whether the count differs, not whether the result is newer or was computed from the current definition. So an older result can overwrite a newer one. This does not make the count staler than it would have been on main in that scenario, but it does qualify the PR’s claim that the count follows a scan after roughly 10 seconds.

I’d leave the suggestion open for the maintainers’ decision. If deferred, the PR should document the concurrency exception and track a fix covering all writers; a deterministic test that forces the older result to write last would help validate that fix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agreed: a scan that finishes just before a batch fires, or schedulers on two nodes, can narrow the gap. db4ec3a adds the exception to docs/architecture/collection-posters.md: recounts are unordered, an older one can finish last, and the next recount corrects it. Whether to make every count writer safe, and whether to track that separately, is for the maintainers to decide, so I'm leaving this thread open.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That sounds reasonable. The documented exception makes the remaining risk clear, and leaving the thread open gives maintainers a chance to decide whether to address or track it separately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Nov 9, 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 ❌

⚠️ Note: some checks couldn't be completed in this run, so auto-approval (when enabled) was skipped. Check the details at https://kodus.siloserver.org/pull-requests and then comment @kody review on this PR to retry once the issue is resolved.

@Quick104
Quick104 merged commit 2a554c3 into Silo-Server:main Nov 9, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Admins see a stale smart collection count after a scan adds or removes titles

2 participants