fix(runtime): read each frame's viewport from the frame, not live from the backend - #406
Merged
Conversation
abrichr
force-pushed
the
experiment/frame-bound-viewport
branch
from
August 26, 2026 19:54
ed2a957 to
8122323
Compare
…m the backend The replayer resolved targets and clamped postcondition search regions against an already-captured frame while reading self.backend.viewport live at call time. If the window moved, resized, or the display rescaled between the capture and the use, the frame was interpreted under geometry it never had -- placing a coordinate where the operator never demonstrated one, with the screen still looking correct. That is a silent wrong action produced by the runtime itself. A PNG carries its own dimensions in its IHDR chunk, so a frame can always answer for itself. _frame_viewport() reads them and validates the signature. Five sites had a captured frame in scope and are rebound to it. The four remaining self.backend.viewport reads have no frame in scope and are correct as live reads. Found while recovering abandoned work (see issue #402), whose 4,602-line backend refactor contains the same idea; this extracts it alone.
abrichr
force-pushed
the
experiment/frame-bound-viewport
branch
from
August 26, 2026 20:32
8122323 to
0d7fa64
Compare
abrichr
enabled auto-merge (squash)
August 26, 2026 20:32
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.
Fixes #402.
The defect
The replayer resolved targets, and clamped postcondition template searches,
against an already-captured frame while reading
self.backend.viewportlive at call time. If the window moved, resized, or the display rescaled
between the capture and the use, that frame was interpreted under geometry it
never had.
The consequence is our own headline failure mode, produced by our runtime
rather than by the application: a coordinate scaled by the wrong viewport lands
where the operator never demonstrated, and the screen still looks plausible.
The fix
A PNG carries its dimensions in its IHDR chunk, so a frame can always answer
for itself. No refactor, no new protocol, no plumbing:
Five sites, each rebound to the frame it evaluates:
screen_pngbefore_pngframe_pngframe_pngframe_png— postcondition search clampThe four remaining
self.backend.viewportreads have no frame in scope andare correct as live reads. They are deliberately untouched.
Severity, stated honestly
Narrow. It requires a geometry change inside the window between capture and
use. No occurrence has been observed, and there are no external deployments.
This is a correctness gap, not a live incident.
Verification
Provenance, and a claim I retracted
Found while recovering abandoned work from a scratch directory that was one
purge from deletion. That work (
feat/atomic-frame-actuation-lease, 4,602lines) contains the same idea inside a half-finished backend refactor which
fails 78 tests — on its own author's base as well as on main, so it arrived
broken. It stays parked; this PR extracts only the correct idea.
Issue #402 originally warned that binding the viewport without also reworking
region postconditions would trade a rare silent wrong action for a frequent
over-halt. I tested that and it is false; the retraction and the two
experiments are in the issue thread. The postcondition breakage on that branch
has a different, unisolated cause. This change stands alone.