Skip to content

Check the Zarr copy's source commit on dispatch (DM-06b) - #2153

Merged
neuromechanist merged 5 commits into
feature/portable-compute-epicfrom
feature/pc-dm06b-zarr-source-check
Nov 14, 2026
Merged

neuromechanist merged 5 commits into
feature/portable-compute-epicfrom
feature/pc-dm06b-zarr-source-check

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Card DM-06b of the portable compute plan: the dispatch proves the Zarr serving copy describes the tagged data.
For a recipe whose input is zarr, resolveRun (after DM-06's newest-version and ready-copy refusals, before any read) resolves T (the tag's commit, GitHub) and S (the serving index's source_commit), decides exact (S equals T) or metadata_only (GitHub compare T...S is ahead, behind_by 0, fewer than 300 files, every path and every renamed file's previous path under .nemar/ or .github/), and passes --source-commit S --tag-commit T --commit-equivalence <verdict> plus one --commit-delta-path per path in the compare's order. This replaces the dataset row's zarr_source_commit (the row's commit is no longer read).
Words: zarr_source_mismatch (409, definite) and zarr_source_unverifiable (503, cannot be read; joins NON_DATASET_FAILURE_WORDS). A refusal writes no job, stamp, hold or ledger row, only the route's usual audit row, as for version_untagged.
Bounds, literal: at most 3 GitHub requests per dispatch (tag, tag without its v after a 404 or 422, one compare at 100 files per page), each abandoned after 5 s, maxAttempts 1 (no retry), redirects not followed, bodies read to at most 1 MiB (commit) and 8 MiB (compare); one index read, abandoned after 10 s, over HTTP read to at most 64 MiB (in production it is getZarrIndex, whose body this file cannot bound; the wait for it is bounded); the installation-token wait is bounded by 5 s. The index read and the tag lookup run together: longest call 15 s.
Credentials: the App installation token when configured; outside production with no App, unauthenticated; in production with no App (or an App that cannot mint), nothing is requested and the word is zarr_source_unverifiable. NEMAR_ZARR_INDEX_BASE (test seam) is honored only outside production.
Local stack: --seed-from-catalog sets the index base to the public serving host and records a dataset ready with its public index's store count (the public record carries neither); --seed-fixture starts the stand-in (verdict exact, S equals the fixture version's commit). The two seeds are refused together (one GitHub API and one index base per stack).
Tests: new backend/test/zarr-source-check.test.ts (65 tests through the real admin route, a real loopback stand-in for GitHub and the index in backend/test/helpers/github-compare-standin.ts); updated compute-runner-jobs, compute-local-stack and the pipeline CLI tests for the new vector and seeding.
Gates: bun run typecheck and bun run lint pass; bunx biome check on every touched file: no errors (3 pre-existing any warnings); zarr-source-check, compute-runner-jobs, compute-local-stack, compute-pipeline-dispatch and the pipeline CLI test: 259 pass, 0 fail; the whole test/compute-* and backend/test/compute-* set with the contract and ADR-index tests: 2648 pass, 0 fail, 6 skip.
Mutations: 32 one-line mutations, each killed by the test named for it; one (dropping the declared-length fast path) is behavior-identical because the streaming count bounds the same body.
Not run, would check: the full bun test because it is the epic gate.
Deviations: see the card report (delta cap 24 not 32 because a job's argument vector holds 64 strings; zero changed files is a mismatch because the recipe refuses metadata_only with no path; shared/compute-recipes.ts, the route's sentence table and test/admin-compute-pipeline-cli.test.ts touched because the vector, the words and the CLI test need them).
Merge note for epic D (#2116, touches compute-pipeline.ts): resolveRun is (db, id, wanted, recipe, env) here; merge it as (db, id, wanted, except, recipe, env).
Card: DM-06b.

Review round 1 fixes (head see the last commit):

  • The tag is a tag: the commit is read from commits/refs/tags/<name> for both the v form and the v-less fallback (the short tags/ form is a 422); a branch or a bare ref of the tag's name cannot answer as T. The stand-in now models ref resolution (a branch resolves by its bare name and refs/heads/, never through refs/tags/; a lightweight and an annotated tag both resolve to the commit).
  • The 409 word and its sentence now say what is proven: "could not be shown to be the tagged version's data". The refusal carries a REASON, a fixed word from ZARR_SOURCE_REASONS (tag_absent, compare_absent, compare_behind, compare_diverged, compare_identical, too_many_files, data_path, too_many_delta_paths, no_delta_path, delta_path_unsupported for the 409; no_github_credentials, token_mint_failed, github_unreadable, compare_unreadable, no_index, index_unreadable, index_commit_unusable, check_threw for the 503), in the route body, the dry run's blocked, and the CLI output (..., reason compare_behind). The header says what metadata_only proves: no file outside .nemar/ and .github/ changed.
  • A delta path can no longer make the job unbuildable: ill-formed text (a lone surrogate) and a total over 32,768 launch bytes (launchStringBytes, a third of the 49,152-byte bound) are zarr_source_mismatch with reason delta_path_unsupported, never invalid_spec. Tests: 24 paths of 512 ASCII characters dispatch and fit the launcher; 10 paths of 500 non-ASCII characters dispatch and fit, 11 are refused; a JSON \ud800 escape is refused.
  • The worst case is 20 s, stated truthfully in the header and here: the token wait (5 s), then max(index 10 s, tag lookups 5 s + 5 s), then the compare (5 s).
  • The per_page comments are corrected (it pages COMMITS; files come on the first page, at most 300 for the whole comparison; the 24-path cap is the real limit); the stand-in caps a compare's files at 300 and a 1000-file case is refused too_many_files.
  • Case variants (.NEMAR/x, .Github/x) and a root with no slash (.nemar, .github) are data paths (tests).
  • Distinct logged and returned words for no App in production (no_github_credentials), an App that cannot mint (token_mint_failed) and a GitHub outage (github_unreadable); check_threw logs the error's name, never its message.
  • Patch note for the lead, in nemar-process docs/recipes.md terms: the recipe accepts at most 32 --commit-delta-path values; the dispatch carries 24 because 16 fixed arguments plus 2 per path equal the job's 64-argument cap (JobSpecSchema). Raising the cap to carry 32 needs 80 arguments there.
  • A 401 is not re-sent (that would break the three-request bound): the stale installation token is dropped from the cache, this dispatch answers zarr_source_unverifiable (github_unreadable), and the next one mints a fresh token. Test: the cache entry is gone (the next call reaches the mint).
  • Local stack: the seams follow what the state database holds, not the start flags (a plain restart over the fixture starts the stand-in; over a catalog dataset points the index read at the public host); a state or start holding both the fixture and a catalog dataset is refused before anything starts; a held dataset of the live or reserved range (other than the local fixture) is refused; the index read from a developer machine uses the catalog user agent (nemar-local-stack/0, and outside production the check's own requests carry it too; the Worker's NEMAR-API only in production). Tests for each.
  • The tests restore the seams' previous values in afterAll instead of setting them undefined.
  • Not changed here (outside this card's Scope; follow-up cards for the lead): the shared transport's 403 body read (github/transport.ts) and getZarrIndex's missing abort signal and body-size bound (s3.ts).
  • Installation token scope: GitHub's mint API (POST /app/installations/{id}/access_tokens) CAN narrow a token to named repositories and read-only permissions: yes. Not done here because the shared mint and its per-installation cache (github-auth.ts) are outside this card; a narrowed token would need its own cache key. Follow-up card.
    Gates after round 1: bun run typecheck and bun run lint pass; bunx biome check on the touched files: no errors; zarr-source-check 82 tests pass; the whole test/compute-* and backend/test/compute-* set with the contract, ADR-index and pipeline CLI tests: 2669 pass, 6 skip, 0 fail. 22 more one-line mutations, each killed by the test named for it (one, a reason on the CLI's per-dataset run line, was unreachable for a Zarr recipe and was removed). Not run, would check: the full bun test because it is the epic gate. One Miniflare ECONNRESET in a beforeEach of a six-file combined run was infrastructure; the file passes alone.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR2153

Version: 0.10.34-PR2153.ae90aec
Commit: ae90aec


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit fdd0613 into feature/portable-compute-epic Nov 14, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/pc-dm06b-zarr-source-check branch November 14, 2026 01:06

This branch was previously deployed

1 inactive deployment
npm — ae90aec6 Deployed Nov 14, 2026 by neuromechanist via publish #4429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant