Repository navigation
Local Zarr reader: shared read core, engine, nemar zarr read (from #2144) - #2406
Merged
Merged
Conversation
* Pin read_window output with a golden test * Move sharding to shared/zarr * Move blosc decoder to shared/zarr/codecs * Move isV3Index to shared/zarr * Point path comments at shared/zarr * Make golden capture runs fail loudly * Type isV3Index with ZarrIndexAny * Rewrap comments that name moved paths
* Rewrap ragged comment in get-events * Add Fetcher and JsonCache to shared/zarr * Move shard footer loading to shared/zarr * Move array metadata loading to shared/zarr * Move level-0 read loop to shared/zarr * Move value assembly to shared/zarr * Check shared/zarr read against zarr-python * Point moved-function comments at shared/zarr * Pin read_window error-stage texts * Test shared/zarr cache contracts * Soften shared/zarr throw guarantees * Align shared/zarr loader docs
* Tighten footer cache overwrite check * Add engine protocol schema and zod mirror * Check protocol schema against zod mirror * Add frame codec and cross-language fixtures * Publish engine protocol schema as v0 * Record read core and protocol ADR * Allow null id on unreadable requests * Open responses, keep requests strict * Add scale, offset and payload limit * Specify window and range semantics * Harden frame decoding and its tests * Compile protocol schema strictly in test * Fix schema route cache comment * Align the engine protocol with neuroschema Squash of the neuroschema alignment fix PR (a2a47e3..d07a787), reviewed in five rounds. Fork CI cannot run on this PR (its base is a feature branch); local gates: targeted root and backend tests, typecheck, Biome, byte-identical fixtures, and a full unit-pure run on d07a787 compared with base 785c172, its new failures rerun in isolation (clean by the pre-registered rule).
Sync the Zarr epic with upstream dev
Sync the Zarr epic with upstream dev
# Conflicts: # .context/decisions/README.md # CHANGELOG.md
Name the API URL override once (API_URL_OVERRIDE_ENV) and use it in the engine allowlist and its test; build the bad-config child env from nothing. Tested: zarr engine/cli/report suites.
runNemar no longer spreads the test process env into the child. Tested: zarr-cli, zarr-engine-cli, zarr-doctor-cli.
Tested: api-export-surface.
Linux refuses a single argv entry over 128 KiB (E2BIG); the child now reads the frame from the test dir. Tested: zarr-engine-client 36 pass.
27M expect() calls exceeded the 5 s CI timeout; violations are collected and asserted once. Mutating rangeCeiling still fails it. Tested locally.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2406Version: 🤖 Updated on each push. |
# Conflicts: # CHANGELOG.md
A footer fetched on a miss and put during a window that then fails to decode is now dropped with it. Entry-point test with a misplaced footer; fails with the put recording removed.
64 MiB in 16 KiB pieces, bound 1000 ms. Still fails against the pre-debba194 quadratic reader (3.35 s).
The long-body stand-in now ends at 64 MiB and flags it; the tests poll for the cancel and assert the end was never reached. An unbounded-drain mutant of readBodyCapped fails all three.
This was referenced Nov 26, 2026
Merged
5 tasks done
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.
This is marordyan's work from #2144 (ADR 0120), carried on an org-owned branch so CI runs with secrets. All credit for the read core, the engine and the CLI goes to marordyan; see #2144 for the design, the phase history, the reviews and the draft docs page.
The branch is #2144's head (98d273b) plus two merges of
dev(3ae2464, 521 commits since the fork point 04b9d0b; 203029e, which brings in the 0.10.40 changelog and #2410) and the integration fixes below. The contributor's commits and authorship are kept; nothing was rebased or squashed.Merge resolutions
.context/decisions/README.md: kept everydeventry (including the accepted statuses of ADR 0116 to 0119 and ADR 0121 to 0138) and added the ADR 0120 entry between 0119 and 0121.test/adr-index.unit.test.ts: removed 120 (and its reservation comment) fromTOLERATED_GAPS, since the ADR file is now present; the set is[127, 137].CHANGELOG.md:dev's sections are unchanged. The Zarr reader entry (and its summary paragraph, which had auto-merged into the 0.10.34 section) now sits under## Unreleased(above## 0.10.40, after Changelog for 0.10.40: legal-process queue, ADR 0138 #2404 moved dev's entries there) as its own### Local Zarr reader (#2144, ADR 0120)section, with Added, Changed and Known limits.Integration fixes
src/lib/api/client.ts: the API URL override variable is named once,API_URL_OVERRIDE_ENV, andgetApiUrlreads it;src/lib/zarr-engine/client.tsuses the constant in the engine's environment allowlist.test/zarr-engine-client.test.tsrefers to the constant instead of the literal name, andtest/zarr-read-report.test.tsbuilds its child environment from nothing. Before this, both files named the override literally, whichscripts/ci/unit-pure-files.shreads as "hits the live backend" and moves them out of the pure tier into the live tier. All new test files are now in the pure tier.test/helpers/zarr-engine-standin.ts:runNemarbuilds the child environment fromPATH,HOMEandTMPDIRplus the stand-in's variables, instead of spreading the test process's environment (which carries the API URL override and any ambient credential). This also fixes 11 failures that appeared only on a machine withFORCE_COLORset.test/api-export-surface.unit.test.ts: pins the newAPI_URL_OVERRIDE_ENVexport oflib/api/client(per-module map and post-split additions); the first CI run failed it.test/zarr-engine-client.test.ts: the stand-in engine children read their reply frame from a file in the test directory instead of a base64 literal inbun -e. Linux refuses one argument over 128 KiB (E2BIG), so the two large-reply tests failed on the CI runner while passing on macOS.test/zarr-engine-window.test.ts: therangeCeilingsweep (about 27 million comparisons) collects violations and asserts once, instead of oneexpect()per comparison, which took 7.1 s against the 5 s default timeout on the runner. Same comparisons; a mutation ofrangeCeiling(dropping the extra chunk) still fails it with the offending geometries listed.zarrandengineare top-level groups, no moved-command entry collides with them, top-level help is not tiered, and the help-tier, completion, API export surface, moved-command and release-version-flag tests pass unchanged.dev's only MCP change since the fork (backend/src/mcp/tools/search-datasets.ts, b24d673) is untouched by this branch and kept;backend/src/mcp/server.tsis identical todevand still registers all six tools.Production impact (checked against this branch)
read_windowgolden test passes; the other MCP tools changed only imports and comments.GET /schemas/zarr-engine-protocol-v0.json(backend/src/routes/schemas.ts).fzstd0.1.1, the zstd decoder the backend already uses at the same version.package.jsonversion untouched.What I ran
bun run typecheck(root and backend): clean.bun run lint: clean;biome lint --only=correctness/noUndeclaredVariables test/ backend/test/: clean.read_windowgolden test): 825 pass, 0 fail.scripts/ci/unit-pure-files.shlists every new test file.What I did not run
bun test(about 80 minutes): CI runs it.completion-network,completion-opportunistic-refresh,completion-refresh-command,docs-fetch,has-zarr-cli-flag,zarr-fidelity-sweep-cli,admin-restructure,cli): they need a live backend, and no command was run against production or staging.mcp-smoke.shunder workerd and the manual production and staging reads reported in Add a local Zarr reader: shared read core, engine and nemar zarr read #2144 were not repeated.CI notes
unit-purefailed on the three issues fixed above.integration-devshard 6/6 failed intest/repull-execute-prepare.test.ts(upload-failed), the same failure as on dev's own release pull request run; Fix re-pull upload tests under aws-cli 2.42 #2410 fixed it on dev and is merged in here.integration-devshard 3/6 reported 0 failures and one unhandled error between tests intest/compute-user-e2e-cli.test.ts(the Tapis stand-in'shas no subscription), a dev file this branch does not touch.Known observation, not changed
FORCE_COLORandNO_COLORset in the user's environment, the engine child used to inherit both and Bun printed a warning on the engine's stderr. Resolved in review round 1 (finding 9): the engine child no longer receivesFORCE_COLOR,NO_COLORorTERM.Review round 1
a 128 MiB frame fed in 64 KiB pieces is read in linear time(3.8 s against a 250 ms bound with the fix reverted).windowByteBudget, not only each read: 38b6cc1. Test:the window's reads are refused once their total passes the window's budget.nbytes, or a zstd frame content size, that differs before allocating; fzstd decompresses into a buffer of the block's size: d89aca8. Tests inbackend/test/blosc-decode.test.ts(header nbytes, frame content size, frame without a content size); theread_windowgolden test passes unchanged.NEMAR_ZARR_DISK_CACHE_DIRnaming an existing non-empty directory without the marker is never chmodded or written; the cache is off with one stderr line, andnemar engine status(refusedunder--json) andnemar doctorsay why; ADR 0120 updated: 75dd302.decode_errordrops every cached entry it read (memory and disk, range bodies and footers), so the next read refetches; the decode_error hint namesnemar engine cache clear; ADR 0120 updated: 530919b.Local Zarr readersection: the inaccurate MCP sentence replaced, and the user-visible effects of fixes 1 to 5 added: 49017d0.nemar doctorturns any non-configuration error from the cache check into a failed check with a fixed message instead of crashing: bac51eb.[zarr]prefix instead of[mcp]and[read_window]: 4f4fd83.FORCE_COLOR,NO_COLORandTERMare dropped from the engine child environment; ADR 0120 updated: 02ad26b.Each fix was checked by turning it off once and seeing its test fail. Gates on the fix commits: root and backend typecheck,
bun run lint, Biome on every changed file, and the targeted tests (root zarr, engine, contract-schemas, api-export-surface, adr-index: 1,139 pass; backend zarr-core, mcp, blosc-decode: 418 pass). The full suite was not run locally; CI runs it.Review round 2
put) is now recorded beside the entries it hit, so a window that fails withdecode_errordrops it too; ADR 0120 and the CHANGELOG now say "read or stored": 569f8f4. Test:a footer fetched on a miss that leads to undecodable bytes > is dropped with the window, so the next read fetches the footer again and succeeds(a stand-in footer with every offset one byte late, then the good one); with theputrecording removed, the second read fails withdecode_error.frame-stream.tsrestored it took 3.35 s and failed.readBodyCappedthat drains the body instead of cancelling fails all three; a mutant that only skips the cancel fails the JSON test, while on the two Range tests the server stream is still cancelled when the unread fetch body is dropped.Gates on the round-2 commits: root and backend typecheck,
bun run lint, Biome on every changed file, and the targeted zarr engine, zarr CLI, doctor, blosc-decode, zarr-core, mcp-read-window and mcp-overview tests (698 pass); the two rewritten test files passed three runs each. The full suite was not run locally; CI runs it.