Skip to content

Quality views: size gate finds each measured chunk exactly once - #611

Merged
neuromechanist merged 4 commits into
feature/issue-586-epic-pipeline-progressfrom
fix/608-gate-panel-lookup
Nov 26, 2026
Merged

neuromechanist merged 4 commits into
feature/issue-586-epic-pipeline-progressfrom
fix/608-gate-panel-lookup

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

The size gate's panel lookup, option (a) from #610: every machine now measures the same chunk.

The bug

siteUnions in scripts/check-quality-views-size.mjs took the first file in dist/_astro/ that held the panel's loading sentence, "Loading the recording's quality views".
Since W9 (#598) the admin drill-down's chunk (admin-drill.<hash>.js) holds that sentence too.
Which of the two readdirSync lists first is the file system's choice (APFS and ext4 differ, and every content hash moves it).
So on c441d5d macOS measured admin-drill (15 and 17 files, 29.8 KB) while CI measured the panel (16 and 18 files, 30.0 KB, over), and at #602 it was the other way round.
The build itself is byte-identical on both.

The change

  • namedChunk(files, prefix, marker) in scripts/quality-views-size-lib.mjs: a chunk whose file name starts with the module's name (panel.) and, when a marker is given, holds the marker.
    Exactly one must match; otherwise it returns an error naming none or the several matches.
  • lookupStem(files, stem) and lookupIsland(files) hold what siteUnions asks for each name: the prefix <stem>. (the dot keeps panel from panel-words, panel-model, panel-bridge), the sentence from CHUNK_MARKERS, and ISLAND_PREFIX.
  • Every named lookup in siteUnions uses them: the panel (panel. with its sentence), the export's controls and images (controls., picture. with their sentences), the tabs' and export parts' chunks by name alone, and the panel's island script.
    A lookup that does not find exactly one chunk adds a failing line that says why, once per name, so the gate exits 1; a tab that needs it says it was not measured.
  • No budget changes, and nothing changes in what a first screen or a lazy root measures.

Tests

test/quality-views-size.test.ts, "the chunk a first screen is measured from", on fake chunks written to a temporary directory and read back as the script reads dist/_astro/:

  • two chunks hold the sentence, only one named panel. (and another panel. chunk without it): the panel is picked, in either listing order;
  • no panel. chunk holds it, or two do: the lookup fails, naming them;
  • a lookup by name alone picks the one chunk, and fails on two or none.

With the old lookup (the first match in the directory's order) all 5 cases fail; on APFS the first case picks admin-drill, the bug itself.

"the names the gate looks up" runs lookupStem and lookupIsland on the chunks Vite emits beside the panel's (panel-words, panel-model, panel-bridge, another component's panel, the admin's, the island): the panel is found even when its sentences chunk holds the loading sentence too; a panel chunk without its sentence fails; the export's chunks are found by theirs; two island scripts fail. With the trailing dot dropped, 3 of these 4 fail.

On a real build (macOS)

On this branch (the epic head, without #610) the gate now measures the real panel on macOS too, as CI did, and fails as CI did:

ok   site build: first screen, Spectrum tab, 16 files gzipped together: 28.7 KB gzipped (76.5 KB minified), budget 30.0 KB
ok   site build: first screen, Components tab, 16 files gzipped together: 28.2 KB gzipped (77.0 KB minified), budget 30.0 KB
OVER site build: first screen, Spectrum tab with no idle preload, 18 files gzipped together: 30.0 KB gzipped (81.3 KB minified), budget 30.0 KB
OVER site build: first screen, Components tab with no idle preload, 18 files gzipped together: 30.0 KB gzipped (81.8 KB minified), budget 30.0 KB
ok   site build: first screen, Activations tab, 10 files gzipped together: 26.1 KB gzipped (69.3 KB minified), budget 30.0 KB
ok   site build: first screen, Activations tab with no idle preload, 12 files gzipped together: 27.5 KB gzipped (74.2 KB minified), budget 30.0 KB

With #610 merged on top (locally, not committed), every line passes:

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.8 KB minified), budget 30.0 KB

No lookup found none or several chunks on either build.

Update: #610 has landed and the epic is merged into this branch (afd214b). On the merged build the gate measures the panel and passes:

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.8 KB minified), budget 30.0 KB

Before that merge, this PR's Quality-view bundle sizes step is red on CI as well, which is the correct result for the epic head: CI run 45876064628 on 5429a2a measured the panel (16 and 18 files) and printed the same six lines as the macOS run above, both no-preload screens OVER at 30.0 KB. Vitest there fails only on the three nemar-cli drift tests (12 tests), as on the epic head.

Tested

  • bunx vitest run test/quality-views-size.test.ts (21 passed); 5 of 5 lookup cases fail on the old lookup, 3 of 4 name cases without the trailing dot
  • bun run test (271 files), bun run typecheck (0 errors), bun run lint
  • bunx astro build && bun scripts/check-quality-views-size.mjs --require-build on this branch, and with Quality views: first screen back under budget on the Linux build #610 merged locally

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

The size gate took the first file in dist/_astro holding the panel's loading sentence, which the admin drill-down's chunk also holds, so macOS measured admin-drill and Linux the panel. namedChunk (quality-views-size-lib.mjs) now requires the chunk name prefix and the marker together, and every lookup in siteUnions (panel, tabs, export, island) fails the gate naming the matches unless exactly one chunk matches. Budgets and the measured sets are unchanged. Tested: test/quality-views-size.test.ts (fails 5 of 5 new cases on the old lookup) and the gate on a real build.
@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: afd214b
Status: ✅  Deploy successful!
Preview URL: https://3774159c.nemar-website.pages.dev
Branch Preview URL: https://fix-608-gate-panel-lookup.nemar-website.pages.dev

View logs

astro check refused indexing the literal chunk map by a string. Tested: bun run typecheck (0 errors), test/quality-views-size.test.ts.
lookupStem and lookupIsland (quality-views-size-lib.mjs) hold the chunk-name prefix with its trailing dot, CHUNK_MARKERS and ISLAND_PREFIX, and siteUnions uses them. Tests cover panel beside panel-words, panel-model and panel-bridge, a panel chunk without its sentence, the export's chunks and the island; three fail with the trailing dot dropped. The test comment no longer ties the lookup order to an OS. Tested: quality-views-size tests (21), typecheck, lint.
@neuromechanist
neuromechanist merged commit 8143331 into feature/issue-586-epic-pipeline-progress Nov 26, 2026
3 of 4 checks passed
@neuromechanist
neuromechanist deleted the fix/608-gate-panel-lookup branch November 26, 2026 18:44
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