Repository navigation
fix(render): queue a from-truth frame for a redundant reveal edge - #3031
Conversation
A reveal proof that arrives while the surface gate is already open was dropped end to end: set_surface_gate filtered the duplicate edge and set_surface_visibility_at returned early, so nothing was owed and no wake was armed. The #2989 confirmation repair reopens the gate speculatively while the surface is still occluded; when the compositor later serves the return frame callback the probe synthesizes Occluded(false), both layers no-op, and the loop parks on the last sampled frame - which predates output written while away (reported with aws configure: the unterminated prompt lines vanish, earlier output stays). A redundant hide stays a no-op. A redundant reveal now queues one full-redraw frame and the next-frame wake through queue_reveal_repaint, ends the hidden-repair probe, and clears the confirmation bound; it does not change the gate or write to the PTY.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…tty#3031)
`Windows check and test` failed on four tests in this PR's own new module
(run 42473103199 job 128708284972): each helper spawned a pane with the
hardcoded unix filler `/bin/cat`, so Windows panicked before any assertion —
pane spawns: Pty("pty i/o error: The system cannot find the file specified. (os error 2)")
at present.rs:15135/15149. The helpers were the only unix-only part of the
module; `panel_rules.rs` already gates its PTY spawns with `#[cfg(unix)]`, so
follow that: gate `split_rt`, `second_workspace_rt`, and the four split and
second-workspace reveal tests, plus `feed_pane`, whose only callers are those
tests (Windows dead_code otherwise). A hardcoded `/bin/cat` is also the
host-value class the workspace forbids in tests.
The reveal behaviour itself is platform-agnostic and stays covered by the
primary-surface cases on every platform plus these four on unix.
Verified: `cargo check -p bitty-runtime --tests --offline`;
`RUSTFLAGS=-D warnings cargo check -p bitty-runtime --tests
--target x86_64-pc-windows-gnu --offline` clean (the leg that was red);
rustfmt +stable --edition 2024 --check clean.
Xuepoo
left a comment
There was a problem hiding this comment.
Independent review — guard-dispatched reviewer, round R2, head f45d3b4
Scope: whole PR at head. Two commits (a055c38e production + 3fccb041 Windows fix), merged with main; the three-dot diff vs origin/main is 3 files, +566/-24, and is byte-identical at 3fccb041 and at the merge head, so the fix-round content is what was reviewed.
CHECK 1: PASS
Gated inside mod prompt_reveal_tests (present.rs:15274): helpers feed_pane (15312–15313), split_rt (15321–15322), second_workspace_rt (15341–15342); tests at 15458/15460, 15505/15507, 15596/15598, 15640/15642. Nothing else in present.rs gained a cfg.
All four tests genuinely need a spawned child: they call split_rt/second_workspace_rt, which do spawn_shell_for_view(pane, "/bin/cat", …), and only that spawn inserts into pane_sessions (panes.rs:610); handle_pane_bytes early-returns without a session (panes.rs:1054). feed_pane is gated because both its callers are gated and --tests runs under -D warnings (dead_code would break the Windows leg).
The two tests that can run without a PTY were NOT gated: reveal_keeps_the_unterminated_prompt_primary (15426) and reveal_shows_the_prompt_that_arrived_while_hidden (15555), both feed_primary-only.
Precedent: panel_rules.rs gates every PTY-spawning test the same way (panel_rules.rs:186, 215, 251, 268 …) and gates the then-unused require_pty import (89). Here the macro is fully qualified, so there is no import to gate; #[cfg(unix)] before #[test] instead of after is cosmetic. Pattern matches.
CHECK 2: PASS
Windows-visible tests in the module: reveal_keeps_the_unterminated_prompt_primary and reveal_shows_the_prompt_that_arrived_while_hidden.
The fixed behaviour keeps non-unix coverage that can actually fail: surface_visibility_tests::redundant_reveal_queues_a_from_truth_frame (present.rs:12342) and repeated_hides_are_no_ops_and_repeated_reveals_repaint (12295), plus the app-level reveal_edge_while_the_gate_is_open_still_presents (bitty-terminal/src/tests.rs:1437, plain #[test]).
Verified by reversion in a scratch worktree (restored afterwards, tree clean): deleting the redundant-reveal branch made exactly those two fail — panics at present.rs:12293 and 12344 — while the other 14 in that module stayed green. So the fix's coverage is not unix-only.
What Windows does lose is shape coverage (non-primary pane grid in a split / second workspace), not the fixed path.
CHECK 3: PASS
git diff origin/main...HEAD adds exactly 8 cfg attributes: #[cfg(test)] on the new module (present.rs:15273) and 7 × #[cfg(unix)] at 15312, 15321, 15341, 15458, 15505, 15596, 15640 — all between 15274 and 15683, i.e. inside mod prompt_reveal_tests. No production item is cfg'd, no spill into bitty-daemon/bitty-terminal; the pre-existing unix gates at 8745/8748/8901/13165/14602 are untouched by this diff.
CHECK 4: PASS
RUSTFLAGS=-D warnings cargo check -p bitty-runtime --tests --target x86_64-pc-windows-gnu --offline (CARGO_TARGET_DIR=…/.targets/ctx-3030-review): exit 0. The only warning: line is the bitty-terminal build-script notice "Windows target on a non-Windows host: the icon resource is not embedded" — a cargo:warning, not a rustc lint, so -D warnings is unaffected, and it predates this PR.
Probe that the command really compiles the gated module: a temporary compile_error! inside mod prompt_reveal_tests made the same command fail with could not compile bitty-runtime (lib test); probe reverted, tree clean.
Linux subset on the same target dir: 6 passed, 0 failed, 0 ignored (all six prompt_reveal_tests ran and passed). I used the lib unit-test target (--lib), which owns these tests; the bare invocation additionally builds ~25 integration-test binaries and hit my local tool timeout, not a failure. cargo fmt --check -p bitty-runtime -p bitty-terminal is clean.
CHECK 5: PASS
(a) One full frame + one wake: queue_reveal_repaint (present.rs:2660–2666) sets coalesced_pending, coalesced_deadline = Some(now) — already open, so present_coalescing_deadline (2183–2194) hands it to the embedder — and pending_full_redraw, which forces full_frame (3892) and bypasses the no-damage early return (3856). Both flags are one-shot, consumed by the commit (7812 clears the coalesced pair; a full redraw is built once).
(b) Gate unchanged: the redundant branch (2564–2575) returns before self.surface_visible = visible (2590); the app forwards through set_surface_visibility(true) (terminal_app.rs:1459), which lands on the same-state path again. The new tests assert is_surface_visible() after the edge.
(c) No PTY write: 2660–2666 touches only present bookkeeping (coalesced*, pending_full_redraw, hidden_repair_at, confirmation bound); the prompt tests pin pending_input_len / grids / surface extent unchanged.
(d) Redundant HIDE still a no-op: inner if visible guard; the transition hide branch (2604–2642) is untouched, and repeated_hides… (12295) still asserts no redraw and no deadline after a second hide.
No same-state loop: the only reveal-proof sources are native edges (Resumed terminal_app.rs:4911, Occluded(false) 4965) and the input path, which early-returns once visible (terminal_app.rs:1479–1481). The hidden-repair probe only fires while hidden, and the speculative reopen is settled either by the reveal frame's commit (7812) or by a hide (2641). Nothing in the runtime re-emits a reveal edge, so each proof buys one bounded frame, not a cycle.
Non-blocking observations:
- One switch-back can now build two full frames:
ResumedandOccluded(false)for the same transition both reach the gate (the app already documents that race, terminal_app.rs:4956) and the second is no longer filtered. Bounded and intended, just a cost. - The four gated tests are the only split/second-workspace shape coverage, so Windows keeps the fix's coverage but loses that shape.
CI at review time: on head f45d3b4, run 42478253630 had "Linux Wayland" and "Quality gates (1)" red with a setup-step exit 127 ("Unable to locate executable file: undefined") and no test assertion; that cannot originate from this diff (it touches no workflow, and main ca5a96f is green). The Windows leg was still pending. Re-check CI before merge.
VERDICT: APPROVE
Closes #3030.
Root cause
A reveal proof that arrives while the surface gate is already open was dropped end to end:
TerminalApp::set_surface_gatefiltered the duplicate edge before the runtime saw it (terminal_app.rs:1444).Runtime::set_surface_visibility_atreturned early onsurface_visible == visible(present.rs:2564).The #2989 confirmation repair reopens the gate speculatively while the surface is still occluded. When the compositor later serves the return's frame callback, the occlusion probe synthesizes
Occluded(false); both layers seesurface_visible == true, no-op, owe nothing and arm no wake. The loop parks on the last sampled frame — which predates the output written while away. Withaws configure --profile rootthat is exactly the reported shape: earlier rows intact, the unterminated prompt lines missing.The prompt-row rebuild itself is not the defect: six regression tests drive the real
aws configuretranscript shape (unterminatedAWS Access Key ID [None]:) through hide/reveal for the primary pane, a split pane and a second-workspace pane, and all of them paint the prompt row byte-identically on unmodifiedorigin/main.Fix
queue_reveal_repaintextracted and called for a same-statetruedelivery — one full-redraw frame plus the next-frame wake, ends the hidden-repair probe, clears the render: a present that never reaches the compositor leaves a stale frame and nothing retries it #2989 confirmation bound. It does not change the gate.set_surface_gateforwards redundant reveal edges to the runtime instead of swallowing them, without logging a transition.Tests
Failing before the fix (verified by reverting the single
queue_reveal_repaintcall —redundant_reveal_queues_a_from_truth_framepanics atpresent.rs:12344):runtime::present::surface_visibility_tests::redundant_reveal_queues_a_from_truth_frametests::input_vm_boundary::reveal_edge_while_the_gate_is_open_still_presentsUpdated contract test:
repeated_hides_are_no_ops_and_repeated_reveals_repaint.Regression pins (pass before and after):
prompt_reveal_tests::{reveal_keeps_the_unterminated_prompt_primary, ..._split_pane, ..._second_workspace, reveal_shows_the_prompt_that_arrived_while_hidden, ..._split_pane..., ..._second_workspace...}— each asserts the prompt row has ink, the wholeheadless_rgbaframe matches a reference runtime, and the switch wrote no PTY bytes and issued no grid or surface resize.Gates
cargo fmt --all -- --check;RUSTFLAGS="-D warnings" cargo clippy -p bitty-runtime -p bitty-terminal -p bitty-ui --all-targets;cargo test -p bitty-runtime --lib runtime::present165 passed; fullbitty-runtime --lib1511 passed;bitty-terminal --bin bitty --features input-vm-test-support1511 passed;view_style_carry5 passed; rustdoc clean.Not verified live
Which edge the owner's return actually delivers (
Resumed, nativeOccluded(false), or only input) was not observed on a live host; the fix covers the same-state reveal class, which is the only path found that leaves earlier output intact while the newest rows are missing. A build with #3025 is required to compare against 0.0.36, which predates it.Summary by CodeRabbit