Skip to content

fix(markers): stop weak online markers replacing chapter markers - #2974

Merged
Quick104 merged 1 commit into
mainfrom
fix/markers-online-confidence
Oct 23, 2026
Merged

Quick104 merged 1 commit into
mainfrom
fix/markers-online-confidence

Conversation

@Quick104

@Quick104 Quick104 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: changes #1148 C1 and C2, and the marker times played in #1149 C1, Silo-Server/silo-apple#311 C1, Silo-Server/silo-apple#312 C1, Silo-Server/silo-android#321 C1 and Silo-Server/silo-android#322 C1 (all open, not run yet)

An online marker replaces a file's own chapter marker however unsure the provider is. Online and plugin markers outrank every local marker, so a TheIntroDB intro rated 0.10 from a single submission replaces the file's authored Opening chapter, which Silo rates 0.95. This hits every server in the default marker mode, online with local fallback, on each file that has both. Admins also have no way to tell Silo to ignore a provider's low-confidence markers.

This change keeps chapter markers over less confident online markers and adds a per-provider minimum confidence for lookups, which defaults to 0 (today's behavior).

Approach

  • Chapters against online markers. CanWriteMarkerUpdate compares a marker placed from the file's own chapters (chapter:v1, chapter:silence:v1, chapter:silence:v2, credits-chapter:v1) with an online or plugin marker by confidence. The higher one wins, and a tie goes to the online marker. A manual marker still wins over everything. Episode-version copies, Chromaprint, and audio or video credits keep plain source priority: their scales are not comparable with a provider's, and extending the rule to them would undo "online with local fallback".
  • Detection offers the chapter. The episode intro and credits chapter steps, and movie analysis, now try the file's chapter when its stored marker came online and the writer would accept the chapter. Without this, the rule could keep chapters but never restore one an online marker had already replaced.
  • Minimum confidence. marker_provider_config.fetch_min_confidence (new column, default 0) applies when provider results are merged. A marker below it takes no part, so the next provider or local detection fills that kind. A provider with a marker dropped this way counts as refreshed even when its answer came from the cache, so its stored marker of that kind is withdrawn. Local markers carry no provider and stay. Because the minimum is applied at selection time, a changed value reaches cached answers on the file's next lookup or refresh without fetching again. The nightly sync looks up only files whose cached answer is due, so with lazy playback off a raised minimum can take up to 30 days to reach a file, or one admin refresh.
  • API and web. The field is on /api/v2/admin/markers/providers only. The shared handler view hides it from the frozen v1 routes (json:"-"), and a v1 PUT cannot set it. The web provider tile shows it under Advanced as Minimum confidence to use markers.
  • Other surfaces. jellycompat MediaSegments reads through the same lookup and writer, so it follows. Neither silo-apple nor silo-android exposes marker provider settings; their vendored v2 fixtures pick up the new field on the next make apiv2-fixtures-sync.

Each path settles a file once and then leaves it:

Path Online marker rated below the chapter Online marker rated at or above the chapter
03:00 sync, then 03:30 detection Sync cannot replace a stored chapter. If sync wrote first, detection writes the chapter once; the next sync leaves it. Sync replaces the chapter. Detection skips the file.
Lazy playback (online first, then local) The lookup leaves the chapter. Local analysis runs only for the kinds the played file lacks; when it covers the kind, it replaces an online marker that arrived first, otherwise the nightly run does. The lookup replaces the chapter.
Admin refresh The refresh leaves the chapter. When a file lacks any kind, local analysis runs every enabled kind and replaces an online marker that arrived first. The refresh replaces the chapter.
on_demand overlay ApplyResult and OverlayOnline use the same rule, so the overlay keeps the stored chapter. The overlay shows the online marker.

Default for the minimum. Shared dev holds only 22 TheIntroDB markers with a real confidence. They were fetched after the plugin began requesting details=true, and all are rated 0.10 to 0.30 from one or two submissions. Earlier markers all carry the plugin's 0.9 fallback. Against the files' own chapters, 4% of those intros and 6% of those credits cover less than 80% of the chapter, and the three low-confidence intros that have a chapter cover all of it. Any minimum above 0.30 would drop every recent TheIntroDB marker. The data does not support a nonzero default, so it stays 0, and the chapter rule handles the low-confidence answers.

Shared-dev measurements (read-only, 23 October 2026)
TheIntroDB markers Count Confidence Submissions
Before details=true (intro / credits / recap cached) 74 / 197 / 78 all 0.90 (fallback) not reported
With details=true (intro / credits / recap / preview) 14 / 5 / 1 / 2 0.10 to 0.30 1 or 2
Online marker vs the file's chapter Pairs Cover < 80% of chapter Mean IoU
Intro, 0.9 fallback 303 13 (4%) 0.90
Credits, 0.9 fallback 53 3 (6%) 0.89
Intro, 0.10 3 (one episode, three versions) 0 0.45 (ends 13.5 s past the chapter)

Overlap with #2971. Both PRs change internal/markers/write.go, write_test.go, and types_test.go, in different places: #2971 edits ApplyResult and adds tests near the top of write_test.go and a row to the provider priority table; this PR edits CanWriteMarkerUpdate, adds rows to the scanner-algorithm table, and adds a test after the priority table. This PR does not touch population.go, population_test.go, or internal/scanner/file_repo.go. Expect a small textual merge and no semantic conflict: #2971 drops misplaced credits in selectResults, just before the merge where this PR applies the minimum.

Maintainer decisions

  1. Rule. This PR compares confidence. The alternative is "a chapter marker always outranks an online one". That is simpler and treats authored chapters as ground truth, but it also ignores a mislabelled chapter when a provider is confident. The TheIntroDB confidences seen so far are far below 0.95, so the two rules behave the same on current data.
  2. Movies. The nightly movie pass does not list movies whose credits came online, so a movie's credits chapter replaces weaker online credits only on re-detection. Listing them would put every such movie in each nightly run.
  3. Default 0. Revisit once TheIntroDB confidences have more submissions behind them.
  4. chapter:silence:v1 counts as chapter-derived. It is the legacy silence extension that ran too long; the backfill already rewrites it.

Validation

  • Go: build, gofmt, vet, make lint-changed (0 issues), make lint-router-recovery (0 issues), make migrate-validate passed. make test-go against a fresh migrated database: 185 packages passed, and TestV1AdminUserChangesKeepBreakGlassDB failed under full-suite load. It passes on its own on this branch and on main, and it does not touch markers.
  • Web: pnpm run lint (0 errors), format:check, build, budget:check passed. make test-web: 6440 of 6441 passed; pgs.test.ts "drops objects past 16 MiB" timed out under full-suite load and passes on its own. It does not touch this change.
  • Contracts and hygiene: settings bindings, playback fixtures, route inventory, migration ledger, scenario catalogs, offline routes, OpenAPI, contract diff (3 additive changes), fixtures, web types, TestCommittedArtifactMatchesRouter, local paths, case collisions, and actionlint passed. The contract diff first failed on the 78 merged [bug] v2 schema declares no format for dates, URLs, or language and country codes #2903 approvals in breaking-approvals.json; this PR removes them, as the contract doc asks of the next PR that changes the OpenAPI.
  • New tests cover the chapter rule in both directions, including ties and missing confidence, and that Chromaprint and copies keep source priority. They also cover the minimum yielding to the next provider and withdrawing a cached provider's stored marker while keeping local ones, the analyzer offering the chapter only over a weaker online marker, and the v2 field round trip and range check. A live TheIntroDB lookup was not run: the sandbox had no TheIntroDB key.
  • On an isolated sandbox built from this branch with the TheIntroDB plugin installed: v2 returned the field at 0, v1 omitted it and ignored it on PUT, the web field saved 30% as 0.3 and read it back after a reload, and v2 rejected 1.5 with 422.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/markers-online-confidence/

Surface and build: web admin, desktop (1440 px) and mobile web (390 px), main 31fabc7 against this branch, on the same sandbox data.

Risks

  • One migration adds a column with a default; existing rows read 0, so lookups behave as before until an admin sets a minimum.
  • On the first nightly run, each episode whose online intro is rated below its own intro chapter gets the chapter step, including one silence refinement, once.
  • Where online markers already replaced chapter markers rated above them, the chapter markers come back after the next nightly run. That is the intended change, but admins will see markers move.

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, running in T3 Code
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated; human verification pending
  • Adversarial review: A separate Claude Code review agent (claude-opus-5-5, read-only) went through the full diff and surrounding code. It checked which markers the new withdrawal can clear, whether online and chapter markers can flip between the nightly sync, local detection, playback, admin refresh, and the on_demand overlay, the processChapterCandidates restructure, v1 leakage, the SQL and migration, and the web tile. It found no correctness bugs. It found two doc inaccuracies: playback and admin refresh do run the chapter step when local analysis starts, and the nightly sync does not reach files whose cached answer is fresh. Both are fixed in the docs and in this description.

🤖 Generated with Claude Code

Note

Let file-owned chapter markers replace weaker online markers and add provider fetch_min_confidence setting

  • Chapter markers (intro, credits, movie credits) can now replace an online/provider marker when the file's own chapter has higher confidence. Manual and other protected markers are untouched. The decision uses markers.CanWriteMarkerUpdate via the new intromarkers.Candidate.yieldsToChapter helper in kind.go, with rules in write.go.
  • Adds a per-provider fetch_min_confidence setting (0–1 range, default 0). Provider lookups now drop markers below the threshold in markers.mergeProviderResults (types.go), and the filtered provider is marked refreshed so its cached marker is withdrawn.
  • The setting is persisted via migration 20261023155414, exposed in the v2 admin API (admin_catalog_marker_providers.go), and editable as a 0–100% input in the admin provider settings UI (MarkerProviderTile.tsx).
  • Updates docs for the markers API, admin catalog API, and intro detection architecture.
  • Behavioral Change: markers.CanWriteMarkerUpdate now gives providers tie wins and lets higher-confidence chapters beat providers; registries without a config store keep the zero threshold, so filtering only applies to configured providers.

Macroscope summarized 4f99817.

An online marker replaced a file's own chapter marker however low the
provider rated it, so a TheIntroDB intro at 0.10 from one submission
replaced an authored Opening chapter at 0.95.

CanWriteMarkerUpdate now weighs a marker placed from the file's own
chapters against an online or plugin marker by confidence, with ties
going to the online marker. Local detection offers the chapter over a
stored online marker the writer would replace. Chromaprint, audio and
video credits, and version copies keep source priority.

Each marker provider gains fetch_min_confidence (default 0, today's
behavior). Markers below it take no part in provider selection, and the
provider's stored marker of that kind is withdrawn even when its answer
came from the cache. The field is exposed on the v2 admin provider API
and the web provider tile; the frozen v1 routes neither return nor
accept it.

Also prunes the merged #2903 entries from breaking-approvals.json, which
the contract gate requires of the next PR that changes the OpenAPI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. label Oct 23, 2026
@silo-kody

silo-kody Bot commented Oct 23, 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 ❌

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T16:36:12.900851Z 4f99817 PR opened
🔒 Security Review ✅ Completed 2026-10-23T16:38:01.303834Z 4f99817 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ 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: c5c9da6f-2470-4bd0-970e-9f2f449fce43
📥 Commits

Reviewing files that changed from the base of the PR and between 31fabc7 and 4f99817.

📒 Files selected for processing: 26
  • contracts/api/v2/breaking-approvals.json
  • contracts/api/v2/fixtures/admin_marker_providers_list.json
  • contracts/api/v2/fixtures/admin_marker_providers_update.json
  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • docs/architecture/intro-detection.md
  • docs/markers-api.md
  • internal/api/handlers/admin_marker_providers.go
  • internal/apiv2/admin_catalog_marker_providers.go
  • internal/apiv2/admin_catalog_marker_providers_test.go
  • internal/intromarkers/analyzer.go
  • internal/intromarkers/analyzer_credits.go
  • internal/intromarkers/analyzer_credits_test.go
  • internal/intromarkers/analyzer_movie.go
  • internal/intromarkers/analyzer_test.go
  • internal/intromarkers/kind.go
  • internal/markers/provider_config.go
  • internal/markers/types.go
  • internal/markers/types_test.go
  • internal/markers/write.go
  • internal/markers/write_test.go
  • migrations/sql/20261023155414_add_marker_provider_fetch_min_confidence.sql
  • web/src/api/types.ts
  • web/src/api/v2/schema.ts
  • web/src/pages/admin-settings/MarkerProviderTiles.tsx
  • web/src/pages/admin-settings/ProvidersSettings.test.tsx

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

📝 Walkthrough

The change adds a configurable minimum confidence for fetched provider markers, exposes it in v2 admin settings, and filters provider results below the threshold. It also changes marker-update precedence so file chapter markers and online markers can replace one another based on confidence.

Changes: Marker confidence controls

Layer / File(s) Summary
Persist and apply provider fetch thresholds
migrations/sql/*, internal/markers/provider_config.go, internal/markers/types.go, internal/markers/types_test.go, docs/markers-api.md
Provider configuration now stores a minimum fetch confidence. Result merging filters markers below the configured threshold and tracks refreshed providers. Tests cover fallback to another provider and withdrawal of a stored online marker when no result meets the threshold.
Expose fetch thresholds in admin settings
contracts/api/v2/*, internal/api/handlers/admin_marker_providers.go, internal/apiv2/admin_catalog_marker_providers.go, internal/apiv2/admin_catalog_marker_providers_test.go, web/src/api/*, web/src/pages/admin-settings/*, docs/admin-catalog-api.md
The v2 admin API and settings UI accept, validate, display, and save the fetch-confidence threshold. The OpenAPI schemas, fixtures, tests, and admin documentation include the field.
Compare chapter and online marker confidence
internal/markers/write.go, internal/markers/write_test.go, internal/intromarkers/*, docs/architecture/intro-detection.md, docs/markers-api.md
Marker updates compare file chapter confidence with provider marker confidence. Intro and credits analysis can apply chapter results when they outrank an existing online marker. Tests cover confidence comparisons and analysis results.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~35 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant AdminSettings
  participant AdminCatalogAPI
  participant ProviderConfig
  participant MarkerProvider
  participant PopulationRegistry
  AdminSettings->>AdminCatalogAPI: Submit fetch_min_confidence
  AdminCatalogAPI->>ProviderConfig: Update provider configuration
  MarkerProvider->>PopulationRegistry: Return marker results
  PopulationRegistry->>PopulationRegistry: Filter results by configured minimum confidence
Loading

Suggested labels: bug, go, javascript, api-v2, priority: P2, impact: usability, size/XL

Suggested reviewers: rhainland

Merge Risk: ⚪ Minimal · up to 4f998

No confirmed issue blocks merging after normal checks.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 47.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 17 files. (9 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 summarizes the primary marker-precedence change: weaker online markers no longer replace chapter markers.
Description check Passed The description directly explains the marker-precedence change, provider confidence setting, API and UI updates, documentation, testing, and known validation results.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 47.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 17 files. (9 skipped: 8 unsupported, 1 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • 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.

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish labels Oct 23, 2026
@coderabbitai coderabbitai Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase impact: usability Core flow broken or severely blocked size/XL 500–999 added + deleted lines (all files); change volume, not priority. labels Oct 23, 2026
@silo-triage silo-triage Bot removed the size/XL 500–999 added + deleted lines (all files); change volume, not priority. label Oct 23, 2026
@Quick104
Quick104 merged commit 88be752 into main Oct 23, 2026
20 checks passed
@Quick104
Quick104 deleted the fix/markers-online-confidence branch October 23, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase bug Something isn't working go Pull requests that update go code impact: usability Core flow broken or severely blocked javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant