Skip to content

fix(scanner): keep multi-file audiobook chapters after playback - #3168

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/1253-multipart-audiobook-chapters
Oct 31, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/1253-multipart-audiobook-chapters

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1253
Validation tasks: changes #1254 C1; changes #1255 C3; changes #1256 C8; changes Silo-Server/silo-apple#339 C8; changes Silo-Server/silo-apple#340 C8; changes Silo-Server/silo-android#349 C8; changes Silo-Server/silo-android#350 C8

A multi-file audiobook (part1.mp3 … part10.mp3, no embedded chapters) loses its chapter list the first time anyone plays it. Afterwards the web detail page has no Chapters section, and every client loses chapter navigation for that book.

The scanner gives each file one chapter named after it. Audiobook scans don't record audio tracks, so on first playback the playback probe repair re-probes each part and replaces the stored chapters with what ffprobe finds, which for an mp3 is nothing. This change keeps chapters the reprobe can't reproduce, and lets the next scan restore books that already lost them.

Approach

  • In the playback probe repair, if the reprobe finds no chapters and none of the stored ones came from the file (source is not embedded), the stored chapters stay. Embedded chapters still follow the reprobe.
  • The unchanged-folder check now treats a multi-part book with a part that has no chapters as changed. Every part always gets a chapter from the scanner, so an empty one only comes from this bug, and the next scan rewrites it.

No API change: source stays empty for these chapters. jellycompat and the Audiobookshelf-compatible API read the same rows and benefit without changes.

Validation

  • New tests: the probe repair keeping scanner chapters but following embedded ones, and the unchanged-folder check reprocessing a book with wiped chapters. Both failed before the fix.
  • go test ./internal/scanner/... ./internal/playback/... ./internal/catalog/..., make lint-changed: pass.
  • Full gate on an integration build of this branch with the other Audiobooks #1253 fixes: see the summary on Audiobooks #1253.
  • Runtime: on the base build, all 10 parts of the test book had chapters: [] immediately after first playback. On the fix build, each part still has its chapter after playback, the detail page lists 10 chapters, and the player shows "part1" → "part2" across the file boundary.

Evidence

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

Surface and build: Web, audiobook detail page after one playback, desktop and phone width; before on e6df1d8ed, after on this branch; same synthetic files.

Risks

None identified. The repair still updates every other probed field.

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 (T3 Code)
  • Tool(s): Claude Code, Codex CLI, GitHub CLI, Playwright, Docker, ffmpeg
  • Model(s): claude-opus-5-5; gpt-6.1-sol (review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: Independent Claude Opus 5.5 and GPT 6.1 Sol reviews of the branch diff (correctness, repo standards, the bug as described). Neither found anything.

…e repair

The audiobook scanner gives each part of a multi-file book one chapter named
after the file. Those rows store no audio tracks, so the first playback runs
the critical probe repair, which replaced the chapters with the reprobe's
(none for an mp3) and wiped the book's chapter list.

The repair now keeps existing chapters when the reprobe finds none and none of
them came from the container. A multipart part with no chapters is no longer
treated as unchanged, so the next scan restores books already affected.
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Next included review available in 24 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: aed7110b-8f47-4452-9786-9dd9d58d160d
Commits

Reviewing files that changed from the base of the PR and between 62b1a6e and 85350b6.

Files selected for processing: 5
  • internal/scanner/audiobook_scan.go
  • internal/scanner/audiobook_test.go
  • internal/scanner/probe.go
  • internal/scanner/probe_repair.go
  • internal/scanner/probe_repair_audio_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Oct 27, 2026
@silo-kody

silo-kody Bot commented Oct 27, 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 evidence-required Needs before-and-after evidence before the Evidence check passes go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Oct 27, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 27, 2026

Copy link
Copy Markdown

The linked evidence is described as audiobook detail-page captures after playback, but it does not identify evidence for these additional visible effects:

  • internal/scanner/probe_repair.go: Add before-and-after player captures or a short recording showing chapter navigation across a multipart boundary.
  • internal/scanner/audiobook_scan.go: Add before-and-after desktop and phone detail-page captures showing chapters restored after a rescan of a multipart book with missing chapters.

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

Posted via Macroscope — Visible change evidence

@macroscopeapp

macroscopeapp Bot commented Oct 27, 2026

Copy link
Copy Markdown

The Validation tasks: line says unblocks #1256 C8, but that case is currently Not run; there is no failed or blocked recorded result to unblock. The scan-recovery change also reaches Audiobooks — Server C1 and Web admin C3, while the preserved chapter data feeds the Web, iOS/iPad, tvOS, Android phone/tablet, and Android TV C8 cases. Those task results are also Not run. Please replace the line with:

Validation tasks: changes #1254 C1; changes #1255 C3; changes #1256 C8; changes Silo-Server/silo-apple#339 C8; changes Silo-Server/silo-apple#340 C8; changes Silo-Server/silo-android#349 C8; changes Silo-Server/silo-android#350 C8

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

@Rhainland

Copy link
Copy Markdown
Contributor Author

Not adding player captures. The player's chapter list comes from the same chapter rows as the detail page, and the evidence page shows those rows kept after playback. The rescan recovery path writes the same rows; its test covers a multipart book with missing chapters.

@Quick104

Copy link
Copy Markdown
Contributor

Reviewed head 85350b6a5e4aeae078cc54d22e7dd2aaaf7e7353 against base 62b1a6e82408eb4be3409255583bf8b0a192a69f. No actionable findings remain.

Fit: 10/10 · Readiness: 9/10 — ready. This restores documented audiobook chapter behavior at the persistence boundary. The recovery check converges after a successful rescan, and the repair still follows embedded chapter metadata. The changed regression cases demonstrate both fixes; CI is green and the branch is mergeable.

Verification:

  • TestPlaybackProbeRepairKeepsChaptersTheProbeCannotReproduce and TestAudiobookFolderUnchanged pass on this head. With the changed tests copied onto the base, the synthetic-chapter preservation and wiped-chapter recovery cases fail for the reported reasons. The embedded-chapter and single-file cases pass on both.
  • The scanner and catalog package suites pass. The playback suite fails TestCopyRemuxSubtitleRenditionRealFFmpeg/{fmp4,mpegts}/seek; I reproduced the same missing-cue failures on the base. They do not establish a regression in this PR.
  • Local database tests were unavailable because SILO_TEST_DATABASE_URL was unset. I did not repeat live-server, browser, device, or Audiobookshelf-client testing. No formal model covers these changed files.

Validated features: re-check #1254 C1, the shared scan path in #1255 C3, and chapter navigation in #1256 C8, Silo-Server/silo-apple#339 C8, Silo-Server/silo-apple#340 C8, Silo-Server/silo-android#349 C8, and Silo-Server/silo-android#350 C8. The October 27 comments report integration testing on 62b1a6e82 plus #3165–#3173, including this fix; human acceptance remains pending. Those comments are newer than the task bodies' Not run rows. I found no regression against their stated criteria. The existing Validation tasks: line is appropriate. The validation script's PR command could not run with the installed GitHub CLI; I checked the linked task records directly. No validation records changed.

Compatibility and manual: the API shape and chapter source values stay the same. Web, Apple, Android, and Audiobookshelf readers use the restored rows; no client patch is required. Jellyfin excludes audiobooks. The current audiobook library and listening guides already describe one chapter per multipart file and chapter navigation, so this fix needs no manual issue.

The review covered the full diff, callers, persistence, failure paths, contracts, and rescan convergence, with three Codex finder passes, a validation pass, a final sweep, and one independent Claude Opus 5.5 round. Neither provider found a verified defect introduced by this PR. No code changes were needed.

Note

AI disclosure: gpt-6.1-sol in T3 Code using the Codex provider. The main review used xhigh effort; the Codex review agents used high effort. The independent second opinion used claude-opus-5-5 at high effort through T3 Code's Claude provider. Tools: GitHub CLI, Git, Go, and the Silo review and validation helpers. This is an AI-generated review posted as Quick104; it does not claim human acceptance.

@Quick104
Quick104 merged commit 1776b95 into Silo-Server:main Oct 31, 2026
16 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 evidence-required Needs before-and-after evidence before the Evidence check passes go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants