Skip to content

fleet/web mock: draw the picture without per-pixel allocations - #1339

Merged
ejc3 merged 1 commit into
mainfrom
wall/e2e-two-viewers
Oct 26, 2026
Merged

ejc3 merged 1 commit into
mainfrom
wall/e2e-two-viewers

Conversation

@ejc3

@ejc3 ejc3 commented Oct 26, 2026

Copy link
Copy Markdown
Owner

main's Fleet Web job has failed since #1331 made the image full-bleed: e2e/wall.spec.ts:541 (two viewers) waited 30 s for all 15 tiles at one common t and got 11 (run 40278845876). The same failure hit #1332's runs (13 of 15; and "switching streams" never finished its switch), which I missed before merging.

Cause, measured on the CI runner. I ran the Fleet Web job unchanged on a throwaway branch with a CPU sampler and a per-openWall log (runs 40281499832 and 40282522751; runner: 4 vCPU, AMD EPYC 7763).

  • The page asks every tile for h=144 at CI's 960x600 window: a 960x540 image, 752,640 pixels a frame with the 16 px overlap. The letterboxed page asked h=90 for a 594x334 image, 335,616 pixels.
  • The mock draws every pixel in JavaScript on 3 render threads. Its node process used 2.0 to 2.9 cores, dropped frames from the first test (54 skipped, 22 renders queued) and fell further behind as the suite went on (3,698 skipped by test 19). At the end one viewer alone synced 12 of 15 in 45 s.
  • Two viewers are not the cost: both ask the same heights, so they share each render (mock node CPU was 26 cpu-s with one viewer and 28 with two over the same 12 s in the passing run). The two-viewers test is where an already saturated mock ran out of time.
  • ffmpeg and Chromium were not it: ffmpeg under 1 cpu-s per process, Chromium 0.5 to 1 core.

Change. shade() built a closure for the planet's ring on every pixel, and renderI420's chroma loop built an array of four offsets for every sample. Both are inlined, with the arithmetic and its order unchanged. One frame of the 960x540 image: 137.8 ms on one core before, 98.7 ms after (node scripts/mock-render-cost.ts 960 600 10, this box).

Evidence

  • Red: run 40281499832 (main's mock + instrumentation): two viewers 12 of 15 at 29.3 s, then a single viewer 12 of 15 at 45 s. Green: run 40282522751, the same with only mock/pattern.ts changed: all 50 Chromium tests passed, every openWall synced in 0.9 to 3.0 s, mock about 2.2 cores, no render backlog.
  • mock/test/pattern.test.ts: the picture is byte for byte the same (hashes of three tiles covering the planet, both sides of the ring, a word, a light and the clock, taken from main's pattern.ts).
  • Local gate: pnpm lint && pnpm typecheck && pnpm test (224) and pnpm test:e2e (56 passed).

Also

  • e2e/helpers.ts: openWall prints the mock's render stats when it times out, so a future timeout says whether the mock kept up.
  • scripts/mock-render-cost.ts: what one frame of a window's image costs and how many cores at a frame rate.
  • ci.yml: the Fleet Web job's comment gives the measured budget (it still described the letterboxed image).

Downstream impact. Test infrastructure only: the mock fleet and the CI job's comment. The page is unchanged.

main's Fleet Web job fails since the image went full-bleed (#1331): the
two-viewers test waited 30 s for all 15 tiles at one common t and got
11. Measured on the CI runner (4 vCPU, EPYC 7763), the mock renderer
was out of CPU: the 960x540 image is 752,640 pixels a frame with the
overlap against 335,616 for the old letterboxed one, the mock's node
process used 2.0 to 2.9 cores (its 3 render threads), it dropped frames
from the first test (54 skipped, 22 renders queued), and by the end a
single viewer synced 12 of 15 in 45 s. Two viewers share each render;
the test failed there because by then the mock was behind for everyone.

shade() built a closure for the planet's ring on every pixel, and the
chroma loop built an array of four offsets for every sample. Both are
inlined; the arithmetic and its order are unchanged. One frame of the
960x540 image takes 98.7 ms on one core here instead of 137.8 ms. With
it, the same runner went through all 50 Chromium tests: every
openWall synced in 0.9 to 3.0 s, and the mock used about 2.2 cores.

- mock/test/pattern.test.ts: renderI420's output for three tiles
  (planet, both sides of the ring, a word, a light, the clock) hashes
  the same as before the change.
- scripts/mock-render-cost.ts: what one frame of a window's image costs
  and how many cores that is at a frame rate.
- e2e/helpers.ts: openWall prints the mock's render stats when it times
  out, so the next such failure says whether the mock kept up.
- ci.yml: the Fleet Web job's comment states the measured budget.
@ejc3

ejc3 commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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-26T13:45:06.337140Z cb4b4fd Manual request
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a60bd24f-964e-4bdf-a9ed-918cdc49a6b4
Commits

Reviewing files that changed from the base of the PR and between 8ff0df8 and cb4b4fd.

Files selected for processing: 5
  • .github/workflows/ci.yml
  • fleet/web/e2e/helpers.ts
  • fleet/web/mock/pattern.ts
  • fleet/web/mock/test/pattern.test.ts
  • fleet/web/scripts/mock-render-cost.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: cb4b4fda41

ℹ️ 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".

@ejc3
ejc3 merged commit 539fce0 into main Oct 26, 2026
8 of 15 checks passed
@ejc3
ejc3 deleted the wall/e2e-two-viewers branch October 26, 2026 13:54
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