Repository navigation
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 |
|---|---|
Route played history through watched marking internal/userstore/jellycompat_progress.go, internal/watchstate/service.go, internal/userdb/jellycompat_progress.go, internal/userstore/pgstore/jellycompat_progress.go |
Both storage implementations pass history entries and watched targets to markWatchedBatchTx. Comments describe history creation for explicit played marks on leaves that are not already completed. |
Verify progress and history behavior internal/userstore/storetest/jellycompat_progress.go, internal/jellycompat/viewer_state_test.go, internal/userstore/pgstore/conformance_test.go, scripts/ci/db-contracts.txt |
Tests check repeated played edits, date-only and unplayed edits, and rollback after failed writes. A Postgres conformance test injects a progress-write failure and is added to the database-contract test list. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- Silo-Server/silo-server#3013: Both changes modify Jellyfin-compatible progress updates and their watched-history behavior.
- Silo-Server/silo-server#3010: Both changes use the shared watched-marking path and define behavior for repeated marks.
Suggested reviewers: quick104
Merge Risk: 
Minimal · up to 27924
-
First-time UserData plays retain their history entry, while repeated played updates do not duplicate it. No issue remains that requires a fix before merge.
Security architecture risk: 
Minimal · up to 27924
-
The change prevents duplicate history by reusing existing watched-state transactions. The reviewed changes preserve account and profile scoping, atomic updates, and notification ordering without adding access or permissions.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The changed mutation remains scoped to the selected account, profile, and media item. The inspected change affects history eligibility and associated progress or favorite state, rather than expanding authority to other accounts or services.
Trust Boundaries and Controls
- observed — The newly reused database helpers gate history insertion on identifiers returned by conditional progress updates, within the same transaction. This avoids a separate application-level eligibility check followed by an unconditional history write.
Resilience and Maintainability Implications
- observed — Errors before commit roll back the leaf mutation. Completion callbacks and interest-tracking updates occur only after successful writer return. Repeated successful completion writes can still notify downstream observers even when no history is added; that notification behavior predates this PR.
-
Pre-merge checks: 
3 · 
2
-
Failed checks: 2 warnings Passed checks: 3 passed-
Full details: Out of Scope Changes check
-
Explanation
The changes stay on the Jellyfin-compatible progress surface. The SQLite and Postgres store changes implement idempotent played-state handling and transaction rollback. The added tests and CI contract registration verify this behavior. The supplied change summary shows no unrelated UI, client, authentication, schema, or API changes.
-
Full details: Linked Issues check
-
Explanation
Issue
#2886explicitly requires aUserDatapost to set user data without recording a new play. The reviewed store code routesedit.HistorythroughmarkWatchedBatchTxin both SQLite and Postgres. The supplied PR evidence states thatRecordJellycompatProgressstill supplies this history entry forPlayed: true. Therefore, a first-time UserData-only played mark records a history row. The repeated mark is idempotent, and the CrossWatch sequence produces one row, but the first-time UserData behavior does not meet the issue's stated requirement.Resolution
Change the Jellyfin-compatible UserData path so
Played: trueupdates progress without inserting history. Keep history creation on the explicitUserPlayedItemsmark-played path. Update the UserData-only and atomic store tests to verify no history row from UserData, while retaining the duplicate-prevention regression test.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 10 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
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 Evidence table describes the change from two history rows to one, but includes no captures showing it. Please add before-and-after captures of the affected client's watch history using the same data, and identify the client and build or commit for each capture. The handler-test summary alone does not show the visible history change required by CONTRIBUTING.md. |
|
Jellycompat Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
Updated the Evidence section with same-data captures from the CrossWatch 0.13.6 request sequence on base |
Signed-off-by: 7487 <[email protected]>
Instead of dropping history for every leaf UserData played mark, add it only when the leaf is not already completed, the rule the mark-played path follows. The store decides inside the transaction with the same conditional progress write markWatchedBatchTx uses. A client that marks played only through UserData still records the play, and a repeat after UserPlayedItems or another UserData post adds no row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3f7f831 to
27924ac
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:
|
Maintainer review summaryReviewed head: 27924ac (rebased onto main; the branch history was rewritten). Addressed
Remaining: nothing. Tests that failed on the base
No live HTTP check on a sandbox. The handler test replays the client's request sequence, and the store contract covers both databases. Validated features: no passed case is in reach. The Jellyfin compatibility task (#1246) has no case run yet. User manual: unaffected. The watch-history page doesn't describe how compatibility clients' played marks are counted. Apple/Android parity: not applicable. This is a server-only fix to the Jellyfin-compatible surface, with no native API change. Cross-provider review: one round (gpt-6.1-sol) confirmed the finding and suggested deciding inside the store transaction, which the fix does. Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)
|
|
Idempotent writes in Suggested fix: No diff. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
Problem
Closes #2886
Related issue: N/A
Validation tasks: none
Some Jellyfin-compatible clients, CrossWatch among them, mark a movie or episode played and then save the same state through
UserData. Silo treated every leafUserDatawrite withPlayed: trueas a new play, so one play could appear twice in watch history, and a repeatedUserDatapost added another row each time. Watched state looked right, but anything counting history rows (statistics, watch-provider export) counted those plays twice.Approach
A leaf
UserDataplayed mark now follows the rule the mark-played route already has: a mark is idempotent per leaf. A leaf that is already completed gets no new history row, and an unmark resets it so the next mark records a play.RecordJellycompatProgressstill passes the history entry forPlayed: true.ApplyJellycompatProgressin both stores adds it throughmarkWatchedBatchTx, the conditional progress write that series and season marks use, inside the same transaction and before the explicit position, date, and favorite are written. The decision is made atomically in the database, so two concurrent posts record one play. A client that marks played only throughUserDatastill records the play, so history views and watch-provider export keep seeing it. ExplicitPlayed: falseand the completion notification behave as before.Validation
TestPlayedMutationsReturnCurrentDTOAndDatereplays the [bug] Jellyfin-compat POST UserData with Played: true adds a watch-history row every time, even when the item is already played #2886 sequence (UserPlayedItems, thenUserDatawithPlayed: trueand the same date) through the compatibility handlers. It fails on main with two rows and passes with one.TestUserDataZeroDateUsesCurrentTimechecks that aUserData-only mark records one play with the progress date. It failed against an earlier revision of this branch that droppedUserDatahistory altogether.RunAtomicJellycompatProgresschecks that a repeated played edit adds no row, that a failed played edit rolls back its history insert, and that a play after unmark records again. It runs on SQLite (internal/userdb) and, through the newTestPostgresAtomicJellycompatProgress, on a migrated Postgres 18 database; it fails on main's store code for both and passes with the fix. The Postgres test is listed inscripts/ci/db-contracts.txt.internal/jellycompat,internal/notifications,internal/userdb,internal/userstore/...,internal/watchstate.make lint-changedreports no issues.Evidence
Surface: Jellyfin-compatible movie and episode
UserDatapersistence. No Silo UI or client code changes. The v1GET /api/v1/historyresponse already collapses repeated rows for one item, so it's the same before and after. What changes is the persisted history that row-count and export consumers read.The #2886 sequence (
POST /UserPlayedItems/{id}?datePlayed=2025-02-03T04:05:06Z, thenPOST /UserItems/{id}/UserDatawith{"Played":true,"PlaybackPositionTicks":0,"LastPlayedDate":"2025-02-03T04:05:06Z"}) through the compatibility handlers, on main 1ec456e:A
UserData-only played mark, on this branch's first revision 3f7f831:The store contract on Postgres 18 with main's store code:
At 27924ac, all three pass:
Risks
UserDatakeep their existing batch-mark behavior.Checklist
AI Disclosure
UserData, and replaced it with the idempotent store-level mark described above, after a cross-provider review (gpt-6.1-sol) confirmed the finding and the repair.🤖 Generated with Claude Code