Repository navigation
W5: dataset quality summary and verification utilities - #595
Merged
neuromechanist merged 14 commits intoNov 26, 2026
Merged
neuromechanist merged 14 commits into
neuromechanist merged 14 commits into
Conversation
Deploying nemar-website with
|
| Latest commit: |
a7ccf78
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b6f7373e.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-issue-588-w5-summary.nemar-website.pages.dev |
3 tasks
neuromechanist
merged commit Nov 26, 2026
b8734e8
into
feature/issue-586-epic-pipeline-progress
3 of 4 checks passed
This was referenced Nov 26, 2026
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
Phase W5 of the live quality views (#588, epic #586, nemarOrg/nemar-cli#2324): the dataset quality summary and the verification utilities.
Verification utilities, on W4's readers
verify.ts:subtleSha256now lives here;model.tsre-exports it.verifyBytes(bytes, {size, sha256})answersnull,file_missing,file_size_mismatchorfile_digest_mismatch. It compares the size first, so bytes of the wrong length are never hashed.prepare-ahead.tsuses it.canonicalJson,viewDigestandviewDigestOfTextimplementnemar.view-digest.v1(RFC 8785).viewDigestOfTextreads throughread.ts's I-JSON parser.digestablemoved here fromguards.ts, which imports it. It refuses a sparse array and any object whose prototype is neitherObject.prototypenor null (aDate, aMap, a class instance).tsv.ts: the C3 role reader onread.ts's grammar.declaredColumns,typedColumnandreadDeclaredTsvare the column checksmodel.tsalready used; they were moved here, not rewritten, andmodel.tsimports them.The dataset summary
dataset-summary.ts:readQualitySummary(metadata, id)decides what the page shows. It returnsnone,refused(a word and one sentence) orshown.summaryTreebuilds one element tree, whichDatasetQualitySummary.astroprints withtoHtml.anonymous: falseshows nothing.dataQualitymember must be present.dataQualitymust meet the dataset-level schema.histogram_too_large.h3per recipe, with its version, the dataset version, and the copy read;counts.passed, the succeeded recordings, by the owner's ruling on nemar-cli B1), failed and skipped;observed_range, and the missing count; a metric with no value prints "none" once;histogramSvgandtoHtml, with arole="img"text alternative that names every bar, both ends and the missing count by stored text;metadata.jsonas binary64 and writes it back withJSON.stringify, sonumberTextprints exactly the served text.histogramSvggains{storedTextOnly}, which leaves out the density tick. The panel's drawing is unchanged.dataset-guards.ts:datasetQualityValid:dataQualityat the dataset level, closed at every level.ownRange: a metric's observed range as an own member only, used by both the writer's rules and the summary (a metric namedconstructornever findsObject.prototype's).dataPaperValid: the data paper schema.documentHeadValid: the root's envelope and the identity members it selects.writerRuleBroken: the backend's writer rules, in its order and with its words.DatasetTabs.astro:quality={readQualitySummary(metadata, id)}.Fixtures, captured rather than hand-written
scripts/capture-quality-summary-fixtures.mjsruns nemar-cli's realdataRoutesover a real migrated database, with rows written asbackend/test/metadata-json-quality.test.tswrites them. It was run at nemar-cli 39e2ee3f.metadata-*.jsonis the body as served, one world per gate: shown, published, a summary spread over six recordings, canary only, concealed, withdrawn, tombstoned, never published, and private (404).dataset-quality-verdicts.jsonholds 60 dataset-level documents. Each carries Ajv's verdict over nemar-cli's vendored bundle and the first writer rule broken according to the backend'swriterRuleBroken. The script also requires Ajv and the backend's zod schema to agree on every document.A W4 fix
guards.ts'sobjlooked a member's guard up withrule.props?.[key].constructor,toString,valueOforhasOwnPropertyfoundObject.prototype's function, which returned something truthy. The member passed a closed object, the view envelope included.quality-views-dataset-guards.test.ts.Testing
bun run typecheck: 0 errors.bun run lint: clean. Biome on every touched test file, the Vitest configs andscripts/capture-quality-summary-fixtures.mjs(its seven intendeddeletes carry abiome-ignorewith the reason): clean.quality-summary(168),quality-summary-pages(4),dataset-tabs.astro(5),quality-views-dataset-guards(19)quality-views-verify(34),quality-views-tsv(36)quality-views-guards,quality-views-models,quality-views-checks,quality-views-renderbun run build: passes.bun run check:quality-views-size: every budget holds; only the worker with its lazy chunk moved (11.8 to 11.9 KB, fromdigestable's hole and prototype checks):guards-computedchunkThe summary is drawn on the server and adds no client script.
bun run test: 260 files passed and 7 skipped; 8243 tests passed and 55 skipped. The drift tests skip locally and are expected to be red in CI until nemar-clidevcarries the epic.Rendering DatasetTabs
test/dataset-tabs.astro.test.tsrendersDatasetTabsthroughexperimental_AstroContainerfor anone, arefusedand ashownsummary. It checks that the Data quality tab and panel exist only forrefusedandshown, that everyaria-controlsandaria-labelledbypair up, that the panel startshiddenwith its tab unselected, that the refusal sentence appears with no figure or table, and that a shown summary has anh3per recipe and a figure per metric.vitest.astro.config.tsis a second Vitest project (vitest.workspace.ts) that compiles.astrofiles with Astro's own compiler (a transitive dependency, nothing added), strips the TypeScript with esbuild, loads style and script virtual modules empty, and stubs the compiler's$$metadata.bun run testruns both projects; the unit config excludes*.astro.test.ts.DatasetTabsare gone; the source checks kept are "no placeholder" and the dataset page'squality={readQualitySummary(metadata, id)}.What the tests pin
src/pages/dataset/[id]/embed.astronever reachesDatasetTabs,DatasetQualitySummaryordataset-summary.ts. The dataset page is the control: the same walk from it reaches all three.anonymousistrue, missing,null,"false"or0shows nothing.[-1.7e308, 1.7e308, 1.75e308, 1.79e308], andmissing = 9007199254740991; both meet the schema and the writer's rules.aria-labelledbyresolves to a non-empty element, and the ids are unique;figcaption, and each table acaptionandth scope="col";aria-hiddenand not focusable, and eachdetailshas asummary.dataQualitycases are recording entries, so they stay with W6.view-digest.v1cases (canonical text and digest) and its 14 refusals replay.verifyByteschecks every declared file of the model vectors, finds each file refusal's word, and checks the shipped copies againstpin.json.tsv.tsreplays everynemar.tablemodel case, drawn or refused, covering all nine reader words.Mutation table
Each mutation was applied alone; the nine suites (the eight unit suites and
dataset-tabs.astro) were run, and the file was restored. The logged run, on the pushed head with a clean tree: 72 mutations, 72 killed.hasOwnbranch in the summary was unreachable after the writer's rules (an equivalent mutant). The lookup is now one helper,ownRange, which both use; its mutation (W09) is killed by a test ofwriterRuleBroken's contract with an inherited range.anonymous: truehidescap_exceededgiven the wrong reasonh4not_processedcap 201counts_unbalanceddroppedlisting_mismatchdropped\Sschema_versionmultiline.0/DateandMapdigestedcolumn_missingdroppedcolumn_repeateddroppedstoredTextOnlyignoredDeviations
metadata.jsoncarries none.record_sha256names the dataset record, which the page does not fetch. The backend checked it against the record's bytes when it kept the summary (nemar-cli B1).record_sha256is a SHA-256 (a schema rule); one that is not refuses the summary with its sentence.signalJourneylink's digest would be wrong: that link follows the latest ended run, the summary the current promoted one.dataQualitycases are all recording entries, which the panel reads, so they remain W6's (NOT_DRAWNnow saysW6).documentHeadValiddoes not check the whole document. It checks the root's envelope and the identity members, which is what the summary relies on. The page reads the rest ofmetadata.jsonmember by member, as it did before.qualityprop and two imports;{showQuality && (...)}, withtabindex="0"on the panel;--soonCSS.[id].astro: theDatasetTabscall is now multi-line, and the SSR comment no longer says "coming soon".DatasetTabsthrough Astro's container (a test project added here); nothing was viewed in a browser.writerRuleBrokenhas the same plain observed-range lookup; the lead files it.For W6 (overlap)
showQualitygates only the Data quality tab and its panel. A Quality panel tab goes beside them as its own tab, and the tablist script handles a missing tab.[id].astro: theDatasetTabselement now spans five lines.guards.ts: the closed-object fix changes verdicts for members named afterObject.prototypeproperties. No corpus case uses one.model.ts:subtleSha256comes fromverify.ts(re-exported),ColumnDeclfromtsv.ts(re-exported), andhistogramOf(content)is now exported.quality-api:verifyBytes(bytes, file)returns the model's words;viewDigest(declaration)andviewDigestOfText(text)returnnullwhen the value has no canonical form;canonicalJsongives the RFC 8785 text.test/quality-views-guards.test.ts:NOT_DRAWN.dataQualityis now"W6", and the two lines after it point to the W5 test.AGENTS.mdhas four new map lines (one for the Vitest projects), and the header comment ofquality-views.csschanged.*.astro.test.tsfile renders a component throughexperimental_AstroContainer(vitest.astro.config.ts); W6 can testQualityPanelthe same way.Refs #588, nemarOrg/nemar-cli#2324.
Agentic AI tools were used.