Skip to content

Quality views: first screen back under budget on the Linux build - #610

Merged
neuromechanist merged 4 commits into
feature/issue-586-epic-pipeline-progressfrom
fix/608-first-screen-size
Nov 26, 2026
Merged

neuromechanist merged 4 commits into
feature/issue-586-epic-pipeline-progressfrom
fix/608-first-screen-size

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the Critical seam finding on #608: the Quality-view bundle sizes step failed on CI run 45867980133 (head c441d5d) with both no-preload first screens at 30.0 KB against the 30.0 KB budget.
No budget, gate expectation or first-screen definition is changed here; the gate's lookup is fixed separately in #611.

Root cause

Two things, one hiding the other.

  1. The gate does not always measure the panel.
    siteUnions finds the panel's chunk by the sentence "Loading the recording's quality views".
    Since W9 (W9: admin run quality drill-down (#588) #598) that sentence is also in the admin drill-down's chunk (pipeline-quality-labels.ts, loading), and [...files.keys()].find(...) returns whichever file readdirSync lists first.
    That order is the file system's: APFS and ext4 list dist/_astro/ differently, and every content hash moves it.
    The build itself is byte-identical on both (every chunk name and hash CI prints is in the local macOS build).
    So the 15/17 versus 16/18 file counts are not a different split: one machine measured admin-drill.*.js, the other panel.*.js.
    At Quality views: one shared drawView #602 CI was green at 29.1 KB on the admin chunk while the real panel's no-preload screen was already 29.3 KB; on c441d5d CI measured the panel; on this PR's second CI run it measured the admin chunk again.
    Quality views: size gate finds each measured chunk exactly once #611 makes the gate find the panel by its name and its sentence, exactly one chunk.
  2. W2b put about 0.7 KB on the real panel's first screen (29.3 KB at Quality views: one shared drawView #602, 30.0 KB at Quality views: sensor positions from names (W2b) #603):
    the nine nemar.sensor-labels.v1 refusal sentences (sensor-labels-copy.ts, imported by render/words.ts),
    and the half of placeSensors in model.ts that calls the algorithm and places the matched electrodes.
    Both are needed only for a scalp map placed by name.

What moved

  • The names half of placeSensors is a lazy chunk, place-by-name.ts, imported where model.ts used to import ./sensor-labels (it imports the algorithm statically), step for step, through the same loaded guard.
  • The refusal sentences are no longer on the first screen.
    render/words.ts no longer imports sensor-labels-copy.ts.
    For a refusal, place-by-name.ts loads the copy through the same loaded guard, so a copy that cannot be fetched (offline, redeployed) leaves the maps montage_unavailable, whose sentence says to reload, never a bare word.
    The renderer's mapSentences(word) then reads the copy from the module cache and passes it to renderSensorField and the text rows.
    montage_unavailable's word and sentence, shown when a lazy load fails, cannot be lazy: their one copy is montage-unavailable-copy.ts (eager, read by render/words.ts and the viewer); the copy module imports nothing at run time, so its chunk depends on no other.
    panel-words.ts (a lazy chunk) imports the copy, so a skip reason that is a sensor-labels word reads as before; that chunk loads the copy whenever the panel has something to say, never with a first screen.

What a visitor sees is unchanged when every chunk loads.
A map placed by name loads place-by-name (about 1 KB) beside sensor-labels, and a refused one the copy (about 1 KB) under the same guard.

Sizes

The real panel's unions, gzipped together, exact bytes on the local build (byte-identical to CI's; budget 30720 B):

First screen c441d5d, real panel (CI) this PR, real panel headroom
Spectrum 16 files, 28.7 KB (29344 B) 16 files, 28.1 KB (28824 B) 1896 B
Components 16 files, 28.2 KB (28906 B) 16 files, 27.7 KB (28378 B) 2342 B
Spectrum, no idle preload 18 files, 30.0 KB (30732 B), OVER 18 files, 29.5 KB (30197 B) 523 B
Components, no idle preload 18 files, 30.0 KB (30751 B), OVER 18 files, 29.5 KB (30179 B) 541 B
Activations 10 files, 26.1 KB (26714 B) 10 files, 25.5 KB (26145 B) 4575 B
Activations, no idle preload 12 files, 27.5 KB (28189 B) 12 files, 26.9 KB (27575 B) 3145 B

What the gate printed on CI:

  • run 45872321787 on 15c3937 measured the panel: 28.1, 27.7, 29.5, 29.5, 25.5, 26.9 KB, all ok;
  • run 45875386851 on ebaa899 measured the admin drill-down's chunk: 15/17 files, 28.9, 28.6, 29.2, 29.2, 26.5, 26.9 KB, all ok (the same as the local macOS gate);
  • with Quality views: size gate finds each measured chunk exactly once #611 on top, the gate measures the panel everywhere: 28.1, 27.7, 29.5, 29.5, 25.5, 26.9 KB, all ok (local build of both merged).

Tested

  • bun run test (271 files, 8880 tests): the one-copy test, and a render test that a map placed by name and refused shows the sensor-labels sentence in its note, each map and each text row (it fails with the sentences not loaded)
  • e2e/quality-panel.spec.ts, "the spectrum's maps placed by name" (the spectrum's layout dropped, its sensors named by the header, the bytes and digests recomputed): drawn when placed; the sensor-labels sentence when refused; with place-by-name aborted, and with sensor-labels-copy aborted on a refusal, the view still draws and every map says montage_unavailable's sentence. Each abort case fails with its guard removed. With e2e/quality-draw-parity.spec.ts: 41 passed, own port
  • bun run typecheck (0 errors), bun run lint, bun run test:quality-views-perf
  • bunx astro build && bun scripts/check-quality-views-size.mjs --require-build, and the real panel's unions measured with the panel chunk pinned
  • Vitest on CI fails only on the three nemar-cli drift tests (12 tests), the same 12 as on c441d5d

Agentic AI tools were used. The author assumes full responsibility for this content.

nemar.sensor-labels.v1's refusal sentences were in render/words.ts, so every panel first screen carried them. They now load with the scalp-map renderer only when a map placed by name was refused (mapSentences); montage_unavailable's sentence, shown when a lazy load fails, stays eager in its own one-copy module. Tested: quality-views render and sensor-labels tests.
The half of placeSensors that runs nemar.sensor-labels.v1 (W2b) sat in model.ts, on every panel first screen. It moves to place-by-name.ts, loaded with the algorithm only for a map placed by name, step for step as before. Tested: quality-views models, presets, render and sensor-labels tests.
@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: ebaa899
Status: ✅  Deploy successful!
Preview URL: https://f848f55b.nemar-website.pages.dev
Branch Preview URL: https://fix-608-first-screen-size.nemar-website.pages.dev

View logs

@neuromechanist

Copy link
Copy Markdown
Contributor Author

CI run 45872321787 on 15c3937, Quality-view bundle sizes: success.
This run's directory order put the real panel chunk (panel.DYBdYTan.js) first, so CI measured the panel itself (16 and 18 files):

ok   site build: worker worker-7V6npiOa.js with its lazy chunks, 3 files gzipped together: 15.6 KB gzipped (45.1 KB minified), budget 16.0 KB
ok   site build: first screen, Spectrum tab, 16 files gzipped together: 28.1 KB gzipped (75.2 KB minified), budget 30.0 KB
ok   site build: first screen, Components tab, 16 files gzipped together: 27.7 KB gzipped (75.7 KB minified), budget 30.0 KB
ok   site build: first screen, Spectrum tab with no idle preload, 18 files gzipped together: 29.5 KB gzipped (80.0 KB minified), budget 30.0 KB
ok   site build: first screen, Components tab with no idle preload, 18 files gzipped together: 29.5 KB gzipped (80.5 KB minified), budget 30.0 KB
ok   site build: first screen, Activations tab, 10 files gzipped together: 25.5 KB gzipped (68.0 KB minified), budget 30.0 KB
ok   site build: first screen, Activations tab with no idle preload, 12 files gzipped together: 26.9 KB gzipped (72.9 KB minified), budget 30.0 KB

These match the local measurements in the description byte for byte (every chunk name and hash CI prints is the local build's).
Quality-view drawing budget passed.
Vitest fails only on the three nemar-cli drift tests (12 tests), the same 12 as on c441d5d, red until nemar-cli dev carries the epic.

Agentic AI tools were used. The author assumes full responsibility for this content.

place-by-name.ts now loads sensor-labels-copy for a refusal through model.ts's loaded guard, so a copy that cannot be fetched leaves the maps montage_unavailable (with its reload hint) instead of a bare word, and mapSentences reads it from the module cache. sensor-labels-copy no longer re-exports montage_unavailable, so its chunk depends on none and the first screen keeps 18 files. Comments and the AGENTS.md file map name the new modules. Tested: bun run test, typecheck, lint, perf.
Browser checks on the spectrum's maps placed by name: drawn when placed, the sensor-labels sentence when refused, and montage_unavailable when place-by-name or sensor-labels-copy is aborted, the view still drawn. Each abort case fails with its guard removed. Tested: quality-panel and draw-parity specs, 41 passed.
@neuromechanist
neuromechanist merged commit d9066b4 into feature/issue-586-epic-pipeline-progress Nov 26, 2026
3 of 4 checks passed
@neuromechanist
neuromechanist deleted the fix/608-first-screen-size branch November 26, 2026 18:40
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