Repository navigation
W6: per-recording quality panel and idle preload - #596
Merged
neuromechanist merged 34 commits intoNov 26, 2026
Merged
neuromechanist merged 34 commits into
neuromechanist merged 34 commits into
Conversation
Deploying nemar-website with
|
| Latest commit: |
d8db332
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2e59ffe6.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-issue-588-w6-panel.nemar-website.pages.dev |
neuromechanist
merged commit Nov 26, 2026
683c0bc
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 W6 of the live quality views (#588, epic #586, nemarOrg/nemar-cli#2324; nemar-cli ADR 0137 as amended, website ADR 0035): the per-recording panel with Spectrum, Components and Signal, and the idle preload at page load.
The route and its client
route-contract.tsis a hand copy of nemar-cli'sshared/contract/quality-route.ts: paths, words with their statuses, bounds and the recording-path rule.test/quality-route-contract-drift.test.tsimports nemar-cli's module. It compares every constant by value and the words in order, and compares the functions by their answers on traversal, schemes, controls, bidirectional code points and length limits.NEMAR_CLI_QUALITY_ROUTE. CI's sparse checkout gainsquality-route.ts,compute-naming.tsandcompute-stamp.ts.record.tsreads a record answer in this order:ETag. From the data plane that digest is required: noETag, or one that names no SHA-256, isrecord_digest_missing. The route exposes the header to the site's origins; that is the nemar-cli epic fix. Only a loopback data plane, which means a local backend in development, reads without it.dataQualityrecord shape, closed as neuroschema's schema is.nemar.record-checks.v1.quality-api.tsgives three states:none:quality_not_found;unavailable: a 404 with no word of the route's ("not available on this server yet");failed: with a word.quality-files.tsbuilds file URLs. Each file is read up to its declared size only. The model checks size and SHA-256 before it parses.nemar.view-digest.v1with W5'sverify.ts. A view whose declaration does not match the route's digest is not drawn.The panel (
components/quality/QualityPanel.astro, islandquality-views/panel.ts)DatasetTabs. The tab is shown only when the dataset's quality summary names a recipe, nemar-ica first.#quality/...link opens the page.panel-bridge.ts), in the visitor's navigation order, limited to recordings a record can name.icactivity, until W7), so no view is left out.DatasetTabsnow binds only its own tab list.#quality/<recording path>/<view key>, each segment encoded. It is written withreplaceStatewhen the visitor picks a tab or a recording, and followed on load and onhashchange.buildModelandmountViewonsharedSensorFieldClient. The geometry is prepared fromonLayout, andquality-views.cssis loaded with the component.neuroschema.views.presets:nemar.spectrum: its recorded parameters are printed. Maps are drawn at the rowsinitial_maps_hzsnaps to, and a click or Enter on the lines picks a row (qv-pick, new inlines.ts).nemar.ic-maps: one text row per component, each cell its stored text with its column's name and unit.nemar.ic-classes: each class's count and its "summed variance of components classed X", as stored.nemar.signal-window: all nine checks, in order.extras/), and the panel's sentences are lazy too (panel-words.ts).Bad channels and bad segments in the viewer
ViewerOptions.qualityMarksgives the viewer the floor's marks.mountOptions, usingregisterSignalOpenerin[id].astro.not_checkedand the panel says so.shadedRectsanddrawShadedinrender.ts);Idle preload (owner ruling) (
preload.ts,preloaded.ts)loadevent and the viewer's index;shouldPreload()passes andrequestIdleCallbackfires (a 500 ms timer stands in where the browser has no idle callback);prepareAhead(preloadInput): warm the worker, fetch and check the layout, prepare its geometry, then fetch and check the files of the first windows only. Those are the Spectrum and Components tabs' views, whose maps are the first on-screen batch.maxBytesis exactly those files' bytes.pagehideand callsforgetPreloads().Fixtures and local backend
scripts/capture-quality-fixtures.mjsmounts nemar-cli's realdataRoutesover a migrated D1 and Miniflare's R2, with the backend's ownquality-fixture.tshelpers and nemar-ica's real product. It writes the record, 8 files and 5 refusals totest/fixtures/quality-views/route/, at nemar-cli 39e2ee3f.scripts/local-backend.mjs --seed-qualityseeds the same derivative, so the real route answers atlocalhost:<port>/data/on007823/quality/v1/nemar-ica/.... I checked it by hand (200,public, max-age=300,ETag).Gates
bun run typecheck: 0 errors.bun run lint: clean.quality-views-*file, the route drift test (pointed at the epic checkout),eeg-viewer,local-backend-guard: pass.bunx astro build, thencheck-quality-views-size.mjs --require-build: pass (numbers below).bun run test:quality-views-perfon M4: pass (numbers below).e2e/quality-panel.spec.ts(7, new),e2e/quality-views-perf.spec.ts(2),e2e/viewer-scalp-map.spec.ts(3): all pass on M4.test/quality-panel.astro.test.ts(new) rendersDatasetTabsthrough Astro's container. It checks that the Recording quality tab and panel exist only with a recipe and a version, that the panel carries the island's data attributes, and that its tabs followTABS.bun run test, with everyNEMAR_CLI_*variable pointed at nemar-clidev, after the merge: 8,432 passed, 7 skipped, 8 failed.devdoes not carryquality-route.tsuntil epic #2324 reaches it.scripts/local-backend.mjswithout--seed-qualityfails against the epic checkout at its observer-run step (compute_disabled). That step predates this PR and has the same fault without the flag.Measured
Panel opened after page load (the new gate): the idle preload runs through its real code, the panel opens one idle period later, and the view is built from the preloaded files with no fetch. The gate requires
cacheMisses = 0and gates the draw at 50 / 100 / 300 ms. Median of 3 fresh first views, first maps / whole view:Size (gzip level 9, gzipped together):
sensor-field-viewwith its static set)Mutations (each must fail the named tests)
The script lives outside the repository. Each mutation edits one guarded line, runs the named tests, and restores the file. All 41 were caught after the merge. A 42nd, letting a declaration with no canonical form through the digest comparison, is equivalent: the record's I-JSON reader refuses such a text first. The digest mutation now lives in W5's
verify.tstests, and the browser mutations ran against the real panel module in Playwright.Deviations and judgment calls
QualityPanel.astrois atsrc/components/quality/, becausesrc/components/QualityPanel.astrois the old Phase 3 panel.not_checkeduntil the serving copy publishes per-store content digests (nemar-cli#2343).icactivity) are drawn under Other by the renderer rule: the fallback, with their file inputs offered. W7 moves them to an Activations tab.labels_pendinguntil W2b. The one spectrum vector placed by name (spectrum_maps_names) is compared on everything but placement.qualityPermalinkis inpanel-model.tsfor W8.DatasetTabs.astro, my changes are the new tab button, its panel and the tab-list binding selector. I named the proprecordingQuality, because W5's isquality.verify.ts(viewDigest,verifyBytes), andview-digest.tsis gone. The merge commit also carries a fix: the Recording quality tab is hidden when there is no version. That fix is pinned by the new Astro container test.dataQualitycorpus cases are replayed intest/quality-views-record.test.ts.What W7, W8 and W9 need
nemar.ic-activityas anextras/activity.tslazy chunk, with an Activations tab inpanel-model.tsTABS. The tab's union is panel, lines and activations.guards-computed.shadedRects.SensorFieldHandle.drawnMaps().record.digests[key], already compared withviewDigest.qualityPermalink(origin, id, version, {recording, key}).preloadedSource(recordFiles(...)).route-contract.tsholds only the public mount. Copy the admin mount and its proxy obligations fromquality-route.ts, and widen the drift test to them.Review fixes (round 1)
Important
readRecordAnswer(..., requireDigest)andlenientBaseinquality-api.ts). The test that read without an ETag is now the opposite test: a missing, empty or unreadable ETag isrecord_digest_missing, and a fetched answer without one fails.Originand recordsAccess-Control-Expose-Headers. A test checks that it listsETagonce nemar-cli serves it.checks.view), and showsdeclaration_invalid. The e2e case uses a non-numberstart_s.okornone(recordForinpanel-bridge.ts). Otherwise it is forgotten and fetched again. Tests cover a failed preload, an aborted preload,noneandok, and a failed preload followed by a successful open.Moderate
panelOpened,[data-qp-opening]).signal_recording_mismatch, e2e).http_*statuses are worded by class, with one sentence for 5xx and one for 4xx.recording_path_invalidandfailedhave sentences.quality-api.tsnow has its catch.floorBad). They are dimmed throughisDimmed, never added tobadChannels, and never reachgetSelectedChannels. A unit test and a source check cover this.DEFAULT_TAB.qv-pickclick computes its row from the click's own coordinates.pendingMarksis cleared onceopenRecordingsettles (finally).viewDigestmatches are planned (digestedViews).sha256and an integer size up toQUALITY_FILE_MAX_BYTESare planned.readLimitedrefuses a NaN limit.siteUnions). The panel's chunk is found by a sentence only it holds. These are left out, with the reason: the idle preload's chunk, the island script and Vite's preload helper. All three load with the page before the panel opens.--seed-qualityneeds--seed-pipeline. This is documented, and the script refuses the flag without it.Owner ruling for W7: the worker, together with the lazy chunks one tab loads, may use up to 16 KB. ADR 0035 is amended, and
BUDGET.workeris 16 KB. The main-thread budget stays at 30 KB.After the fixes (head 59e44b1, CI run 45760304741). Lint, typecheck, the budget, the build and the size step pass. Vitest fails on the same 8 drift tests only.
Mount to ready, first maps / whole view, median of 3:
Sizes:
Mutations of the new checks:
mountView's own or the view's: removed one at a time, the other still stops the work. Removing both does fail the e2e switch test.Review fixes (round 2)
infoand are not gated, because their headroom is too thin to survive W7's first commit.Access-Control-Expose-Headers: ETag, and the test that checks this is strict.lenientBase). This site's own origin is no longer lenient, and the test now asserts that.hidden(), throughisDimmed.e2e/viewer-quality-marks.spec.ts, which runs on a public recording: the readout says "1 hidden", and the annotation layer offers no "Annotate … marked channels".hasTouchcontext, a tap with no prior pointer move picks the row under it. The test reads the maps' caption at the stored frequency.PanelHandle.liveMaps()).[data-eegv-marks]appears.mountOptionsnow only reads the pending marks, and the opener clears them infinallyonceopenRecordingsettles, whatever its outcome.Round 2 mutations
The three abort survivors, redundant by design.
mountView's own signal check, or the view's check after the model is built.drawView), covered bymountView's signal;mountViewcalled without its signal), covered by the check after the model is built;controller.signalpassed tomountInto), covered by the same check.After round 2 (head d8db332, CI run 45762844545). Lint, typecheck, the budget, the build and the size step pass. Vitest fails on the same 8 drift tests only.
Site-build sizes (the gate):
Mount to ready on the runner, first maps / whole view:
The 256-sensor first maps were 32.3 ms in the run before. This run's 44.7 ms is close to the 50 ms budget.
Note on
e2e/quality-views-perf.spec.ts(W4's spec). Run together with the other specs under Playwright'sfullyParallel, it sometimes misses its 128-sensor median through CPU contention. Run alone, it passed twice in a row. It is unchanged.Refs #588, nemarOrg/nemar-cli#2324
Agentic AI tools were used.