Skip to content

IS-Q2: close the gaps real-data validation found - #560

Merged
neuromechanist merged 16 commits into
feature/issue-537-epic-spatialfrom
feat/is-q2-validation-fixes
Nov 18, 2026
Merged

neuromechanist merged 16 commits into
feature/issue-537-epic-spatialfrom
feat/is-q2-validation-fixes

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Card IS-Q2 of the iEEG spatial view plan (the intracranial track of epic #537, ADR 0033). Part of #537.

What changed

  • Closed by names (name-refusal.ts, panel.ts, eeg-viewer.css): a recording whose channel names join no contact (nm000377, on004624) keeps an openable Brain toggle and opens a refusal that states the cause in the notes' words, lists the first 12 channel names beside the first 12 contact names as the dataset wrote them with their counts, and says "No rule joined these names; nothing was guessed."; the credit stays. A refusal for want of coordinates (nm000537, on004642, or channels that name contacts with no position) keeps its disabled toggle and sentence.
  • Units banner (units-banner.ts, panel.ts, export.ts, eeg-viewer.css): when IS-C1 converted a declared non-millimeter unit and every drawn contact then lies more than 300 mm from the origin (a documented, tested constant), a banner on the stage and in the saved SVG and PNG says "Declared unit m, but the values look millimeter-sized (largest distance X mm from the origin). Positions are shown as declared and are not placed on any template." Nothing is rescaled or inferred; the template is withheld.
  • Activity long task: no product change. The Chromium trace attributes every block over 60 ms to the scope's own WebGL frame, not to decoding or computing (below), so the card's stop condition applies and computeActivityPlan is unchanged. The test now settles the scope before each phase and judges the 200 ms budget in every regime.
  • The 2D-views stall: not reproduced, left open, with the evidence in the note and a page watch in the export test for a recurrence. One cause of the "silent embed" is found and fixed in the helpers (the embed's second notice).
  • .context/research-ieeg-spatial-validation.md: updated with all of the above (trace, budgets by regime, hang evidence, sleep log, new findings).

Trace findings (Chromium 148.0.7778.96, headless, software WebGL; nm000485, 136 channels, 10 s)

  • Decode and compute are small: over the whole read the Zarr client and codecs took 33 to 39 ms in total and at most 1.4 ms in one task; activity.ts 15 to 16 ms in total, at most 4.2 ms in one task; panel.ts at most 2.0 ms; brain-gl.ts at most 2.3 ms. No task of theirs reaches 10 ms.
  • Every block over 60 ms is one compositor commit of 212 to 218 ms with no JavaScript in it: GLES2::ReadPixels waiting 181 to 206 ms for the GPU process's software CPU readback of the scope's canvas (138 drawArrays, 880 by 656), then 32 to 35 ms for the panel's canvas. It fell inside the Activity phases because the scope's render after the panel opens or a window step lands whenever its Zarr data does.
  • Budget (heartbeat gaps over 60 ms and longtask entries, both; recompute alone): 0 ms in all seven judged or recorded runs: live fast (Zarr median 2 ms), two replays of recorded real responses (median 10 ms), three live slow runs (median 3.0 to 3.6 s) and the 3.5 s seam (median 4.95 s). The scope's own window step is 182 to 259 ms in this browser and is reported beside the budget. One live slow run stalled at the change of measure (not ready after 120 s) and was skipped with its evidence.

Gates (head 79d9c07 after review round 1; the epic tip ec75559 is the base, nothing newer to merge)

  • bun install --frozen-lockfile: Checked 416 installs across 568 packages (no changes)
  • bun run typecheck: Result (523 files): 0 errors, 0 warnings, 19 hints (the base's 19)
  • bun run lint: Checked 451 files in 208ms. No fixes applied.
  • bun run test src/lib/ieeg-spatial: Test Files 15 passed (15), Tests 498 passed (498)
  • bun run test: Test Files 192 passed | 3 skipped (195), Tests 5524 passed | 14 skipped (5538)
  • E2E_PORT=4431 PUBLIC_DATA_BASE_URL=https://data.nemar.org bun run test:e2e e2e/ieeg-spatial-validation.spec.ts (Chromium 148.0.7778.96, headless, dev server, data plane fast) on the head after the round's code changes: 27 passed (2.8m). The full run in a slow hour before it had 24 passed, 3 failed for a file read that met a 500, a silent embed and the EEG test's own embed notice, all fixed in the helpers.
  • bun run test:e2e e2e/ieeg-spatial-panel.spec.ts on the same head: 27 passed (2.6m). Earlier runs in a slow hour stopped at a serial-mode failure (an embed notice, a toggle "checking" for 60 s). The first test is a pre-existing race with the scope's own render: with every Zarr response 2.5 s late the original test failed 4 of 4 on the epic base and 1 of 4 on this branch, the settled version passes 4 of 4 (fast plane: 10 of 10 for the original on both).
  • Export test, 40 repeats at head 04c58a9 (15:33 to 15:54, --repeat-each=40 --workers=1, caffeinate -i; product code as then, spec helper before the embed-notice fix): 36 passed, 4 failed, none at or after the "2D views" click (three before the panel opened with the page responsive and Zarr requests of 11 to 114 s or never finished; one the embed's own notice that the old helper missed).
  • Plain-script repeats of the export test's sequence on the epic base, caffeinate -i (45 at 14:24 to 14:33, 6 at 14:33, 60 at 15:55 to 16:09): 111 of 111 completed; the click to the 2D stage took 29 to 43 ms every time.
  • Leak check on every written file: only the two XML namespace identifiers (www.w3.org, purl.org) the earlier cards document.
  • Chunks, bunx astro build and gzip -9c, base ec75559 and this head built the same way: panel chunk 99,124 raw and 36,107 gzipped to 105,076 and 38,144 (+2,037; 102,998 and 37,383 before the round); viewer chunk 166,137 raw and 58,276 to 58,275 (a file name hash). Beyond the viewer chunk at the epic base (56,848 gzipped): 38,144 + 1,427 = 39,571 bytes, 60 percent of the 64 KB budget.

Review round 1 (head 79d9c07)

  • I1, the largest fault: one read per slice. Activity read the located rows in slices of 16 channels, one read each, and a chunk holds many channels: nm000485 fetched the same 3 byte ranges nine times. Now the window is read once and computed in slices capped by channels and by samples (SLICE_SAMPLE_CAP, 1,000,000), with a yield after the read and after every slice. Live, before (epic base) and after: requests 27 and 27 against 3 and 3, distinct responses 3 and 3 (each nine times against once), bytes 11,797,299 against 1,310,811, ready after 739 and 324 ms against 279 and 280 ms; under the 3.5 s seam, ready after 45.9 s against 4.4 s (switch on) and 47.0 s against 4.0 s (measure), 85 requests over the long-task test against 13. Per-task trace on the fast plane, before and after: Zarr client and codecs 30.6 ms in total against 3.3, at most 1.2 ms in one task both times; activity.ts at most 4.2 against 4.0 ms; panel.ts at most 1.0 against 0.8; brain-gl.ts 1.9 against 1.4; no task of theirs reaches 5 ms, so no new long task. The 1,000,000 cap is from a Chromium benchmark (no tracing): band power 8.4 ms at 500,000 samples, 68 ms at 4,000,000; 1,000,000 is about 17 ms by interpolation, not measured at that size. A test through the viewer's own reader counts chunk requests against distinct chunks.
  • I2: under the banner the reason the 3D switch is off is a visible line beside it, with aria-describedby from the switch (a disabled button has no focus).
  • S1: ADR 0033's MNI305/fsaverage row says they are placed only when the values are in millimeters and never under the units banner.
  • S2: a contact at exactly 0 0 0 is left out of the 300 mm test (IS-C1 returns a placeholder as written); one placeholder no longer hides a bad-units file.
  • S3: the names lists write characters that do not display (controls, zero-width and bidi controls, soft hyphen, no-break space) as visible escapes, flag names with characters beyond ASCII, isolate each name as its own bidirectional run, and name each list by its heading; tests with control, right-to-left and lookalike names built on a real contact of on005522.
  • S4: the note and a spec comment say 111 plain-script repeats, with their times, and that the 40 export repeats ran at head 04c58a9 with the old helper.
  • S6: the panel spec's first test settles the scope before the Activity read; run on the epic base in a scratch checkout, the original failed 4 of 4 under a 2.5 s late route, so the race pre-exists; whether a double read could hide a real plan fault is not shown and not claimed.
  • Extent line: a line in the stage and in the figures says the flat views' scale (the widest span of the drawn contacts), since they have no scale bar.

Revert checks for the round (one line mutated, tests fail, restored byte for byte): per-slice read (8 plan tests; 3 real-reader tests), no yield after the read (2), no yield between slices (2), no sample cap (2), span ignoring the bound (2); reason line never said (1), origin placeholder counted (1), scale label dropped from the figures (1), scale from the wrong distance (3), scale model field dropped (2), invisible characters not escaped (2), non-ASCII not flagged (2), notes dropped (2), no-break space not escaped (1); e2e: reason line hidden, aria-describedby dropped, scale line hidden, lists not labelled, dir="auto" dropped, isolation dropped from the stylesheet (each fails its named test; Chromium computes isolate for any list item, so the e2e checks the attribute and the stylesheet text).

Revert checks

Each is one line mutated, the named tests fail, the line is restored from a backup and compared byte for byte.

  • Closed by names (unit): names model dropped (1 test), toggle never enabled (1), missing-coordinates refusal opened (2), a no-position cause treated as naming (2), sample limit 13 (2), verdict reworded (2), closed even with a channel located (1).
  • Banner (unit): threshold lowered to 0 (6), positions divided by 1000 (7), template not withheld (1), canvas offered under the banner (2), PNG ops dropped (1), SVG group dropped (1), SVG metadata dropped (1), unconverted unit (1), one far contact enough (1), unit word hard-coded (1), 3D switch left enabled (1).
  • e2e: names box hidden (both datasets fail), banner hidden, PNG ops dropped (band columns 0 against more than 0.3), SVG group dropped.
  • Long-task test: a 300 ms busy loop in the compute step fails it under replay (recompute alone 325 ms, where the longtask API saw none of the nine blocks); removing the quiet waits fails it under the 3.5 s seam (272 ms, the scope's late render).

Deviations from the card

  1. The long task was not the recompute. The card's "likely fix, to be confirmed by the trace" is refuted by it (decode at most 1.4 ms and compute at most 4.2 ms per task), and its stop condition applies: the blocks are the scope's frame, the viewer's module. The plan was changed afterwards in review round 1 for a different, measured reason (one read per window, with a yield after the read and after every slice), and acceptance 5 is covered by those tests.
  2. Under the banner the stage is the three flat views, with the 3D switch off and saying why. The 3D spheres are true-size millimeters with no minimum on-screen size, so a canvas drew no contact pixel at that distance (measured on on004100); a minimum size is in IS-R1's module. The card said the camera would fit the contacts so something is visible; in 3D it does not.
  3. Edited outside the card's file list: e2e/ieeg-spatial-panel.spec.ts (the on004100 fsaverage template case is gone because the banner withholds it; the embed-notice selector), and panel.test.ts (the old "disabled when no channel matches" test is replaced by the closed-by-names tests; the fsaverage affine tests take a head-scale known-answer input, the same real contacts read as millimeters, since both committed fsaverage datasets declare meters over millimeter-sized numbers).
  4. The long-task test judges the budget in every regime instead of skipping on slow Zarr evidence (the skip for a panel that never becomes ready remains); a second seam, QA1_ZARR_HAR, replays recorded responses.
  5. New modules name-refusal.ts and units-banner.ts (the card allows a small helper module), each with its test; the banner's wording is declared once in units-banner.ts.

Patch notes for other owners (details in the note)

  • Viewer: one scope frame at 136 channels costs 180 to 250 ms of synchronous readback at commit in headless software WebGL; not measured on a GPU. The first reads of the viewer have no timeout and no notice while a Zarr request stalls (the toggle stays "checking").
  • Panel's owner: every dispatch, including a no-op window_changed, redraws the panel's canvas (18 to 35 ms here); not changed.
  • ADR 0033's template table lists fsaverage as placed; the banner withholds both committed fsaverage datasets (on004100, on006253), so no dataset in the suite places the MNI305 affine at head scale.
  • IS-R1: a minimum on-screen contact size would let the 3D view show positions the banner flags.

Not run, would check

  • Every CI job green on the final head, because the manager reads gh pr checks.
  • Firefox and Safari (only Chromium is installed), and a Chromium with a GPU, because the long-task attribution is the cost of software rasterization at commit.
  • Staging xx099902, after the owner's merge; the census rerun (not part of this card).
  • The 2D-views stall itself: not reproduced, so nothing to verify as fixed.

Card: IS-Q2. Part of #537

Installs a 10 ms timer and animation-frame heartbeat, a console
beat that reaches Node while the page is blocked, and request
timing for views.json, the mesh files and the Zarr host in the
export test. A run that does not pass leaves them in the
annotations. Lint clean; the export test passes with it.
The scope's own render after the panel opens or a window step
lands whenever the data plane delivers it; with a slow plane it
fell inside a later phase and was blamed on the recompute. A
Chromium trace shows it is the scope's WebGL frame read back in
a software-GL browser, not decode or compute. Wait for a quiet
Zarr host before each phase and judge the budget in every regime.
A recording whose channel names join no contact (nm000377,
on004624) kept a disabled toggle and one sentence, and its
names were shown nowhere. The toggle now opens a refusal that
states the cause in the notes' words, lists the first 12
channel names beside the first 12 contact names as recorded,
with counts, and says no rule joined them and nothing was
guessed. Missing-coordinates refusals stay disabled.
Unit tests on real fixtures; e2e on both datasets.
on004100 declares meters over millimeter-sized numbers, so its
contacts land tens of meters out and nothing was visible. When
a declared non-mm unit is converted and every drawn contact is
then over 300 mm from the origin, a banner on the stage and in
the SVG and PNG says so. Positions stay as declared, no
template is placed, and the stage is the flat views (the 3D
spheres are true-size mm, sub-pixel here). Nothing is rescaled
or inferred. The fsaverage affine tests use a head-scale input.
A full run met the embed page showing neither its viewer nor a
notice for 90 s (on004624), the symptom IS-QA1 saw once. Record
the page's load state, words and the requests it was waiting for
when openViewer gives up. The EEG test reloads on the embed's own
notice as the others do, and the electrodes file read in the
closed-by-names test is retried like the panel's.
QA1_ZARR_HAR replays the Zarr host's real responses from an
HTTP archive (QA1_ZARR_HAR_RECORD=1 records one), so the fast
regime can be measured on a day the data plane is slow. Unset
in a normal run. A 300 ms busy loop in the recompute fails the
test under replay (325 ms); dropping the quiet waits fails it
under the 3.5 s seam (272 ms, the scope's late render).
Updates the validation note: the Chromium trace of the long task
(decode and compute never reach 10 ms per task; every block is the
scope's WebGL frame read back at commit), the budget measured in the
fast and slow regimes, the closed-by-names and banner rows, 111 plain
repeats and 40 repeats of the export test with no stall at the 2D
views click, the host's sleep log, and new findings for the viewer,
the embed and the panel's owner.
The embed writes a second notice when the Zarr index fails to
load, and the spec helpers waited only for the server-rendered
one, so a page already saying 'could not load' counted as
silent for 90 s. A snapshot of one failure shows it; IS-QA1's
silent embed and the other silent failures here match it by
symptom. Both specs wait for either notice and reload as they
do for the first. The note's finding 12 says what is and is not
shown.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 79d9c07
Status: ✅  Deploy successful!
Preview URL: https://4bdc6176.nemar-website.pages.dev
Branch Preview URL: https://feat-is-q2-validation-fixes.nemar-website.pages.dev

View logs

Activity read the located rows in slices of 16 channels, one
read per slice, and a chunk of the store holds many channels:
nm000485 fetched the same 3 byte ranges nine times (27 requests,
11.8 MB for 1.3 MB of samples) and took 25 to 47 s on a slow
route. The window is now read once (a span per sample bound),
then computed in slices capped by channels and by samples, with
a yield after the read and after every slice. After: 3 requests,
1.31 MB, 4.4 s under the 3.5 s seam. A test through the viewer's
own reader counts chunk requests against distinct chunks.
Under the units banner the reason the 3D switch is off is now a
visible line beside it (with aria-describedby), not only a
tooltip on a disabled button. The flat views have no scale bar,
so a line in the stage and the figures says their extent (the
widest span of the drawn contacts). A contact at exactly 0 0 0
is left out of the 300 mm test: IS-C1 returns a placeholder as
written, and one must not hide a file whose real contacts are
tens of meters out. e2e covers the line, the description link
and the stage's order.
The names lists write a character that does not display (a
control, a zero-width or bidi control, a soft hyphen, a no-break
space) as a visible escape, flag a name with characters beyond
ASCII (a Cyrillic A is not a Latin one and never joins), isolate
each name as its own bidirectional run, and name each list by
its heading for a screen reader. Tests use control, right-to-left
and lookalike names built on a real contact of on005522.
MNI305 and fsaverage are placed only when the values are in
millimeters; under the units banner they never are, which holds
for both committed fsaverage datasets (on004100, on006253).
The panel spec's first test asserted one read right after ready,
but the scope's own render after the panel opens or a step lands
whenever its Zarr data does, and its window report re-plans a
read. With a 2.5 s late route the original test failed 4 of 4 on
the epic base and 1 of 4 on this branch; with the quiet wait it
passed 4 of 4. Also corrects the repeat count in a spec comment.
Single read per window (before and after: requests, distinct
responses, bytes, ready time, per-task trace), the 1,000,000
sample slice cap and its benchmark, which runs ran on which head
and when, the panel spec's pre-existing race, the scale line,
and the new chunk sizes.
@neuromechanist
neuromechanist merged commit 79607dc into feature/issue-537-epic-spatial Nov 18, 2026
5 checks passed
@neuromechanist
neuromechanist deleted the feat/is-q2-validation-fixes branch November 18, 2026 23:50
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