You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): close the marker editor when the player switches file version - #4210
Closes#4107
Related issue: #1150
Validation tasks: changes #1153 C1 (not run yet)
Other clients: Apple N/A (no marker editor); Android N/A (no marker editor); Roku N/A (no marker editor)
In the web player, a marker draft started on one file version could be saved onto a different version. If you opened Edit markers, changed a range, then picked another version in Playback settings, the panel stayed open with the old draft, and Save sent it to the file now playing. That file got a range built from the other file's values, and the file you actually edited stayed unchanged. Anyone with marker editing on an item with more than one version is affected.
The player now closes the Edit markers panel when the playing file changes, so a draft only ever saves to the file it was made on.
Approach
useMarkerEditor remembers which file its draft belongs to. A version switch keeps the player mounted and only hands the hook a new file ID, so when that ID changes the hook closes the draft, and Save does nothing unless a draft is open. Reopening the panel takes a fresh copy of the new file's markers. Picking the version that is already playing does not close the panel.
A save still in flight when the file changes finishes against the file it started on, then leaves the editor alone, so it can't replace or close a draft opened on the new version.
The issue also allowed saving the draft to the original file instead. Closing is simpler, and the alternative would leave the seek bar showing one file's markers over another file's video.
Web only. The server and API are unchanged.
Validation
Web hook test: a draft closes when the file ID changes, Save afterwards sends nothing, and switching back does not restore the draft. Fails on main, passes here.
Web hook test: a save that finishes after a version switch leaves the new version's open draft alone and still reports the old file's change. Fails on the head before that fix, passes here.
pnpm run lint, format:check, build, budget:check, make test-web: pass.
make verify-local-paths, verify-size-ratchet, verify-bidi, verify-case-collisions: pass. Go checks not run: no Go changes.
Local build with the real web bundle, an episode with two synthetic versions holding different preview markers, headless Chromium at 1440 and 390 px: same steps on main and on this branch (results below).
Episode with two versions: file 3 (720p, preview 2:30–2:50) and file 4 (1080p, preview 2:30–2:55). Playing file 4: open Edit markers, Preview, Set start, switch to 720p, Save.
main:
panel after switch: open, Preview 0:05 – 2:55
PUT /api/v2/markers/files/3 {"preview":{"start_seconds":5.174601,"end_seconds":175}}
stored after: file 3 preview 5.17–175, file 4 preview 150–175 (unchanged)
this branch:
panel after switch: closed
no PUT sent
stored after: file 3 preview 150–170, file 4 preview 150–175 (both unchanged)
this branch, reopen Edit markers on the new version and save:
panel shows file 4's own preview (2:30 – 2:55)
PUT /api/v2/markers/files/4 {"preview":{"start_seconds":60.447728,"end_seconds":175}}
Risks
An unsaved draft is discarded whenever the playing file changes while the panel is open. Before, Save would have written that draft to the wrong file.
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 how I checked a change nobody sees.
AI Disclosure
Harness: Claude Code (via T3 Code); Codex CLI for code review
Tool(s): Claude Code, Codex CLI, Playwright (headless Chromium), GitHub CLI
Adversarial review: independent reviews of the full diff by claude-opus-5-5 and gpt-6.1-sol on correctness, repository standards, and the issue's requirements. Neither found anything to change.
Note
Close marker editor in useMarkerEditor when the player switches file version
The useMarkerEditor hook now tracks the file ID for the current draft. When the fileId prop changes, it closes editing and clears the error.
A save attempted while editing is closed returns immediately and issues no request.
If a save request completes after the file ID changed, its success or failure no longer updates the new file's draft or error. A successful save still calls onSaved with the submitted body.
Risk: check useMarkerEditor.ts if any consumer relied on late save results applying to the newly loaded file version.
A version switch keeps the player mounted and hands useMarkerEditor the
new file id, so an open draft from the previous file was saved onto the
file now playing. The hook now closes the draft when its file changes,
and Save does nothing unless a draft is open.
The marker editor now closes its draft and clears errors when the playing file changes. It does not send a save request when editing is inactive. A test covers switching files, attempting to save, and switching back.
Changes: Marker editor file switching
Layer / File(s)
Summary
Reset and guard marker drafts web/src/player/hooks/useMarkerEditor.ts, web/src/player/hooks/useMarkerEditor.test.tsx
The hook tracks the file associated with the draft. When the file changes, it exits editing and clears the error. Saving now also requires editing to be active. The test verifies that saving after a switch makes no fetch request and switching back does not reopen editing.
Switching file versions now closes the marker editor and blocks saves while editing is inactive. One narrow edge case remains: if a save is still in flight during a switch and the user reopens the editor, the late save result can replace the new draft and close the panel. Marker data is not written to the wrong file. This is worth fixing or accepting before merge.
Security architecture risk: Minimal · up to d2d67
The change prevents an old marker draft from being saved after switching files. The inspected code establishes no introduced or worsened risk to security, failure containment, rollback, or ownership guarantees.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The assessed effect is confined to initiating file-marker writes from the web editor. The endpoint and file identifier construction remain unchanged; no increased service or credential authority is established by this change.
Security Findings and Attack Paths
inferred — The previously described edit-file-A, switch-to-B, then-save path is narrowed: switching ends editing, and the current save callback cannot issue a request until editing is restarted. This supports improved draft-to-file isolation, not a claim that all marker authorization paths are secure.
Resilience and Maintainability Implications
observed — Closing editing does not abort an already-started request. Its file ID remains captured, but completion can update hook state after cancellation or reopening. The same completion logic and enabled cancellation controls existed before this PR, so this is pre-existing behavior rather than an introduced architecture concern. Draft invalidation is not transactional rollback.
Pre-merge checks: 2
Check name
Status
Explanation
Title check
The title names the main change: the marker editor now closes when the player switches file version. It matches the changeset in useMarkerEditor.ts and its test, and it uses the conventional fix(web) …
Description check
The description explains the problem (a marker draft saved to a different file version), the approach (useMarkerEditor tracks the draft's file ID and closes editing when it changes), validation steps,…
Full details: Title check
Explanation
The title names the main change: the marker editor now closes when the player switches file version. It matches the changeset in useMarkerEditor.ts and its test, and it uses the conventional fix(web) prefix. The title is 71 characters, which is within a normal range.
Full details: Description check
Explanation
The description explains the problem (a marker draft saved to a different file version), the approach (useMarkerEditor tracks the draft's file ID and closes editing when it changes), validation steps, and risks. It matches the changes in the hook and its test.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 83595587-e12c-414a-9fb3-3ae85a1b5f35
Commits
Reviewing files that changed from the base of the PR and between feae205 and 11466e2.
Files selected for processing: 2
web/src/player/hooks/useMarkerEditor.test.tsx
web/src/player/hooks/useMarkerEditor.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
A version switch now closes the Edit markers panel, so the editor can be
reopened on the new file while a save from the old one is still in flight.
When that save finished, it replaced the new draft with the old file's and
closed the panel, and a failure showed its error on the new file's panel.
The save still reports what it wrote to the old file, but leaves the
editor state alone once the playing file has changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
silo-triageBot
added
size/M
50–199 added + deleted lines (all files); change volume, not priority.
and removed
size/S
0–49 added + deleted lines (all files); change volume, not priority.
labels
Nov 15, 2026
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 settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
Review of 0c2fd7e10c, which is this PR's change plus a merge of main (main had changed the same hook in #4231) and one fix commit.
The approach holds. Closing the Edit markers panel when the playing file changes is the simplest fix #4107 allows, and it keeps the seek bar from showing one file's markers over another file's video.
Addressed
A save still in flight during a version switch could replace and close a draft opened on the new version (raised by CodeRabbit and Kody). Fixed in 0c2fd7e10c. Such a save still reports what it wrote to the old file, but no longer touches the editor. Marker data was never written to the wrong file on this path.
Remaining: nothing.
Tests
The PR's version-switch test fails on main (the panel stays open) and passes here.
The new late-save test fails on the head before 0c2fd7e10c (the new draft closes) and passes here.
Prettier, eslint, the web typecheck, and the hook tests pass locally.
Cross-provider review: gpt-6.1-sol reviewed the merged head with extra temporary tests (StrictMode, same-file refreshes, null file ids, late seek-bar edits) and found nothing beyond the in-flight save.
Validated features: Marker authoring & editing, Web (#1153). C1 covers editing markers from the web player and has not been run yet, so no passed case can regress. The Validation tasks: line stands.
User manual: unaffected. The markers page doesn't describe what the player's panel does on a version switch.
Other clients: only the web player has a marker editor, as the PR says.
Evidence: still current. My fix touches only a save that finishes after the file changed, which none of the captured steps do.
Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)
Fit: a small web-only fix that stops a save going to the wrong file, with no new settings or API surface.
Readiness: both fixes have tests that fail without them, and the author's browser run shows the reported behavior gone. I did not reproduce it live myself.
The reason will be displayed to describe this comment to others. Learn more.
Late saves notify the host with markers from the previous file
Because onSaved receives no file ID, a save that finishes after a version switch can overwrite the current file's markers with values from the previous file. Include the saved file ID in onSaved and apply the update only to the matching file.
Prompt for LLM
File web/src/player/hooks/useMarkerEditor.ts, lines 227-228:
Late saves notify the host with markers from the previous file
A save that completes after a version switch still sends the old file's marker changes to `onSaved`, whose contract provides no file ID for the host to distinguish them from updates to the currently playing file. This can patch the new version's local markers with the old version's values; include the saved file ID in the callback and apply the update only to the matching file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workingjavascriptPull requests that update javascript codepriority: P2Limited scope, workaround exists, or polishsize/M50–199 added + deleted lines (all files); change volume, not priority.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #4107
Related issue: #1150
Validation tasks: changes #1153 C1 (not run yet)
Other clients: Apple N/A (no marker editor); Android N/A (no marker editor); Roku N/A (no marker editor)
In the web player, a marker draft started on one file version could be saved onto a different version. If you opened Edit markers, changed a range, then picked another version in Playback settings, the panel stayed open with the old draft, and Save sent it to the file now playing. That file got a range built from the other file's values, and the file you actually edited stayed unchanged. Anyone with marker editing on an item with more than one version is affected.
The player now closes the Edit markers panel when the playing file changes, so a draft only ever saves to the file it was made on.
Approach
useMarkerEditorremembers which file its draft belongs to. A version switch keeps the player mounted and only hands the hook a new file ID, so when that ID changes the hook closes the draft, and Save does nothing unless a draft is open. Reopening the panel takes a fresh copy of the new file's markers. Picking the version that is already playing does not close the panel.A save still in flight when the file changes finishes against the file it started on, then leaves the editor alone, so it can't replace or close a draft opened on the new version.
The issue also allowed saving the draft to the original file instead. Closing is simpler, and the alternative would leave the seek bar showing one file's markers over another file's video.
Web only. The server and API are unchanged.
Validation
main, passes here.pnpm run lint,format:check,build,budget:check,make test-web: pass.make verify-local-paths,verify-size-ratchet,verify-bidi,verify-case-collisions: pass. Go checks not run: no Go changes.mainand on this branch (results below).Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-4210/
Episode with two versions: file 3 (720p, preview 2:30–2:50) and file 4 (1080p, preview 2:30–2:55). Playing file 4: open Edit markers, Preview, Set start, switch to 720p, Save.
Risks
An unsaved draft is discarded whenever the playing file changes while the panel is open. Before, Save would have written that draft to the wrong file.
Checklist
AI Disclosure
Note
Close marker editor in
useMarkerEditorwhen the player switches file versionuseMarkerEditorhook now tracks the file ID for the current draft. When thefileIdprop changes, it closes editing and clears the error.onSavedwith the submitted body.useMarkerEditor.tsif any consumer relied on late save results applying to the newly loaded file version.Macroscope summarized 0c2fd7e.