Repository navigation
Embeddable signal viewer route (phase 1 of #410) - #415
Merged
Merged
Conversation
The .eegv and .eegv__* rules and .eegv-units-notice move out of BidsTree.astro's global style block into src/styles/eeg-viewer.css, which BidsTree.astro imports, so a page without a file tree can load them (website#410). Biome reformatted whitespace only; a whitespace-insensitive diff of the old block and the new file is empty. Lint green.
The dialog's subject, task, prev and next markup and its scoped styles move into EegViewerNav.astro so the embed route can render the same controls. Data attributes are unchanged, so the dataset page script needs no change. The dialog keeps its own copy of the .eegv-nav__btn rules for the Copy link button, with a sync comment. Lint green.
mountEegViewer can append a caller-supplied element into .eegv__scope on every mount, stamped data-eegv-overlay. The annotation layer's capture-phase pointerdown and click handlers ignore events that start inside it, so a click on the overlay never places an annotation, and the cursor readout treats its box as a no-readout zone so an overlay hidden while the readout shows can still be reached. The dataset page passes no overlay. Unit tests and lint green; browser check comes with the embed page.
With fitHeight the scope takes the height its host leaves after the viewer's other controls, floored at 140 px, instead of min(width/2, 540, 0.7 * innerHeight). A second ResizeObserver on the host and the viewer root follows frame resizes and chrome that fills in late, and re-renders only when the fit moved, so applying a height cannot loop. Off by default; the dataset page's rule is unchanged. fitScopeHeight is unit tested.
A new unavailableLink option replaces the fallback's download link and the directory recording's expand-arrow hint, neither of which exists in an embed. It renders escaped, in a new tab. The sentence moves into an exported unavailableMessageHtml so the choice and the escaping are unit tested; the dataset page output is unchanged. Tests and lint green.
src/lib/embed.ts holds the embed contract shared by the middleware, the embed page and the dataset page's Embed control: the /dataset/<id>/embed route matcher (raw path, so encoded spellings fail closed), the ?theme= parser, embed and dataset page URL builders, the origin a snippet names, and the iframe snippet with escaped attributes. Unit tested.
The dialog's orchestration moves out of the dataset page script into src/lib/eeg-viewer/viewer-session.ts so the embed route can drive the same code: the live instance and its supersession counter, opening a recording, navigate and step, the subject/task/prev/next sync, the draft guard, settings transfer, neighbour prefetch, the units notice, ?view= resolution and URL sync, and Copy link. Page-specific behavior comes in through hooks. The page keeps the inline tree row, Enlarge, and the dialog open/close glue. Tested: a Playwright characterization of the dialog on on007753 (View data, exact/relaxed/zero-padded/missing ?view=, inline to Enlarge and back without a remount, Enlarge then next then close, prev/next and both dropdowns with labels, disabled ends and focus hand-off, Copy link and URL tracking, the draft guard on next, subject and the corner X, fast next x3) gives identical results on origin/staging and after this change. Pure pieces are unit tested; lint, typecheck and tests green. ADR 0012 gets an update noting where its code now lives.
theme joins view in CLIENT_ONLY_QUERY_PARAMS, so every embedder's ?theme=light|dark shares one cached copy of the embed route. Safe because no route reads it on the server: a grep of every searchParams read under src/pages, src/layouts, src/components, src/lib and the middleware finds none for theme, and the embed layout applies it in an inline script before first paint. Unit tested.
A minimal document for the embed route: global tokens and CSS, the favicon, robots noindex, a canonical link resolved like Base.astro's, and an inline bootstrap that applies ?theme=light|dark before first paint and otherwise leaves the system preference in charge. No nav, footer, notices, cookie notice, assistant widget or Umami tracker. The body is exactly the frame's height. Lint green; exercised with the embed page.
A chrome-free page for partner iframes. SSR mirrors the dataset page: ds* ids 301 to the on* embed with the query kept, landing and metadata via the same helpers with the same 404/503/500 rules (no-store), the same ?v= selection and public Cache-Control. Errors, an unpublished dataset, a ?view= miss or no viewable recordings render a sentence and a link, never a blank frame. The header carries the recording name, EegViewerNav and Open on NEMAR; the NEMAR mark sits on the scope. The client is a thin shell over the shared viewer session, which gains mountOptions (fitHeight, the mark as scopeOverlay, an unavailable link to the dataset page) and onRecordingShown (keeps every outbound link on the recording on screen). Links open a new tab on the serving origin. Tested in Chromium against bun run dev: at 360x480, 800x560 and 1200x720 the document does not scroll; lint and typecheck green.
routeAllowsFraming matches /dataset/<id>/embed only. That route gets frame-ancestors * and no X-Frame-Options; every other route keeps frame-ancestors 'self' and SAMEORIGIN. applySecurityHeaders is the one place, so passthrough, cache HIT and cache MISS agree, and it deletes any X-Frame-Options a cached response carried. Tests walk every page file under src/pages through applySecurityHeaders and the middleware and find exactly one frameable page; they pin 'unsafe-eval' on the embed route and, in host.test.ts, that it is a marketing route. curl against bun run dev: the embed sends frame-ancestors * without XFO; /, /dataset/on007753, /login, /settings and /upload send 'self' and SAMEORIGIN. Tests and typecheck green.
Next to Copy link, Embed copies an iframe snippet for the recording on screen: embedUrl on the marketing origin from a production host (this deploy's origin elsewhere), pinned to ?v= only when the page was, and the session's viewSpec. A refused clipboard reveals the snippet in a read-only, pre-selected textarea, hidden again on the next navigation. It shares the status live region and has its own focus outline. Tested in Chromium and WebKit against bun run dev: the clipboard holds the expected snippet; with clipboard-write denied the textarea shows, focused and fully selected, and hides after next. The dialog characterization still matches origin/staging exactly.
ADR 0023 records the separate chrome-free embed route, frame-ancestors * with no allowlist and no X-Frame-Options there, the absent session, notices, assistant widget (an exception to ADR 0018) and analytics, the mark on the scope, and the shared viewer session; indexed in the decisions README. AGENTS.md lists the new files; CHANGELOG.md gains the Unreleased entries. Docs only.
Last in the header, the shared PrivacyChoicesIcon from #414 links to /privacy on the serving origin, in a new tab. Its accessible name is a statement, "Privacy: how NEMAR counts embedded views", since nothing can be chosen inside an embed. Narrow-frame header spacing tightens so the header stays two lines at 360 px. Measured in Chromium: no document scroll at 360x480, 800x560 and 1200x720.
On a narrow host the status line is one line while a window loads and two once the summary replaces it, so each render moved the fit and each fit started a render. A fitHeight viewer now carries .eegv--fit, which holds the status to one ellipsized line (full text in its title), and a moved fit is applied to the scope at once instead of after any read in flight, so a late legend or minimap no longer overflows the frame. Tested in WebKit and Chromium at 360x480: no overflow sampled over two seconds and no status or scope mutation once settled. Dataset page untouched (the class is fit-only).
Deploying nemar-website with
|
| Latest commit: |
1a358f1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4a318e88.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-issue-410-embed-view.nemar-website.pages.dev |
fetchZarrIndexOutcome returns ok, absent (the index's 404) or error (a network failure, another non-OK status, or a body parseZarrIndex rejects, which now logs with the dataset id). fetchZarrIndex wraps it, so the dataset page is unchanged. The embed says "This dataset has no interactive recordings yet." for absent and keeps "right now" for error; the dead .catch is gone. Tested: the mapping with real Response objects (a captured on000246 index, 404/403/500/503, a non-JSON body, a rejected index), a refused loopback connection, and on007406 (no Zarr copy) in Chromium and WebKit at 800x560 and 360x480.
The embed shell's start() rejection is now caught: it logs [embed] with the dataset id and shows a notice with the dataset link. The session's afterClaim hook moves inside mount's try, so a throwing hook ends in the same failed outcome as a throwing mount. Tested in Chromium and WebKit by making history.replaceState throw in the page (an injected fault, ?view=sub-05_task-nope so the URL must be rewritten): the notice and the link show and the console names on007753.
When mount or navigate threw, the catch dropped the session's handle
without disposing what the failed mount had built; now both catches
dispose through live.destroy or the host's own cleanup first. The
post-success side effects (units notice, the viewer-open hook, neighbour
prefetch) run after the try, each logged on its own, so a throw there
no longer turns a working viewer into an unowned one behind a
"couldn't open" message. Logs carry { datasetId, path }.
Tested in Chromium and WebKit with injected faults: an analytics hook
that throws leaves the dialog's viewer live and navigable and Escape
disposes it; a 2d-context throw mid-navigation leaves no scope behind.
A failed navigation put the chrome back on the previous target, which could itself have been mid-mount. The live record now tracks shownPath and shownName, updated only when a mount goes live, and a failed navigation restores to those. Tested in Chromium and WebKit on the embed (on007753): from sub-01, next (sub-02 in flight) then next (sub-03, an injected 2d-context throw) leaves the title, the counter (1 of 41), the next label and ?view= on sub-01, and next from there opens sub-02.
4 of 9 tasks
In fit mode a sibling appended to the host after the first fit (the session's units notice) resized neither the host nor the viewer root, so nothing refit and the document could scroll by the notice's height. A MutationObserver on the host's children now refits, and observes each new child's size. The embed pads the notice to the viewer's edge and, at 560 px and narrower, caps the nav selects at 5.5rem with tighter header gaps, which keeps the header to two lines with a long subject label. Tested in Chromium and WebKit: a line appended to the host after the viewer settles overflowed by 27 px before this and 0 after; on000246 (MEG, a real units notice) does not scroll at 360x480, 800x560 or 1200x720 in either theme.
The embed shell's showNotice logs one console.warn("[embed]", {
datasetId, version, view, reason }); the viewer's [eeg-viewer]
unavailable log carries { datasetId, path } (the session's open and
navigation failure logs already do, from the mount fix).
Tested in Chromium: a ?view= miss on on007753 and on007406's missing
index each log the expected object.
The present hook returns a boolean. openRecording presents the new host
first and stops, logging { datasetId, path }, before releasing the
current viewer, setting the title or mounting anything when it returns
false. Because the new host is now presented before the release, the
dataset page's onRelease closes the dialog only when the released
instance is the one inside it.
Tested in Chromium and WebKit: View data over an open inline row
presents sub-01 and collapses the row; with the dialog slot removed it
leaves the inline viewer live and the title unchanged. The dialog
characterization still matches origin/staging.
The unsaved-annotation guard failed open whenever anything threw, including focusPopover after isPopoverOpen had already said a draft was open, which let the navigation through and lost the draft. Now only a throwing isPopoverOpen fails open; a throwing focusPopover is logged and the navigation is still refused. The draft-guard scenarios of the dialog characterization are unchanged.
Copy link and Embed capture the recording path before awaiting the clipboard and, if the visitor navigated meanwhile, write neither the status nor the fallback textarea, which would otherwise describe a recording no longer on screen. Tested in Chromium: with the clipboard write held pending, navigating before it settles leaves the status empty and the textarea hidden; the normal and refused-clipboard paths behave as before.
The unavailable sentence said the Zarr copy "may still be generating" for every failed open. It now says that only when zarrita reports the store missing (isMissingStoreError, its NotFoundError, which is what a 404 on the root metadata becomes) and otherwise "The viewer could not load this recording." A recorded failure reason still wins. A retry control is website#416, not built here. Tested: unavailableMessageHtml for both cases, isMissingStoreError against a real zarrita open of an empty in-memory store and against other errors.
resolveCanonical(id).catch(() => null) on the dataset page swallowed a rejected ds* to on* lookup without a trace. It now logs the id and the error, and still serves the id as-is. Typecheck green.
The embed logs a rejected canonical lookup the same way the dataset page
now does. A ?v= that names no published version still falls back to the
latest, and now says so in a one-line, ellipsized note ("Version X is
not published; showing the latest, Y.") with a server-side warning.
Tested in Chromium and WebKit on on007753 with ?v=v9.9.9 at 800x560 and
360x480: the note shows, the viewer mounts, the document does not
scroll.
With scripting off, "Loading viewer…" stayed on screen beside the noscript sentence forever. A <noscript><style> hides the placeholder then, leaving only the sentence and its link. Tested in Chromium and WebKit with JavaScript disabled: the placeholder computes to display none and the noscript sentence shows; with JavaScript on nothing changes.
The frameable not-found page printed the path segment verbatim ("NEMAR
has no dataset <id>.") and so did its <title>, which let any site put
its own sentence on a nemar.org page inside its frame. displayableDatasetId
admits /^[A-Za-z0-9._-]{1,40}$/; anything else reads "NEMAR has no
such dataset." and titles the page "NEMAR dataset". The meta
description follows the same rule.
Tested: unit tests for both sides of the rule; curl against the dev
server for on999999 (echoed) and two sentence-shaped paths (not
echoed in the body or the title).
"Nothing runs on the visitor's device" and "sets nothing on the device" were wrong: the viewer keeps its nav order, preload settings and annotations in browser storage. Embed.astro, the embed's privacy link comment and ADR 0023 now say no analytics script runs and no cookie is set; settings and annotations the visitor creates stay in their browser. Phase 5 copies this into the privacy policy. Docs and comments only.
The embed route's Content-Security-Policy must equal the dataset page's once its frame-ancestors * is replaced by 'self', so framing stays the only difference ADR 0023 makes. Tests green.
embed.ts no longer claims a test covers the inline theme bootstrap; it names the other copy (the is:inline script in Embed.astro's head) and says the two are kept in step by hand. ADR 0012's new heading drops its em-dash. Comments and docs only.
The releaseEegViewer wrapper had one caller left and a comment naming two; it is gone and the inline open calls session.release() itself, with the comments that named the wrapper updated. No behavior change; the dialog characterization is rerun after the next commit.
sessionContext(datasetId, version, zarr) in viewer-session.ts builds the SessionContext for every page that opens a recording: the dataset page's inline row, View data and ?view=, and the embed. It passes the Zarr state through so its prefetched set stays shared with the tree rows, and gives an empty list and the un-busted token without an index. The now unused zarrTokenForButton goes. Tested: unit tests on on007753 paths and the no-index case; the dialog characterization still matches origin/staging; typecheck green.
Records under Changed that a Zarr copy that exists but will not load is no longer described as still generating, on the dataset page and in the embed. The shared session is not user-visible, so it gets no entry. Also drops a stray blank line inside the Added list. Docs only.
This was referenced Oct 5, 2026
neuromechanist
added a commit
that referenced
this pull request
Oct 5, 2026
Re-review of #426: the embed's unknown-version note (and its log) quoted the raw ?v= value, the same echo #426 closed for ?view=. displayableVersion admits version tokens such as v1.0.1, and anything else reads "That version". displayableViewParam now trims, as parseViewSpec does, and says what it can and cannot rule out. The changelog says where #415's code moved from, and ADR 0024 and the flag comment describe the widened catch. Tested: lint, typecheck, unit tests.
neuromechanist
added a commit
that referenced
this pull request
Oct 5, 2026
* Quote ?view= in notices only when it is a name Release review of #424: the embed's and the dataset page's "no recording matches" notices quoted the raw ?view= value, so anyone writing a link (or framing the embed) could put their own sentence on a nemar.org page. displayableViewParam quotes values shaped like entity strings, filenames or BIDS paths and says "a recording" otherwise, the same guard displayableDatasetId gives the path id. Tested: recording-nav tests (90 passed), including real view values and free-text refusals. * Count embed calls with the point built in the try Release review of #424: embedCallPoint ran outside countEmbedCall's try. No input found makes it throw, but a counter must never break the response it counts, so building the point now sits inside the same catch as the write, and the log names the dataset when there is one. Tested: middleware tests (83 passed). * docs: changelog corrections from the release review - the private handoff's 501 keys on the API base, not production; - the page's own responses carry no-store/no-referrer/noindex, a cross-host redirect only no-store; - add the shared viewer session (#415) and the ?theme= cache key; - add the ?view= quoting fix. * Quote ?v= only when it is a version; review nits Re-review of #426: the embed's unknown-version note (and its log) quoted the raw ?v= value, the same echo #426 closed for ?view=. displayableVersion admits version tokens such as v1.0.1, and anything else reads "That version". displayableViewParam now trims, as parseViewSpec does, and says what it can and cannot rule out. The changelog says where #415's code moved from, and ADR 0024 and the flag comment describe the widened catch. Tested: lint, typecheck, unit tests. * test: format the displayableVersion cases
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds
/dataset/<id>/embed, a chrome-free signal viewer that partner sites can put in an iframe, and makes it the only route another site may frame. The dataset page's viewer dialog gains an Embed control that copies the snippet. The dialog's orchestration moves into one shared module,src/lib/eeg-viewer/viewer-session.ts, which the dialog and the embed both drive, so a viewer feature is written once for both surfaces.Refs #411, part of #410 (closing keywords do not fire on
stagingmerges).What changed
Shared viewer session.
viewer-session.tsnow owns the live instance and its supersession counter, opening a recording, navigate/step and the subject/task handlers, nav-control sync (labels, disabled ends, focus hand-off), the unsaved-annotation draft guard, settings transfer, neighbour prefetch, the units notice,?view=resolution and URL sync, Copy link, and the new Embed control. Page-specific behavior comes in through hooks (isShowing,setTitle,present,onRelease,onDetach,onViewerOpen,mountOptions,fallbackActionHtml,onViewParamMiss,onRecordingShown,shareLink,embedSnippet), never a branch on "is this the embed". The dataset page keeps only its own parts: the inline tree row, Enlarge, the dialog open/close glue (including the corner-X veto), tree hydration and View data. ADR 0012 gets an update saying where its code now lives. The refactor is its own commit and was characterized in a browser before and after (gate 6).Viewer options (
viewer.ts,annotation-ui.ts).scopeOverlayappends a caller element into.eegv__scopeon every mount (stampeddata-eegv-overlay); the annotation layer's capture-phasepointerdownandclickignore events that start inside it, and the cursor readout treats its box as a no-readout zone so an overlay hidden while the readout shows stays reachable.fitHeightsizes the scope to what the host leaves after the other controls (floor 140 px), tracked by a second ResizeObserver that re-renders only when the fit moved and applies the height at once so a slow window read cannot leave the document overflowing; the default rule is unchanged.unavailableLinkreplaces the download link and the "expand arrow" hint, which mean nothing in an embed; the sentence is now the exported, testedunavailableMessageHtml.Embed route (
src/pages/dataset/[id]/embed.astro,src/layouts/Embed.astro). SSR mirrors the dataset page:ds*ids 301 to theon*embed keeping the query, the same landing and metadata helpers with the same 404/503/500 rules (no-store, with a sentence and a link in place of an empty body), the same?v=selection and the same public Cache-Control. It never reads the session. The layout has global tokens and CSS, the favicon,noindex, a canonical to the dataset page and a pre-paint?theme=light|darkbootstrap; no nav, footer, notices, cookie notice, assistant widget or Umami. The header (one line, two at 360 px) carries the recording name,EegViewerNav, Open on NEMAR and, last, a privacy link withPrivacyChoicesIconfrom #414 named "Privacy: how NEMAR counts embedded views". The client is a thin shell over the session. The NEMAR mark sits bottom-right on the scope, at 0.55 opacity (1 on hover and focus), clear of the 22 px time axis, hidden while the cursor readout shows. Every outbound link opens a new tab on the serving origin. A?view=miss, no viewable recordings, or an index that will not load shows a sentence and a link, never a blank frame.Framing (
src/middleware.ts).routeAllowsFramingmatches/dataset/<id>/embedon the raw path (encoded spellings fail closed). That route getsframe-ancestors *and noX-Frame-Options; every other route keeps'self'andSAMEORIGIN.applySecurityHeadersis the one place, so passthrough, cache HIT and cache MISS agree, and it deletes any XFO a cached response carried. A test walks every page file undersrc/pages/and finds exactly one frameable page; tests pin'unsafe-eval'on the embed route and, inhost.test.ts, that it is a marketing route.Edge cache (
src/lib/edge-cache.ts).themejoinsviewinCLIENT_ONLY_QUERY_PARAMS. No route reads it server-side (grep of everysearchParamsread undersrc/).Snippet (
src/lib/embed.ts). Route matcher,?theme=parser, embed and dataset-page URL builders, andembedSnippetwith escaped attributes, in the shape #410 specifies. The dialog's Embed control builds it for the recording on screen, pinned to?v=only when the page was. On clipboard failure it reveals a read-only, pre-selected textarea, hidden again on the next navigation.Shared markup and CSS. The dialog's nav markup and styles move to
EegViewerNav.astro; the viewer CSS moves verbatim (whitespace-insensitive diff is empty) fromBidsTree.astrotosrc/styles/eeg-viewer.css, imported by BidsTree and the embed.Docs. ADR 0023 (separate route,
frame-ancestors *without an allowlist, no XFO, no session/notices/assistant widget/analytics, mark on the scope, one shared session, alternatives); indexed; AGENTS.md map; CHANGELOG[Unreleased]entries.Review fixes
Every item from the two reviews of this PR is applied as its own commit; nothing was skipped.
fetchZarrIndexOutcome):ok,absent(the index's 404) orerror(network failure, another non-OK status, or a bodyparseZarrIndexrejects, now logged with the dataset id).fetchZarrIndexwraps it, so the dataset page is unchanged. The embed says "This dataset has no interactive recordings yet." forabsentand keeps "right now" forerror. Tested with realResponseobjects (a captured on000246 index, 404/403/500/503, a non-JSON body, a rejected index) and a refused loopback connection, no replaced fetch.start()(logs[embed]with the id, shows a notice and the dataset link);afterClaimruns insidemount's try.live.destroy ?? host._eegvCleanupbefore dropping the handle; the units notice, the viewer-open hook and neighbour prefetch run after the try, each logged on its own.shownPath/shownName): A, next (B in flight), next (C throws) lands back on A.console.warn("[embed]", { datasetId, version, view, reason })inshowNotice;{ datasetId, path }on the[eeg-viewer]open-failed, navigation-failed and unavailable logs.presentreturns a boolean;openRecordingpresents first and stops before releasing anything, setting the title or mounting when it fails. The dataset page'sonReleasenow closes the dialog only when the released instance is the one inside it.isPopoverOpen()fails open; a throwingfocusPopover()is logged and the navigation is still refused.NotFoundError, viaisMissingStoreError); otherwise "The viewer could not load this recording." A retry control is Viewer: a Try again action when the first recording fails to open #416.resolveCanonicalis logged with the id on the embed and the dataset page; a?v=naming no published version is logged and the embed shows one ellipsized line, "Version X is not published; showing the latest, Y."<noscript><style>hides "Loading viewer…"./^[A-Za-z0-9._-]{1,40}$/(displayableDatasetId), in the body and the<title>; otherwise "NEMAR has no such dataset."Embed.astro, the embed and ADR 0023: no analytics script runs and no cookie is set; settings and annotations the visitor creates stay in their browser.frame-ancestors *becomes'self'. (No Map-backed cache test, as asked.)embed.tsno longer claims a test covers the inline theme bootstrap; ADR 0012's update heading drops its em-dash.releaseEegViewerdeleted; the inline open callssession.release().sessionContext(datasetId, version, zarr)inviewer-session.ts, used by the inline row, View data,?view=and the embed, and unit tested; the deadzarrTokenForButtongoes.The fault-path checks above (items 2, 3, 4, 7 and the copy race) were run in Chromium and WebKit against the dev server by injecting a fault in the page (a throwing
history.replaceState, analytics hook, 2d context or clipboard, or a removed dialog slot), since real data does not produce those failures on demand.Decision gates
Measured against
bun run dev(production backends) from a cross-site parent page onhttp://127.0.0.1:8080, with Playwright in Chromium and WebKit. Scripts and screenshots are in the session scratchpad (phase1/gates.ts,phase1/characterize-dialog.ts,phase1/gates/), not in the repository./dataset/on007753/embed?view=sub-05_task-BCCWJreadingin an iframe onhttp://127.0.0.1:8080; the viewer mounts (one scope, titlesub-05_task-BCCWJreading_eeg.vhdr) and the console has no CSP or framing messages. The only console errors are the dev server's Astro toolbar (504 Outdated Optimize Dep) and a 404 for a Zarr events chunk, both also present onorigin/staging.'self'andSAMEORIGIN. A unit test walks all 60 page files undersrc/pages/(and trailing-slash spellings) throughapplySecurityHeadersand the middleware: exactly one frameable page, the embed.curlagainst the dev server:/,/dataset/on007753,/login,/settings,/uploadsendframe-ancestors 'self'andX-Frame-Options: SAMEORIGIN;/dataset/on007753/embed(with and without the trailing slash) sendsframe-ancestors *and no XFO. Framing/dataset/on007753from the parent is refused in both engines (Chromium: "violates the following Content Security Policy directive: frame-ancestors 'self'", frame atchrome-error://; WebKit: "Refused to load ... does not appear in the frame-ancestors directive").sub-0001_task-AEF_run-02, 16 channels kept the file's unit): overflow 0 px in both engines, both themes, at all three sizes (scope 155/343/467 px Chromium, 162/349/473 px WebKit). A line appended to the host after the viewer settles overflowed by 27 px before the refit fix and 0 after.?theme=light,?theme=dark, and bothprefers-color-schemeemulations without?theme=(wordmark follows--color-fg:rgb(15, 23, 42)light,rgb(241, 245, 249)dark). Over the trace the cursor readout shows and the mark goes to opacity 0 withpointer-events: none; moving onto the mark clears the readout and brings it back at opacity 1. Its bottom edge sits 7 to 8 px above the time-axis band at all three sizes, inside the scope. A click openshttp://localhost:4321/dataset/on007753?view=sub-05_task-BCCWJreadingin a new tab. With annotate armed, a click on the mark opens the tab and places nothing (no popover,0 events · 0 channel marks), while a click on the trace with the same armed tool does open the popover. Our ownsolid 2pxfocus outline shows on the mark, the header links, the privacy link and the dialog's Embed button, also under ChromiumforcedColors: "active"; WebKit checked with Option+Tab, its tab-to-every-control key.?view=resolves as on the dataset page. Exactsub-05_task-BCCWJreading, relaxedsub-05_task-nopeandsub-5all opensub-05_task-BCCWJreading_eeg.vhdrand rewrite?view=tosub-05_task-BCCWJreading, as the dialog characterization records for the dataset page.ds007753301s to/dataset/on007753/embedwith the query (and?theme=dark) intact.sub-99shows "This embed asked for sub-99, but no recording in this dataset matches it." with a new-tab link to the dataset page. No?view=opens the first recording in nav order (sub-01). Directory recordings mount: on004696 (iEEG MEF3.mefd) and on000246 (MEG CTF.ds,?view=sub-0001_task-AEF_run-02).origin/stagingbefore the refactor and replayed after it and again on the final branch (View data; exact, relaxed, zero-padded and missing?view=; inline row to Enlarge and back with no remount; Enlarge, next, close ends the instance and collapses the row; prev/next and both dropdowns with labels, disabled ends and focus hand-off; Copy link and?view=tracking, cleared on close; the draft guard refusing next and a subject pick and vetoing the corner X; fast next x3 leaving one live viewer) is identical. No mark on the dataset page (0 overlays) and the same height rule: dialog scope 540 px and inline scope 389 px at 1280x900, onorigin/stagingand on this branch./dataset/on007753/embed?view=sub-05_task-BCCWJreading&v=v9.9.9shows "Version v9.9.9 is not published; showing the latest, v1.0.0." and mounts the viewer. Neither scrolls.bun run lint,bun run typecheck,bun run test,bun run build. All green.Tests
bun run test: 2931 passed, 7 skipped (125 files);origin/staginghas 2869, so this PR adds 62, coveringembed.ts(includingdisplayableDatasetId),fitScopeHeight,unavailableMessageHtmlandisMissingStoreError, the session's purenavControlState,viewSpecForPathandsessionContext, the Zarr index outcome mapping,?theme=in the cache key, the framing policy with the page-file walk and the embed-vs-page CSP comparison, and the embed route's host classification. Inputs are real on007753, on004696 and on000246 index paths and responses; no mocks.bun run typecheck: 0 errors, 0 warnings. The DOM orchestration is covered by the browser characterization and the gate scripts, rerun after the review fixes (gate 6 still identical toorigin/staging).Follow-ups
applySecurityHeaders, which the unit tests cover)./privacy(the docs privacy policy). Phase 5 adds the embed section; once it has an anchor, the link can point at it.