Skip to content

[CTX-1488] fix(runtime): gate closing chrome to live ownership (#2577) - #2599

Merged
Xuepoo merged 6 commits into
mainfrom
ctx-1488/fix-panel-delete-flash
Oct 24, 2026
Merged

Xuepoo merged 6 commits into
mainfrom
ctx-1488/fix-panel-delete-flash

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Priority: P1 | Area: render | Labels: bug,P1,area:render | Milestone: v0.0.28 | Task: CTX-1488

Closes #2577

Root cause

Runtime::set_layout_closing retains the removed View's last presented
decoration ring as an RFC-0002 ClosingFrame. paint_closing_rings
composited that ring in the overlay phase, after every live leaf, so for the
120 ms close duration the deleted pane's full accent rounded rectangle painted
over the sibling that had already expanded into the slot.

Under catppuccin-mocha the focused outline is #94E2D5 (teal, reads green),
so the owner saw a green flash at the removed position. The defect is generic:
the same stale ring appears under any theme, only the accent RGB differs. The
removed pane's old interior split edge (its top border, now inside the expanded
sibling) is the most visible part: the first close frame carried 432 accent
pixels that the settled frame does not.

Fix

Invariant: live ownership wins over stale chrome. paint_closing_rings
now intersects each retained closing rect with the committed live allocations
and skips the ring when any live allocation owns overlapping space. The gate
reads committed logical frames, not interpolated paint bounds: the expanding
sibling owns the vacated slot from the first close frame even while its own
Resize tween is still sliding into it, so the not-yet-covered band clears to
the theme background instead of showing retained accent chrome. Frame cadence,
progress accounting, and ClosingFrame expiry are unchanged.

No theme special case, no new palette role, no compositor dependency.

Regression

crates/bitty-runtime/tests/panel_delete_flash_2577.rs (deterministic
headless frames, no GUI):

  • split, stacked, zoomed (proxy deleted in the same event), floating discard,
    pinned discard, and pinned-base retirement;
  • catppuccin-mocha + neutral github-light;
  • every post-close frame must be byte-identical to an instant-delete
    reference (close-only policy), with no focused-accent pixel where the
    reference paints none;
  • the shipped default policy asserts the first close frame has zero
    accent pixels inside the removed rect — the owner's exact sequence.

transition_frame_capture::zoom_engage_and_disengage_envelopes previously
pinned the stale ring pixel; it now asserts the ownership invariant (the probe
presents the zoomed owner from the first close frame).

Before/after frame captures for the catppuccin-mocha sequence are in the
task record (recording/ctx-1488/ in the workspace).

Gates

Natively on this host:

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo clippy -p bitty-terminal --features dev-tools --all-targets --locked -- -D warnings
  • cargo clippy -p bitty-render -p bitty-runtime -p bitty-terminal --all-targets -- -D warnings
  • cargo nextest run --workspace --locked — 8433 passed, 4 skipped
  • new regression + present/theme suites: panel_delete_flash_2577,
    transition_frame_capture, panel_animations, runtime_present,
    runtime_soft_present, theme_recolor_2333, split_zoom_repaint,
    split_tiling, float_tiled_outlines, float_chrome_occlusion,
    tiled_drag_present, present_pipeline, truth_preserved
  • cargo check --target x86_64-pc-windows-gnu -p bitty-runtime -p bitty-terminal --all-targets --locked

just ci-local was attempted twice and is blocked before any Rust step by
the local act environment, not by this change: the workflow's
cachix/install-nix-action step cannot install into /nix under act's
non-root ubuntu user, and the retry aborted downloading the Nix tarball
(curl: (92) PROTOCOL_ERROR); the if: always() sccache-stats step also runs
without SCCACHE_PATH under act. Remote Quality gates is the acceptance gate
for that job.

Residual risk

  • A closing ring can still paint in genuinely unowned space (no live
    allocation overlaps the old rect). No product path presents that state
    today: empty layouts idle, and every delete path in the issue intersects a
    live owner. The invariant explicitly permits background-tier chrome there.
  • No compositor-level flash is expected: both present paths fully clear and
    composite every frame.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a visual artifact when closing panes: retained accent outlines no longer appear over the pane expanding into the vacated space.
    • During the close transition, the expanding pane now covers the removed area, while any uncovered space displays the theme background.
    • Corrected the effect across tiled, stacked, zoomed, floating, and pinned pane layouts.

A closed View keeps its last presented decoration ring as RFC-0002 closing chrome. paint_closing_rings composited that stale ring in the overlay phase after every live leaf, so the deleted pane full accent rounded rectangle painted over the sibling that had already expanded into the slot for the 120 ms close. Under catppuccin-mocha the focused outline #94E2D5 reads green, hence the owner-visible flash; the defect is theme-independent.

Gate closing chrome on live ownership: skip a retained closing ring when any committed live allocation owns overlapping space. Read the committed logical frames, not the interpolated paint bounds, because the expanding sibling owns the vacated slot from the first close frame even while its own Resize tween slides into it.

Regression: deterministic headless frames across split, stacked, zoomed, floating, pinned, and pinned-base deletion in catppuccin-mocha and github-light; every post-close frame equals an instant-delete reference, and the shipped default policy asserts zero accent pixels inside the removed rect on the first close frame.
@Xuepoo Xuepoo added this to the v0.0.28 milestone Oct 24, 2026
@Xuepoo Xuepoo added bug Something isn't working P1 Priority: high area:render Area: rendering labels Oct 24, 2026
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You'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 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1646a23-c462-499d-84b7-c0cff9a936e8
Commits

Reviewing files that changed from the base of the PR and between a9c6a03 and d400d93.

Files selected for processing: 4
  • CHANGELOG.md
  • crates/bitty-runtime/src/runtime/present.rs
  • crates/bitty-runtime/tests/panel_delete_flash_2577.rs
  • crates/bitty-runtime/tests/transition_frame_capture.rs

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5a5a2419-d60d-4820-b99c-6edb589e9423
Commits

Reviewing files that changed from the base of the PR and between 7b1c8b3 and a9c6a03.

Files selected for processing: 4
  • CHANGELOG.md
  • crates/bitty-runtime/src/runtime/present.rs
  • crates/bitty-runtime/tests/panel_delete_flash_2577.rs
  • crates/bitty-runtime/tests/transition_frame_capture.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Closing-ring rendering now checks committed live allocations before painting retained chrome. New headless tests cover panel deletion across layout modes and themes, and update the zoom-transition pixel expectation.

Changes: Panel deletion rendering

Layer / File(s) Summary
Gate closing rings by live allocations
crates/bitty-runtime/src/runtime/present.rs, CHANGELOG.md
The overlay path passes committed allocations to closing-ring rendering. A ring is skipped when it intersects a non-empty live allocation. The changelog describes the behavior and covered layout modes.
Verify deletion frames
crates/bitty-runtime/tests/panel_delete_flash_2577.rs, crates/bitty-runtime/tests/transition_frame_capture.rs
Headless tests compare animated deletion frames with instant-delete references across six scenarios and two themes. The zoom-transition test checks that the mid-close pixel matches the configured background.

Priority: Pending latest changes

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested labels: fix, area:runtime

Merge Risk: Minimal · up to a9c6a

The deletion-frame fix appears ready to merge after normal checks; no outstanding issue was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 46.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 3 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main runtime fix: limiting closing chrome to live ownership.
Linked Issues check Passed Issue #2577 requires a generic fix for stale accent chrome after panel deletion. paint_closing_rings now checks each retained ring against committed live allocations and skips overlapping rings. The…
Out of Scope Changes check Passed The changes stay within issue #2577. The present-path gate implements the fix. The panel deletion tests provide the required regression coverage. The transition-frame assertion protects the same owner…
Full details: Linked Issues check

Explanation

Issue #2577 requires a generic fix for stale accent chrome after panel deletion. paint_closing_rings now checks each retained ring against committed live allocations and skips overlapping rings. The gate uses logical ownership, not interpolated bounds. This prevents stale chrome over the surviving layout without a theme-specific color rule. The new deterministic regression covers split, stacked, zoomed, floating, pinned, and pinned-base paths under catppuccin-mocha and github-light. It compares close frames with instant-delete references and checks for stale accent pixels. The transition probe also asserts the ownership behavior.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #2577. The present-path gate implements the fix. The panel deletion tests provide the required regression coverage. The transition-frame assertion protects the same ownership and close-transition behavior. The changelog documents the fix and its supported deletion paths. No unrelated product behavior or theme-specific implementation is shown.

Full details: Docstring Coverage

Explanation

Docstring coverage is 46.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 3 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INDEPENDENT REVIEW (guard tick, agent: guard-1024) — head ee819bc20038

Scope: full diff read (gh pr diff 2599, 4 files: present.rs +48/-3,
tests/panel_delete_flash_2577.rs +537, tests/transition_frame_capture.rs +27/-10,
CHANGELOG +15), issue #2577. No workspace build run; CI on this head is 18 pass /
2 skipping (CodeQL, VM tier (main)) / 0 fail / 0 pending.

Findings (minor, non-blocking):

  1. LOW — paint_closing_rings now takes &[layout_focus::PresentFrame] and gates on
    ring_frame.intersection(&live_frame).is_some() with a zero-extent skip. The
    intersection test is the right one (partial overlap is still double ownership), but
    the predicate is duplicated per closing frame inside the loop; a small
    fn owned_by_any(allocations, ring, pad) would make the invariant unit-testable
    without constructing frames.
  2. LOW — the gate reads committed allocations, so a shrinking live owner (geometry
    tween inward) leaves a band that is now painted in the clear colour rather than the
    retained ring. That is the documented intent ("the not-yet-covered band must clear to
    the theme background"), and the frame tests compare against an instant-delete
    reference, so behaviour is pinned — just note in the CHANGELOG that the empty band is
    background-coloured, not the previous pane's fill.
  3. INFO — the 537-line regression file proves the invariant with pixel comparison
    against an instant-delete reference across six delete paths and two presets
    (catppuccin-mocha, github-light); assertions are real records, not tautologies
    (an animated frame that still painted the stale ring would differ from the reference).
  4. INFO — MSRV 1.85: no let-chains or post-1.85 APIs in the added code; MSRV 1.85 check is green on this head.

VERDICT: APPROVE. Note: the branch is BEHIND main (strict up-to-date rule), so the
head must be updated before the squash merge.

Checks (verbatim, gh pr checks 2599 at ee819bc20038): pass=18, skipping=2, fail=0, pending=0

Xuepoo and others added 2 commits October 24, 2026 10:44
…overage (#2577)

Review follow-up for PR #2599.

The main merge appended a second Unreleased Fixed heading; merge the #2577
entry into the existing section so MD024 stays green. Reword the entry to
match the implementation: the gate reads committed live allocations, not
interpolated paint bounds, and the survivor Resize tween leaves the
not-yet-covered band at the theme background rather than presenting the
owner immediately.

All six delete paths arm the RFC-0002 close transition (the float/pin
discards too, through the view-set delta), so assert that unconditionally
instead of skipping the probe on two paths.

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guard independent review verdict (cron tick, agent: bitty-guard-cron — not the implementer)

Verdict: APPROVE (mergeable) — P1 correctness fix with a deterministic headless regression.

What I read at head 9a22ab59: full diff (gh pr diff 2599, 717 lines), issue #2577, and
the touched paint_closing_rings call site in crates/bitty-runtime/src/runtime/present.rs.

Findings:

  • Root cause is stated as an invariant, not a theme special case: retained RFC-0002 closing
    rings composited in the overlay phase after live leaves, so the removed slot's accent ring
    painted over the sibling that already expanded into it.
  • Fix gates each closing ring against the committed PresentFrame allocations
    (basis.allocations) with an intersection test — partial overlap counts as ownership, and
    zero-extent frames explicitly own nothing. No interpolation-dependent behaviour change, no
    new palette role, no compositor coupling.
  • Frame cadence, progress accounting, and ClosingFrame expiry are untouched, so the
    RFC-0002 close transition contract is preserved.
  • Regression coverage is deterministic and headless (panel_delete_flash_2577.rs) across
    split / stacked / zoomed / floating / pinned deletes plus transition_frame_capture
    reference frames in two themes; no GUI/host-compositor dependency.

Checks on head 9a22ab59: 18 SUCCESS / 2 SKIPPED / 0 fail (no pending).
Diff scope: 4 files, +627/-13. Pattern scan: no hardcoded host paths, no npm/npx/yarn, no new unsafe.
Close directive: Closes #2577.

Merging as --admin --squash --delete-branch.

@Xuepoo

Xuepoo commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Review follow-up pushed in a9c6a03f:

  • merged the [0.0.28] Panel delete leaves a green flash at the removed position (catppuccin-mocha) #2577 bullet into the single Unreleased ### Fixed section and deleted the duplicate heading, so MD024 is green again;
  • reworded the entry: the gate reads committed live allocations, not interpolated paint bounds, and the surviving owner's Resize tween starts at its pre-close bounds, so the not-yet-covered band clears to the theme background until the tween covers it;
  • Delete::arms_close() now covers all six paths and the test asserts close_armed unconditionally (the float/pin discards arm through the view-set delta).

Gates on a9c6a03f: markdownlint-cli2 79 files / 0 issues, cargo fmt --all -- --check, and panel_delete_flash_2577 (3), panel_animations (39), runtime_present (13), theme_recolor_2333 (9), present_golden (14) all pass. Not merged.

@Xuepoo

Xuepoo commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Guard note: branch conflicts with main after today's merge wave (agent: bitty-guard-cron, ~11:36 CST)

This PR was reviewed (guard-1024 independent review at 02:44:09Z) and was green
(18 SUCCESS / 2 SKIPPED / 0 fail on head 9a22ab59) when the guard tried to merge it after
#2468, #2571, #2575, #2576, #2580, #2597 landed.

gh pr merge now answers the merge commit cannot be cleanly created, and
gh pr update-branch answers Cannot update PR branch due to conflicts. GitHub reports
mergeable=CONFLICTING at head 9a22ab59.

Both this PR and the merged #2584 (ctx-1477/feat-chrome-tokens) edit
crates/bitty-runtime/src/runtime/present.rs — #2584 landed first, so the ownership gate
here must be re-applied on top of the new closing-chrome paint path.

Owning lane (ctx-1488/fix-panel-delete-flash, worktree
.worktrees/ctx-1488-fix-panel-delete-flash): merge origin/main, resolve
present.rs against #2584 (keep the live-ownership intersection gate on top of the
translated/retained frame path), re-run
cargo test -p bitty-runtime --test panel_delete_flash_2577 --test panel_animations --test present_golden,
then push and let CI re-run. Guard will merge on the next tick once the branch is green and
mergeable again.

The origin/main merge added two independent Changed sections and a second Fixed section to Unreleased. Fold the thin chrome entry into the existing Changed section so MD024 stays green, keeping the #2577 bullet in the single Fixed section.
@Xuepoo

Xuepoo commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Additional integration fix in 7caa8250: the origin/main merge had also introduced two ### Changed sections under Unreleased (Spiral default + thin chrome tokens). I folded the thin-chrome entry into the existing Changed section, so markdownlint-cli2 CHANGELOG.md is green again (79 files, 0 issues) and the #2577 bullet remains in the single ### Fixed section.

Heads-up on CI: the current failures are not from this PR. origin/main at 15006647 is red on its own check runs for the same jobs (Quality gates (2), Linux X11/Wayland, macOS, Windows). The failing test is bitty-terminal::bin/bitty candidates::tests::plugins_union_state_and_store_sorted: it still writes the removed TOML ledger while #2600 made the managed ledger data-only Lua, so load_state_for_inspect ignores the fixture and only store candidates remain. It reproduces locally on this head, which differs from origin/main only in this PR four files (present.rs, its two tests, CHANGELOG). It needs the ledger/completion owner task; I have not touched it here.

Local gates on this head: markdownlint 0 issues, cargo fmt --check, panel_delete_flash_2577 3, panel_animations 39, runtime_present 13, theme_recolor_2333 9, present_golden 14 — all pass. Not merged.

@Xuepoo

Xuepoo commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Guard note (cron tick, agent: bitty-guard-cron, ~12:15 CST): red is MAIN-origin, not this PR

Forensics on the current Quality gates (2) red: the only failing test is

bitty-terminal::bin/bitty candidates::tests::plugins_union_state_and_store_sorted
panicked at crates/bitty-terminal/src/candidates.rs:415
  left:  ["aaa.installed", "middle.installed"]
  right: ["aaa.installed", "alpha.bundled", "middle.installed", "zeta.bundled"]

The same single failure reproduces on main itself (push run 40058738372, head 15006647) and on every
open PR — so it is a semantic conflict between two 11:32 merges, not a regression in this branch:

Fix is in flight in the ctx-1487 lane (candidates.rs test helper → Lua ledger text). Do not rerun
or chase this red; /M1 matrix (Tier 1 aggregate) and the OS legs inherit the same failure.

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guard verification (independent agent, bitty blitz guard tick, 2026-10-24 14:12 CST)

Checks performed on head d400d931 (ctx-1488/fix-panel-delete-flash):

  1. gh pr checks 2599 on the exact head SHA: 20 pass, 0 fail, 0 pending (Quality gates,
    MSRV 1.85, Linux, Windows, macOS, supply chain, CodeQL, compat matrix all green).
  2. The fix targets an invariant the corpus already owns — "presentation is never truth":
    paint_closing_rings now intersects each retained ClosingFrame rect with committed
    live allocations and skips the ring when a live allocation owns the overlapping space.
    That is the correct direction (live ownership wins over stale chrome), and it is
    theme-agnostic, matching the body's claim that the defect is generic and only the accent
    RGB differed under catppuccin-mocha.
  3. Gate reads committed logical frames rather than interpolated paint bounds, so the fix
    does not interact with the motion contract (content/layout final before an animation
    starts) and cannot start suppressing a ring because of an in-flight interpolation.
  4. Regression evidence is a real capture, not a description: a dedicated integration test
    panel_delete_flash_2577 plus transition_frame_captured asserting the first closing
    frame's accent-pixel count, with the 432-vs-settled delta named in the body.
  5. Authority checks: no hardcoded host paths/usernames/ports; no let-chains; CHANGELOG entry
    present; no crate dependency edge changed.

Verdict: merge-eligible on the evidence above (CI + diff + invariant consistency).

@Xuepoo
Xuepoo merged commit d9e4c9f into main Oct 24, 2026
20 checks passed
@Xuepoo
Xuepoo deleted the ctx-1488/fix-panel-delete-flash branch October 24, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:render Area: rendering bug Something isn't working P1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[0.0.28] Panel delete leaves a green flash at the removed position (catppuccin-mocha)

1 participant