Repository navigation
Stage a serving index ahead of its tag by NEMAR's own metadata, as the tag's - #2464
Merged
Merged
Conversation
A nemar-ica run of the archive with no serving index staged got no --source-commit, so its record stated no commit, its stamp had no input digest and its derivative was skipped for good (no_input_digest). The staging answer now carries the tag's commit whenever it was read, and the job spec hands it as --source-commit with or without an index. Tested: serving-index-staging, compute-derivatives (nemar-ica cases), compute-serving-index-contract; each new case fails with the fix reverted.
Names the mechanism decision 6 always implied: a run staged without a serving index is handed --source-commit and the tag's commit whenever it was read, so its derivative is keyed none and stored. Tested: adr-index unit test.
The grid and a run's detail read the stored checkpoint from a progress row that only the stamp sync resolved, so after the derivative store skipped a run they showed it pending until the next sync, and coverage counted it complete. The store's pass now resolves the stored rows it decided, and coverage complete excludes a run whose decided stored row did not keep every recording. Tested: compute-derivatives (new view cases), compute-progress-reconcile, compute-pipeline-grid, quality-admin-route; both parts revert-checked.
Not tested: changelog text only.
Keeps the new case apart from the nemar-ica placeholder case, which a parallel change edits. Tested: compute-serving-index-contract unit test (13 pass).
The read bounds and the derivative object prefix move to a leaf module the progress and quality modules read, so the store imports resolveDecidedStored at the top with no cycle; the dynamic import and its catch, which only guarded the module load, are gone. Tested: compute-derivatives, compute-progress-reconcile, quality suites (252 pass).
keyStamp trusted the record's git: digest. When the recorded spec hands --source-commit, the stamp's digest must be exactly git:<that commit>; another commit, or two handed, is digest_mismatch. Tested: compute-derivatives (98 pass); the two mismatch cases fail with the check removed.
Every Worker-dispatched run of the archive, nemar-floor included, now reads its version's tag commit at dispatch and gets --source-commit. A GitHub fault defers the run (source_commit_deferred, a refused stamp, no end; it stops the queue); an absent tag refuses it (version_tag_absent, nothing written). Staging is handed the commit and reads only the index. Suites that dispatch a BIDS run use a GitHub tag stand-in (helpers/github-tags.ts). The coverage case now uses a genuinely unkeyable run (digest_mismatch), as does the CLI help. Tested: 29 backend compute and quality suites (1059 pass) plus the callback, cron, sweep, metadata and CLI suites; revert-checked.
Supersedes the last clause of ADR 0121 decision 10 and refines ADR 0141 decisions 3 and 4 (pointers in both); the 0141 amendment added earlier on this branch is folded into it. Tolerates the 0142 gap that PR #2458 reserves. Tested: adr-index unit test.
Not tested: changelog text only.
One GitHub compare of the tag's commit and the index's admits an index whose commit is ahead by .nemar/, .github/ and .gitattributes paths only; the spec records ahead_of_tag (both commits, changed paths) and the run is handed the index's commit, the one the recipe accepts. Behind, diverged, content changes and unlisted deltas are refused with their own words; an unread compare defers. Keying checks the handed commit is the admitted one. Tested: serving-index-staging (96), compute-derivatives (100), the contract unit tests and the compute suites (1127 pass); revert-checked.
Supersedes ADR 0141 decision 2 in part, refines ADR 0143 decision 1 and ADR 0123 decision 3 for such a run; pointers in 0141 and 0143. Tested: adr-index unit test.
Not tested: changelog text only.
Only a GitHub credential fault (no_github_credentials, token_mint_ failed) stops a run over the queue, and it ends the daily tick; a github_unreadable deferral is one repository's and is passed over. A run asks for PIPELINE_RUN_EXTRA_TRIES (10) candidates beyond its room, so datasets refused for a missing tag or deferred never fill it. The tag stand-in now answers both tag spellings. Tested: compute-pipeline-queue (33 pass); each new case fails with its mutation.
A source_commit_deferred stamp no longer counts as another kind in SERVING_INDEX_DEFERRAL_AGE_SQL, so it does not restart the 24 hours. Tested: serving-index-staging (79 pass); the new case fails when the word is counted as another kind.
Narrows decision 2, adds the extra tries to decision 3 and the clock to decision 5; index line and changelog follow. Tested: adr-index unit test.
… into feat/serving-index-metadata-ahead # Conflicts: # .context/decisions/README.md
…ce-commit # Conflicts: # CHANGELOG.md
… into feat/serving-index-metadata-ahead
Owner ruling: the run is the tag's. An index admitted ahead of its tag is handed with the tag's commit (--source-commit T) and keyed git:T; its own commit is provenance in ahead_of_tag (tag_commit, index_commit, changed_path_count, renamed from changed_paths). recipeJobSpec refuses an admission compared with another tag commit, or one ahead by nothing; StagedServingIndex drops its duplicate sourceCommit; keyStamp checks the handed commit is the recorded tag_commit. A .gitattributes edit is admitted only when its patch adds or removes no eol=crlf, working-tree-encoding, ident or non-annex filter, and refused unlisted without a patch. An over-bound compare is index_delta_unlisted, not a fault. The nemar-process arguments that let the recipe use an admitted index come in a later commit. Tested: serving-index-staging (116), compute-derivatives (100) and 14 more compute suites (834 pass in all), root contract, recipe, adr and CLI tests (146); seven revert checks.
Hand T, keep S as provenance, state the owner's invariant, correct the claim that .gitattributes never changes bytes, say why the rule differs from ZARR_SOURCE_DELTA_ROOTS, and note that an unanswerable compare costs one 24-hour deferral. Renamed for the new title. Tested: adr-index unit test.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2464Version: 🤖 Updated on each push. |
…adata-ahead # Conflicts: # .context/decisions/0141-the-dispatcher-stages-the-serving-index-and-the-launch-specification-is-version-2.md # .context/decisions/README.md # CHANGELOG.md # backend/src/services/compute-pipeline.ts # backend/src/services/serving-index-staging.ts # backend/test/compute-derivatives.test.ts # backend/test/serving-index-staging.test.ts
5 tasks done
The plumbing for nemarOrg/nemar-process#108: a run handed an index ahead of its tag keeps --source-commit T and adds --serving-index- commit S and one --serving-index-delta-path per changed path (old names of renamed files included, each once, code-unit order). A job's 64 arguments fit 24 paths, so admission refuses a larger delta as index_delta_unlisted instead of cutting it; a path with no UTF-8 form is refused. keyStamp keys such a run only when the arguments attest the recorded index commit and path count, and attest nothing when no index ahead of its tag was staged. The marker is gone. Tested: serving-index-staging (120), compute-derivatives (105), 14 more compute suites (843 pass), contract/recipes/adr/CLI unit (160), the drift test against nemar-process dev and #108 (16 each); six revert checks.
Tested: adr-index unit test.
…adata-ahead # Conflicts: # CHANGELOG.md
A block-list admitted !eol, -eol, -text and macro uses that change checkout bytes when CR LF conversion is in effect. Every attribute of every added or removed line, macro definitions included, must now be annex.* or diff/merge (any form), filter=annex, or text, binary, eol=lf set; any patch line, context included, that can turn CR LF on (eol=crlf, legacy crlf) refuses the edit. Lines starting +++ or --- are no longer skipped: a compare patch has hunk lines only. Tested: serving-index-staging (135 pass); the old block-list fails 7 cases, skipping +++/--- fails 2, dropping the context check fails 1.
Not tested: comment only.
Tested: adr-index unit test.
The patch shows only touched lines and a little context, so an unchanged eol=crlf line elsewhere in the file went unseen. Each changed .gitattributes the edit leaves at the index's commit is now read whole (GitHub contents at S, 1 MiB bound; a deleted file is skipped, a renamed one read under its new name) and any line, macro definitions too, that turns CR LF on refuses the index. A file that cannot be read whole is github_unreadable and defers. The stand-in answers contents. Tested: serving-index-staging (139), compute-derivatives (105) and six more compute suites; dropping the read fails 3 cases.
Tested: adr-index unit test.
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
Builds on #2460, now merged to
dev(978a55b); this PR targetsdev, and the branch mergeddevin (its diff againstdevis this change alone).The owner's ruling of 2026-11-27 on #2461 (ADR 0144, proposed here): the data and events a serving copy was created from are the tag's, and NEMAR's metadata (
.nemar/,.github/,.gitattributes) is readiness work that changes without a tag. So a copy built from a commit ahead of the tag by that work is kept as the tag's.What is admitted
servingIndexAheadOfTag(inzarr-source-check.ts, called bystageServingIndex) handles an index whose commit S is not the tag's commit T:T...S, using the Zarr check's request, timeout and bound.ahead,behind_by0, and fewer than 300 files..nemar/or.github/, or be a.gitattributesfile at any depth.A
.gitattributesedit is admitted only when it cannot change checkout bytes (gitattributesPatchProblem, an allow-list since review round 2). Every attribute of every line the patch adds or removes is checked, macro definitions ([attr]name) included. A line starting+++or---is checked like any other, since a compare patch holds hunk lines only.annex.*,diff,merge.text,binary,eol=lf.filter=annex.index_content_changed): everything else, includingeol=crlf,-eol,!eol,-text,!text,text=auto,-binary, other filters,working-tree-encoding,ident, and any unknown name, which could be a macro.eol=crlf, legacycrlf, on a macro definition too) refuses the edit, because that is the one condition under whichtext,binaryandeol=lfchange bytes. The patch's own lines are checked first..gitattributesat S, changed or not (81fef998): an admittedbinaryin one file changes bytes under aneol=crlfin another, so once a delta that changes any.gitattributesis otherwise admitted:git/trees/S?recursive=1, 8 MiB bound; GitHub truncates at 7 MB, so any whole answer fits) names every.gitattributes.contentsrequest, 1 MiB bound), including a changed one the listing lacks. No line in any of them may carryeol=crlforcrlf, or the delta isindex_content_changed.SERVING_INDEX_MAX_GITATTRIBUTES_FILES) isindex_delta_unlisted.github_unreadableand defers the run, like an unread compare..datalad/'s). Across the 396 repositories GitHub's code search indexed on 2026-11-27, none carried more than two. The worst case is the compare, one listing and 24 reads: 26 requests a dataset after the tag's commit..gitattributeschange whose patch GitHub leaves out isindex_delta_unlisted.text eol=lflines going) is still admitted.Not admitted:
.bidsignore, other.datalad/files, data files, BIDS files, and anything that is not a plain path.What is refused
index_behind_tag,index_diverged,index_content_changedandindex_delta_unlisted. The last now also covers a compare body over the bound (previously a fault).github_unreadable. That defers the run (serving_index_deferred), so a compare that can never be answered costs one 24-hour deferral and then a run without the index.The run is the tag's; S is provenance
--serving-index /data/serving-index/index.json --source-commit T. The record states T and the derivative is keyed bygit:Tplus the staged copy's digest, so ADR 0123 decision 3 and ADR 0143 stand unchanged.serving_index: {sha256, size, ahead_of_tag: {tag_commit, index_commit, changed_path_count}}.changed_pathsis renamed tochanged_path_count.{sha256, size}.recipeJobSpecchecks: it refuses an admission whosetagCommitis not the commit handed, or whose index commit is the tag's.StagedServingIndexdrops its duplicatesourceCommit. The tag's commit is the one handed; the index's commit isahead.indexCommit.keyStampkeys such a run only when the specification hands exactly the recordedtag_commit; otherwise it isserving_index_unattested. The digest must also begit:+ that commit, per ADR 0143 decision 4.The attestation to the recipe (nemarOrg/nemar-process#108, commit
c86eeb99):--source-commit T, the arguments add--serving-index-commit Sand one--serving-index-delta-pathper changed path, a renamed file's old name included, each once and in code-unit order. The recipe uses a row only when its--source-commitis the attested T and the index'ssource_commitis S.RECIPE_SERVING_INDEX_MAX_DELTA_PATHS; the recipe takes 32). A larger delta is refused asindex_delta_unlisted, never cut short. 24 paths of the longest allowed length (512 characters) build a 64-argument specification.keyStampkeys such a run only when the arguments hand the recordedtag_commit, attest the recordedindex_commit, and carrychanged_path_countpaths; and only when nothing is attested for an index of the tag's own commit, or when no index was staged.COMPUTE_RUNTIME_IMAGEis repinned to that image before compute turns on. This is in ADR 0144's consequences and the CHANGELOG's deploy order.RECIPE_SERVING_INDEX_MAX_DELTA_PATHSnotes that 24 long non-ASCII paths can exceedLAUNCH_VARIABLE_BYTES_MAX. The spec then does not build, and the dispatch answersinvalid_specbefore the claim.test/compute-recipes-process-drift.unit.test.tscompares recipe versions, engines and steps, not flags, and Phase 3: Rich metadata enrichment for DataCite DOIs #108 changes none of them. It passes against nemar-processdevand against Phase 3: Rich metadata enrichment for DataCite DOIs #108's head (16 each), so no drift test waits for Phase 3: Rich metadata enrichment for DataCite DOIs #108.Effect on #2461's data
Re-counted with the patch rule, one read-only GitHub compare per dataset, on the same 40 sampled datasets whose index is newer than their tag:
.gitattributespatches touches a byte-changing attribute..bidsignorealone in 2 (on001787, on006126).Refs #2461. It does not close it: copies built after a content change still need a rebuild at the tag or a new tag.
Tests
Run on the pushed head:
New or changed cases:
serving-index-staging.test.ts:.gitattributespatch, is staged and the spec ends with--source-commit T.identical,aheadwithoutbehind_by, a file entry that is not an object, no filename, a filename or previous filename that is not text..gitattributespatches that addeol=crlf, removeeol=crlf, addworking-tree-encoding, addident, unsetident, add afilter=lfs, or give a quoted pattern witheol=crlfare refused.filter=annex, and a comment namingeol=crlfare admitted. A missing patch isindex_delta_unlisted.index_delta_unlistedand the run goes ahead.recipeJobSpechands T with an admitted index, and refuses an admission compared with another tag commit, or one ahead by nothing.compute-derivatives.test.ts:git:Tand the index's digest, withahead_of_tagnaming S.tag_commitisserving_index_unattested.compute-serving-index-contract.unit.test.ts: thechanged_path_countshape.Every
.gitattributesat S (81fef998), inserving-index-staging.test.ts, 145 pass:* eol=crlfthe delta does not touch, under a nested edit that adds*.tsv binary, refuses; so does a nested unchanged*.tsv eol=crlfunder a root edit, found only by a recursive listing.recursive=1, and each file is read once, the changed one too.index_delta_unlisted, with nothing read.index_delta_unlisted, with nothing read.truncated, withouttree, or with a malformed entry isgithub_unreadable, with nothing read; one over its bound isindex_delta_unlisted; throughservingIndexForRuna 502 defers the run..gitattributesthe listing lacks is still read (refused on itseol=crlf;github_unreadablewhen absent)..gitattributeslists no tree and reads no file.bc47f4bc(its one.gitattributesamong 1,537 files, not truncated).compute-derivatives105,zarr-source-check82,compute-pipeline-input36,compute-pipeline63,compute-pipeline-dispatch48,compute-runner-jobs73,compute-runner-reporting22,adr-index11; all pass.Revert checks for the listing (each restored, verified with
cmp):recursive)truncatedWhole-file read (
72888ad4), inserving-index-staging.test.ts, 139 pass at the time:* text eol=crlf40 lines from the hunk refuses, and so do a[attr]m eol=crlfdefinition and a legacycrlf(one read each, at S).bc47f4bc) admits.github_unreadable; throughservingIndexForRunthe run is deferred..gitattributesis not read, and a renamed one is read under its new name only..gitattributesand is otherwise admitted, and only for a recipe that keys the serving index, which the dispatcher does not run today.Review round 2 (
23b4330a), all inserving-index-staging.test.ts, 135 pass at the time:+*.tsv !eol,+*.tsv -eol,+*.tsv -text,+*.tsv m(a macro use), a macro used beside an unchanged[attr]m eol=crlf,+++x eol=crlf,---y working-tree-encoding=UTF-16,text=auto, the legacycrlf,-binary, a removed-text, and an addedtextbeside an unchangedeol=crlf.binary,diffandmergein every form, and a macro defined with annex rules only.Revert checks for round 2 (each restored):
+++/---lines againAttestation cases (
c86eeb99):--serving-index,--source-commit T,--serving-index-commit S, the delta paths), on007823's included.index_delta_unlisted.recipeServingIndexAttestationArguments: flags, the bound arithmetic, and a refusal for equal commits, a bad commit, 25 paths, an empty path, or a repeated path.serving_index_unattestedkeying cases.Revert checks for the attestation (each restored):
Earlier revert checks (each restored afterwards; "fail" counts failing tests):
recipeJobSpec.gitattributespatches not readNot run: the full
bun test(about 80 minutes). It would check every other suite, because the serving index's recorded shape and words changed; only the suites that grep for serving index, staging, stamps or pipeline dispatch were run.Agentic AI tools were used. Workflows follow the Research Skills (doi:10.5281/zenodo.20696515). The author assumes full responsibility for this content and associated changes.