refactor(render): (with-frame ...) — RAII-style synced frame boundaries - #175
Closed
mparrett wants to merge 1 commit into
Closed
refactor(render): (with-frame ...) — RAII-style synced frame boundaries#175mparrett wants to merge 1 commit into
mparrett wants to merge 1 commit into
Conversation
Replace the hand-written (sync-begin!) … (flush-frame!) pairs at every full-screen frame boundary with a single (screenfx/with-frame ...) macro that opens the DEC 2026 sync on entry and always closes it (end-sync + flush) on exit via try/finally. The begin/end can no longer drift apart or be skipped by an early return, and — the point — a frame that throws mid-emit still emits end-sync instead of leaning on the terminal's own 2026 release timeout. Converts render-full, render-dirty (both branches now share one frame, with the state-only commit-camera! hoisted past the sync boundary), animate-vfx!, the six modal screens, screenfx/clear-screen, and title's draw-frame + descent loop. Not nesting-safe: mode 2026 is a boolean, so an inner with-frame's finally would close the outer frame early — documented in the docstring; the existing top-level-only discipline still holds. Adds guard tests for the balanced pair and for end-sync-on-throw. Co-authored-by: Cursor <cursoragent@cursor.com>
mparrett
force-pushed
the
perf/render-sync-with-frame
branch
from
July 23, 2026 19:36
087ec53 to
eba896f
Compare
Collaborator
Author
|
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.
Re-opens #174, which GitHub auto-closed as a side effect of deleting #149's
branch on merge (its base,
perf/render-sync-output, no longer existed, andGitHub refuses to reopen or retarget a PR once that happens) — not a
concern about the code. Same branch, same commit (087ec53), already
reviewed and approved by nnunley on #174 against this exact diff.
What
Replaces the hand-written
(sfx/sync-begin!) … (sfx/flush-frame!)pairs atevery full-screen frame boundary with a single macro:
Every frame emitter becomes
(sfx/with-frame …):render-full,render-dirty,animate-vfx!, the six modal screens,screenfx/clear-screen, and title'sdraw-frame+ descent loop.Why
Addresses the review note on #149: a
with-framewith afinallymakes the sync boundary structural instead of a matched pair a future edit can split.finallycloses it immediately, no reliance on that timeout.Notes
with-frame'sfinallywould close the outer frame early. Preserves perf(render): synchronized output (DEC 2026) across all frame renders #149's "wrap only top-level frames" discipline. Documented in the macro's docstring.commit-camera!hoisted just past the frame boundary inrender-full/render-dirty— it only mutates the@last-cameraatom (no terminal output), behavior-preserving.xsofy.screenfx/*since let-go's syntax-quote doesn't auto-namespace symbols (let-go#48), matching the existingwith-folded-saltconvention.Tests
just checkclean; full suite green — 307 tests / 2803 assertions, 0 failures — including the existing render golden tests and two new guards: the balanced begin/body/end pair, and end-sync-on-throw.