Skip to content

Stop sampling a live animation in the dropdown fixed-point checks - #14

Merged
SDSLeon merged 1 commit into
masterfrom
poracode/menu-zoom-fixed-point
Sep 15, 2026
Merged

SDSLeon merged 1 commit into
masterfrom
poracode/menu-zoom-fixed-point

Conversation

@SDSLeon

@SDSLeon SDSLeon commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Fixes master's red Tests (Cargo.toml profile) (macos-latest) job.

Root cause: the wall clock, not the profile

The job failed with a menu measured 220px × 158px where the line before measured 220px × 157px, same origin — on a commit (8e64c0c2) that changed no .rs, no manifest and no toolchain, and after the same job had passed twice on identical Rust.

The Dropdown panel is wrapped in entering_zoom(Motion::POPOVER_IN), which reproduces v3's zoom-in-90 by growing the panel's own vertical padding from 90% to 100% over 150ms (anim::ZoomBox::panel). Content is 146.2px, so the layout height runs 157.0 → 158.2px and crosses the rounding boundary ~50ms after the menu opens.

gpui drives a oneshot Animation from scheduler::Instant — the real wall clock. Neither run_until_parked nor executor().advance_clock() moves it, so settle() never settled the zoom; it sampled it wherever the clock happened to be. Locally the test finishes in ~10ms and every sample lands at 157. A runner that stalls ~50ms between two samples gets 157 then 158.

Reproduced deterministically: injecting a 30ms stall into the unmodified test reproduces the CI assertion exactly, origin and all. A 25ms stall also takes down an_open_submenu_is_its_own_popover_and_stays_inside (86 vs 85) — same latent bug, second assertion.

There is no geometry defect

The resting panel is a true fixed point at 158px, and the height change is the animation doing its job. What was wrong is that assertions about the positioner were reading a surface that was still moving, and passing on timing luck.

  • Every host opens with the entry zoom off via the public MenuStyle theme default — the same switch an application would use. Dropdown composes its Menu internally and never sets the instance flag, so the theme is the correct lever. No source change, no new API, and the motionless layout is the animated resting layout (verified 220×158 both ways).
  • Fixed-point samples are now taken across 30ms of real time. This strengthens them: they now mean "nothing moves on its own" rather than "nothing moved within a microsecond".
  • assert_eq! is untouched. Nothing is ignored, loosened, or profile-gated.
  • New the_entry_zoom_lands_on_the_motionless_layout keeps the stock theme, waits the zoom out, and pins both halves: a finished zoom is a fixed point across real-time gaps, and it converges on exactly the motionless layout.

Mutation-tested both directions

  • Entry zoom left running → 8 tests fail deterministically (they previously passed by luck). Independently re-confirmed under the failing job's codegen settings.
  • POPOVER_IN.ms bumped so the zoom never settles → the new test fails with the original 158 vs 157.

Verification

run-tests.sh --workspace --locked 0 (113/113) · the same with the failing job's knobs CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_DEV_CODEGEN_UNITS=16 0 (113/113) · dropdown_viewport_deep 19/19, three consecutive runs under those knobs · clippy -D warnings 0 · fmt 0 · gpui_patches --check 0 · inventory 0 · coverage 0 · all parity audits 0.

Separate defect found, deliberately not fixed here

Reduced motion changes the menu's layout: with motion 220 × 158, with reduce_motion 443 × 110. anim::pressed returns the row untouched under reduced motion, so the w_full press slot disappears; with the slot present its percentage width contributes nothing to a MaxContent measurement and the panel collapses to min_w 220, wrapping the descriptions. The reduced-motion figure is the one matching the pinned CSS, so the normal path is the wrong one. Blast radius is every pressed() control's intrinsic width — worth its own change.

🤖 Generated with Claude Code

`Tests (Cargo.toml profile) (macos-latest)` went red on master with a menu
measured 158px tall where the line before had measured 157, on a commit that
changed no Rust. The profile was innocent too: the cause is the wall clock.

The panel is wrapped in `entering_zoom(Motion::POPOVER_IN)`, which reproduces
v3's `zoom-in-90` by growing the panel's own vertical padding from 90% to 100%
over 150ms, so the menu is a different height on every frame while it runs.
gpui drives a oneshot `Animation` from `scheduler::Instant` -- the real clock --
and neither `run_until_parked` nor `advance_clock` moves it, so `settle` never
settled the zoom. It sampled it wherever the clock happened to be. Locally the
test finishes inside 10ms and every sample lands at 157; a runner that stalls
about 50ms between two samples gets 157 and then 158. Injecting a 30ms stall
into the unmodified test reproduces the CI assertion exactly, origin and all.

So there is no geometry defect: the resting panel is a fixed point at 158px,
and the height change is the animation doing its job. What was wrong is that
assertions about the positioner were reading a surface that was still moving,
and passing on timing luck.

Every host in the file now opens with the entry zoom off through the public
`MenuStyle` theme default -- the same switch an application would use, and the
motionless layout is the animated resting layout. The fixed-point samples are
now taken across 30ms of real time, which strengthens them: they mean "nothing
moves on its own" rather than "nothing moved within a microsecond". No
assertion was loosened, ignored or profile-gated.

`the_entry_zoom_lands_on_the_motionless_layout` keeps the stock theme, waits
the zoom out, and pins both halves -- a finished zoom is a fixed point, and it
converges on exactly the motionless layout. Mutation-tested both ways: leaving
the zoom running fails 8 tests deterministically, and a `POPOVER_IN` that never
settles fails the new one with the original 158-against-157.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
herogpui Ready Ready Preview Sep 14, 2026 11:58pm UTC

Request Review

@SDSLeon
SDSLeon merged commit 94eec32 into master Sep 15, 2026
13 checks passed
@SDSLeon
SDSLeon deleted the poracode/menu-zoom-fixed-point branch September 15, 2026 00:05
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