Repository navigation
feat(website): play feature clips from the CDN, and show the cache in Settings - #9995
Conversation
|
Intent: Make the dashboard play a feature clip that lives on a CDN as correctly as one on disk — ask the server whether the clip is reachable (the page cannot ask, cross-origin), preload a streamed clip's metadata so its controls work, disclose that it plays over the network, and show in Settings how much of the release is saved on this machine with one control to fetch the rest. Not a goal: the backend half of the contract (routes, release folders, the download pass) — that lands separately. No change to what a verdict means, when a clip is offered, or the startup sequencing policy. No new governance scope: the download gate is the backend's |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of The screenshots confirm the row matches sibling settings geometry and the chip renders as designed. I have everything I need for the review. UX-Verdict: CONCERNS Blind reader used every control correctly, but the downloads-off state is a dead end and the downloading line leaks a raw clip id. Watch
Evidence gaps
Suggestions
[UX-REVIEWED] f7d59b3 |
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Sound server-side fix for the CORS-broken HEAD, but the frontend contract it types against lives only in still-open #9972. Watch
[DESIGN-REVIEWED] f7d59b3 |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of All claims are verified. The backend at this HEAD has none of the new routes (grep for First-Principles-Verdict: CONCERNS The local-clip pre-open probe is deleted under "learns nothing," but the deleted comment's own words named what it learned. Not justified as shipped
What this change shipsInventory (10 items) — 9 justifiedIntent: let a feature clip stream from the CDN instead of breaking on the cross-origin HEAD, and show the release's cache state in Settings — an ADDITION.
Degradation without #9972 verified against the base backend: WatchItem 3: the residual the pin protected — a local clip whose static route breaks between offer and render — is real and un-acknowledged; the new server probe couldn't cover it either (it checks disk, not the route), so the removal may be right, but the description claims equivalence ("exactly as it does today") where the diff ships a regression edge. Clears when: the author confirms the broken-static-route-on-a-local-clip failure (dead dialog instead of no dialog) is an accepted trade, on the record. [FIRST-PRINCIPLES-REVIEWED] f7d59b3 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
cb1bd3f to
e5875b0
Compare
|
disposition: fixed · span=2f6082500a24
|
|
disposition: accepted-and-deferred · span=ff27c4f55fbd
|
|
disposition: rebutted · span=f7c53b0f3102
|
|
disposition: rebutted · span=598d35b0eab3
|
|
disposition: fixed · span=03241bb206ff
|
|
disposition: fixed · span=db224c8ebf8b
|
|
disposition: fixed · span=b57d94ef00ba
|
|
disposition: fixed · span=18bdf5ba706d
|
|
disposition: fixed · span=11289b7117e0
|
|
disposition: rebutted · span=5be75337cefe
|
|
disposition: fixed · span=1db972ae2b97
|
|
disposition: fixed · span=2b014febd1a9
|
|
disposition: fixed · span=33a66efbb886
|
|
disposition: fixed · span=2f6082500a24
|
|
disposition: rebutted · span=4cebe1fb8478
If the lane holds this on the new head, the sanctioned exit is the human override; the maintainer can paste after |
|
disposition: accepted-and-deferred · span=cfac68325644
|
|
disposition: rebutted · span=971cc1dcdb7c
|
|
disposition: accepted-and-deferred · span=ddb9e56cd65d
|
|
disposition: rebutted · span=bb8abde87844
|
|
disposition: fixed · span=28b89d957caa
Why you cannot see it on f7d59b3: it is a copy-only change, and pushing it would re-roll every lane on a head that is currently 54 green / 0 red. It rides the next push of this branch — the first one a code finding earns — so it is verifiable next round rather than this one. Commit df15a1932801e5b53e245ed1f064016ccbf8fc96 carries it locally today. |
|
disposition: needs-a-decision · span=32b0f08261bc
|
|
disposition: rebutted · span=1380df001faa
|
|
disposition: fixed · span=db224c8ebf8b
|
|
disposition: fixed · span=2a18e292fc0e
|
|
disposition: fixed · span=775263533c41
|
|
disposition: fixed · span=1f62fff76317
|
|
disposition: fixed · span=abb5690bf7ef
|
|
disposition: needs-a-decision · span=8ca7fef90318
|
|
disposition: rebutted · span=82e9660c7913
|
|
disposition: fixed · span=8adddc9ef2c4
|
|
disposition: fixed · span=39c960226fa4
|
|
disposition: rebutted · span=774c2b595c8e
|
|
Three prose changes are committed locally and are deliberately not on this head. They are held as
None of it changes behaviour. Gates on that commit are green (tsc, eslint, feature-map, docs-lint, the modal capture harness, and the three affected test suites), and two local pre-push review lanes returned no blocking findings on it. Why it is not pushed: this head has a complete set of green reviewer verdicts, and Deferred, tracked: the modal header says "Feature intro", the Settings row says "Feature Videos", and the clip's own title comes from the backend catalog — a new user cannot tell whether those are one feature or three. One canonical name is a rename across a surface already shipped on Merge order: #9972 (backend) first, then this PR. Every route and payload field this client reads is defined there. |
… Settings (kirodotdev#9995) A feature clip can now live on a CDN instead of only in the release folder on disk, and the frontend has to be told which one it is looking at. The backend reports that in `source`, and this branch acts on it. A REMOTE clip is checked with the server before the dialog opens: `GET /api/feature-videos/probe`. A local one is not, and that asymmetry is the point. `offerable()` only offers a clip whose files `_asset_exists` found on disk, in the same request that hands the clip over, so a probe for a local clip re-runs a check the offer already passed. A clip on a CDN is the case the offer CANNOT check and the page cannot check either: a cross-origin HEAD is refused for want of CORS headers, so a healthy clip reads as missing. Only the server can answer, and only for the remote half. The semantics around it are unchanged. A remote dialog opens on `ok` only. A failure records no verdict, so the clip is offered again next launch, and it is journaled with `probe_not_ok` when the server looked and found nothing or `probe_failed` when the question could not be asked at all. The launch is spent either way. Nothing preloads, for either source. `preload="none"` plus a poster is the cost argument for showing a clip at startup: a launch nobody plays costs one small JSON response and the still. A streamed clip is held to the same rule and says "Plays online" beside the title instead -- a disclosure about a cost the user has NOT paid yet. Reading its header first to populate a seek bar would spend CDN bytes and make that disclosure false. The cost is a streamed clip showing no duration until it plays. A remote clip is not opened at all when the install may not pull bytes (`download_enabled`), tested `=== true` so an absent answer reads as no. A clip already on disk is unaffected -- it needs no network, so the policy has nothing to say about it. Settings > Chat gains a readout beside Feature Tips: how much of the current release is saved on this device, which clip is being fetched, or that downloads are turned off, plus one "Download all now" control. The control is absent rather than greyed when policy forbids downloads, and unavailable while a fetch is already running so the same pass cannot be queued twice. It polls only while the panel is mounted. `GET /api/feature-videos/status` already exists and answers with an engagement-history payload carrying none of the cache fields, so an absent `download_enabled` is the feature detect and the row renders nothing rather than asserting a download policy the install does not have. Copy went through a new-user read: "cached", "policy" and "Streaming" all read as jargon or as a fault, so the line now says where the clips are and what still works. Three fields carry no reader and are not declared: `min_version` and `release` on the clip -- the panel takes the release from the status payload -- and `state` on the status payload, where `downloading` already carries the live signal. Frontend only. No Python, and no URL is ever composed by the client -- `video.src` is played exactly as the backend authored it. Co-authored-by: Zejiang Guo <zejiangg@amazon.com>
Problem / Motivation
A feature clip can now live on a CDN, and the dashboard cannot tell that from a clip on disk. Every part of the frontend assumes the file is same-origin: the pre-open check is a
fetch(src, {method: 'HEAD'}), the player preloads nothing, and the card says nothing about where the bytes come from. Point any of that at a CDN URL and it breaks.The HEAD is the sharp end. A CDN clip is cross-origin, so the browser refuses the HEAD for want of CORS headers and reports a network failure. A healthy clip reads as missing, and the dialog never opens.
There is also nothing in the dashboard that says how much of the current release is on this machine, and no way to ask for the rest.
Why it matters
Without this, a remote clip either never plays or opens a player that cannot fill. Both are worse than showing nothing: the user gets a popup on their first screen with a control that does not work, for a feature they never asked about.
A user on a metered or slow connection also has a right to know before they press play that the clip comes over the network. And an operator has no way to see whether the release's clips are cached, or to warm them.
What changed (motivation → approach → change)
The server answers "is this clip there?".
GET /api/feature-videos/probereplaces the client HEAD. Only one of the two possible sources is same-origin, so no request the page can make answers it for both; the server has no such limit and is also the side that can see the release folder. Everything around it is unchanged — the dialog opens onokonly, a failure records no verdict so the clip is offered again next launch, the failure is journaled, and the launch is spent either way. The journal entry gains acode:probe_not_okwhen the server looked and the clip is not there,probe_failedwhen the probe could not be asked.The player is told where the bytes are.
sourcesayslocalorremote, and the client never guesses from the URL shape. A cached clip keepspreload="none"— nothing is fetched until a press. A streamed clip preloads nothing either — the chip discloses a cost the user has NOT paid, and reading the header first to populate a seek bar would make that false. The cost is a streamed clip showing no duration until it plays. It carries a "Plays online" chip beside the title, since pressing play on that clip spends network.video.srcis played exactly as the backend authored it; the client composes no URL.A remote clip is not opened at all when the install may not pull bytes. The test is
download_enabled === true, so an absent answer reads as no. A clip already on disk is unaffected — it needs no network, so the policy has nothing to say about it.flowchart LR subgraph Before A1[gate says open]:::ctx --> B1[HEAD on video.src]:::removed --> C1[dialog]:::ctx end subgraph After A2[gate says open]:::ctx --> B2[GET /api/feature-videos/probe]:::added --> D2{source}:::added D2 -->|local| E2[preload none]:::changed D2 -->|remote| F2[probe, then preload none + Plays online]:::added end classDef added fill:#DCFCE7,stroke:#16A34A,color:#14532D,stroke-width:2px classDef changed fill:#FEF3C7,stroke:#D97706,color:#78350F,stroke-width:2px classDef removed fill:#FEE2E2,stroke:#DC2626,color:#7F1D1D,stroke-dasharray:4 3 classDef ctx fill:#E0F2FE,stroke:#0284C7,color:#0C4A6E linkStyle 1 stroke:#DC2626,stroke-dasharray:4 3 linkStyle 2,3,4,5,6 stroke:#16A34A,stroke-width:2px🟩 added · 🟨 changed · 🟥 removed · 🟦 unchanged
Only a streamed clip is checked with the server; a cached one opens on the offer the backend already verified.
The probe is asked only for a streamed clip.
offerable()on the backend only offers a clip whose files_asset_existsfound on disk, in the same request that hands it over, so a probe for a cached clip re-runs a check the offer already passed. A CDN clip is the case the offer cannot check and the page cannot check either. A cached clip therefore opens on the offer alone, exactly as it does today.Both feature-video calls from Settings name the active slot.
_blocks_reads_sessionreads "not restricted" for a missing key and for the shareddashboard:uiplaceholder alike, so a request without one is served the permanent engagement history even from a temporary session — the one kind of session whose contract is that reads are withheld. The key is what makes the server's own gate reachable.This PR needs #9972 first.
/probeand/fetch-allare served there, and/statusgrows its cache fields there. Merge order is #9972 then this PR. A gateway without them degrades rather than breaking: an absentdownload_enabledhides the Settings row instead of asserting a policy, and a cached clip never needed the probe.Settings ▸ Chat shows the cache. A row beside Feature Tips reads "Saved on this device: 2 of 3 · release 2026.09.1", or names the clip being fetched, or says downloads are turned off. One "Download all now" control sits next to it. The control is absent rather than greyed when policy forbids downloads, and unavailable while a fetch is already running so the same pass cannot be queued twice. It polls only while the panel is mounted. The row is a readout, not a setting — whether clips play at all is the backend's
feature_videos.enabled, and the row disappears when that is off.The copy went through a new-user read. "cached", "policy" and "Streaming" all read as jargon or as a fault, so the line now says where the clips are and what still works.
Three fields the spec named are not here, because nothing reads them:
min_versionandreleaseon the clip (the panel takes the release from the status payload) andstateon the status payload (downloadingalready carries the live signal the row renders).Tests
StartupVideoModal.test.tsx— the probe is asked of the server once, by clip id, carrying the active slot key; the page never fetches the asset itself (the regression guard for the whole change);ok: falseand a failed probe each open no dialog, mount no<video>, write no verdict, journal the rightcode, and spend the launch. A cached clip is never probed at all. A remote clip plays the backend's URL unchanged, preloadsnone, and shows the chip; a cached one preloadsnoneand shows no chip. A remote clip with downloads off opens nothing and does not even probe, and an absentdownload_enabledbehaves the same; a cached clip with downloads off still plays.ChatPanel.featureVideos.test.tsx— each of the three status lines, the row's absence when the feature is off and when the gateway reports no cache at all, both failure notices, the control starting the fetch, its absence under policy, and its unavailability mid-fetch.Mutation-verified, each with the test that catches it: dropping
!remoteBlockedfromoffered; making the probe gate always pass; probing a cached clip at all; the render gate that follows it;preload="metadata"for a streamed clip; dropping the session key from either Settings call; reading an absentdownload_enabledasfalse; rendering the download control unconditionally; dropping the in-flight clause from itsdisabled.The two absence assertions wait on the status read itself rather than on an unrelated row — anchoring them on Feature Tips let a mutation that made the row render pass unnoticed.
Manual verification
Both capture harnesses assert as well as photograph, and both pass:
npm run verify:startup-video-modal(share off/on, the share card, and the streamed clip's chip +preload="none") andnpm run verify:feature-video-cache-row(all three status lines, the control present and enabled, disabled mid-fetch, and absent under policy).Gates run locally on this head:
tsc -b --force,eslint --max-warnings 0, the full website vitest suite, the Electron suite,i18n:check(19 checks),jscpd,lint:phantom-classes,i18n:render,check_feature_map.py,check_brand_name.py,check_changelog_history.py,check_focus_cue.py,docs-lint.sh,check_comment_history.py, andcheck-bundle-size.mjs.Screenshots / video
The streamed clip, with the chip beside the title:
The cache row in Settings ▸ Chat:
The row's other two states, and the unchanged startup-modal frames
Fetching a clip — the line names it and the control is unavailable:
Downloads turned off — no control in any state:
A cached clip, sharing off then on, and the share card — unchanged by this PR, re-shot to show the chip is absent for a local clip:
Related Issues
no linked issue: this is one work item of a larger "feature videos v2" effort tracked outside the public repo. Merge order is #9972 (backend) then this PR; the degradation paths above make the reverse order survivable rather than expected.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)