Repository navigation
Quality inventory, copy and reader - #2537
Merged
neuromechanist merged 19 commits intoNov 28, 2026
Merged
neuromechanist merged 19 commits into
neuromechanist merged 19 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2537Version: 🤖 Updated on each push. |
neuromechanist
merged commit Nov 28, 2026
cf2c3ef
into
feature/issue-2524-epic-quality-axes
31 checks passed
3 tasks
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.
Part of #2525 (epic #2524), phase 0a.3 PR 2 of 2. It follows #2534 (neuroschema 0.7.0 vendored).
This PR declares every quality element once, with its sentences and a typed reader (ADR 0146 decisions 3 and 4). Nothing reads it yet: website 0b/1b and the phase 1a checker will.
Files
shared/contract/quality/inventory.json: item set 1.0.0. It has 33 elements: 11 signal, 13 metadata, 7 annotation, 2 precondition. It also declares 21 reason words, 9 producers with their current versions, and the profileeeg-bids-metadata-stats-2024, which is named on the legacy table's 13 rows.shared/contract/quality/inventory.schema.json: draft 2020-12,$idhttps://api.nemar.org/schemas/quality-inventory-v1.json,$defsElement,Producer,Reason,Profile, closed everywhere.shared/contract/quality/copy.json(nemar.quality-copy.v1): 137 keys, sorted, including the 21 literalbanner.<axis>.<state>keys, 16fix.*sentences each with its.href, the sixdatatype.<word>display names, and the not-computable sentences for each count unit.shared/contract/quality/build-sums.mjs [--check]andSHA256SUMS.json(nemar.contract-files.v1). The sums cover the three files, read as git blobs of HEAD; uncommitted changes to them are refused. The list names no commit.shared/contract/quality-inventory.ts, exported fromshared/contract/index.ts. It provides the constants, the strict zod schemas,QUALITY_INVENTORYandQUALITY_COPY(parsed at import), and four functions:qualityProducerVersion,qualityInventoryProblem(17 words, first broken rule in order),qualityElementsForandfillQualityCopy.test/contract-schemas.test.ts:quality-inventory.tsis inSTRICT_BY_DESIGN, andQUALITY_INVENTORY_NAMES(6 schemas) joinsSTRICT_NAMES(now 41) and the index-export test..github/workflows/test.yml: theprocess-copysparse list addsrecipes/nemar_process/plugins/{nemar_quality,nemar_spectrum}/manifest.json, with the comments updated. The metrics test reads them underNEMAR_REQUIRE_PROCESS_RECIPES: "1".test/unit-pure-timings.json(both new files), andCHANGELOG.md(Unreleased).Tests and what they hold
test/quality-inventory-contract.unit.test.ts(28 tests):nemar-floorandnemar-icacarryfindRecipe(...).version,@bids/validatorcarriesvalidator-version.json, andnemar-zarrcarriesZARR_ENGINE_VERSIONfromscripts/zarr/zarr_queue.py(a text test);fix.*has a docs.nemar.org.href;display_name,display_precision6 and 7, an unknown key, a bad prefix, an empty, repeated or unknownapplies_to, and afixwithoutfix.;qualityInventoryProblemword, in order, plus null for the committed files;state.*andstate_word.*keys, and the bundle'squalityStateenum are the same eight words, and thevalue.*words arequalityItemResult.valuewithout null;qualityItemResult.id,failureCodeandmetricNamepatterns;fillQualityCopy, andqualityElementsForfor MEG (metadata and signal) and for mixed datatypes;SHA256SUMS.jsonsizes and digests, a mutation test (a flipped byte, a missing file and an unlisted file are each reported), andbuild-sums.mjs --checkspawned, which exits 0;neuroschema_versionequalsNEUROSCHEMA_VERSION.test/quality-inventory-metrics.unit.test.ts(6 tests):extensions.nemar.metrics, plus the plugin metrics inprocessingSteps[].qualityMetricsand thenemar-icadistributions.countmaps to components, iterations or channels;fractionmaps to%with scale 100;natmaps to nats).NEMAR_PROCESS_DIRparse underPluginManifestSchema, and every metric they declare is written. Without the variable this test skips and logs why; underNEMAR_REQUIRE_PROCESS_RECIPES=1a missing manifest fails it.Deviations from the card
producers(array) replacesproducer(lead ruling 7). The six floor metrics name["nemar-floor", "nemar-ica"], and the ICA and plugin metrics name["nemar-ica"].QUALITY_COPY_READ_PREFIXESaddsheading.andlegend.. Without them, the card's own keysheading.versionandlegend.titlewould becopy_key_unread.lineNoiseAfterDb's definition stands alone. It now reads "How far power at 50 or 60 Hz (whichever was larger before removal) stands above neighboring frequencies, after the band-stop filters." The source text "The same, after ..." reads as nothing in a tooltip of its own.banner.metadata.*rows do. Signal and annotation say "Signal quality ..." and "Annotation quality ...".id_repeatedalso covers repeated reason words and profile ids, andprerequisite_unknownalso covers a reason'sblocks_on.qualityProducerVersionthrows on an undeclared producer instead of returning null.build-sums.mjsexempts itself from the "not listed" check.NEMAR_PROCESS_DIRat a nemar-process checkout onmain, which has no plugin manifests, so the manifest comparison skips there. I also ran the metrics test against nemar-processdev(a93410f) withNEMAR_REQUIRE_PROCESS_RECIPES=1, and it passed.The docs pages for the
fix.*.hreftargets are filed as nemarOrg/docs#151 (lead ruling 6). The TypeScript replay of the item-checks and conformance-checks vectors belongs to phase 1a.What the website will need (handoff to 0b, website#625)
scripts/copy-quality-views-vocabulary.mjsor a siblingscripts/copy-quality-contract.mjs. It reads nemar-clishared/contract/quality/SHA256SUMS.json, requiresformat === "nemar.contract-files.v1", and checks each listed file's size and SHA-256 before writing. It copiesinventory.jsonandcopy.jsontosrc/lib/quality/contract/(shipped) andinventory.schema.jsontotest/fixtures/quality/contract/(tests only), and refuses any listed path it cannot place.shared/contract/neuroschema/quality/SHA256SUMS.json(nemar.vendored-files.v1), copyingvectors/*.jsontotest/fixtures/quality/vectors/.src/lib/quality/contract/pin.json(nemar.website-vendored-quality.v1), recordingitem_set_version,neuroschema_version, the nemar-cli commit (git -C "$NEMAR_CLI_DIR" rev-parse HEAD) and every copied file's digest. A drift test holds the copies to the pin and the pin to nemar-cli..github/workflows/ci.yml: add/shared/contract/quality/and/shared/contract/neuroschema/quality/to thenemar-cli-contractsparse list, plus an env var naming the sums file.{datatype}placeholder is filled withdatatype.<word>(EEG, MEG, iEEG, EMG, NIRS, motion), never the raw word. A not-computable sentence is chosen by the element'scount_unit:not_computable.<unit>andnot_computable.blocked_by.<unit>, where unit is recordings, participants or dataset.state.not_computableis the generic "Not computable: {reason}.".QUALITY_INVENTORYand the elementsqualityElementsForreturns are deep-frozen and typed read-only.state_word.<state>,qualifier.stale_dataset,qualifier.stale_unrecorded,info.direction.<d>,info.exported,precondition.integrity.{present,complete,incomplete,not_audited},precondition.conformance.not_stored,reason.<word>,legend.title,footer.how_computed). The site writes no state sentence of its own.devstay red until the whole epic merges (one merge).Gates
bun shared/contract/quality/build-sums.mjs --checkbun run typecheck && bun run lintbunx biome checkon shared/contract/quality, the reader, index and the three test files: cleanNEMAR_PROCESS_DIR=<nemar-process checkout> bun teston quality-inventory-contract, quality-inventory-metrics, contract-schemas and ci-tier-routing: 243 pass, 1 skip (the manifest comparison: that checkout'smainhas no plugins)devwithNEMAR_REQUIRE_PROCESS_RECIPES=1: 165 passdev).Review
Review round 1 (538c653): 1 important and 3 moderate findings, all fixed, plus the lead's producer ruling.
datatype.*keys, with adatatype.read prefix) and a test that every datatype has one.count_unit, with both units tested, so the six dataset-level elements with prerequisites no longer read "1 of 1 recordings".not_computable.blocked_bybecamenot_computable.blocked_by.<unit>.not_supportedbanners now end ": NEMAR has no checker for it."QUALITY_INVENTORYis deep-frozen and typedDeepReadonly; a test checks that a push and an assignment throw.--checkspawn now runs git withGIT_OPTIONAL_LOCKS=0and has a 30 s timeout. The flake did not reproduce in 11 runs of the combined set, including afterbun install.PRODUCERS_IN_THIS_EPIC(nemar-metadata,nemar-annotation, each with the file its phase ships). It follows theTOLERATED_GAPSpattern: every producer of an element with a non-emptysupported_forhas a non-nullcurrent_versionunless it is listed, and an entry whose file exists, or that names no supported element, fails. The epic-to-dev seam review checks that the set is empty.UNVERSIONED_BY_DESIGN(nemar-data-plane): the integrity audit is built but has no version. It is not an epic exception, so the lead should confirm it.build-sums --checkpass.Review round 2 (f6b849a): three changes, all applied.
nemar-data-planeis nowcurrent_version: "1.0.0", which stands for today's integrity rule (data_complete,bytes_present, ADR 0005 and ADR 0064). A comment beside the test's pin says a change to the rule bumps the version.UNVERSIONED_BY_DESIGNis removed.nemar-metadatais nowcurrent_version: nulluntil phase 1a ships it. The stale check reads the inventory instead of guessed paths: an entry fails if its producer is versioned, undeclared, or names no supported element. A purestaleExceptionsfunction makes each of these cases testable.build-sums --checkpass.CI fix (465a36b):
unit-pure shard 3/6failed becausetest/docs-links.unit.test.ts("every referenced page exists") rejected the 16fix.*.hreflinks incopy.json. Those docs pages do not exist yet (nemarOrg/docs#151). The test now has aPENDING_PAGESmap (/quality/metadata,/quality/annotation,/quality/conformance, each naming docs#151) that tolerates those pages only when the pointer is inshared/contract/quality/copy.json. A new test fails once the docs repository publishes a page or once copy.json stops pointing at it, so the entry cannot be left behind.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.