Skip to content

[bug] A completion in the same second as an earlier partial stop adds no completed history row #5366

In review

Description

@Quick104

What happened

When an item is completed in the same whole second as an earlier partial stop for it, the item is marked played but no completed history row is added, so its play count is one short. Seen through webhook sync; the same code serves other progress writers.

Steps to reproduce

  1. Send a stop event for an item at a partial position.
  2. Within the same second, send a completion (played) event for the same item and profile.
  3. Read the item's watched state and history.

Expected behavior

A completed play is recorded even if a partial one landed in the same second.

Actual behavior

The item is played, but history has only the partial row.

Cause

AddHistoryIfMissing (internal/userstore/pgstore/progress.go:1486) treats any history row in the same whole second as the same play (NOT EXISTS at line 1534) and ignores completed, so the earlier partial row blocks the completed one. Webhook sync reaches it through internal/webhooksync/service.go:461 → internal/watchstate/service.go:317 → :672. The same-second rule guards against the import double-count fixed in #3433.

Silo version / commit

2970 · a16a24720 (local sandbox). Found during agent runtime testing for validation task #1238.

Evidence: https://evidence.siloserver.org/r/silo-server/v1-validation-1238/

AI disclosure

  • AI harness: Claude Code (in T3 Code).
  • AI tools: GitHub CLI, curl.
  • AI models: claude-sonnet-5-5 (testing), claude-opus-5-5 (verification and this report).
  • AI involvement: fully AI-generated. No person has reproduced it yet; filed at the maintainer's direction.
  • Independent review: a separate claude-opus-5-5 agent traced the code path above.

Filed with Claude Code (claude-sonnet-5-5 testing, claude-opus-5-5 verification) and GitHub CLI at the maintainer's direction.

Activity

  1. added
    bug
    on Nov 26, 2026
  2. added
    priority: P2
    triaged
    on Nov 26, 2026
  3. Rhainland commented on Nov 26, 2026

    @Rhainland
    Contributor

    Reproduced on origin/main at 0ad67a01e: through a Jellyfin webhook connection, a PlaybackStop at a partial position and then a TogglePlayed played mark half a second later left the movie played, with only one partial history row and no completed play.

    Cause: AddHistoryIfMissing skips an imported watch when the item already has a play in the same second, and it didn't check completion, so the earlier partial row hid the completion. The SQLite store had the same check.

    Fix in #5403: a partial play no longer hides a completion in its second, on both stores. A replayed import is still skipped. Checked on a local build of the fix: the same two webhooks now leave a partial row and a completed row, and sending them again adds nothing. A shared conformance test covers both stores, including replays and a partial stop after a completion.

    AI disclosure: reproduced and fixed by Claude Code (claude-opus-5-5) at the maintainer's direction.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: P2triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions