Skip to content

Issue-185: Cover the world engine in CI with goldens and a speed check - #237

Merged
zakiyyah-osman merged 4 commits into
devfrom
fix/185-engine-ci-coverage
Nov 30, 2026
Merged

zakiyyah-osman merged 4 commits into
devfrom
fix/185-engine-ci-coverage

Conversation

@zakiyyah-osman

Copy link
Copy Markdown
Collaborator

Closes #185

CI had two blind spots for the D-37 engines: no check for the world engine getting slower, and no golden of a frame an engine draws. No engine or app code changes.

What changes

  • Golden frames (e2e/engineGolden.spec.ts): a water world, Kepler-186 f and Jupiter, drawn by the world engine through the existing parity hook on its virtual clock.
  • Speed check (scripts/check-engine-speed.js, CI job "engine speed against the base"): times the world engine of the PR and of its base commit, in turn, on one runner. Fails when median forming or frame time is over 1.5 times the base's.
  • Measurements (R11.3, scripts/engine-bench/forming.js): forming time, frame rate and the backdrop-filter comparison on one laptop (Intel Arc). The A15 columns and R12 Viewer: real shapes and volumes (shape-model asteroids, remnants, nebulae, comets) #43 stay open.

Evidence

  • Identical engines: ratios 0.82 to 1.14 across local runs, including one on 2 cores (with 10 frames per sample; the script now uses 5).
  • Deliberate slowdown (80 ms per spin-up step, three draws per frame; one round): failed, forming 1.67x and 2.18x.
  • Golden with the wrong picture swapped in: failed.
  • contract:check, typecheck, lint, format:check, test, build pass locally. The full Playwright suite was not run locally.
  • Not yet seen on CI: the goldens were made on a laptop, and the new job has never run on a GitHub runner.

Please check

  1. Time limits are unchanged, although the ticket asks to tighten them. Over 13 CI runs (24 to 29 Nov) the split-view build test took 126 to 288 s against a 330 s limit. Is leaving them acceptable?
  2. "+ Artistic" golden: the frames come from the engine through the parity hook, not through the app's stage component. Does that meet the ticket's wording?
  3. Frame timing is weak for gas giants: with three draws per frame, Jupiter's frame ratio stayed at 0.92 (Earth-like: 1.58). Forming time caught the slowdown for both.
  4. Compared with the base, not main (D-42). A slowdown spread over several PRs, each under 1.5x, passes.
  5. Runner cost: one more job on frontend PRs, about 3 minutes of timing locally (6 on 2 cores) plus two installs.

Not covered

Star and rock engines (their parity hooks did not run as they are: the star one found no "3D viewer" button, the rock one timed out), the fly view's speed on CI, and real-GPU speed on CI.

🤖 Generated with Claude Code

zakiyyah-osman and others added 3 commits November 30, 2026 11:55
golden.spec.ts draws the three.js path, so no golden covered an
engine-drawn frame. engineGolden.spec.ts draws a water world,
Kepler-186 f and Jupiter through the existing dev-only parity hook and
compares them by SSIM. Stars, rocks, the stage component and the fly
view are not covered.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add forming.js, which measures the world engine inside the app on a
real GPU, and record one laptop's results in R11.3, including the
backdrop-filter comparison. The A15 columns stay unmeasured.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add an "engine speed against the base" job. It times the world engine
of the PR and of its base commit in turn on one runner and fails above
1.5 times, because runner speed varies too much for a time limit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@zakiyyah-osman

zakiyyah-osman commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

@MintHerbs follow-up on the flaky test I mentioned on #234: "the last frame of a build is the normal render of the same plan and seed" (build.spec.ts) had a failed attempt in 9 of 13 CI runs between 24 and 29 Nov, including on dev, and failed both attempts in 2 of them.

It blocked this PR for a while: it failed both attempts on the first run (30 Nov) and both on a re-run, then passed on retry in a second re-run (similarity 0.77 to 0.93 in the first four failures, against a 0.97 minimum). All checks now pass. This PR changes no app or engine code.

Could this get a ticket and someone to own a fix?

@JoottunAtish JoottunAtish left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved with nits. CI is green at d79cc02. The speed job has already run on CI (ratios 0.92 to 1.08), and the three laptop-made goldens pass on CI on the first attempt. No engine or app code changes; the parity hook is dev-only, so the D-37 "+ Artistic" gating is untouched.

On the two open questions in the body: keeping the e2e limits as they are is fine given the 13-run data, and goldens through the parity hook meet #185's "Done when".

Nits (non-blocking, fine as a follow-up):

  1. frontend/e2e/engineGolden.spec.ts:53-54: the search cases send no id, and they pass only because out.artifact and c.id are both undefined. Pass the expected id, or have the hook skip the check when id is missing.
  2. Check engine_world_water.png (Aqua Prime) by eye before it is frozen. It is mostly tan with dark patches.
  3. SSIM scores are only printed on failure, so we can't see the margin to 0.97. Log or attach them on every run.
  4. The engine goldens skip the Q-69 corner background check. The lit-pixel guard catches a blank frame but not a background drift.
  5. scripts/check-engine-speed.js:
    • It runs the PR's script against the base, so renaming a preset or changing the hook fails on the base side with an unclear error.
    • There is no retry for a slow runner.
    • It only works on Linux and macOS (process.kill(-pid)). Say so in the header comment.
  6. fetch-depth: 0 in frontend.yml fetches every branch. Fetching only the base SHA is enough.
  7. Docs: the "Golden frames" row of the A12 table in docs/architecture/testing.md still lists only the fixture goldens. Optionally update the scripts/ line in docs/uml/04-package.md.
  8. The flaky build.spec.ts:465 deserves its own ticket.

Skip the parity hook's preset check when a case gives no id, log the
golden scores on every run and check the corner background, measure a
world twice before failing the speed check and name the side that
failed, fetch only the base commit in CI, and update the docs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@zakiyyah-osman

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. The nits are addressed in ea00d480:

  1. Card cases without an id: the parity hook now skips the preset check when a case gives none. This touches engine/parity/hook.ts (dev only), so "no engine code changes" in the description now has that one exception.
  2. Water golden: checked by eye and fine as the reference. The tan is probably from the card's 3,500 K host star (not tested).
  3. SSIM scores: logged on every run.
  4. Background: the four corners are checked against the golden's.
  5. Speed script: a world over the limit is measured again and fails only if over both times; errors name the side that failed; the header notes Linux and macOS only. It still drives the base with the PR's script.
  6. CI fetch: only the base commit, shallow.
  7. Docs: updated the A12 "Golden frames" row, 04-package.md and the acceptance tests.
  8. Flaky build.spec.ts:465: still needs a ticket (see my comment above).

CI is green, though the flaky test needed re-runs.

@zakiyyah-osman
zakiyyah-osman added this pull request to the merge queue Nov 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 30, 2026
@zakiyyah-osman
zakiyyah-osman added this pull request to the merge queue Nov 30, 2026
Merged via the queue into dev with commit f1b32d0 Nov 30, 2026
18 of 20 checks passed
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.

2 participants