Repository navigation
Let the widget embed the notebook as a tab - #471
Merged
Merged
Conversation
frame-ancestors was 'none'. The build now writes it per environment from the platform's widget hosts and each notebook community's cors_origins (develop adds previews and loopback), refusing an origin frame-ancestors cannot express. notebook/osa-bridge.js, added to the notebook page, runs a starter's osa-autorun cells on open and after a kernel restart, and when embedded reports ready and setup status to the widget and applies its light or dark theme. Every build now exposes the app it drives, so the --expose-app flag is gone. Settings overrides: follow the device theme when opened alone, autosave every 5 s. NEMAR's starter gains the agreed instructions and its setup cell runs on open. _headers covers /osa/open, the path Pages serves open.html at. Tested: build unit tests (47 offline); e2e-check.js in Chrome, next commit.
e2e-check.js serves the build's own _headers and now checks that the setup cell runs with no clicks, an unsaved edit autosaves, a kernel restart reruns setup, the notebook works framed on an allowed cross-site origin (a first dark message on a light device, then light, then the device switching back must not override it), and an origin not on the list is refused; production checks loopback is. Tested: develop and production pass in Chrome 153. Seven mutations (no headers sent, no bridge, follow-the-device left on, no wait for it to turn off, restarts ignored, autosave override dropped) each fail their check. The first theme check found a real race in the bridge, fixed in the previous commit.
ADR 0012 amends 0011: the widget's sites may embed the notebook, the bridge and its messages, why not a JupyterLab extension, and the two settings overrides, with what was measured. The adopter guide documents the osa-autorun tag, who may embed the notebook and the frame-src embedders need; the notebook README the bridge and the removed flag. Tested: docs only.
From review of #471: a bridge that failed to start only logged to the console, so the widget would wait for ready forever; it now posts {type: 'error', phase: 'startup'}. The whole setup run is inside its try, so every path posts a setup status. A setup cell counts as run only if it gets an execution count, cleared first because a reopened notebook shows its saved one. The theme reply is always sent, with applied true or false, after up to 10 s. A new kernel reruns setup, as a restart does. Tested: develop e2e-check.js passes in Chrome, including the restart rerun (prompt [2] to [1]) and every theme check.
From review of #471: X-Frame-Options SAMEORIGIN for a browser too old to read frame-ancestors (a current one ignores it when both are sent, measured: the allowed embed still loads in Chrome). The origin check is tested with quote, semicolon, newline and path payloads, and the config loader is shown to refuse them first. embed_origins raises clearly for an environment without platform hosts, and a test keeps the two lists in step. The refused-origin Chrome check now first proves its host page loaded and pointed at the notebook, so silence means refusal. Tested: 56 build tests; loosening the origin pattern fails 3; pointing the refused host at a dead port fails the Chrome check; develop passes.
From review of #471: the adopter guide described the widget's notebook tab as shipped, but the widget still opens a new tab until #470; it now says which is which. The build docstring cited ADR 0011 for the bridge, which is 0012's subject. ADR 0012 records the X-Frame-Options fallback, the bridge's failure messages, and that the config loader refuses an inexpressible origin before the build re-checks it. Tested: docs and a docstring.
Member
Author
Review response (49a0b15, 6f8978a, 3b29ca6)Four Sonnet reviewers (code and security, tests, silent failures, docs) reviewed 3ad30ae. Every finding is addressed below; the two not acted on say why. Security (all five questions answered sound)
Silent failures (49a0b15)
Tests (6f8978a)
Docs (3b29ca6)
Also found and fixed before review (see the description): the first theme check let a mutation survive; the reworked check found a real race in the bridge, which now reads Verification: develop |
neuromechanist
added a commit
that referenced
this pull request
Sep 24, 2026
Release review: add the widget's Notebook tab (#471, #474), color_scheme auto (#472), the first-paint fix (#476) and the dark-page field colors; the capsule and notebook-site bullets described the notebook opening in a new tab, which #474 replaced. Tested: docs-only; each claim checked against origin/develop (config.yaml color_scheme, osa-widget-config- key, ADR 0012 path).
neuromechanist
added a commit
that referenced
this pull request
Sep 24, 2026
* Title the changelog's release as 0.8.14 Tested: docs only. * Complete the 0.8.14 changelog Release review: add the widget's Notebook tab (#471, #474), color_scheme auto (#472), the first-paint fix (#476) and the dark-page field colors; the capsule and notebook-site bullets described the notebook opening in a new tab, which #474 replaced. Tested: docs-only; each claim checked against origin/develop (config.yaml color_scheme, osa-widget-config- key, ADR 0012 path).
6 tasks
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.
Part of #470. The notebook site's side of showing the notebook as a tab inside the chat widget; the widget's own tabs, capsule and pop-out come in a separate PR. ADR 0012 records the decisions and amends 0011.
What changes
frame-ancestorswas'none'. The build now writes it per environment (embed_origins):'self', the platform's widget hosts (demo.osc.earth,osa-demo.pages.dev), then every notebook community'scors_origins(for NEMAR: nemar.org, www.nemar.org, test.nemar.org). The develop build adds*.osc.earth,*.osa-demo.pages.devand loopback. A frame-ancestors source cannot take a partial-label wildcard, so a community origin written that way fails the build.notebook/osa-bridge.js, added by the build tonotebooks/index.html. It runs a starter's code cells taggedosa-autorunwhen the notebook opens and again after a kernel restart. Embedded, it reportsreadyand setup status to the widget and applies the widget's light or dark theme. It listens only towindow.parent, whose origin frame-ancestors has already vetted, and posts no reader data.exposeAppInBrowser), because the bridge drives it. The--expose-appflag is gone, soe2e-check.jschecks the same build a deployment ships.adaptive-themeon (a notebook opened on its own follows the device), andautosaveInterval5 s instead of 120 s (so the widget's pop-out reopens the latest edits).%pip install scipy, File > Download), and its first code cell (install, import,Readyline) is tagged to run on open._headersalso covers/osa/open, the path Cloudflare Pages servesopen.htmlat, and the bridge script, with no-cache.Measured before building
In Chrome against JupyterLite 0.8.4:
notebook:run-cellsettles when the cell finishes (unlikenotebook:run-all-cells);apputils:change-themeonly turnsadaptive-themeoff and returns when it is on, leaving the theme in place (also read in JupyterLab's own command), so the bridge turns that setting off first;settingsOverridesin the rootjupyter-lite.jsonreach the notebooks app. Autosave was checked with a control: with the override, an unsaved edit reached storage within a second; without it, not within 20 seconds.Tests
embed_originsper environment (loopback and previews develop-only, an inexpressible wildcard refused, the shipped NEMAR sites present),inject_bridge(once, before</head>, refusing a page without one or with the tag already), the settings overrides merged into existing ones, and the shipped starter's only auto-run cell being its first code cell.e2e-check.jsnow serves the build's own_headers, and checks, in Chrome: the setup cell runs with no clicks; autosave, and the autosaved edit surviving a reopen; a kernel restart reruns setup; framed on an allowed cross-site origin, the notebook reports ready and setup done, and each light and dark message is applied inside the frame; framed on an origin not on the list, it never loads. Production checks that loopback is refused.apputils:adaptive-themedoes not return its settings write, soapputils:change-themesaw the setting still on and switched it back. The bridge now reads the setting back before changing the theme.Not in this PR