Repository navigation
Conversation
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Walkthrough
Merge Risk:
|
|
The Evidence section is still a placeholder, but this changes what users see:
Suggested fix: replace “Evidence: captures to follow in this section.” with the requested captures or an evidence.siloserver.org link to them. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
The Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
@macroscopeapp The Evidence section now links before-and-after captures from local dev builds of |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
The confinement exception also reaches NFO person-photo jobs: Calendar C1 is also affected: the server fills event Suggested Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
|
@macroscopeapp Agreed that person photos from a title's |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Quick104
left a comment
There was a problem hiding this comment.
Review of b226548. The approach holds up: the confinement checks I and a second reviewer tried to break (planted links at several depths, a folder above the escaping link, prefix-sharing siblings, link loops, a cataloged file that is itself a link out) all stay refused, and the acceptance tests fail on main and pass here. Two findings below, both small. I'm fixing both in a commit on this branch, so there's no need to change anything yourself. The branch also needs a rebase onto main for a db-contracts.txt conflict, which I'm doing in the same push.
b226548 to
8cd2997
Compare
…library A library whose title folders are symlinks into another tree, as download managers and debrid mounts lay them out, had every local poster, backdrop and episode image refused as outside the library roots and parked for 7 days. The scanner follows those links and catalogues the videos behind them, so the artwork beside a video it plays was the only thing refused. When an image's folders lead out of every root through a symlink, read it only when a folder it physically sits in, below the library root, also holds a present catalogued file of the same title. That folder is opened as an os.Root, the catalogued file must be the same file reached through it, and the image is read through it with the usual leaf checks. Everything else keeps the outside-roots refusal, except that an I/O error while checking is a read failure retried as usual. The admin image picker reads sidecars the same way.
The check that lets local artwork through a symlinked title folder had three gaps. A storage error while checking a cataloged file was dropped, so a flaky mount parked the job as refused. Only the first 8 cataloged files were tried, and a full batch without a match was taken as proof that none would match. And the image was read through the opened folder by its logical path, which os.Root refuses when it goes through an absolute link, even one that stays in the folder. Keep storage errors from every step of the check, try up to 32 files and retry when a full batch has no match, and read both the cataloged file and the image through the folder by their resolved paths, as readConfinedLocalImage does.
The previous commit resolved each cataloged file with EvalSymlinks before checking that it sits in the opened folder, which follows a video's link out of the folder. A link into a stalled network mount would then block the worker. Look the file up through the opened folder first, as before, and stat its cataloged path only once it is known to be inside. The image keeps its resolved path, so an absolute link inside the folder still reads.
Looking a cataloged video up through os.Root by its logical path kept a link out of the folder from being followed, but os.Root also refuses an absolute link, so a video that is an absolute link to another file in the same title folder no longer vouched for it. Resolve the video's path one component at a time inside the folder instead: each link is read, not followed, and its target must lie in the folder before the check carries on there. A target outside the folder is refused without being touched, and a link loop ends the check.
…artwork The cataloged-file check listed the first 32 files by id and, when none vouched for the folder, retried the job. Every retry listed the same 32 files, so it could not succeed: a vouching file after them was never reached, and a folder no file vouches for cycled through retries and cooldowns instead of parking. Page through every cataloged file under the folder in path order instead, so the answer is final. Count only OS storage errors as retryable in the outer check too, as the inner one does, so a non-errno error such as a symlink loop keeps the stable refusal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
8cd2997 to
ec063f2
Compare
Review summaryReviewed head: Branch updated, not rewritten. Addressed in this round
Checked and holding
Left for maintainers
ValidationThe validation board couldn't be read: the review token lacks the User manual and clientsThe manual needs an update. VerdictFit: 8/10 · Readiness: 9/10 — CI green; documented risks remain for maintainer review
🤖 Generated with Claude Code (claude-opus-5-5) via /silo review, with a second-opinion pass from gpt-6.1-sol. Coordinator follow-up: Codex (gpt-6-astra) in T3 Code verified the guide and filed the manual issue. Final check on The stalled-mount exposure remains documented and was not reproduced on a real hung mount. The alternative confinement design remains a separate maintainer option. Manual follow-up: Silo-Server/siloserver.org#332, to update after merge. 🤖 Codex (gpt-6-astra) in T3 Code. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Main now stores file names that are not UTF-8 in fspath encoding (Silo-Server#2571). The checks that let a cataloged video vouch for a title folder linked out of the library passed those encoded paths straight to EvalSymlinks, Stat, Lstat, Readlink and OpenRoot, so a folder whose name needs encoding was never found and its artwork stayed refused as outside the library. Use the fspath wrappers for each call, decode the folder and the in-root path for os.Root, and compare with fspath.SameFile. The new test links a title folder whose name needs encoding; it fails without this change.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Thanks for the review and the fixes. Since then I've merged current On the points you left open: the stalled-mount exposure is the same kind of stat the read already does, so I've left it as it is; the narrow layout stays refused, as it is today; and if you'd rather go the scanner-side way (recording each title link's resolved target for |
Keep both appended entries in scripts/ci/db-contracts.txt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…alog paths Jobs the old confinement refused as outside the library roots waited a week between attempts and, once their attempts were spent, parked for good: enqueue reopens a parked job only when its source path changes, so libraries that had hit the refusal long enough never got the fix. A migration queues those jobs again now. A cataloged path that is no longer shaped as recorded (a file where a folder was, a link loop, a name too long) is an answer about the path, not a storage failure, so it no longer turns the stable refusal into a read failure retried on the short backoff. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pathInsideFolder cleaned a link target before resolving the links in it, so "alias/../video.mkv" with alias pointing at payload/sub became "video.mkv" again instead of payload/video.mkv. The check looped and a cataloged video inside the title folder could not vouch for it. A ".." now steps back from the link-free path resolved so far and is refused above the folder. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104
left a comment
There was a problem hiding this comment.
Review of 0328c92, the encoding change and the merged main since my earlier review of ec063f2.
The approach still holds. The acceptance tests fail on main with the outside-roots refusal and pass here. The database contract test passes on PostgreSQL. Three findings below, one medium and two low. I'm fixing all three in commits on this branch, so there's no need to change anything yourself.
The branch also conflicted with main in scripts/ci/db-contracts.txt. Both sides only appended entries, so I'm merging main and keeping both, without rewriting your commits.
🤖 Generated with Claude Code (claude-opus-5-5) via /silo review.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
Closes #2552
Related issue: N/A
Validation tasks: reaches #1143 C5; #1144 C2; Silo-Server/silo-apple#307 C2; Silo-Server/silo-apple#308 C2; Silo-Server/silo-android#317 C2; Silo-Server/silo-android#318 C2; #1136 C1; Silo-Server/silo-apple#303 C1; Silo-Server/silo-apple#304 C1; Silo-Server/silo-android#314 C1; Silo-Server/silo-android#313 C1 (all Passed), only for libraries whose title folders are symlinks out of the library. There, a person's local photo from a title's
.actorsfolder, and title, season and episode artwork shown on person pages and calendar cards, now appear where they were refused before. That still meets each case's criterion (a person with a photo shows it; releases and dates are unchanged). Libraries without linked title folders take the same path as before, so a re-check is only needed if the fixture library uses that layout.Libraries whose title folders are symlinks into another directory tree get none of their local artwork. Download managers and debrid or cloud mounts commonly lay libraries out this way: one link per title in the library folder, pointing to where the files really live. Silo scans and plays the videos through those links, but every poster, backdrop, season and episode image beside them is refused as
local image path outside library roots, and the job waits 7 days before trying again. On my server that is about 8,700 local artwork jobs. #2552 has the details.The refusal is deliberate protection against a symlink planted inside a library that leads out of it. This change keeps that protection and makes one exception: an image is read when the folder it sits in also holds a file the scanner catalogued for the same title.
Approach
When the symlink-resolving check finds that an image's folders lead out of every library root, the processor now walks from the image's folder up to, but not including, the library root. It accepts the image at the first folder that meets all of these:
media_fileshas a present file of the same title under the folder's logical path (CatalogedFilesUnder, keyed by content ID; an episode's file carries its series' ID, so season and episode images use the series);os.Root, that catalogued file is the same file through the root as at its catalogued path (fspath.SameFile).os.Rootwon't follow a link out of the folder, so a catalogued file that is itself a link elsewhere proves nothing.The image is then read through that root with the existing leaf checks: no symlinked leaf, a regular file, the size cap, and
os.SameFilebetween theLstatand the opened handle. Anything that fails keeps today's outside-roots refusal and its 7-day park. Every cataloged file of the title under the folder is tried, 32 at a time in path order, before the image is refused. A storage error while checking, such as a mount that stops answering, or a failed listing retries on the normal schedule aslocal image read failedinstead of parking. Paths inside the opened folder come from resolved paths, as inreadConfinedLocalImage, so a link inside the title folder that stays in it, absolute or not, doesn't stop the read. The paths arrive fspath-encoded, as the catalog stores them, and each check decodes them at the file system (fspath.EvalSymlinks,Stat,LstatandReadlink), so a title folder whose name isn't UTF-8 works too.Person photos from a title's
.actorsfolder go through the same check, vouched for by the crediting title's files, so they now appear for these libraries too.This is the trust #644 settled on for transcode inputs: the catalogued
media_filespath is the authorization boundary. Someone who can retarget a catalogued symlink can already change which video Silo plays and transcodes, so reading the artwork beside it adds no new trust.The admin image picker reads local sidecars through the same helper, both to preview them and to apply the one an admin picks, so admins can choose these images too.
I added the rule to
docs/architecture/local-nfo-metadata.md, where the confinement is described. A migration (20261102003211_requeue_local_artwork_refused_outside_roots.sql) queues thefile://jobs refused before with the outside-roots text again, because a job that spent its attempts on that refusal is parked until its source path changes.This is server-only. There is no API change; titles in these libraries just get their local artwork. Nothing changes for jellycompat or the native clients beyond the artwork they now receive.
Validation
Regression tests (no database), using real symlinks in temporary folders:
TestProcessLocalImageAcceptsSymlinkedTitleFolderWithAnEncodedName; it fails without 0328c92);The two acceptance tests fail on
main; the refusal tests pass on both.Database contract for
CatalogedFilesUnder(PostgreSQL), added toscripts/ci/db-contracts.txt: present files of the title only, not a sibling folder that shares the name as a prefix, not a missing file, not another title's file; the limit holds.Local package checks:
go vetandgo test -p 4 -count=1over./internal/metadata/and the folder tests in./internal/catalog/against a migrated PostgreSQL 18 database pass. After merging currentmain(932a166) and the encoding fix (0328c92),go vet ./internal/metadata/ ./internal/catalog/andgo test -p 4 -count=1 ./internal/metadata/pass; I didn't rerun the database contract locally.Manual run:
mainand this branch as local dev builds; see Evidence.Review fixes (maintainer review, 1ca1d7e, on a merge of
mainat 7e0765b): the requeue migration, applied to a migrated PostgreSQL 18 database with seeded rows (refusedfile://rows queued and due; missing, running and remote rows untouched); a stale catalogued path with a file where a folder was now gets the stable refusal; a catalogued video linked through another link and..inside the folder now vouches, and a..link out of it stays refused. The two new test checks fail on the commits before their fixes.go test ./internal/metadata/, theCatalogedFilesUnderdatabase contract,make migrate-validateandmake lint-changedpass.Not run locally: the full Go and web suites. CI runs them.
Benchmarks: not applicable. The extra work only runs for an image that would otherwise be refused: one indexed
media_filesquery and a few stat calls per folder between the image and the library root.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-2558/
I ran
main(0e8277f) and this branch (8e34899a1; later commits change only error handling for failed checks, tests and docs) as local dev builds. The library folder holds one symlink per title into a store folder, and each title folder has a short generated video, aposter.jpgand amovie.nfo. Provider plugins were off, so the titles matched from the NFO only.mainlocal image path outside library roots, next attempt in 7 daysThe page has desktop and phone-width captures of all three screens and the job rows. The picker captures come from a rebuild at 5f90877.
Risks
Checklist
AI Disclosure
mainand two fix commits (00aa7b6, 1ca1d7e).Note
Fix local artwork reads in title folders symlinked out of the library
os.Rootand the image is read through it; otherwise the read stays refused.FolderRepository.CatalogedFilesUnderto list present cataloged files of a title beneath a directory with cursor-based pagination (limit 32). Cataloged paths with in-folder symlinks are resolved component-by-component, rejecting links that leave the folder or loop.Macroscope summarized 1ca1d7e.