Skip to content

detail: Also available — the same film on two servers, as a list you can walk into - #27

Closed
GLinnik21 wants to merge 5 commits into
shared-servers-basefrom
worktree-agent-a0d7ac64211c42f27
Closed

GLinnik21 wants to merge 5 commits into
shared-servers-basefrom
worktree-agent-a0d7ac64211c42f27

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Deliverable E of the Shared Sources design (the Also available half; the hero's
"Shared by …" run is #23). When a second pinned source also holds the item on screen, the
detail page's actions row gains an Also available pill with a trailing chevron, and it
opens the app's usual Popover + TableView — never a full-screen sheet:

row detail badge
Movies This account · 1 hr 57 min 1080p
LDN Films bamx23 · 1 hr 57 min 4K

The design's calls, and where each one lives

A control in the actions row, not a section of the page. An item on several servers is
a rare fact; a permanent band would spend a whole row on nothing everywhere else. So the
button is drawn only when a second source holds the film — alt_sources::is_available(),
which the row consults before it allocates an index. With one server there is no query, no
control and no layout, the same "with one source, none of this is drawn" rule the shelf
heading's annotation implements as absence rather than as a branch that draws nothing.

The gate counts distinct sources, not copies: two copies in two libraries of one server
is not "also available elsewhere", and the row naming the second one would lead back to
the machine you are already on.

The tick marks the copy you are on, and the badge is the resolution class — the
vocabulary the hero's badges row already speaks, through the same fmt::resolution, so one
file cannot be spelled two ways on one screen.

OK NAVIGATES. It opens that server's own page for the film rather than swapping the copy
under you — which is also what settles the per-server progress problem: watch state does not
travel between servers, so a design that switched the copy in place would have had to explain
a resume position that jumped.

Ordering is the copy that plays first, then quality, then yours before a friend's at equal
quality. The design's own example is the case that separates the first two clauses — a 1080p
copy you are standing on sorts above a friend's 4K one — and that is what the tests pin.

Nothing from the REJECTED list is here: no chip in the badges row, no line of its own in the
hero, no invisible merge, no permanent section, no silent copy switch.

Identity is the guid, never the ratingKey

Every item-shaped integer in Plex is server-local and starts at 1 — both servers in this
household have a ratingKey 4 and a section 1 — so install() (the seam the multi-server
data layer feeds) is documented as guid-resolved, and until that lands the store is empty at
every mount.

What this needed elsewhere

  • Button gains a trailing accessory slot. The leading icon is part of the label's own
    statement (the Play triangle is "play"); a chevron is a disclosure mark about what the
    control does. pill_w grew a pill_w_full twin rather than a second sizing path — sizing
    the pill without the chevron and then drawing one pushes the label off-centre.
  • The hero row's focus follows its CONTROL by name (HeroCtl/hero_set), not by a += 1
    around one insertion point. That was sound while the restart disc was the only conditional
    control; with a second, two controls can appear in one frame and which of them moved the
    focus depends on where it was sitting. The geometry is one accumulation walk for the same
    reason — the alt pill is a variable-width control in the middle of a row that was
    otherwise a pill followed by fixed-width discs.
  • The source switch is performed by app.rs, not by the screen. Re-pointing
    plex::client() invalidates every store keyed to the server current when it was filled —
    the hub catalog, the browse grid, an open person page — and none of them carries a server in
    its keys. install_pms's wipe is now activate_server, shared by the profile switch and
    this one, and the BACK trail is truncated to its root because Node::Detail carries a
    ratingKey and no server (step 2 of docs/shared-servers.md).

Tests

make check 432 passed (from 418), run three times, all green, plus the three named
clippy lints and a --test-threads=1 pass to catch order dependence. make and
make RELEASE=1 both link.

The decisive call — OK navigates — is proven through the real press path rather than left
to a capture: the control's OK, the panel presented, one DOWN, commit; then both ends
asserted. The request names the OTHER server and THAT server's ratingKey, and nothing about
the current page moves (no in-place swap, no second navigation request, same mounted item,
same control set). It is mutation-checked: with request_alt_open stubbed to a no-op that
test fails and the other 431 pass, so it grades the navigation and not the scenery.

Also pinned: the gate (including the two-copies-on-one-server case, which looks like a working
feature and is not, and a list naming only your own source — which is what "not pinned" means
from here, since the store holds pinned sources and nothing else); the ordering rule, with
input-order independence so it is not luck; that exactly one copy is ever marked current —
once when a producer lists the same copy twice, and nowhere at all when the page's own copy is
absent, never twice; that the sort key agrees with the badge drawn beside it; that a copy with
no runtime states only its owner; that OK on the row you are on is not a destination, and BACK
is spent on the panel before the trail.

One order-dependence found and fixed in review: alt_arm derived the friend's slot from a
literal, and plex's own tests leave CURRENT wherever they last set it, so both copies
collapsed onto one source and the control silently failed to appear when one of those ran
first under the same serial lock.

Device verification — deferred to coordinator

Not verified on device. There is no host runtime, so nothing here has drawn a pixel, and
the fleet device pass was deferred while this unit was queued for the lock. No device result
was collected — nothing below is a claim about how it looked.

What is unverified is appearance and the live press: the pill's width, where the panel lands
(it should flip above the actions row — the row sits at y≈812 and the list measures ~224,
so below does not fit inside the bottom keep-out), the badge's inline position in a
TableView row, and the OK navigation end to end.

Recipe, executable without me. It reuses #23's /tmp/plxnative-shared=<handle> — no second
trigger was invented — and needs #23 merged only for the hero's own run; the panel's stand-in
reads the trigger directly, so this works on this branch alone.

# 1. the row WITHOUT the button — the common case, a film only you have
tools/tv-session.sh up --screen detail=4
tools/tv-session.sh shot without.png

# 2. arm the borrowed-item trigger and relaunch (--keep preserves it while re-arming detail=4)
ssh root@"$(cat .tv-host)" "printf bamx23 > /tmp/plxnative-shared"
tools/tv-session.sh up --screen detail=4 --keep
tools/tv-session.sh shot with.png

# 3. open the panel (focus starts on Play; the alt pill is the control to its right)
tools/tv-session.sh key right
tools/tv-session.sh key ok
tools/tv-session.sh shot panel.png

# 4. the decisive one: commit the OTHER copy
tools/tv-session.sh key down
tools/tv-session.sh key ok
tools/tv-session.sh shot destination.png
tools/tv-session.sh log 'altsources|route='

A CORRECT set of frames:

  • without.png — the actions row is [Play] (✓) exactly as today. No third control, and no
    gap where one would go. If rk=4 carries a resume point the row is [Resume] (↺) (✓); that is
    fine, the point is that there is no Also available.
  • with.png — one more control, between the play group and the watched disc:
    [Play] [Also available ⌄] (✓). The chevron is the same mark the Library's toolbar chips
    carry. The hero is otherwise unchanged — no new band, no chip in the badges row.
  • panel.png — a rounded panel ~700 wide hanging off the button's left edge and sitting
    ABOVE it, over a light scrim (0.45, the Library chip menus'). Two rows: Movies /
    This account · 1 hr 57 min / 1080p, ticked and highlighted; LDN Films… no — the
    stand-in labels both rows with your own library title, so expect the SAME label on both, the
    sub-lines differing (This account vs bamx23) and the badges differing (1080p then
    4K). The 1080p row must be FIRST and ticked — that is the ordering rule on screen: the
    copy that plays outranks the better copy.
  • destination.png — a DIFFERENT page: the route dipped and came back. The film is the same
    (the stand-in's second slot is the same machine, so its ratingKey is honestly the same film),
    and the panel is gone. The log must carry altsources: source switched to slot N for rk=….
    If the frame shows the same page with different content, that is the rejected design and a
    real bug
    — but note the stand-in cannot produce a genuinely different resume position,
    because both slots address one server.
  • The event log should also show altsources: stand-in for rk=4 on slot N (dev) once per page,
    never once per frame.

What the stand-in cannot stand in for, so do not read these into a frame: a different library
name, a genuinely different file, a per-server resume position, or a source going offline.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV

GLinnik21 and others added 4 commits August 14, 2026 00:26
Deliverable E of the Shared Sources design. When a second pinned source also
holds the item on screen, the actions row grows an "Also available" pill with a
trailing chevron, and it opens the app's usual Popover + TableView listing the
copies: the library on each source, whose it is and how long it runs, and the
resolution class as a badge.

The reason it is a CONTROL and not a section of the page is that an item on
several servers is a rare fact — a permanent band would spend a whole row on
nothing on every other page in the library. So it is drawn only when a second
source actually holds the film, and `is_available` counts distinct SOURCES
rather than copies: two copies in two libraries of one server is not "also
available elsewhere", and the row naming the second one would lead back to the
machine you are already on.

OK NAVIGATES. It opens that server's own page for the film rather than swapping
the copy under you, which is also what settles the per-server progress problem:
watch state does not travel between servers, so a design that switched the copy
in place would have had to explain a resume position that jumped. Navigating
makes it self-evident — you are on a different page, and it says where you are
in that copy.

Ordering is the copy that PLAYS first, then what a viewer would prefer: higher
quality, and at equal quality yours before a friend's, because yours cannot go
offline mid-film. The design's own example is the case that separates the first
two clauses — a 1080p copy you are standing on outranks a friend's 4K one — and
it is what the host tests pin, along with the gate and the rule that exactly one
row is ever ticked (marked on the first copy matching the page's own (server,
ratingKey), so a duplicated input cannot say "you are here" twice).

Copies are keyed by the item's GUID and never by its ratingKey: every
item-shaped integer in Plex is server-local and starts at 1, so both servers in
this household have a ratingKey 4. `install()` is the seam the multi-server data
layer feeds; it is empty until that lands, which is what makes the whole feature
cost a one-server library nothing — no query, no control, no layout.

Three things this needed elsewhere, each smaller than it sounds:

`Button` gains a TRAILING accessory slot, because the leading `icon` is part of
the label's own statement (the Play triangle IS "play") while a chevron is a
disclosure mark about what the control does. `pill_w` grows a `pill_w_full`
twin rather than a second sizing path, since sizing the pill without the
chevron and then drawing one pushes the label off-centre.

The hero row's focus now follows its CONTROL through an index change by name
(`HeroCtl`/`hero_set`), not by a `+= 1` around one insertion point. That was
sound while the restart disc was the only conditional control; with a second
one, two controls can appear in the same frame and which of them moved the
focus depends on where it was sitting. The geometry walk is one accumulation
for the same reason — the alt pill is a variable-width control in the MIDDLE of
a row that was otherwise a pill followed by fixed-width discs.

And the source switch itself is performed by app.rs, not by the screen.
Re-pointing `plex::client()` invalidates every store keyed to the server that
was current when it was filled — the hub catalog, the browse grid, an open
person page — and none of them carries a server in its keys, so a screen doing
the switch itself would leave server A's ratingKeys being fetched from server B
with only the page in front of you correct. `install_pms`'s wipe is now
`activate_server`, shared by the profile switch and this one, and the BACK trail
is truncated to its root because `Node::Detail` carries a ratingKey and no
server (step 2 of docs/shared-servers.md).

Host 418 -> 430 + lint, `make` and `make RELEASE=1` both green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
`/tmp/plxnative-shared=<handle>` already means "pretend this item came from
<handle>" — it is how the hero's own "Shared by …" run is judged on a panel,
because with `Detail::source` empty at every construction site there is no item
in the product that can put a borrowed-item surface on screen. A second copy of
that film on <handle>'s source is the other half of the same pretence, so this
reuses that trigger rather than adding a second one for one deliverable.

What it stands in for, precisely, because a stand-in that lies is worse than
none. YOUR copy is real: the page's own ratingKey, on the current server, with
the loaded item's runtime and resolution class and the library the browse store
says you are in — which is what makes the tick meaningful. THEIR copy is that
same film on a second registry SLOT, and the slot is real: a genuinely different
server when one is registered, otherwise the current server registered again
under a synthetic machine id. From everything this feature does — counting
sources, resolving a client, switching, refetching — that is a second source,
and because it is the same machine the ratingKey it carries is honestly the same
film. So OK performs the real switch and opens a real page, which is the one
behaviour of this panel that cannot be judged from a still.

The single invention is that their copy is one resolution class better than
yours, and it earns its place: the ordering rule is otherwise unobservable. The
design's own example is a 1080p copy you are standing on sorting ABOVE a
friend's 4K one — the case that separates "the copy that plays" from "the best
copy" — and with two equal badges a capture cannot show the rule was applied at
all. `one_class_better` promotes nothing past the top of the ladder and leaves
an unrecognised class exactly as the server spelled it.

It is built by a `pump` on the detail page's frame, not by the store's `reset`,
because a mount deliberately clears `metadata::current()` for the whole 2-5
round-trip fetch: at reset time there is no runtime, no class and no title to
copy. Two string compares in the ordinary case, and `dev_stand_in` is `None` at
COMPILE time under `cfg(test)` so the host suite can never depend on what this
Mac happens to have under /tmp.

Host 430 + lint, `make` (ARM) green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
`pump` returned early only on SUCCESS, so the ordinary case — the trigger not
armed, which is every real boot — re-opened `/tmp/plxnative-shared` on every
frame of every detail page. It now marks the attempt whatever the outcome, and
takes the "has the item landed" gate BEFORE marking, so waiting out the mount's
2-5 round trips does not spend the one chance the page gets.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
The trigger swap replaced the parser but left its doc — a JSON schema for a
`/tmp/plxnative-altsources` file that no longer exists, which would have sent
the next reader to write one. What survives from it is the sentence that has to:
the trigger literal, spelled in a comment so the catalog grep in the root
CLAUDE.md still finds this surface.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
Copilot AI lite review requested due to automatic review settings August 13, 2026 21:36
The decisive property of "Also available" is that OK opens the other server's
page for the film rather than swapping the copy under you, and it is exactly the
property a device capture could appear to confirm without it being true: a route
change is a route change whoever caused it, so a screen that swapped content in
place under a transition somebody else started would photograph identically.
Proven in code instead, through the real press path — the control's OK, the
panel presented, one DOWN, commit — asserting both ends:

  * the request names the OTHER server and THAT server's ratingKey (a ratingKey
    is per-server, so carrying ours would open a different film there), and
  * nothing about the page you are on moves: no in-place swap, no second
    navigation request, the same mounted item and the same control set.

Its twin pins the other outcome: OK on the copy you are already on asks for
nothing — the tick has answered the question — but is still spent on dismissing,
and BACK is reported as SPENT so app.rs does not also pop the trail.

Mutation-checked rather than assumed: with `request_alt_open` stubbed to a no-op
the first test fails and the other 431 pass, so it is the navigation it grades
and not the scenery.

Also the negative the gate is really about, which the count alone did not state:
a copy list naming only the source you are already on adds no control, however
many copies of the film that source has. That is also what "not pinned" means
from here — the store holds copies on PINNED sources and nothing else, so a
source nobody pinned cannot put a control on this row.

Host 430 -> 432.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the “Also available” affordance on the detail page to surface and navigate to the same film on another pinned source, using the app’s existing Popover + TableView panel idiom. This fits into the UI system as another modal picker panel (similar to library toolbar chips/menus) and integrates with app.rs to perform the server switch safely.

Changes:

  • Introduces ui::alt_sources module: model, ordering/gating rules, popover rendering, and a headless stand-in path.
  • Extends ui::widgets::Button with an optional trailing accessory icon and sizing support (pill_w_full) to keep pills centered and correctly measured.
  • Updates detail hero action-row focus/geometry to be control-set aware (HeroCtl/HeroSet), adds panel input routing, and wires server-switch navigation via app.rs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
rust-modules/src/ui/widgets.rs Adds trailing accessory icon support for Button and updates pill sizing/centering.
rust-modules/src/ui/mod.rs Exposes new alt_sources UI module.
rust-modules/src/ui/detail.rs Adds the “Also available” hero control, modal panel routing, and robust focus mapping across dynamic control sets.
rust-modules/src/ui/alt_sources.rs New module implementing the “Also available” panel (gate/model/order/tick + popover UI + stand-in).
rust-modules/src/app.rs Centralizes “server activation” reset logic and performs the server switch + navigation when an alt copy is chosen.
rust-modules/src/ui/CLAUDE.md Documents the new module in the UI contribution guide (currently contains an incorrect trigger/function reference).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

| `table.rs` | `TableView`/`Section`/`Row`/`Badge` — the animated list (settings/track-menu look). Rows carry an optional **leading icon** (`Row::licon`, sharing the column the active-row checkmark owns) and there is a **`Row::separator()`** grouping hairline that `move_sel`/`hit_row`/`set_sections` all refuse to focus — build a divided action list out of ONE section with a separator row, not out of two sections (a headerless second section adds air but draws no rule, because the hairline rides the section header). |
| `icons.rs` | `Icon` enum + antialiased SVG rasterizer; color is the `tint` you pass. **Adding an asset has two non-obvious rules** (module doc has the full contract + the failure each one prevents): a mark is **ONE `<path>`**, composed of overlapping SUBPATHS — separate elements are alpha-composited and crease along the join, subpaths are winding-unioned and don't — and **every subpath winds the same way**, since nonzero fill turns a reversed one into a hole. Author at the size it is DRAWN (the rating marks are drawn for a 34px box, not shrunk from poster art) and grade it by rasterizing through `src/svg.c` at 1× and 4×. |
| `stats.rs` | **Stats for nerds** — the on-screen diagnostics read-out, toggled from the player's `…` overflow popover (`more_menu.rs`). Not chrome and not a route overlay: a latched flag drawn LAST over the player, so it survives the transport's auto-hide and sits over live playback the way YouTube's does. It exists because the app is used on televisions nobody here owns and **every other diagnostic surface is compiled out of a RELEASE build** — its output format is a PHOTOGRAPH, and that dictates the design: values at `size::HEADLINE` over an opaque `PANEL_TOP`/`PANEL_BOT` ground (luminance contrast, not hue — a phone camera chroma-subsamples), sampled at 2 Hz and HELD (a number that moves between the viewfinder and the shutter cannot be trusted, and ~20 volatile runs a frame would thrash the 160-slot glyph cache), and bounded to two columns of `COLUMN_ROWS` that **never scroll** — a read-out the user must scroll is two photographs and a chance of missing the line that mattered, so a new field costs an existing one. Both columns are built from ONE `player::Diag` snapshot, never two `diag()` calls, or the panel can report a left-hand state beside a right-hand one taken 16 ms later. Read the module doc before adding a field: it carries the redaction rules (no URL or path ever — the PMS token rides in every query string; no server name, address or machineIdentifier; no item title), and the enforcement is that `Diag` holds only numbers, booleans and enums. |
| `alt_sources.rs` | **"Also available"** — the same film held by a second pinned source, as a `Popover`+`TableView` list (Shared Sources, deliverable E). Three things live here and nowhere else. The **gate**: `is_available()` counts distinct SOURCES, not copies, and the detail page's actions row asks before it draws a control at all — so a one-server library pays nothing, no query, no pill, no layout, which is the same "with one source, none of this is drawn" rule `home.rs`'s shelf annotation implements as absence. The **row model** `rows()`, pure: `[library] [owner · runtime] [resolution class]`, ordered *the copy that plays first*, then quality, then yours before a friend's at equal quality (the design's own example is the case that separates the first two — a 1080p copy you are standing on outranks a friend's 4K one), with **exactly one** row ticked, marked on the first copy matching the page's own (server, ratingKey) so a duplicated input cannot say "you are here" twice. And the rule that **OK NAVIGATES** to that server's page rather than swapping the copy in place — which is also what settles per-server watch state, since a copy switched under you would have to explain a resume position that jumped. It only reports an `Action`; `detail::open_alt_copy` re-points the registry and raises the page's ordinary open request. Copies come from the item's **`guid`**, never its `ratingKey` (both servers in a household have a `ratingKey` 4) — `install()` is the seam the multi-server data layer feeds, empty until it lands, with `/tmp/plxnative-altsources` as the draw-only stand-in the device captures were taken through. |
@GLinnik21

Copy link
Copy Markdown
Collaborator Author

Superseded by #47, which is the integration branch this unit was built for and which now carries the whole feature.

Closed rather than merged because #47 already contains this work — verified before closing, not assumed: every commit on this branch is either an ancestor of #47 or reached it through the shared servers, squashed commit, and the one genuine follow-up that was NOT in it (the OK NAVIGATES test on #27) has been cherry-picked across.

The review record lives here; the code ships there.

@GLinnik21 GLinnik21 closed this Aug 15, 2026
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.

2 participants