Repository navigation
Keep the harness prop where the sprite can see it - #89
Merged
Merged
Conversation
An accessory app's window is buried by anything that activates, and a covered top edge is not a Perch (#86), so the sprite fell through the prop the frame-loop checks were about to assert on. Re-assert the window's place at 20Hz, faster than the app's ~10Hz window poll. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
omesser
force-pushed
the
fix/harness-prop-stays-visible
branch
from
August 30, 2026 13:24
691a3ba to
4e4352a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mainfails its own verification harness as of2de74ec. The fault is in the harness.What happens
Three frame-loop checks fail, reproducibly:
The sprite falls straight past the prop's edge at 743 and lands on the floor.
Why
scripts/perch-window.swiftopens its prop as an accessory app's window, callsorderFrontRegardless()once, and never says it again. Anything that takes focus during the run buries it. A window list traced at the tick the sprite passes the edge:#86 refuses an edge covered by a window in front of it, because a sprite standing there is drawn floating in the middle of a window nobody can see through. iTerm's maximized rect contains every point on that display, so the edge is refused and the sprite falls through.
#86 is right, and the harness was asserting the wrong thing. Opening the prop alone leaves it at index 0 and visible; running
open -a iTermputs it at index 1, and ascreencaptureof that display shows the prop is then completely gone behind iTerm. So the check was demanding the sprite perch on a window that is not on screen — the exact case #86 exists to prevent.#88 did not break this. It made app startup slower, so the sprite now reaches the edge after the burial instead of before it. On #86's branch alone the harness was 24/24, which is why neither PR caught it: each was green in isolation, and only the merge result is red.
The fix
The prop re-asserts its position every 50ms, on the main run loop the step schedule already uses. Three lines and a constant.
The interval is chosen against the app's ~10Hz window poll, not the step schedule: a burial then cannot span a whole tick. That bound is what matters — one tick reading the prop as buried unperches a resting sprite, and once it has fallen a few points the edge is above it and it never re-perches. At 100ms or more a burial would be visible to a poll about half the time.
Measured, sampling the prop's layer-0 index every 20ms across an
open -a iTerm:2de74ecThe level argument is untouched, so the level-20 pose that
a window above the application level is not a Perchdepends on still works.Verify
./scripts/verify-overlay.sh— all checks pass, twice in a row, on the mergedmainthis branch sits on.cargo test --workspace156 + 18, clippy-D warningsandcargo fmt --all --checkclean. Only a Swift file changed.One hole left open
The frame-loop checks never assert the prop was actually frontmost when the sprite landed; they infer a perch from the traced position matching the prop's y. That is the hole this bug fell into, and it is why the harness passed for months while asserting something it could not see. Filed rather than fixed here, because it changes the harness's contract rather than repairing the reported fault.
🤖 Generated with Claude Code