Skip to content

🤖 perf: add the first-run view parity tool (T3 C step 2 PR 3b) - #6456

Merged
ThomasK33 merged 4 commits into
mainfrom
perf/t3-c2-pr3b-parity-tool
Oct 14, 2026
Merged

ThomasK33 merged 4 commits into
mainfrom
perf/t3-c2-pr3b-parity-tool

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

Adds scripts/perf/firstRunViewParity.ts and make first-run-view-parity: gate 8's tool for PR 4b. In a real Chrome against a built server, at 390, 744, 1200 and 1900 px and in the light and dark system theme, it checks that the static first-run view's "OSS contributors..." paragraph is within 2 px of the live wizard's in x, y, width and height, and that the static phase has exactly one <main>. It saves full-page screenshots of the static phase and of the live first frame for every run, for PR 4b's shell precondition (owner decision 10-14).

Background

Option C step 2 of #5971, plan section 5.6, PR 3 (split into 3a, 3b and 3c by the perf owner). #6444 added the static markup (FIRST_RUN_VIEW_HTML). PR 4b will serve it on /, and its gate 8 needs this tool.

Implementation

  • --tree <built tree> [--out <dir>] [--chrome <path>]. One xum server --no-auth on a fresh empty root (the first-run state), one browser context per width and theme. Widths 390 and 744 use phone emulation (touch, DPR 2); 1200 and 1900 use plain desktop. The theme is the system color scheme with empty localStorage, which is what a new user gets.
  • Each run holds the app's main-*.js so #xum-pre stays alone on screen. The tool waits for every stylesheet and then for the fonts layout needs, measures the static paragraph and counts <main>, and takes the static screenshot. Then it releases the chunk, waits (per animation frame) until #xum-pre is gone and the live paragraph exists, measures it, and takes the live screenshot.
  • The test page (until PR 4b exists): the served / has no #xum-pre yet. A Playwright route on the / document then inserts 🤖 perf: add the static first-run view's markup as a server constant (T3 C step 2 PR 2) #6444's FIRST_RUN_VIEW_HTML once before </body>, which is outside #root (React clears #root). parity.json records "injected": true. When the served / already has id="xum-pre" (PR 4b), the tool leaves the response alone.
  • A route-fulfilled document has no local address space, so Chrome's Local Network Access blocked the app's WebSocket to 127.0.0.1, and the app showed its connection error instead of the wizard. The tool launches Chrome with --disable-features=LocalNetworkAccessChecks.
  • Exit: 0 every run passes, 1 a run fails the rule, 2 bad input, 3 an invalid run.
  • Makefile: one target plus its .PHONY entry, exactly the hunk the perf owner cleared.

Validation

Tests (first commit, scripts/perf/firstRunViewParity.test.ts), each with the mutation it catches. I applied each mutation in a scratch edit, saw the named test fail, and restored the file:

Test Mutations it catches
the test page gets the constant once, outside #root inserting the markup inside #root
parity allows 2 px of drift in position and size, and exactly one main checking x/y only; a 3 px tolerance; allowing 0 <main>

The tests fail on main because the tool does not exist yet.

One run against main 6090f7691d (hand-injected test page): 8 of 8 pass. Static and live boxes are identical at every width and theme:

Width Paragraph box x, y, width, height (static = live) <main> in static phase
390 44.5, 307, 301, 60 1
744 147, 451.5, 450, 40 1
1200 375, 305, 450, 40 1
1900 725, 405, 450, 40 1

The first runs found two tool bugs (the blocked WebSocket, and a measurement before the stylesheet applied at 1900 px dark), fixed in the third commit. After the fix, three full runs passed 8 of 8 each. Screenshots of the final run are in a comment below. At 1200 and 1900 px they show the shell difference behind the dialog that PR 4b must resolve.

Gates: make static-check exit 0, make crap-check PASS (0 violations, 0 warnings).


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $337.13

…T3 C step 2 PR 3b)

The parity tool (plan section 5.6, PR 3, gate 8) compares the static first-run view with the live
wizard. Until PR 4b serves the view, it builds its test page by inserting #6444's constant into
the served "/" by hand. These tests require that insertion to land once, outside #root, and pin
the rule: 2 px of drift in x, y, width and height, and exactly one <main> in the static phase.
They fail on main because scripts/perf/firstRunViewParity.ts does not exist yet.

anthropic:claude-opus-5-5 high 337.13
…step 2 PR 3b)

scripts/perf/firstRunViewParity.ts serves a built tree on a fresh empty root and opens "/" in a
real Chrome at 390, 744, 1200 and 1900 px, in the light and the dark system theme. It holds the
app's main chunk, measures the static view's "OSS contributors" paragraph and counts <main>,
then releases the chunk and measures the live wizard's first frame after the handoff. It fails a
run when the paragraph drifts more than 2 px in x, y, width or height, or the static phase does
not have exactly one <main>. It saves full-page screenshots of both phases for PR 4b's shell
check (owner decision 10-14).

Until PR 4b serves the view, the served "/" has no #xum-pre, and the tool inserts #6444's
FIRST_RUN_VIEW_HTML before </body> through a Playwright route. Make target:
first-run-view-parity (FIRST_RUN_VIEW_PARITY_ARGS), as cleared by the perf owner.

The test's #root assertion now fails with a compact message instead of an element dump.

anthropic:claude-opus-5-5 high 337.13
…the painted view (PR 3b)

Found on the first run against a built server (main 6090f76):
- Chrome's Local Network Access blocked the app's WebSocket to 127.0.0.1 from the route-fulfilled
  test page, so the app showed its connection error and never handed over. The tool now launches
  Chrome with LocalNetworkAccessChecks disabled.
- 1900 px dark measured the static paragraph before the stylesheet applied (x 0, width 500). The
  tool now waits for every stylesheet, then for the fonts layout asks for, then two frames.

Three runs of the full matrix then passed 8 of 8 each.

anthropic:claude-opus-5-5 high 337.13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T07:07:45.809933Z 63b6600 New commits
🔒 Security Review ✅ Completed 2026-10-14T07:05:49.469880Z 63b6600 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ThomasK33

Copy link
Copy Markdown
Member Author

Screenshots from the final run of make first-run-view-parity against main 6090f7691d, with #6444's constant inserted by hand (parity.json: "injected": true). Left: the static phase (main chunk held). Right: the live wizard's first frame after the handoff. All 8 runs pass the paragraph rule. At 1200 and 1900 px the shell behind the dialog differs (mobile header in the static view, expanded sidebar in the live one): that is PR 4b's blocking precondition (owner decision 10-14).

390 px, light

static live first frame
static 390 light live 390 light

390 px, dark

static live first frame
static 390 dark live 390 dark

744 px, light

static live first frame
static 744 light live 744 light

744 px, dark

static live first frame
static 744 dark live 744 dark

1200 px, light

static live first frame
static 1200 light live 1200 light

1200 px, dark

static live first frame
static 1200 dark live 1200 dark

1900 px, light

static live first frame
static 1900 light live 1900 light

1900 px, dark

static live first frame
static 1900 dark live 1900 dark

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $337.13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f6a1511f6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/perf/firstRunViewParity.ts Outdated
Comment thread scripts/perf/firstRunViewParity.ts Outdated
Comment thread scripts/perf/firstRunViewParity.ts Outdated
…it (PR 3b review)

Codex round 1 on #6456 (three P2):
- A Chrome that does not launch (bad --chrome) left the detached server and the temporary root
  behind: the launch ran before the try/finally. The server start and the browser launch now run
  inside it, and a server that never answers /health is stopped before the error.
- The main-module guard compared a URL path with a file path, so a checkout path with an escaped
  character (a space) made make first-run-view-parity exit 0 without running. It now uses
  fileURLToPath.
- A stylesheet that never loads made the static-phase wait loop forever. It is now a 60 s
  waitForFunction, and a timeout is an invalid run (exit 3) with cleanup.

Checked: the full matrix still passes 8 of 8, and --chrome /nonexistent exits 3 and leaves no
server and no root.

anthropic:claude-opus-5-5 high 337.13
@ThomasK33

Copy link
Copy Markdown
Member Author

Readiness (perf owner, workspace 8e18f4aada): I am queuing this PR at 63b660046977ed7fd9ee285975d1f96d9bed667e.

I checked these facts myself:

  • The head matches git ls-remote.
  • Required passes.
  • 0 review threads are open.
  • The Codex code and security reviews are both "Completed" on this head, and Codex added a 👍 after the last commit.
  • The diff touches only scripts/perf and the Makefile hunk I cleared (.PHONY + first-run-view-parity).

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 82c2de7 Oct 14, 2026
34 of 35 checks passed
@ThomasK33
ThomasK33 deleted the perf/t3-c2-pr3b-parity-tool branch October 14, 2026 07:33
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