Skip to content

fix(markers): stop re-selecting files every sharing provider declines - #2689

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/2468-intro-share-unacceptable-candidates
Oct 21, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/2468-intro-share-unacceptable-candidates

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #2468
Related issue: N/A
Validation tasks: reaches #1148 C2 (automatic sharing to TheIntroDB; case not run yet)

The Share detected markers task picked the same episode files on every run when a provider could never accept them. A provider declines a file without recording a claim when the series lacks an external ID the provider requires (TheIntroDB before v0.2.0 requires a TMDB ID), or when the marker's confidence is below that provider's own minimum. The candidate query didn't know about either rule: it filtered on the lowest minimum across providers, built the claim key TMDB first, and dropped a file only once every provider held a claim. So each run resolved the file's IDs again, skipped it, and added it to the task's skipped count. This affects servers with automatic sharing on, mostly libraries with TVDB-only series or several sharing providers with different minimums.

This change makes the candidate query check each provider on its own, so a file every provider declines is not selected. It becomes eligible again when the reason changes, for example when the series gains a TMDB ID or the intro is re-detected with higher confidence.

Approach

CandidateLocalMarkerFiles now takes each provider's minimum confidence and required external IDs. A file is a candidate while at least one provider would submit it: the marker meets that provider's minimum, the series has every ID it requires, and the provider holds no claim under the key it submits with. That key is the same one contributionTargetKey builds in Go (first required ID, else TMDB, TVDB, IMDb). Series with no external ID are excluded, matching the existing HasAnyID check.

The task now gets its providers from ContributionService.AutoContributors() instead of reading the config store and asking AcceptsContributions per provider. It lists the registered submitters with automatic sharing on, so fetch-only and unloaded providers stay excluded, as #1785 made them on main, and AcceptsContributions is removed.

The query reads current data instead of storing a "declined" row, so there is nothing to invalidate when the inputs change. Server-only change: no API, client, or jellycompat surface is affected. docs/markers-api.md states the selection rule.

Validation

  • New DB-backed test runs the real task, store, service, and resolver with two providers (one requiring TMDB at 0.9, one requiring TVDB at 0.97). On main it fails because the second run selects both declined files again. With this change it passes, and it also covers the files becoming eligible again. It is listed in scripts/ci/db-contracts.txt with a new store test for the per-provider rules.
  • go test ./internal/markers/... ./internal/taskmanager/... against Postgres: pass.
  • make test-db-contracts: all 275 pass.
  • make lint-changed: 0 issues.
  • End to end on a local server with TheIntroDB at its last pre-v4 commit (requires a TMDB ID), pointed at a local stub of its API. Nothing was sent to TheIntroDB. Seed data: one TVDB-only series and one TMDB series, each with an S1E1 scanner intro.

Evidence

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

The page shows the Share detected markers row of the web admin marker tasks card (Admin > Settings > Playback) and the task's execution history, at desktop and phone width, after two runs on the same seed data. Before is built from 365e3d436, after from 1c2ab7f4d. Run counts from the end-to-end run, including the runs after the series gains a TMDB ID:

main, run 1:   submitted 1, skipped 1
main, run 2:   submitted 0, skipped 1   (TVDB-only file selected and skipped again)

this branch, run 1:   submitted 1, skipped 0
this branch, run 2:   submitted 0, skipped 0
series gains a TMDB ID, run 3:   submitted 1, skipped 0   (stub received the intro for tmdb_id 1399)
this branch, run 4:   submitted 0, skipped 0

Risks

Claims written before the target_key migration use TMDB-first keys. A provider that keys submissions by TVDB or IMDb would not see those legacy claims and could submit once more after upgrade. No current marker plugin keys that way: TheIntroDB v0.1.x keys by TMDB and v0.2.0 declares no required IDs.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • 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 (review)
  • Model(s): claude-opus-5-5; gpt-6.1-sol
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: independent reviews of the full branch diff by claude-opus-5-5 and gpt-6.1-sol, reconciled. GPT found nothing. Opus raised the legacy-claim case under Risks, which was checked against the published marker plugins and left as documented.

Note

Apply per-provider rules in marker file candidate selection

  • Previously the marker contribution task used one shared confidence threshold and a provider-name list; now each registered automatic provider applies its own confidence threshold, required series external IDs, and target-key claim rules
  • contribute.go adds ContributionService.AutoContributors, which lists enabled automatic providers with their settings, and the task gets this list from the runner instead of a separate configuration reader
  • contribution_repo.go rewrites CandidateLocalMarkerFiles so a file is selected when at least one provider would submit it. A file declined by every provider is not returned again until a confidence, identifier, or claim condition changes
  • Adds database contract tests for per-provider eligibility and declined-file re-selection, and registers them in db-contracts.txt
  • Behavioral Change: ContributionCandidateSource and ContributionRunner interfaces changed shape; any out-of-tree implementations must be updated. The old single-provider acceptance method and the shared threshold/provider-name arguments were removed

Macroscope summarized 83ddbf4.

@silo-triage silo-triage Bot added the size/XL 500–999 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 ❌

@silo-triage silo-triage Bot added bug Something isn't working priority: P2 Limited scope, workaround exists, or polish labels Oct 19, 2026
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cdadf300-3cfb-4377-a314-6a3ea0afa792
📥 Commits

Reviewing files that changed from the base of the PR and between 365e3d4 and 1c2ab7f.

📒 Files selected for processing: 10
  • cmd/silo/main.go
  • docs/markers-api.md
  • internal/markers/contribute.go
  • internal/markers/contribute_test.go
  • internal/markers/contribution_repo.go
  • internal/markers/contribution_repo_test.go
  • internal/taskmanager/tasks/contribute_markers.go
  • internal/taskmanager/tasks/contribute_markers_db_test.go
  • internal/taskmanager/tasks/contribute_markers_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; 0 remain after this review.

📝 Walkthrough

Automatic marker contribution now passes each enabled provider’s minimum confidence and required external IDs to candidate selection. The query selects files when at least one provider meets its requirements and has no blocking claim. The task no longer requires a separate provider configuration reader.

Changes: Automatic marker contributions

Layer / File(s) Summary
Load automatic contributors and wire the task
internal/markers/contribute.go, internal/markers/contribute_test.go, internal/taskmanager/tasks/contribute_markers.go, internal/taskmanager/tasks/contribute_markers_test.go, cmd/silo/main.go
The contribution service returns registered submitters enabled for automatic local contributions, with their minimum confidence and required external IDs. The task passes these records to candidate selection and no longer accepts a separate configuration reader.
Apply provider-specific candidate rules
internal/markers/contribution_repo.go, internal/markers/contribution_repo_test.go
Candidate selection checks each provider’s confidence threshold, required IDs, and claim target. Tests cover provider combinations, claims, candidate order, and marker kinds.
Verify declined-file reselection and document selection rules
internal/taskmanager/tasks/contribute_markers_db_test.go, docs/markers-api.md, scripts/ci/db-contracts.txt
A database-backed test checks candidate selection after provider declines, changes to series IDs or confidence, and submitted claims. The documentation and database-contract list include the selection behavior.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: quick104

Merge Risk: ⚪ Minimal · up to 1c2ab

The reported provider-key mismatch does not occur on the inspected plugin path; no actionable merge-blocking issue remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 8 files. (2 skipped: … 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 and concisely describes the primary fix: preventing repeated selection of files that all sharing providers decline.
Linked Issues check Passed Issue #2468 requires the server task to stop re-selecting files that a provider cannot accept because of required external IDs or provider-specific confidence. The change passes each registered automa…
Out of Scope Changes check Passed The changes stay within issue #2468. The task wiring, AutoContributors() method, candidate-query update, focused unit and database tests, CI registration, and marker API documentation all support pr…
Description check Passed The pull request description directly explains the marker candidate-selection bug, the per-provider eligibility changes, affected task interfaces, tests, validation, and documented risks. It matches t…
Full details: Linked Issues check

Explanation

Issue #2468 requires the server task to stop re-selecting files that a provider cannot accept because of required external IDs or provider-specific confidence. The change passes each registered automatic provider's minimum confidence and required IDs to candidate selection, uses the provider submission key, and excludes files when no provider can submit them. AutoContributors() also excludes unregistered or non-automatic providers. The task and repository tests cover repeated selection and renewed eligibility after IDs or confidence change. The documented test results report database-contract and package test success.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #2468. The task wiring, AutoContributors() method, candidate-query update, focused unit and database tests, CI registration, and marker API documentation all support provider-aware candidate selection. No unrelated API, client, or jellycompat change is reported. The exported signature changes are required by the server-side implementation and are limited to the affected internal contribution interfaces.

Full details: Description check

Explanation

The pull request description directly explains the marker candidate-selection bug, the per-provider eligibility changes, affected task interfaces, tests, validation, and documented risks. It matches the changeset.

Full details: Docstring Coverage

Explanation

Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 8 files. (2 skipped: 2 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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@macroscopeapp

macroscopeapp Bot commented Oct 19, 2026

Copy link
Copy Markdown

The change is visible in the web admin: the marker-task card and task-history screen render submitted/skipped counts that this change alters. The run-count text is not before-and-after screen evidence and does not identify the capture builds or commits. Suggested fix: attach before-and-after captures of these results using the same test data, with desktop and phone-width captures where visible, and identify the surface and build/commit for each.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

The Share detected markers task picked candidates with the lowest minimum
confidence across providers and a fixed TMDB, TVDB, IMDb claim key, and
dropped a file only once every provider held a claim. A provider that
declined a file without claiming it (a series missing an external ID the
provider requires, or a marker below that provider's own minimum) left the
file a candidate, so every run resolved and skipped it again.

The candidate query now checks each provider on its own: the marker must
meet its minimum confidence, the series must carry every ID it requires,
and its claim is looked up under the key it submits with. A file every
provider declines is no longer selected, and it becomes eligible again when
the series gains the ID, the confidence rises, or the settings change. The
provider list comes from the contribution service, so only registered
submitters with automatic sharing on are considered.

Closes Silo-Server#2468
@Quick104
Quick104 force-pushed the fix/2468-intro-share-unacceptable-candidates branch from 1c2ab7f to 83ddbf4 Compare October 21, 2026 16:22
@Quick104

Copy link
Copy Markdown
Contributor

Maintainer review of 83ddbf40c. Nothing for the author to change.

Rebase. The branch conflicted with main, so I rebased it onto current main and force-pushed with a lease on 1c2ab7f4d. Two main changes overlapped:

  • fix(markers): let marker plugins opt out of contributions #1785 added ContributionService.AcceptsContributions so the share task skips fetch-only plugin providers. AutoContributors() already lists only registered Submitters, and the fetch-only wrapper doesn't implement Submitter, so I kept this PR's version and removed AcceptsContributions, which had no other caller. I updated the Approach paragraph in the description to match.
  • test: remove low-value and never-run tests #2817 deleted several contribution tests that this branch had edited. The rebase keeps those deletions and this PR's new tests, and drops the autoContributors test helper that only the deleted tests used.

Findings. No defects found. Two known limits remain for the maintainers:

  • The legacy-key risk under Risks has one more effect. For a provider whose first required ID isn't TMDB, a claim written before the target_key migration also makes the query select that same file on every run, which the old TMDB-first query avoided. Main has the same problem for every newer claim from such a provider, and no published marker plugin keys that way today, so this is not a blocker.
  • The query trims IDs with BTRIM (spaces only) and Go uses strings.TrimSpace. An ID stored with a tab or newline would get mismatched keys. Main's query didn't trim at all, so this isn't new.

Verification

  • TestContributeMarkersTaskDoesNotReselectDeclinedFiles doesn't build on main because the constructor changed. I ported it to main's constructor: it fails there ("second run selected [12 13]") and passes on this head.
  • go test for internal/markers, internal/taskmanager/... and cmd/silo, with the contribution DB tests run against Postgres 18: pass.
  • make lint-changed: 0 issues.
  • Review covered three finder angles, a validation-impact check and a cross-provider read-only round with gpt-6.1-sol, which found nothing new.

Validated features. No passed case is affected. #1148 C2 (automatic sharing to TheIntroDB) is reached but not yet run, as the description says.

User manual. Not affected: siloserver.org doesn't describe how this task selects files.

Apple/Android. Server-only change: no API, client or jellycompat surface.

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

Fit: a bounded fix to a server task's selection query. It derives eligibility from current data instead of storing declined rows, so a file becomes eligible again on its own when a series gains an ID or a marker's confidence rises. Readiness: the fix is shown by a test that fails on main. The remaining limits are pre-existing or disclosed, and they affect no plugin published today.

Review by Claude Code (claude-opus-5-5) with a gpt-6.1-sol cross-check.

@silo-kody

silo-kody Bot commented Oct 21, 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 merged commit 9e5ce03 into Silo-Server:main Oct 21, 2026
16 checks passed
rangoDJ added a commit to rangoDJ/silo-server that referenced this pull request Oct 24, 2026
contribute.go: this branch imports regexp and main (Silo-Server#3000) imports math;
keep both.

Main (Silo-Server#1785, Silo-Server#2689) dropped the task's config argument: the providers that
contribute automatically now come from the runner's AutoContributors. This
branch's three tests set up a provider through the removed fakeAutoConfig;
they now set the fake runner's auto contributors instead and call the
three-argument constructor. What they check is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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/XL 500–999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Share intro markers re-selects episodes a provider can never accept on every run

2 participants