Note
🤖 Claude Opus 5.5 responding on behalf of samanyudas
Reproduced on current main and root-caused. The cause in the issue is right, and it has two parts that each need a change.
Reproduction on main
Build: /tmp/miri123/final (Miri 471737fb, engine a20f56e, the current pin). main at ffefedfa only adds docs on top.
verify-miri run 20261106-201727, external display, eight AXFixture columns, so fixture-1 is parked at x 2555.
| Try | Steps | fixture-1 during hold | fixture-1 after release |
|---|---|---|---|
| h1 | Left button held in fixture-8's content, activate fixture-1's app, release after 4 s | engine focus and frontmost, x 2555, not visible | x 2555, not visible |
| h2 | Same, release after 8 s (past the marker's 5 s timeout) | engine focus and frontmost, x 2555, not visible | x 2555, not visible |
| c1 | Control, no button held | engine focus and frontmost, x 4, visible | n/a |
The layout check at end passed and the previous build was restored.
h2 shows that nothing reveals the window even after the held marker times out.
Root cause, confirmed in the engine harness
autocenter_window_on_focusreturns when anyMouseHeldMarkerexists (src/ecs/focus.rs:576). The guard comes from upstream80f59e1("Clicking a window defers the reshuffle until mouse-up so content doesn't shift mid-click"). That intent covers the pressed window, but the check skips every newly focused window. A temporary print showed the early return for the activated window with one held marker.mouse_up_triggerreshuffles around the pressed window (src/ecs/mouse.rs:314) even when focus has moved to another window. With only part 1 fixed, the release scrolls the strip back to the pressed window and parks the activated one again.
Why the harness did not catch it: the mock's focus_window queues both ApplicationFrontSwitched and WindowFocused.
front_switched_trigger turns the first into a WindowFocused too, so the second counts as a repeat and reaches the unguarded ensure_visible at src/ecs/triggers.rs:418, which reveals the window.
On the Mac, activating an app whose only window is already its focused window gives one focus event (inferred from the live result, not logged), so only the guarded path runs.
A faithful test gives the parked window its own app and calls activate_app alone.
Experiments (engine harness, nothing pushed)
Four tests: the two acceptance criteria, a no-hold control, and a new guard-purpose test (press a partly hidden window, which gets focus on the click, and check it stays put until release). No existing test covered this.
| Engine | Held shows | Shows after release | Control | Pressed window waits for release | Full suite |
|---|---|---|---|---|---|
a20f56e unchanged | fail | fail | pass | pass | |
A: drop !mouse_held.is_empty() | pass | fail | pass | ||
| B: A, plus skip the release reshuffle when the pressed window lost focus | pass | pass | pass | fail | 1311 passed (guard purpose untested) |
| C: B, but keep the guard for the pressed window only | pass | pass | pass | pass | 1312 passed, 221 drag tests included |
Fix options
- Recommended: C.
In
autocenter_window_on_focus, return only when the held marker names the focused entity. Inmouse_up_trigger, reshuffle around the pressed window only if it still holds focus. About five changed lines plus the four tests. A title-bar drag stays covered by the separateDragState::holds_windowguard. - Keep the global guard, and on release reshuffle around the focused window instead of the pressed one. This meets only the release criterion. The window still stays hidden while the file is held, which is the case the issue is about.
Acceptance criteria
All four can be checked.
Criteria 1 to 3 run in make engine-test.
Criterion 4 is Sam's hand check with a real file drag, because synthetic drags in my run showed no drag image, as the issue already notes.
Related gap seen only in the harness: the repeat-focus path at triggers.rs:418 ignores a held button, so a duplicate focus event can still shift the strip mid-click. I have not seen this on the Mac and did not file it.