fix(cmux-next layout): a column close keeps the camera's velocity back into the strip
Summary
When you press Cmd-W on a column while the strip camera still moves back into the strip (a center or a fling in flight), the camera stopped dead and then started again.
The cause: when a removed column put the camera past the end of the new strip, the reducer's removed-column clamp (#22059) set the camera velocity to 0. It did this also when the velocity already pointed back into the strip. Now the clamp stops only a velocity that points out of the strip. A camera that comes back into the strip keeps its speed.
This is a port of the dogfood fix 8449499be76 on cp/fix-close-render-motion-v2212. That fix also keeps the leading-column report that the camera owes until the close lands. That half is not here: feat has no render-server close (RenderClose, springCloseOnRenderServer) to take the report. The report fix lands with the render-server close if feat gets one (lead decision, 2026-11-01).
Regression test
ColumnCloseClampVelocityTests (pure reducer):
aCloseKeepsAVelocityBackIntoTheStrip: a camera at 845 pt that moves at -14854 pt/s keeps that velocity after the close clamps it to 600.aCloseStopsAVelocityOutOfTheStrip: a camera that moves out of the strip still stops.
Command (fleet): cmux-ci run --display --label gui-session-v1 --class light --script scripts/ci/package-test-lane.sh --arg=suite --arg=Packages/macOS/CmuxNext --arg=ColumnCloseClampVelocityTests,ColumnCloseMotionTests,ColumnCloseScrollMotionTests,RowCloseMotionTests,LayoutHiddenMotionTests --env CMUX_TEST_REQUIRE_GUI=1 --ref SHA
-
Red, a5865c67c10 (test only): step
4d2cb033cdf1415cf4fdb23d(cmuxs-Mac-mini-4).aCloseKeepsAVelocityBackIntoTheStripfails with velocity 0.0, expected -14854. The 4 CPU close suites pass. -
Green, c4bd2ae69d4 (fix): step
c816b9f4dbb899d895f53733(cmux12s). All 5 suites pass, including the #22059 tests (ColumnCloseMotionTests,RowCloseMotionTests,LayoutHiddenMotionTests). -
At the PR head 46853fe617e1 (a cmux-bot merge of feat; the PR's files are the same as at the reviewed 7a19c3b7512): display step
cdf4ae8b17aa4ee41d4fe3eb(cmux11s, CMUX_TEST_REQUIRE_GUI=1) passes all 5 suites: ColumnCloseClampVelocityTests, ColumnCloseMotionTests, ColumnCloseScrollMotionTests, RowCloseMotionTests, LayoutHiddenMotionTests. -
Review-finding follow-up (a strip that fits stops the camera at 0): red
2dce1850cb9d33b3eafba78dat a1c9a6a3c11, green0e0f6f819a8683101e20ec42at 7a19c3b7512.
Observed / Not run
- Observed: the red and green steps above.
- Not run: a live Cmd-W during a center in a tagged build. I did not see the visible motion; the evidence is the reducer state. On the dogfood line, the render-server close tests (
CloseRenderMotionTests.aCloseKeepsTheCamerasVelocity) cover the same bug. - Not run: it is not known if the dogfood close tests passed at the commit that wrote them (c4c8c49). At that commit the test build and then the product do not compile with the current toolchain.
No capture: the change is one velocity in the scroll reducer, with no new UI. A still image cannot show velocity.
Changelog
- Fixed: closing a column while the strip scrolls back no longer stops the scroll dead and starts it again.
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes a column close stopping the strip camera dead and restarting it. The removed-column clamp now zeroes velocity only when it points out of the strip from the edge the camera rests on; a center or fling already coming back keeps its speed. When the closed strip fits (no inside to return to), the camera stops at 0.
ColumnCloseClampVelocityTests covers preserving a velocity back into the strip, stopping a velocity out of the strip, and stopping a camera coming back on a strip that now fits.