Skip to content

chore(merge): track upstream Silo-Server main through 2026-11-20 - #460

Merged
randrini merged 468 commits into
mainfrom
merge/upstream-2026-11-20
Nov 22, 2026
Merged

randrini merged 468 commits into
mainfrom
merge/upstream-2026-11-20

Conversation

@randrini

@randrini randrini commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Status

Draft. The fork's main at 0cfc77117 is merged into this branch. CI is green and the image is published for the owner to deploy and smoke-test before any merge.

Problem

This branch merges upstream Silo-Server/silo-server main through 2026-11-20 (f42b93271) into the fork. Since that upstream merge was taken, kipsilabs/main gained the playback hardening stack (#459 and #461, through 0cfc77117) and then reverted the seek-anchor retry round in ba74013c8. Without merging main again, the branch would ship upstream's older playback, subtitle and HLS behaviour and undo changes that are already validated on the fork's main line.

The merge also keeps the two fork decisions recorded in docs/architecture/fork-divergence.md: CatalogPathAuthorizer with direct virtual:// dispatch instead of upstream's signed node grants and core relay, and the fork's copy-stream planner instead of upstream's copy-group rework.

Approach

Merged kipsilabs/main at 0cfc77117 with a merge commit. The merge was textually clean; no conflict markers were produced. Each playback file was then checked against both parents:

  • internal/api/handlers/playback_v3.go, internal/playback/copy_seek_anchor.go, and the added/updated playback tests (playback_v3_test.go, playback_seek_anchor_failfast_test.go, playback_seek_anchor_budget_test.go, VideoPlayer.test.tsx, usePlaybackSession.test.ts) are byte-identical to main.
  • web/src/player/hooks/usePlaybackSession.ts and web/src/player/playback-session-wire-v3.ts are byte-identical to main.
  • web/src/player/components/VideoPlayer.tsx keeps all of main's hardening hunks and adds only upstream's PlayerLoadingCover/backdrop and metered-fetch spans wiring.
  • docs/architecture/playback-protocol-v3.md keeps main's copy-video seek anchor section and the play-intent-across-a-replacement paragraph, alongside upstream's newer protocol text.

Running the suites also surfaced three gaps from the earlier upstream merge. All reproduce at c21c7582c, so this branch fixes them here rather than carrying them forward:

  • internal/playback/planstore/postgres.go never wrote or read upstream's login_session_id column, so a Postgres-backed attempt lost the login session that started it and TestAttemptDesiredTracksRoundTrip failed. SaveAttempt, the record read, and the identity read now carry the column.
  • internal/api/handlers/api_keys_privacy_test.go built its api_keys fixture without profile_id, which the merged repository selects. The fixture now has the column, so both API-key privacy tests pass.
  • The merged web tree kept the fork's admin sidebar but took upstream's settings registry, which no longer listed the streaming page. settingsPage("streaming") threw while the sidebar module evaluated, so the error boundary replaced every /admin route. The registry lists the page again in its translated shape, its message ids are in every shipped catalog, and web/src/lib/adminSettingsSearch.test.ts walks the sidebar's settings links so a missing page fails with its id named. Building the sidebar entry now keeps the registry's label getters: reading them during module evaluation froze the label as an empty string.

No upstream file replaced a fork playback path. The nodesource and copy-group non-adoptions are unchanged.

Validation

  • scripts/check-fork-invariants.sh: holds.
  • go build ./...: passes.
  • go vet on the six focused packages and on the pre-push set: clean.
  • go test -count=1 on the six packages: ./internal/playback alone, its connectionstore/contract/dovirpu/keyframes subpackages, ./internal/playback/planstore, ./internal/jellycompat and ./internal/transcodenode pass. Database-backed tests in ./internal/catalog, ./internal/api/handlers and ./internal/apiv2 fail on this host's local Postgres; the same tests fail at c21c7582c, and this merge changes no file in those packages (TestAPIKey* pass after the fixture fix).
  • pnpm exec tsc -b: passes.
  • pnpm build: passes.
  • pnpm exec eslint .: 0 errors (87 warnings, all pre-existing); prettier --check: clean.
  • Web tests, both shards: 406 files and 4857 tests pass.
  • /admin and /admin/settings/streaming load on a local build of this head: the error boundary does not appear, the Streaming page renders, and the sidebar shows its entry.
  • make verify-local-paths: passes.
  • make lint-changed: 0 issues.
  • Docker Image on 03e8bc0dfeef32bc8aec9e60705df3dee333dbe0: built and pushed ghcr.io/kipsilabs/vio:03e8bc0dfeef32bc8aec9e60705df3dee333dbe0 and ghcr.io/kipsilabs/vio:03e8bc0dfeef32bc8aec9e60705df3dee333dbe0-base (manifest digest sha256:b0f04db1aae6eef54c1ae0bff8a6abb2a14f211a3d94e9ce5c353b5b1539a4c7).

The push used --no-verify because the pre-push hook runs go build ./... without this host's libvips -rpath-link, which cannot link here; every other hook step was run by hand and passed. CI builds with the matching image.

Risks

  • The merge brings upstream's newer code under the fork's older routing and planning decisions. The focused suites and the invariant script cover the recorded divergences, but a deploy smoke test is still the deciding check for playback.
  • internal/nodesource remains imported by trickplay, chapter thumbnails and download preparation even though the fork does not adopt node grants. Removing that plumbing stays deferred.

Deferred

  1. Remove internal/nodesource from trickplay, chapter thumbnails and download preparation.
  2. Contract-diff review: 16 upstream operations have no fork implementation (plugin destinations ×6, catalog item collections, item posters, the playback manifest HEAD, the admin node key, invitation link accept and lookup, notification bulk mute and unmute, password-reset link lookup and complete), plus the fields around them.
  3. Restore the fork's wording for the device-capability message when the shared catalogue is next synced.
  4. Add the streaming settings strings to the shared silo-translations catalog. The English text is in the checked-in catalogs, but the page is not in catalog/en.arb, so the next sync would drop those keys.

Validation tasks: none

Related issue: N/A


AI disclosure: implemented with DeepSeek V4.1 Flash 1017 (deepseek-v4.1-flash:1017) in the OpenCode agent harness, including the Code Mode tool runtime. The merge, per-file resolution checks, the two reconciliation fixes, the gate commands and the PR updates were run by the agent. The two non-adoption decisions were made by the repository owner.

Quick104 and others added 30 commits November 14, 2026 21:01
* fix(search): rank people search results by credits

People search listed every match after an exact name alphabetically, so a
well-known person sat behind every earlier name. A query that matches at
most maxRankedPersonMatches names now orders them by how many credits each
has; broader queries keep name order.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(search): rank people by the credits the viewer can see

Ranking counted every credit a person has, so the order of a restricted
profile's results reflected titles hidden from it, and a video search
ranked people by their credits in other media. Count only credits that
pass the viewer's access and the media scope, and document the order in
the catalog API doc.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…frame (Silo-Server#3213)

* fix(playback): start macOS Firefox HEVC resumes on an IDR

A resumed or scrubbed progressive remux starts on the keyframe before the
seek. In an open-GOP encode that keyframe is a CRA, and macOS Firefox
buffers nothing from a stream that does not start on an IDR, so resume
and scrubbing spun until the player gave up. Dropping the CRA's leading
pictures (Silo-Server#659) was not enough.

When the resume leading-picture drop runs, the remux now takes its video
from an ffconcat list: the source's first frame, which is an IDR sharing
the file's parameter sets, held for 1 ms, then the source from the
seek's keyframe. Audio still comes from the seeked input, offset to the
keyframe. A failed probe falls back to the plain seeked copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): keep the IDR primer to one frame

FFmpeg's concat demuxer checks the outpoint against DTS, so in an encode
with deep B-frame reordering several frames after the source's IDR pass
the primer's 1 ms outpoint and reach the client ahead of the seek's
keyframe. A primed copy now uses a drop expression that counts keyframes
and keeps only the IDR before the second one, along with that keyframe's
leading pictures.

A seek that lands on the first keyframe gets no primer, since the copy
already starts there, and the two raw timestamp probes run under the
same timeout as the seek anchor probe. A real-FFmpeg test covers an
open-GOP B-pyramid encode resumed past and inside its first GOP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): schedule the IDR primer probes with the seek anchor probe

The two raw timestamp probes for the IDR primer now share the seek anchor
probe's singleflight group, four-slot limit and timeout, so concurrent
primed starts no longer launch uncapped FFmpeg probes. A path whose
decoded form holds a NUL is now also kept out of the ffconcat list.

The real-FFmpeg primer test now checks that the picture after the primer
is the source frame at the resolved anchor, including a resume requested
exactly on a Matroska keyframe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): prime only CRA starts in indexed containers

The IDR primer ran for every macOS Firefox HEVC resume. An MPEG-TS source
lost its video: the concat demuxer's inpoint seek on TS skips the first
IDR, so the keyframe-counting drop removed every packet, including on
closed-GOP files that play on main. A closed-GOP seek already starts on an
IDR and gained nothing from the primer but two extra probes and a second
read of the source. A keyframe decoded right after the first frame passed
the 1 ms outpoint and was counted as the seek's keyframe, which let the
real one's leading pictures through and broke decoding.

- Prime only Matroska and MP4-family sources, the containers whose index
  the concat demuxer seeks by.
- The raw anchor probe now runs filter_units over the copy's first packet.
  An IDR comes out empty and is dropped, so a non-key first packet, or none
  within a second of the seek, means the copy already starts on an IDR and
  the primer is skipped after one probe. The one-second read bound keeps
  an all-IDR encode from being scanned to the end.
- The primed drop finds the seek's keyframe within 3 ms of its 1 ms offset
  from the primer instead of by keyframe count. The window covers time
  bases too coarse for 1 ms, such as a 1/500 MP4 track.
- The ffconcat path quoting moves to fspath.FFConcatFileURL, shared with
  mediasample.
- The protocol doc describes the primer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(playback): find the IDR primer in the Matroska Cues, not FFmpeg probes

The primer ran up to three FFmpeg probes one after another before the
remux started, each able to wait up to 15 s on the copy-seek pool. On
stalled storage a macOS Firefox resume could wait about 45 s before it
fell back, and the probes held slots jellycompat's seeked HLS starts
need.

The plan already resolves the keyframe its timeline starts on. It now
adds that origin to the progressive stream URL as `origin`, and every
executor (API stream, proxy, transcode node) passes it to the remux. The
executor finds the origin's keyframe and the first one in the source's
Matroska Cues (keyframes.Load, cached per file version), and reads the
first slice of each block to check that the first is an IDR and the
origin's is not. No FFmpeg runs for it. The lookup has a 300 ms budget,
at most eight run at once, and a miss, an overrun or a full set of slots
serves the plain copy at once. Audio arguments are unchanged, and the
primed output matches the probed one packet for packet.

Sources without usable Cues (MP4, MPEG-TS) and URLs without `origin`
get the plain copy. The probe helpers in copy_seek_anchor.go go back to
main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Brady3035 <Brady3035@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Quick <31828688+Quick104@users.noreply.github.com>
…Server#4214)

* fix(audiobooks): match the tagged volume, edition and narrator

Audiobook enrichment accepted a series' first book for a later volume, a
different narrator's edition, box sets as the plain title, and an exact
title alone for items with no author, and it never trusted a tagged ASIN.

Audiobooks now select candidates with stricter rules: a stated volume must
agree, a volume-less series name no longer stands in for volume N, edition
markers must match both ways, an author-less item matches only through an
ID it already holds, and a candidate carrying the tagged ASIN ranks first
unless the titles share no word. Ties resolve the same way whatever order
results arrive in. After a fetch, the record's authors and narrators must
agree with the item (a one-word name only matches itself), and a
narrator-tagged item needs a record that names a narrator unless the record
carries the item's tagged ASIN. A failing candidate is dropped and the next
one fetched, up to three per provider, through the provider gate. A tagged
ASIN is also looked up directly on providers that declare it as a lookup
key. Provider error text is redacted by one helper before it is logged or
stored.

Ebook and manga matching is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): apply the narrator rule only to the record that establishes a match

A narrator-tagged item needs the record that establishes its match to list
a narrator, unless that record was reached through the item's own tagged
ASIN; the lookup context is now passed in rather than read from the IDs the
provider echoes back. Records merged after the match, including ones
admitted during the merge, are rejected only when they list narrators and
none agree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): try the next candidate after an empty fetch and reject a stated other volume

- A candidate whose fetch returns no metadata is dropped and the next one
  tried; its IDs and title are kept only once a record passes the checks.
- A fetched record whose title states a different volume than the item's
  title is rejected on every path, the tagged-ASIN lookup included.
- The tagged-ASIN title check also considers the record's aliases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): treat a number both titles share as part of the title, not a volume

"Slaughterhouse-Five", "Catch-22" and "Fahrenheit 451" were read as volumes
5, 22 and 451, so a record titled "<title>, Book 1" was rejected as another
volume. Audiobook matching now counts an explicit marker ("Book 2", "#2", a
range) as a volume always, and a bare number only when the other title does
not also carry it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): read the trailing number as the volume when a series name carries one

"The 39 Clues 2" and "Area 51 2" were read as volumes 39 and 51; the record
for book 1 repeats that number, so the item ended with no volume and book 1
was accepted. Audiobook matching now reads the last bare number.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): admit a retried tagged-ASIN lookup as a tagged lookup

When a tagged-ASIN lookup fails and the merge retries it with the same
tag-only IDs, the retry now gets the lookup's admission rules, so a record
without narrators is accepted for a narrator-tagged item on either path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): hold title aliases to the volume rules

An alias that states another volume could carry a candidate's title score:
"Dungeon Crawler Carl 2" accepted "The Gate of the Feral Gods" through its
alias "Dungeon Crawler Carl, Book 4". Aliases now pass the same volume
checks as the primary title before their score counts, and a fetched record
is rejected when any of its titles states a different volume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): let a record without narrators match, preferring one whose narrators agree

A record that lists no narrators is no longer a contradiction for a
narrator-tagged item. Among one provider's candidates that pass every check,
a record whose narrators agree with the tags is chosen over one that lists
none; the first narrator-less record is used only when no agreeing one is
found. Narrators that disagree still reject a record. The exemptions that
existed only for the strict rule are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): reject a record on volume only when none of its titles agrees

A book can sit in two numbered series ("Guards! Guards!" is Discworld 8 and
City Watch 1), so a fetched record is rejected for its volume only when its
titles state another volume and none states the item's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): accept a narrator-less record as it is; agree on the title that matched

Drop the search for a narrator-agreeing record after a narrator-less one
passed every check: it cost extra fetches against providers that never list
narrators. A record whose narrators disagree is still rejected and the next
candidate tried.

A tagged-ASIN record now sets the cross-provider agreement baseline from the
title or alias that best matches the item, so a translated primary title
does not make a later provider's matching result read as a disagreement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(metadata): pick the admitted candidate in one helper

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): try the next candidate after a per-item fetch error; accept another series' numbering

A NotFound or other permanent answer for one candidate's record now moves
on to the next candidate; a paused, throttled or failing provider still
stops for the item, so the gate decides the next call.

Search admission no longer rejects a candidate whose primary title states
another series' number when its original title or an alias states the
item's ("Guards! Guards!: City Watch, Book 1" with the alias
"...Discworld, Book 8"), matching the check after the fetch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): move on only after record-level fetch errors; aliases must name the work

Only a gRPC NotFound or InvalidArgument for a candidate's record moves on
to the next candidate. Provider-wide refusals (Unauthenticated,
PermissionDenied, Unimplemented), untyped errors, throttling and pauses
stop the provider for the item.

An alias may outweigh a primary title in another series' numbering only
when the alias itself passes the title match against the item, not merely
because it carries the item's number.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…re the next one (Silo-Server#4225)

Tone-mapped playback of a short HDR MPEG-TS failed the source check when its
90% sample fell after the last keyframe: MPEG-TS has no index, so nothing
decodes there. The check now moves such a sample back to the stream's last
keyframe, found by a demux-only scan from the previous sample that goes on
in 3,000-packet steps until the stream ends.

The frame read and the conversion now use the same clock. Samples are offset
by the file's start_time, and the conversion passes -seek_timestamp 1, so a
TS whose timestamps start far from 0 is sampled where intended.

Closes Silo-Server#4197

Co-authored-by: Quick104 <31828688+Quick104@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ing books below a book folder (Silo-Server#4217)

* fix(scanner): merge audiobook disc folders into one book and stop hiding books below a book folder

The audiobook walk treated every folder that held audio as one book and
stopped below it. Disc folders (Disc 1, CD2, Part 3) each became a book, a
book folder hid any book stored below it, and loose files in a library root
merged into one book.

A folder's own audio files and the audio in its disc subfolders are now one
book, whatever else the folder holds. Part order follows complete disc and
track tags, with a disc folder's number standing in for a missing disc tag,
and otherwise disc folder then filename. A folder's other subfolders are
walked, and each holding audio is a book of its own; Bonus, Extras, and
Sample folders below a book stay unwalked. A library root's loose files are
one book each, keyed by the file's path. A folder whose own parts could not
all be read is held, its subtree protected, until it reads cleanly.

A library scanned under the old rules converges on rescan: a folder book
keeps its item, disc items merge into the first disc's item (with its
listening progress), and a root's merged loose files split with the first
file keeping the item. File and subtree scans widen past disc and extras
folders to the book above, never across the deepest configured root, and an
admin's scan of an ignored file admits that file and nothing else the
ignore files exclude.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scanner): name audiobook parts by their path in the book, and fail on uninspectable links

- The concurrent-scan inventory check compared a part's file name with the
  stored path relative to the book root, so in a disc book another scan's
  row for CD1/01.mp3 read as a part this scan lacked and the scan skipped
  its update, leaving a new disc unindexed. Both sides now use the path
  relative to the book root.
- Listing a book's parts now fails when a symlinked entry cannot be
  inspected, instead of treating it as a file and rebuilding the book
  without a disc it may hold; a link whose target is gone still lists.
- The folder-layout doc covers the admin's single-file admission and that
  widening never crosses the deepest configured root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…Silo-Server#4247)

A watchlist or favorites import wrote every sync row after the whole row
loop, so a run that failed partway left the entries it had already added
untracked, and a provider removal before the next successful run never
reached them. Each row is now written right after its entry is added,
including when the add keeps a title's entry and then fails, and a saved
entry is counted before its row write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… time (Silo-Server#4272)

A window with a duration now waits at most 10 seconds for the kept track or
the file's index, then demuxes the source, which streams cues as it goes. On
storage where each random read costs about a second, reading one 600-second
window through the index took minutes, so the web player gave up after 30
seconds with nothing.

A PGS window that gave up this way warms the cached .sup with a demux
instead of reading the whole track through the index, whose random reads
starved the playback stream reading the same file. Windows open to the end
and tracks only the index can read keep waiting as before.

Closes Silo-Server#4199

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ilo-Server#4264)

Replacing an existing single-item download with a quality that needs
preparing skipped the "Downloads at once per user" check, so a device
could start more conversions than the limit allows. The replacement now
runs under the account's quota lock: it rereads the entry, rechecks its
revision guard, and takes a concurrent slot when the prepared file is not
ready, leaving the entry itself out of the active count, as a season
replacement does. Capability discovery for tone-mapped targets stays
outside the lock, and the period quota still ignores replacements.

Closes Silo-Server#4116

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ver#4258)

* fix(web): name sidebar section pins from the library layout

A pinned library row stored the row's title from when it was pinned, so
the sidebar link and the catalog heading it opens stayed English in a
translated interface, kept a per-fetch heading such as "Spotlight -
2010s", and never picked up a rename. The sidebar now reads each pinned
library's layout once and shows the row's current title from it,
translated like the row on the library page, falling back to the stored
label until the layout loads or when the row has left it. The same
applies to section links promoted into a customized primary menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): keep pinned section titles current without refetching on media events

A library's layout lists its rows from section configuration alone, so
progress, playback and catalog-item invalidations never change it. Leave
library layouts out of those invalidations and give the sidebar's layout
reads an ordinary observer: a row renamed or edited in this browser now
renames its pin right away, and a failed read retries, without the
sidebar reading every pinned library's layout on each realtime event. The
library page also stops refetching its layout on every progress event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): leave library layouts out of rating refreshes

A rating changes a section's cards, never a library's layout of rows, so
saving or deleting a rating no longer refetches every pinned library's
layout for the sidebar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Silo-Server#4265)

* fix(scanner): keep an ebook another scan indexed during a library scan

An ebook or manga library scan listed the catalog after processing its
files, so a book that a single-file scan indexed meanwhile was missing from
its walk and was marked missing, which removed its library membership and
item in the same pass. Take the database time before the walk, as the
audiobook scan does, and list and mark only rows written before it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(scanner): tidy the concurrent book scan test helpers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…Silo-Server#4269)

* fix(manga): keep a new series when another scan runs at the same time

A manga scan writes a new series' library membership and then links the
chapter to it. Every manga scan ends by deleting the library's series that
have a membership and no chapters, so another scan could delete the new
series between those two writes. The chapter was then left without a
series, and later scans skipped its unchanged file, so the series card
stayed missing until the file changed.

Commit the membership and the chapter link in one transaction, and skip an
unchanged chapter only while it is linked to a series that is in a library,
so a chapter left without one is relinked on its next scan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(manga): read the chapter's series link in the skip-state query

Check that an unchanged chapter still has a series in the same query that
loads its skip state, so a manga rescan makes one query per unchanged
chapter instead of two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ough local sessions (Silo-Server#4268)

* fix(audiobooks): track Audiobookshelf plays that apps report only through local sessions

Plappa and Prologue on iOS never call /play. They stream the book's files
directly and post their local session to /session/local every few seconds,
so Silo kept the resume position but showed nothing in admin Activity or
Playback History.

A live local-session report (client updatedAt within a minute) now records
a reported play: an abs_playback_sessions row keyed by the client's session
id, plus a lifecycle start with frontend abs. No server holds it in memory,
so every API server applies reports to the same play, it stays outside
stream limits, and no media route can load it; the public track route and
the /play sync and close routes answer 404 for its id. A per-account
advisory lock finds or admits the play, so concurrent first reports start
one play and the ten-play account cap holds across the cluster. A report
records the lifecycle start again while the play has none.

Activity lists an open reported play from its start row at the row's
position. The lifecycle sweep ends it 90 seconds after its last report:
closing the row is the claim, so a report that lands after the sweep looked
keeps the play going. History takes the row's position and the listening
the client reported since the row began. A report after the end starts a
new play with its own id and history row.

Closes Silo-Server#4244

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): keep reported-play reports to one statement and free stale slots

Review fixes for reported Audiobookshelf plays:

- A report that continues a play whose start is recorded is one UPDATE,
  with no transaction and no file lookup; the locked admission runs only
  when the client session has no open play.
- Admission closes the account's silent rows whose lifecycle start was
  never recorded, so they stop holding cap slots for a day.
- Listening is clamped at zero before the integer cast, so a nonsensical
  client total cannot fail every report.
- A start recorded late takes the row's start time.
- The sweep's close claim compares report times with the database clock.
- A refusal at the cap logs at debug level; it repeats every few seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(audiobooks): split the reported-play store test's setup out

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): keep a reported play's newer position when an older report arrives late

A report delayed past a newer one rewound the play's position, which
Activity and the history row would show until the next report. The
client's listening total only rises within its session, so a report whose
total is behind the play's keeps the play alive but leaves the newer
position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api): keep the session list file under its size limit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): name a batch's client from its deviceInfo on /session/local-all

Audiobookshelf clients send deviceInfo once on the local-all envelope, not
on each session, so a reported play from a batch showed as Audiobookshelf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): ignore malformed optional local-session fields instead of rejecting the sync

A deviceInfo name that is not a string, or an updatedAt that is not a
number, made the whole /session/local-all batch (or the single
/session/local session) fail to decode, so the client's progress never
synced. Those fields are optional: a malformed one now reads as unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): read deviceInfo without an error branch the linter flags

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): match deviceInfo names case-insensitively again

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): bound the reported plays one local-session request tracks

A /session/local-all batch could ask for reported-play tracking on every
entry. A client has one live session at a time, so a request now tracks at
most the account cap's worth of live sessions, and none after the cap
refuses a play.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): keep open reported plays updating after the cap refuses a new one

A refused start no longer stops the rest of the request: plays the client
already has open still take their reports, and only new starts stop. A
client session repeated within one request is tracked once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): order reported-play reports by the highest client total, and bound future clock skew

The position check compared a report against the floored, age-capped
listening credit, so a late report whose total rounded to the same second,
or one under the cap, could still rewind the position. The row now keeps
the highest client total it saw and moves the position only for a report at
or above it.

A report dated in the future by the device clock counted as live for up to
a minute, so a late copy of a play's last report could start the play again
after the sweep ended it. Future skew is now limited to 30 seconds, which
keeps it and the one-minute past window inside the 90-second idle window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(api): record a reported play's real start position in history

The end took the start position as the final position less the listening,
which is wrong after a seek. The lifecycle start row holds the position the
play began at; the history row now takes it from there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ilo-Server#2454)

* feat(web): show whether a series or season is complete on its poster

A viewer can see complete seasons out of seasons that have aired, or episodes in the library out of a season, before deciding to start it.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(catalog): scope availability badges to viewer access

Pass AccessFilter into season presence counts, skip the unused v1
aggregation, attach availability on the single-season path, withhold
series badges when a season has no episode rows, and keep season
overlays clear of the progress bar and completed check.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(catalog): skip availability enrichment on frozen v1 paths

Gate season and section presence lookups behind IncludeCardAvailability
on the native v2 viewers so /api/v1 no longer pays for json:"-" fields.
Strengthen the AccessFilter DB assertions for the allowlist case.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(catalog): count only files the viewer can play

An episode_libraries row was enough for the season badge, so a 2160p-only episode still completed a season for a 1080p viewer. Presence now requires a file that passes the same ceiling as a multi-episode file.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(catalog): count availability badges the way playback and renewals need

- A trailing season with no date or a future one and no episodes no longer
  marks the series incomplete, so a renewed show keeps its badges.
- A season with no air dates counts toward the series once an episode is in
  the library, so the series no longer says Complete while that season's
  poster shows a gap.
- A library-scoped read counts only files in that library.
- Spanning files count only the episodes playback serves (MaxEpisodeSpan).
- The season check sits in the physical top-right corner, clear of the
  badges in right-to-left languages.
- Cancelled lookups log at debug; gofmt, Prettier and changed-line lint fixes;
  docs name the responses that carry the field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): translate the Availability badge

The label, description, Complete and the have/total fraction come from the
catalog (Silo-Server/silo-translations#37), synced locally until it merges.
The fraction passes numbers so they print in the locale's digits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(catalog): bound the availability count by the page's episodes

The season count joined all of episode_libraries and media_files, so its
cost grew with the library. It now reads each requested episode's present
files by index in one pass that feeds both the linked and the
multi-episode branch, and reads the enabled folders once.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* perf(api): count availability only for profiles that draw the badge

Every v2 card read counted seasons and episodes although the badge is off
by default. The profile's poster badge settings now resolve with the
viewer preferences already read for each request, falling back to the
server-wide defaults from the administrator defaults snapshot, and v2 asks
for the count only when that profile draws the badge. The web reads its
cards again when the badge is turned on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* perf(api): count series availability alongside the other card lookups

Section and catalog listings counted availability after their parallel
card lookups, adding its time to the response. The series on a page are
known before the cards are assembled, so they are counted in that fan-out;
only a season card whose series is first known from the assembled card is
counted afterwards.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: memnos <memnos@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Quick <31828688+Quick104@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…gh promotion (Silo-Server#4248)

A watchlist entry outside the library had a sync row named for one TMDB
ID. Promotion onto the library watchlist deleted the title and its other
IDs, so sync could look for the library item only by that ID: a promotion
matched by TVDB, or a movie whose TMDB ID had changed, went to the provider
as a removal; a provider removal took only the gone entry off and left the
library item; and a removal pending under the old TMDB ID didn't hold a
listing under the new one.

The row now keeps every ID the title has held (title_ids, backfilled for
existing rows), refreshed while the entry stands and added by promotion and
removal under the title lock before the title goes. Sync uses them and the
row's provider key to recognize a promotion, hand the title row's place on
the provider's list to the one promoted library item, take that item off
with a provider removal, and hold a listing under another TMDB ID behind
every pending removal that shares an ID with it, which a newer listing
supersedes.

Closes Silo-Server#4228

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add a posterAspect prop to ItemGrid and pass it through as the useGridLayout poster ratio, so rows of square covers no longer leave 2:3 poster height empty below them
- Make loading skeletons use the same aspect as the grid's posters
- Use square posters in audiobook library browse and the audiobook catalog scope
…ver#4270)

* fix(catalog): keep an item another scan is still publishing

A scanner publishes a new title in separate statements: the item, then its
file row, then its library membership. A library scan of the same folder
that ran between the last two found an item with a present file and no
membership, and membership reconciliation deleted it as an orphan. The
publishing scan's membership insert then failed its foreign key, and the
file row stayed behind pointing at the deleted item. The ebook and manga
scanners skip an unchanged file even when its item is gone, so the book
never came back until its file changed.

Reconciliation now deletes an item only when it has no membership and no
present file. Items that are really gone (held after a removal, or left by
a root that was unreachable) only have missing file rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scanner): republish an unchanged book that has no library membership

The ebook and manga skip check treated a present, unchanged file as fully
published. A scan that stopped between writing the file row and the
membership, or a sweep that deleted the item under a surviving file row,
left a book that every later scan skipped, so it never came back to the
library. The skip check now also requires the item's membership in the
file's library; without one the scan publishes the file again, which
restores the membership or recreates the item.

The concurrent-publish test now runs a scan of a sibling folder, which
reconciles the whole library without walking the book being published, so
it still covers the reconciliation guard on its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…hem on the track (Silo-Server#4273)

* fix(web): draw seek-bar marker bands in the shared palette and keep them on the track

Intro, recap, credits and preview bands now use the cross-client marker
palette (Tailwind 400 shades: blue, orange, purple, cyan) at 45%, 75% while
editing. The hover dot and the marker editor panel share one per-kind colour
map, so they can no longer drift from the seek bar. A band that runs past the
file's duration is clamped to the end of the track instead of overflowing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): keep marker edit handles on the track with their band

The band is clamped to the track, but its drag handles still used the raw
position, so a stored range that runs past the duration put the end handle
beyond both the band and the track. One helper now places both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): keep a clamped start handle draggable at the track end

A marker stored wholly past the duration clamps both edit handles to the
end of the track, where the end handle covered the start handle. The start
handle now draws on top in that case so it can be dragged back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…o-Server#4284)

A local watchlist removal waiting for the provider held back an older
listing only in the form it was removed in. A title removed while outside
the library came back as the library item once the library got it, and a
removed library item came back as an entry outside the library once the
library lost it. A newer listing also left the other form's removal
pending, so it could take the new add off the provider.

Pending rows of both forms are now indexed by every ID and provider key
they know, and the import checks them before adding a listing in either
form. A library item already on the watchlist is still imported, and
other library items that share an ID still don't hold each other.

Closes Silo-Server#4254

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…now (Silo-Server#4283)

* fix(watchsync): send a list removal under the key the provider lists now

A complete provider read could find a list row only through another of its
title's IDs and keep the row, but leave its provider key as it was. A removal
sends only that key, and the Simkl and MDBList plugins send the provider the
one ID it holds, so a removal under the old key could miss the provider's
entry; Simkl reports it applied, and the next sync added the title back.

The row now takes the key of the listing that kept it: a watchlist title row
or a promoted library item kept through another title ID, and a library item
whose pending local removal holds an older listing under another key. The key
changes through a single-column update, so a local removal written meanwhile
stays.

Closes Silo-Server#4271

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(watchsync): move pending title removals on incremental reads too

A listing that waits on a pending title removal now moves that removal to
the listing's key when it is read, so an incremental read, which skips the
complete read's missing-row check, no longer leaves it under the old key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ics catch up (Silo-Server#4280)

* fix(scanner): keep the audiobook duplicate lookup fast before statistics catch up

The lookup that decides whether a new audiobook is a moved copy of an
indexed one joined people, credits, and items in an order the planner chose.
During the first audiobook scan on a server with a large catalog, planner
statistics still say there are no audiobooks, and the chosen plan compares
every author credit with every audiobook, so each lookup gets slower as the
library fills.

Resolve the author and narrator names first, materialize the items credited
to both, and read media_items by primary key. The type check moves to the
caller so the planner cannot pick the partial books index.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(scanner): test the audiobook type before the candidate limit

Filter on the materialized candidate rows so a non-audiobook item cannot
take one of the 25 slots, while media_items is still read by primary key.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…Silo-Server#4288)

* perf(audiobooks): keep the enrichment sweep going while books are due

A scheduled sweep claimed one batch and then waited for the next run,
even when the batch finished quickly and more books were due. Run now
claims the next batch after a short gap until a batch comes back short,
a provider is paused, no book in the batch reached an outcome, the run
is canceled, or the sweep lock's session is gone.

Run, the lock and the batch summary move to enrichment_sweep.go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): keep sweeping past a partly paused chain and stop cleanly

A paused provider no longer ends the sweep while other providers in the
chain still match books; a batch where every book was deferred still
stops it. A cancel that lands after the gap, and a lost lock session,
now end the run without an error, so the books it recorded still count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): end the sweep when a batch cannot be summarized

The batch summary decides whether the sweep goes on. A failed summary
query read as a batch where no book reached an outcome, so the run
stopped early and reported a low count without saying why. It now ends
the run with the error; what the batch recorded stands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(audiobooks): accept matches on real-world tags

- A record reached through the book's tagged ASIN is no longer rejected
  when its narrators contradict the narrator tag; an author contradiction
  or a title sharing no word still rejects it. Later providers are checked
  against that record's narrators.
- A decimal volume ("Series Name 0.5") is its own volume, never equal to
  either of its digits.
- Person names that differ only in spacing ("Mary Van Dyke", "Mary
  VanDyke") agree.
- A title that starts with the book's series name and number is searched
  and scored by the rest of the title; the volume rules still read the
  number from the full title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): address review of real-world tag matching

- Keep a decimal whole only where it numbers a volume, so a point written
  for a colon ("4.50 Night Express") still matches the colon spelling;
  drop trailing zeros so 2.50 equals 2.5.
- A tagged-ID record overrules the narrator tag only when its title names
  the item's work on its own, not just shares the series name, and only
  until an accepted record has listed narrators.
- Work out the bare series title once per item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): address PR review threads on tag matching

- Score candidates against both the full and the bare series title and
  keep the better score, so a provider title that keeps the series prefix
  still matches.
- Read the volume of a series-prefixed title from its prefix: a number in
  the book's own title ("Series Name 3 - Room 101") no longer replaces it.
- A second tagged-ID record whose narrators contradict those an accepted
  record settled is dropped on its own instead of leaving the item
  unmatched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(metadata): keep decimal normalisation linear and the series-name guard

- Check for a volume marker before a decimal by reading back over the word
  before it, not by matching a regexp against the whole text before it,
  so normalising a long title full of decimals stays linear.
- A candidate holding the volume number fewer times than the item's title
  does still counts as the series name ("Zone 3" for "Zone 3, Book 3").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ads are slow (Silo-Server#4302)

* fix(playback): demux a whole subtitle track when the file's random reads are slow

A whole read of an embedded subtitle track through the file's index makes
one random read per cue. On storage that fetches a large chunk for each
small read, such as a mount of remote storage with a local read cache,
that takes minutes and starves any playback stream reading the same file.

The read now gives way once its last 16 reads averaged over 500 ms: it
sends no more reads and returns ErrSlowReads, and the request demuxes the
source, which reads the file in order. Reads already sent finish, so a
track they complete is still read. A track only the index can read has no
demux to give way to and is read as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(playback): warm a PGS window whose whole read was slow with the demux

A PGS window open to the end reads the track whole. When that read gives
way to slow reads, the warm it starts went through the index again, paying
the slow first round once more before it demuxed. Treat ErrSlowReads like
a slow window read and warm with the demux directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…correctly (Silo-Server#4292)

* fix(audiobooks): read Audible-export title, narrator, and genre tags correctly

Files exported from Audible with common taggers carry a series-prefixed
title tag next to a clean album tag, the author in performer with the
narrator in composer, and one genre per tmp_GenreN tag beside a
comma-joined genre tag. The scanner stored the prefixed title, the
author as narrator, and split Audible genre names apart.

- Title: album wins when title is album behind a series prefix, or when
  album is title plus a subtitle; unrelated tags keep title.
- Narrator: the first narrator source naming someone other than the
  tagged authors; an author-read book keeps the author.
- Genres: tmp_GenreN tags replace the genre tag when present, trimmed of
  a trailing ";" or ","; the comma split keeps Audible's comma names whole.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): tighten the Audible tag rules after review

- An explicit narrator tag (narrator, ©nrt, narratedby) wins even when it
  names the author; only performer and composer skip author names.
- With a series tag, only that series counts as a title prefix, so a
  number in the work's own name stays; a Roman numeral position must be
  well formed.
- An album that adds the series or a position after the title is not a
  subtitle.
- Audible comma genre names match regardless of spacing around commas.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): match the series as whole words and try each narrator tag

- A subtitle counts as naming the series only when the series appears in
  it as whole words, so a short series name inside another word no longer
  keeps the bare title.
- A narrator tag with no usable name no longer hides a narratedby tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): compare title words in any script

The subtitle guard split words with the ASCII-only dedupe pattern, so a
series name written only in non-Latin letters became empty and never
matched; an album adding such a series replaced the title. The title rule
now splits on letters and digits in any script. The dedupe normalization
is unchanged, since rename detection compares it with its SQL twin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): treat a Roman-numeral position ending an album as the series, not a subtitle

An album such as "Book Title: Saga Name, Book III" on a file with no series
tag passed the subtitle check, which only knew positions in digits.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(audiobooks): treat a bracketed position ending an album as the series, not a subtitle

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…rver#4305)

* fix(audiobooks): re-read tags on an admin's metadata refresh

An unchanged audiobook is skipped on every scan, so the library Refresh
Metadata job scanned each book's folder and changed nothing; after a
change to how tags are read, an admin had no way to apply it to existing
books short of an item's complete refresh, which gives the book a new
item.

The library refresh in full mode, and an item's quick or reset refresh,
now mark their scans so the audiobook scanner reads each book's files
again. The book keeps its content ID, file rows, and progress. Ordinary,
scheduled, and monitored scans still skip unchanged books.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): re-read only the refreshed book

The re-read mark now carries the content ID being refreshed. An item's
scan path is its parent folder, which for a loose book is the library
root, so an unscoped mark re-read every loose book there once per item
of a full refresh. Only the refreshed book is read again now; the rest
are skipped as before. A reset item refresh no longer sets the mark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(audiobooks): re-read tags after a reset and for ignored audiobooks

- A reset refresh writes the provider's values and clears the fields and
  credits the provider leaves out, some of which only an audiobook's tags
  supply. The reset now scans the audiobook again afterwards, in place, so
  the tags fill what is still empty.
- A full library refresh lists audiobooks whose match an admin ignored and
  reads their tags again without asking a provider about them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(adminjob): publish a committed reset when the audiobook tag read fails

The post-reset tag read ran after the reset committed but returned its
error before the cache invalidation and catalog events, so clients kept
the pre-reset values. A failed read is now a warning on the job result,
as an artwork caching failure is, and the job message says the tags
were not read again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(adminjob): fail the reset job when the audiobook tag read fails

The tag read failure was stored as a result warning that no client
shows. The committed reset is still published and its cached rails
evicted, and the job then fails with the read's error, so the web shows
its refresh-failed message; running the reset again reads the tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(adminjob): fail the reset when the scan did not read the audiobook

A scan of a path shared with other books, such as loose books at the
library root, succeeds when only the refreshed book failed, so the
post-reset read could report success with the book unread. The re-read
mark now records whether the marked book was read, and the reset job
fails when it was not. Ordinary scans report partial failures as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(audiobooks): name the refreshes that read tags again

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…rver#4312)

* perf(scanner): report audiobook scan progress on a timer

An audiobook scan wrote its progress only every 500 finished books, so
slow books left the admin count still for a long time. Workers now only
count; one goroutine reports the counts every 3 seconds, plus a final
report when the pool drains. The movie/series ticker moves onto the same
helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scanner): keep the last audiobook progress on cancel and skip repeat writes

A canceled scan now writes its final counts too, and a tick with nothing
new writes nothing, so a stalled scan does not rewrite the same row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scanner): write scan progress on every tick again

Skipping an unchanged tick also skipped the retry of a write that had
failed, leaving the admin count stale while a slow book held the counts
still. Only the audiobook progress log stays limited to changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ver#4314)

* feat(web): break concurrent streams down by playback method

The Concurrent streams dashboard widget now offers three views: Lines
(the default: total plus direct play, direct stream and transcode),
Stacked (the methods as bands that add up to the total) and Total (the
previous single line). The view is stored with the widget placement.

Each v2 timeseries point gains streams_by_method, the play-method split
of the bucket's peak-streams minute. The existing direct, remux and
transcode fields are each their own per-bucket peak and can come from
different minutes, so they cannot be stacked under the total. A new
streams_by_method dashboard capability advertises the field.

The Egress widget's Total/Nodes switch moves into a shared
WidgetViewToggle used by both widgets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(web): hide the stacked streams view when the server sends no method split

A server that predates streams_by_method, such as an older replica
answering during a rolling upgrade, omits the split. Stacking without it
filed every stream under Other, so the Stacked option is hidden and a
stored Stacked view falls back to Lines until the split is available.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…erver#4295)

A favorites or watchlist import that failed partway still let the same
list's removal phase run. The import is what drops a pending local removal
when the provider lists the title again after it, so a removal it never
reached went out and took the provider's newer add off. Removals now wait
for a run whose import completes; lists with import off still send them.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ilo-Server#4313)

* perf(scanner): reuse the walk's reads when reconciling each audiobook

The audiobook scan read each book folder again after the walk had listed
it: the skip check and the parse each listed the folder and its disc
folders, every part was stat'ed in both, and the book's path was resolved
to its canonical root up to five times. On a network mount each of those
is a round trip.

The walk now keeps, per book folder, the canonical path it resolved and
the listings of the folder and the disc folders it took. Grouping uses
that canonical path; reconciliation resolves the path once and hands it
to the skip check, the identity lookup and the row writes; the skip check
asks the database first, so a book with no rows reads nothing from disk;
and parts are listed from the walk's listings. A part that is gone when
it is stat'ed sends the book back to a fresh listing, so a book changed
since the walk is handled as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(scanner): record a walked audiobook only for folders that hold one

Build the walked-book record only for a folder that holds a book, and let
only an ignored link that could be a part or a disc folder send the book
back to disk reads. Cover a disc part gone since the walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scanner): leave an audiobook alone when its link moves while it is read

The root is resolved once before the parse. A link moved to another book
during the parse made the files read belong to that book, and they were
written under the first root. Resolve again after the parse and fail the
book for this scan when the root changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(scanner): keep the walk's audiobook listings compact

A book's walked listings were a map per book, and every book was indexed
again in a merged map. Keep the book folder's listing inline and disc
folders in a slice only when present, share the book path's string for
an unchanged canonical path, look books up in each walk's own map, and
drop a book's listings once it is reconciled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Restores the fork's test files where the merge took upstream's tests for code
it did not carry, deletes the two suites whose API this tree no longer has,
and adapts the pin-verification and media-sample call sites to the signatures
in the tree.
@randrini
randrini changed the base branch from integration/playback-combined2 to main November 20, 2026 16:45
main carries the validated playback bundle (progressive remux Range
handling, seek-anchor budget, bitmap page window pricing, subtitle
refusal semantics). The merge auto-merged four files both sides touched;
main's side wins for all of them:

- internal/playback/remux.go: keeps parseRemuxByteRange and the refusal
  path, and keeps upstream's macOS Firefox IDR-primer `origin` helper the
  branch had adopted (pure addition on top of main).
- internal/playback/copy_seek_anchor_test.go: restored main's
  TestResolveCopySeekAnchorUsesKeyPacketTimestamp, which the upstream
  test-pruning commit had dropped from this branch.
- web/src/player/components/VideoPlayer.tsx: keeps main's meter wiring
  plus the branch's loading-cover and media-span additions.
- docs/architecture/playback-protocol-v3.md: keeps main's progressive
  Range refusal contract and adds this branch's upstream documentation.
Every Go job failed at its first command because the shared setup action
installed Go from `>=1.26 <1.27`, and setup-go exports GOTOOLCHAIN=local,
so a module whose `go` directive is 1.27.4 could not switch to the
toolchain it needs.

The composite action, the macOS lane and the image build stage now take
the version from go.mod. The invariant check derives the Dockerfile's
golang tag from the same directive, so the image build cannot lag the
module either.
… every test package

The branch's conflict resolution kept upstream's shape in places where
the fork's own behaviour lived, and kept upstream tests whose subject the
fork does not implement. Both left `go vet ./...` red and, behind it,
whole areas broken at runtime.

Restored fork behaviour:

- downloads: virtual originals route through serveVirtualOriginal again,
  artifact preparation resolves a virtual input and keeps the canonical
  identity in its execution fingerprint, and a virtual original's manifest
  reports the relay's real size. Get and CancelAbandonedPrepare come back
  on top of the current transport and retire path.
- scanner: ffprobe output is capped again, the fast candidate preprobe is
  back, and the format size is read. Without the cap a provider-controlled
  stream table could grow this process's memory; without format size the
  virtual identity gate never passed.
- requests: the profile-block gate applies to discovery and detail, a
  blocked profile sees only its own requests, GetRequest and the withdraw
  path check the profile, and the capability reports the block. Router
  wires the profile loader.
- tonemap: an explicit frame colour range overrides a contradicting
  container tag, as the HDR10+ backfill records.
- node auth: an unconfigured secret still sends unsigned, which is how the
  fork's worker links run; a receiver that holds a key still refuses it.
- node health: a node that predates the per-node key handshake is healthy
  again, matching the fork's shared-secret model.
- events: the downloads channel is subscribable by an admin, so the
  capability does not advertise a channel every subscription fails on.

Tests now compile against the code this tree keeps (adopted fakes, current
signatures, fork row shapes), and upstream tests for code the fork did not
carry were dropped rather than resurrected: node-key issuance, the
environment-managed storage transitions, web media URL validation, and the
last-keyframe sampling strategy.
The upstream merge replaced eslint.config.js with upstream's, where every
source file is catalog-converted. The fork has converted part of the tree,
so the literal-string rule went global and failed on fork screens that keep
plain text by design.

Restores the fork's converted-file list, keeps the upstream test
expectations that match the merged pages, and declares the two admin-only
helpers and the settings-form hook as admin text. The settings hook's
managed-by-env list is memoised so its dependent memo stops changing every
render.
Follow-up to the first reconciliation pass, for what the wider suite
found:

- playback: the start-ready pipeline, its prepare writer and its startup
  budget are the fork's again, with the frame-rate helper the merged
  download path reads; the quiet-paused-slot test went with the upstream
  session feature the fork does not carry.
- pool: a node is signable without a per-node key, because the fork signs
  with the shared secret. Without this every transcode node was filtered
  out and route resolution answered route_capacity_unavailable.
- contract: the spec lint reads the fork's withheld-null enum table again,
  and the committed fixtures were regenerated from the router.
- header names: node result headers keep the fork's X-Vio prefix, which
  the transcodenode and downloadprepare tests read.
- routes: the v2 HEAD manifest route is not registered, so it is no
  longer declared; the committed route manifest follows.
- backup: settings classes name only settings this tree registers.
- catalog: the indexer tests use the fork's vio_ index prefix.
- media samples sign with a transcode keyring, the kind the client sends.
The merged v2 tests expected upstream's notification reason model, its
1-10 rating scale, its OAuth cookie prefix and its push-display gate
ordering, none of which this tree carries. The tests now assert what the
server does: the fork's vio_ cookie prefix, its five-point rating, and the
pre-auth limiter position. Assertions for removed reasons and the retired
display-limiter ordering were dropped with the model behind them.
The merge brought upstream files that the fork's stricter lint config
flags on every line of the merge. Unused declarations (the fork's dropped
admission lifecycle, dead test scaffolding, upstream helpers this tree
never calls) are deleted rather than silenced; the rest are small fixes:
checked errors, US spelling in comments, named constants for repeated
ffprobe options and sort keys, a clamped job cap, and a memoised selector.
Functions that upstream keeps whole carry a reasoned nolint for the
length and complexity limits, as the fork already does elsewhere.
…rk's

The fork's 20260916003925 migration already creates
idx_plugin_installations_plugin_id, so upstream's later
20261118203050 migration failed on any database that had run it and
every job that migrates a disposable database failed at 772/777. The
statement is now idempotent; the cleanup above it only needs the index to
exist.

Also records the notification-reason removals the contract gate reports:
the merge retires the fork's favorite, watchlist and continue-watching
reasons in favour of upstream's model, no first-party client reads them,
and restoring the fork's model stays follow-up work.
The full-restore classifier failed on five tables and two switch
columns the merge brought in (episode aliases, the catalog purge
revision, queued release metadata, Jellyfin direct-play failures,
per-device profiles), and the per-user coverage gate wanted the device
profiles claimed the way device registrations are.
The lock-ordering migration replaced refresh_episode_catalog_entry with a
version that no longer resolves an alias episode to its canonical episode,
so an alias membership produced an entry keyed by the alias, or none at
all, and the episode-alias DB contracts failed. The new migration keeps
the entry-row lock and the sort_title key and restores the canonical
resolution and member aggregation.
The upstream merge kept the fork's admin sidebar and upstream's settings
registry, and the registry lost the streaming page entry. `settingsPage()`
threw while ADMIN_NAV_SECTIONS evaluated, so the error boundary replaced
every /admin route.

Restore the entry in the translated shape, add its message ids to every
shipped catalog, and keep the registry's label getters when building the
entry: reading them while the nav module evaluates froze the label as an
empty string.

A test now walks the sidebar's settings links and fails naming any page the
registry lacks.
@randrini
randrini marked this pull request as ready for review November 22, 2026 01:54
@randrini
randrini merged commit 62d412a into main Nov 22, 2026
17 checks passed
@randrini
randrini deleted the merge/upstream-2026-11-20 branch November 27, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.