Repository navigation
Point the develop chat at its deployment's NEMAR hosts - #481
Conversation
mcp_servers[].url, runtime.python.fetch_allow and runtime.python.prelude
each take one value or a {production, develop} map (#480). The backend
is develop when OSA_DEPLOYMENT says so, or, unset, when mounted at
/osa-dev; the MCP client connects to the resolved URL and the public
config response carries the resolved runtime.
Tested: test_deployment.py (new), the router and MCP client tests; 10
single-line mutations each fail them; full offline pytest, 2956 passed.
test.nemar.org embeds the develop widget and shows only the exemplar fleet, which production's MCP and Zarr host do not know. Develop now reads mcp-test.nemar.org and zarr-test.nemar.org, and its prelude points eegprep-lean's read_index at the staging host (#480). Tested: test_nemar_runtime.py, test_nemar_mcp_wiring.py, and an offline check of the vendored wheel that read_index reads the template global at call time.
auto-update-dev.sh passes OSA_DEPLOYMENT=develop, which takes effect when the host's copy is next updated; until then the /osa-dev mount decides (#480). Tested: shell change only; the fallback is covered by test_deployment.py.
Why per-deployment maps, how the backend knows its deployment, and the eegprep-lean global the develop prelude relies on (#480). Tested: docs only.
auto-update.sh and deploy.sh pass OSA_DEPLOYMENT for whichever deployment ENVIRONMENT selects, and docker-compose.yml sets production. Production no longer relies on the ROOT_PATH fallback, since both containers read one shared .env and a stray ROOT_PATH=/osa-dev there would have sent production readers to staging hosts. Review finding on #481. Tested: pytest tests/test_deploy (runs each script's own selection block under bash for dev and prod) and the offline suite.
CommunityConfigResponse rejects a runtime whose fetch_allow or prelude is still a per-deployment map, so a caller that skips for_deployment fails on the server instead of handing the widget a value it reads as no egress and no prelude. Review finding on #481. Tested: pytest tests/test_api/test_community_router.py; the validator mutated off fails both new cases.
A map that both misses a deployment and names an unknown one now says both,
since {production, staging} is a typo for develop. A blank OSA_DEPLOYMENT
counts as unset, now pinned by a test. Both deployments' preludes are
tested for compilation, not only develop's. for_deployment's signature and
NOTEBOOK_ENVIRONMENTS are typed with the Deployment literal, clearing two
mypy errors in the new code. Review findings on #481.
Tested: pytest tests/test_core/test_config (a prelude check limited to
develop now fails a test).
Review responseTwo Sonnet reviews: code and error handling, and tests with documentation. Every finding is addressed. Code and error handling
Tests and documentation
One reviewer ran Gates: offline pytest 2968 passed. The one failure, |
test-data-lane.js and the browser harness read config.yaml directly and handed the widget code a per-deployment map, which it reads as no prelude. Both now resolve production's values, as the server does for a local run. The data lane also boots the develop prelude in real Pyodide, which nothing had run before: it checks that FetchTransport is the default and that read_index points at zarr-test.nemar.org. Tested: every Bun suite in test.yml's Frontend Tests job, the runtime bundle check, and bun frontend/browser-harness/chrome.js (exit 0); removing the develop prelude's INDEX_URL_TEMPLATE line fails the new check.
Preview Deployment
This preview will be updated automatically when you push new commits. |
|
Follow-up: the first CI run failed Frontend Tests, and the failure was mine. |
Summary
Closes #480. On test.nemar.org, the NEMAR chat talked to production NEMAR, which knows none of the datasets staging shows: staging's catalog is the exemplar fleet (
xx0999NN). The production MCP answereddescribe_dataset(xx099906)with "not found in the public catalog", andzarr.nemar.org/xx099906/zarr/index.jsonis 404.The develop deployment now reads NEMAR's staging hosts, the way the notebook site's develop build already does (ADR 0011). The decision is recorded as ADR 0013.
Changes
src/core/config/deployment.py:current_deployment()returnsOSA_DEPLOYMENTwhen set. Otherwise it returnsdevelopfor the container mounted at/osa-dev, which is whatdeploy/auto-update-dev.shalready runs, andproductionfor anything else. An unknown name is a startup error.extensions.mcp_servers[].url,runtime.python.fetch_allowandruntime.python.preludetake one value or a{production, develop}map. A map must name both deployments, and every deployment's prelude is compiled at load.McpServer.resolved_urlis what the MCP client connects to. The public config response carriesRuntimeConfig.for_deployment(...), one list and one prelude, so the widget and the runtime bundle are unchanged.https://mcp-test.nemar.org/mcpandhttps://zarr-test.nemar.org/, plus a prelude that setseegprep_lean.index.INDEX_URL_TEMPLATEto the staging host. That is the globalread_indexreads its URL from, and eegprep-lean has no other setting for it. Theexecute_codedescription names "NEMAR's Zarr host" rather than one hostname.deploy/auto-update-dev.shpassesOSA_DEPLOYMENT=develop. The host's copy of the script only changes when someone updates it; until then, the/osa-devmount decides.docs/community-browser-runtime.md("Values per deployment"), anddeploy/DEPLOYMENT_ARCHITECTURE.md.Production is unchanged: every production value is the one it had.
Testing
tests/test_core/test_config/test_deployment.py(new):/osa-dev/,/osa-dev2,OSA_DEPLOYMENTover the mount, and an unknown name;read_indexstill readsINDEX_URL_TEMPLATEat call time, so a re-vendored wheel that changed that fails a test instead of quietly sending the develop chat back to production.test_version_shows_versiondeselected, the local-only test_version_shows_version fails locally and passes in CI, because rich colorizes on a TTY #434). ruff check and format.