Repository navigation
feat: browser recipe leads with read_window - #1487
Merged
Merged
Conversation
At level 0 python_browser now reads through read_index, index.store and read_window, which return physical units with channel labels, and names the index by the recipe's own contract_base so a dev or staging server reads its own environment. The open_array read of array_path follows as the raw alternative, and is the only read at a view level, which read_window does not read. buildReadRecipe carries the dataset id and store path through to buildHowTo. Tested: bun test contract-mcp, mcp-schema-parity, mcp-read-window, mcp-recording-tools, mcp-route; typecheck; lint; each new test mutation-checked; the emitted recipe for nm000103 run verbatim on CPython with eegprep-lean 0.1.0.dev2 against the live archive.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1487Version: 🤖 Updated on each push. |
path and group names are free-form in the index schema and are now written into code a client runs, so each interpolated value in all three lanes is a JSON.stringify literal, valid in Python and in JavaScript. Adds an exact-block test for the read_window call and a round-trip test for a quote and backslash in each lane. Tested: bun test contract-mcp (75), mcp-schema-parity, mcp-read-window; each new test mutation-checked.
Contributor
Author
|
Local review, two Sonnet reviewers (code and tests). Every finding is addressed:
Merge after sccn/eegprep#416. |
This was referenced Sep 23, 2026
Merged
This branch was previously deployed
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
nemar_read_window'spython_browserrecipe handed a modelopen_arrayplusgetitem, whose result is the stored digital counts. A model that plotted that got a figure that looks like EEG and is wrong, with nothing raising. The recipe's own trailing comment pointed atread_window, but a model follows the code, not the comment. OSA's assistant did exactly that when told to plot (OpenScience-Collective/osa phase 3, #432).At level 0, the lane now leads with the read in physical units, and names the index by the recipe's own
contract_base:index_url.read_index's default URL is production's. Naming the index bycontract_basemeans a dev or staging server's recipe reads that environment.index_urlis new in eegprep-lean 0.1.0.dev2 (eegprep-lean: let read_index take an explicit index URL sccn/eegprep#416), and the snippet says so.digital = await arr.getitem(...)follows as the alternative, and is the only read at a view level, whichread_windowdoes not read.index.jsononce: measured on zarr.nemar.org, nm000103's is 2.7 MB of JSON and 98 KB on the wire. The decision also adds a coupling, to eegprep-lean 0.1.0.dev2. ADR 0070 keeps a one-line amendment pointing at it, and its verdict is unchanged. Both reviewers judged an amendment alone a close call, which is why this is a separate ADR.JSON.stringifyliteral, valid in Python and in JavaScript.store.pathand group names are free-form strings in the index schema, and they are written into code a client runs.buildReadRecipenow carriesindex.dataset_idandstore.paththrough tobuildHowTo, its only caller. The zod 4 lane description says the same.Merge order: after sccn/eegprep#416. OSA vendors 0.1.0.dev2 in its phase 3 before its browser lane is live anywhere; until then, OSA's prompt carries its own snippet and does not depend on this recipe's shape. docs.nemar.org does not quote
python_browser, so no docs change is needed.Test plan
bun test test/contract-mcp.unit.test.ts(75), andbackend/test/mcp-schema-parity,mcp-read-window,mcp-recording-toolsandmcp-route(210).New tests:
read_windowbefore the raw read;index_url, the store path and the group exactly;contract_baseis named, not production's;eegprep_lean.;Each was mutation-checked (production URL, a bare call,
read_windowat a view level, raw read first), and each mutation failed its test.The recipe this code emits for nm000103 (from production's index document) ran verbatim on CPython with eegprep-lean 0.1.0.dev2 against the live archive.
read_windowgave (129, 500) in uV at 250 Hz with labels E1 onward, and the raw read gave int16 counts.Review fixes: an exact-block test for the
read_windowcall, and a round-trip test of a quote and backslash in the path, group and zarr name for all three lanes. Each was mutation-checked: an unescaped path, swapped arguments, and an unescaped zarrita path each failed.bun run typecheck,bun run lint, and the ADR index test.