Repository navigation
[CTX-1870] feat(runtime,ui): home the AC-1 presentation-mode clause at the generation rebind edge (bitty#2476) - #3219
Conversation
…n mode at the reload rebind edge
bitty#2476 AC-1 asks that a reload-driven rebind leave the panel's
presentation mode intact. The mode is a workspace fact on the leaf View,
so the panel host neither writes nor reads it: the clause had no
production observer, and a row over a test-built tree stayed green with
the edge deleted (the tautology a reviewer measured).
The bind edge now names the leaf the rebind retained and the app's
existing generation-edge drain records what that leaf presents:
- AppPanelGenerationPort::bind_successor queues
PluginPanelLayoutOp::ObservePresentation{panel_id, view_id} per
committed rebind, naming the leaf the placement mirror still holds.
- TerminalApp::apply_plugin_panel_requests drains it:
Runtime::view_presentation (new, across layout/floats/pins/
scratchpads) -> PanelRuntime::note_presentation_observation.
- PanelRuntime::presentation_observation_of is the single read. Nothing
derives placement, paint, a lease, or a grant from the row, rows are
replaced at the next observation, and dispose drops them, so the leaf
stays the only truth.
A reload's release no longer queues PluginPanelLayoutOp::Close: that
release is not terminal for the container, the same edge rebinds it, and
the placeholder it presents is written into that container, so closing
the leaf destroyed the presentation the edge exists to retain. Every
other PlaceholderReason still closes the leaf.
Test: a new row on the production chain (composition root -> port ->
app drain) asserts the retained Floating mode; the dispose-and-reload
row is split so dispose still removes the leaf.
|
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 3 minutes. View limit details
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. |
Xuepoo
left a comment
There was a problem hiding this comment.
Independent review — 94b70bab2132bf4d98ed567b7addc92056aac0c0
Reviewed read-only against main (5 files, +467/−54). Every claim below was checked in the code, not taken from the description; the mutation work ran on a copy outside the lane worktree with its own CARGO_TARGET_DIR.
Claim by claim
| # | Claim | Result |
|---|---|---|
| 1 | ObservePresentation{panel_id, view_id} queued per committed rebind, from the placement mirror the rebind leaves untouched |
PASS — variant plugin_runtime.rs:589; queued in bind_successor :1112–:1128 off placement_view_of :1119. PanelRuntime::rebind_panel writes binding + lease + ceiling only (registry/host.rs:494), so the mirror is genuinely untouched by the bind. The mutable borrow is split into rebound first, so no RefCell double-borrow at the read-back. |
| 2 | Drain → record_plugin_panel_presentation → Runtime::view_presentation → note_presentation_observation → single accessor → dropped in release_panel_mirrors |
PASS — terminal_app.rs:4397, :4418; layout_focus.rs:2550 (find_view :2533 covers layout, detached floats, pins, scratchpads); registry/host.rs:1121, :1146, row type :238; cleared at host.rs:639, reached from dispose_panel :423 and dispose_workspace_panels :448. note_presentation_observation refuses a non-live panel (:1128), so a row cannot outlive its record. |
| 3 | No paint/placement/grant consumer | PASS — grep for presentation_observation_of|note_presentation_observation|PanelPresentationObservation outside host.rs matches only doc prose, the drain write, and the two test files. Nothing in the present loop, Placement, the lease table, or the grant path reads it. "Evidence, not truth" is accurate. |
| 4 | Other PlaceholderReasons still close |
PASS, with a caveat — :1064 is the only producer of PluginPanelLayoutOp::Close; only Reloaded skips it. Production reasons that reach release_generation are Reloaded (plugin_runtime/mod.rs:4188), Unloaded (:3885), Disabled (:4114), Crashed (:5345); Suspended/Denied/Incompatible have no producer at this edge, so no leaf is left behind for a container that closes. See F2 for the states this creates. |
| 5 | Split did not silently drop a dispose assertion | PASS — git diff hunk: the old row asserted leaf_count()==2 → reload → leaf_count()==1 + panel_count()==0; the dispose row asserts the same four things with dispose in the middle. Nothing was dropped. See F3 on the wording. |
| 6 | Rows and counts | PASS — re-run here: presentation_mode_it_retained → 1 passed / 1647 filtered; whole bin suite 1648 passed; bitty-runtime --lib 1680; panel_generation_ownership 19, panel_grant_ceiling 19, panel_rebind 12, panel_unbind_release 8. All match the PR. |
| 7 | Discrimination (not tautological) | PASS — reproduced, plus two mutations of my own; see below. |
| 8 | Doc honesty at panel_generation_ownership.rs:2323 and in "What this does not prove" |
PASS for the note — :2345 says plainly that the row proves "the report, not the invariant", which is the honest reading. One body/comment defect, F1. |
| 9 | API surface, MSRV | PASS — cargo +1.85 check -p bitty-runtime -p bitty-terminal --tests exits 0 here; no let-chains, no if let guards, let-else only. No #[allow(dead_code)] anywhere in the diff, no test-only widening, no parameter that never varies. Note F4. |
| 10 | Scope vs the brief | NECESSARY, not smuggled — the observation shares the tick with the Close and drains after it, so with the old close the row is None by construction, and "mode intact" is false if the leaf does not exist. Retention is the precondition for the clause to be observable in production and it is what D.3/A.2 already say. It is under-accounted for, not unjustified (F1, F2). |
Discrimination proof (copy at $SCRATCH/ctx1870-review-mut/tree, own CARGO_TARGET_DIR)
| Mutation | Result |
|---|---|
A bind edge stops queueing (let _ = (self.layout_ops.as_ref(), panel_id);, plugin_runtime.rs:1120) |
FAILS — panicked at plugin_runtime.rs:5146: assertion left == right failed: the reload edge reports the mode the retained leaf still presents / left: None / right: Some(PanelPresentationObservation { view: ViewId(2), mode: Floating }) |
B drain stops recording (terminal_app.rs:4401 → let _ = (panel_id, view_id);) |
FAILS — same assertion at :5153, left: None, same right |
C old close restored (!matches!(Reloaded) → !matches!(Suspended)) |
FAILS — panicked at :5130: assertion left == right failed: a reload retains the container for its successor (D.3) / left: 0 / right: 1, preceded by bitty: panel 1 presentation not observed (leaf ViewId(2) is gone) |
D (mine) drain records a constant PresentationMode::Tiled instead of the read mode |
FAILS — left: Some(PanelPresentationObservation { view: ViewId(2), mode: Tiled }) / right: Some(… mode: Floating }). Proves the mode value is read from the leaf, not merely that a row exists; the PR did not show this. |
E (mine) Unloaded also skips Close |
FAILS — the dispose row dies at :5032 (drive_tick returned None), so the split's dispose half is not vacuous. |
Each mutation restored afterwards; the tree returns to 1 passed / 1648 passed. The row is sensitive to the edge, the drain, the retention, and the mode value.
F1 — the rationale for the only behaviour change misstates the old ordering and what is retained (fix before merge)
Two statements are false, and both are load-bearing for a future reader deciding whether !matches!(…Reloaded) is safe:
- Ordering. PR body: "left the bind edge rebinding a container whose leaf was already gone." The
Closeis queued, so it drains in the app's next tick, i.e. afterbind_successorhas already committed. Mutation C shows the ordering directly: nonot reboundwarning from the bind, the leaf is still there at bind time, and the drain then reportsleaf ViewId(2) is gonewhilepanel_count()drops to 0. So the old defect was not a failed rebind — it was a successful rebind whose container and record were destroyed one tick later (viaclose_plugin_panel_leaf→dispose_panel). That is the more serious bug and the one worth writing down, because it is what a future reader must not re-introduce. - What survives. The retained presentation is not the placeholder.
PanelRegistry::rebind_panelclearsrecord.placeholder = Noneat phase 2 step 2 (registry/panel.rs:4342), anddetach_panel_scene(plugin_runtime.rs:1056) removed the render scene before the bind. After a successful reload the container is bound, placeholder-free and scene-less. The comment at:1057–:1063("the placeholder this release just presented is written into that container … the very presentation the edge exists to retain") and the body's shape-(a) argument both read as if the placeholder outlives the bind.
Fix: rewrite plugin_runtime.rs:1057–:1063 and the body's "The one behaviour change this required" paragraph to say (i) the close was deferred and killed the just-rebound container rather than the rebind, and (ii) what is retained is the container and its leaf, not the placeholder.
F2 — the behaviour change's consequences are neither measured nor listed (fix before merge)
The PR's whole claim set is about what is and is not proven, so the consequences of its one semantic change belong in it:
- After a successful reload the retained leaf presents nothing until the successor mounts a scene, and
bitty.panel.createmounts a new container — so a reload can leave a content-less pane beside whatever the successor creates. No row covers it and "What this does not prove" does not name it. - A reload that fails after
dispose_inner(resolution/activationErrinreload_inner) or whose successor bind is refused leaves the containers in theReloadedplaceholder with noCloseever queued. The old code removed them. Worse,held()enumeratespanels_ended_at(owner, predecessor), so a later reload of the same plugin names a different predecessor generation and cannot rebind those orphans — they stay "Its plugin is reloading." until the plugin is disposed or the user closes the pane.
Either add a row for one of these two, or add both to "What this does not prove" and to the note at panel_generation_ownership.rs:2323. No code change is demanded — the claim set is.
F3 — non-blocking, wording
The dispose row is described as "unchanged behaviour", but the old row only ever called reload; it never exercised dispose. What is unchanged is the assertion quartet, now run against a path this row did not previously touch. Say that, rather than implying dispose was already covered here.
F4 — non-blocking, note
presentation_observation_of has no production caller (only the two test files). That is consistent with the declared "evidence" design and it is not hidden behind #[allow(dead_code)], so I am not treating it as a defect — but the module table at panel_generation_ownership.rs:63 says the clause is "homed" without qualification, which reads stronger than "reported". The doc comment at :2345 defuses it; the table would too if it said "homed as a report".
On #4's other-reason question
No other reason can now leak a leaf into a closed container: Close is still queued for every non-Reloaded release and it removes the leaf and disposes the record, so those paths end with neither. The pre-existing asymmetry is the opposite one — Disabled/Unloaded say the container "keeps its container and state" and that re-enabling "permits a rebind" (bitty-ui/src/panel_recovery.rs:235, :240), yet they close the leaf and dispose the record, so no rebind is possible afterwards. That predates this PR and is out of scope; I mention it only because the new !matches! makes the asymmetry explicit.
Bottom line
The seam is real, single-sourced, consumer-free, discriminating, MSRV-clean, and it homes the clause the way the brief asked. I found no code defect in it. What blocks is the accounting around its one behaviour change: the stated rationale is wrong about both ordering and what survives (F1), and the change's two new end states are neither covered nor disclaimed (F2). Both are text-level fixes plus one coverage/caveat addition.
VERDICT: CHANGES-REQUESTED
Guard tick (2026-11-17 19:10 CST): independent review landed, round 2 required — not mergingThe independent review on
Round 2 must therefore do one of these, and say which in the PR body:
Option 2 changes reload semantics and needs the owner/commander's call, so it is not a call this lane should take on its own. Recording it as an open question against bitty#2476 rather than shipping it inside an AC-1 seam. Also asked in round 2 (non-blocking): F3 (the dispose row now exercises a path the old row never did — "unchanged behaviour" is a loose phrase) and F4 ( CI context: |
…ale and disclaim its end states (bitty#2476) Round-3 accounting fix for the independent review's F1 and F2, plus the two non-blocking wording findings (F3, F4). Comment and rustdoc only; no behaviour change. F1 — the rationale for the one behaviour change was wrong about both ordering and what survives. `PluginPanelLayoutOp::Close` is *queued*, so it drains in the app's next tick, after `bind_successor` has already committed (`plugin_runtime.rs:1057`-`:1073`). The old defect was therefore not a bind rebinding a leaf-less container: the bind succeeded, and one tick later `close_plugin_panel_leaf` removed the leaf and disposed the just-rebound record. What a reload retains is the container and its leaf, not the placeholder — `PanelRegistry::rebind_panel` clears `record.placeholder` in D.2 phase 2 step 2 (`registry/panel.rs:4342`) and `detach_panel_scene` has already taken the render scene, so a rebound container is bound, placeholder-free and scene-less. F2 — the two end states the retention change introduces are now named as unmeasured in `pgo_1_container_facts_survive_the_rebind_edge`'s rustdoc (`panel_generation_ownership.rs:2349`-`:2371`) and in the module header's PGO-1 bullet: (a) a successful reload leaves the retained leaf presenting nothing until a successor mounts a scene, while `bitty.panel.create` mounts a new container; (b) a reload failing after `dispose_inner` or with a refused successor bind leaves containers in the `Reloaded` placeholder with no `Close` ever queued, and `held()`'s `panels_ended_at(owner, predecessor)` key means a later reload cannot rebind those orphans. Written down rather than given a row; the review asked for either. F3 — the split dispose row no longer claims "unchanged behaviour": what is unchanged is the assertion quartet, now run against a path (`dispose`) the row did not previously touch. F4 — the module table says the clause is homed **as a report**, since `presentation_observation_of` has no production caller.
Xuepoo
left a comment
There was a problem hiding this comment.
Independent review round 3 (guard-dispatched, agent: auditor)
Scope — 94b70bab..f4b573cc is comment/rustdoc-only (proved, not assumed)
Command ($SCRATCH/recheck-3219/scope-proof.sh, run in the repo root):
STRIP='^[[:space:]]*(//|\*|/\*|\*/|$)'
for f in crates/bitty-runtime/tests/panel_generation_ownership.rs \
crates/bitty-terminal/src/plugin_runtime.rs; do
diff -q <(git show 94b70bab:"$f" | grep -vE "$STRIP") \
<(git show f4b573cc:"$f" | grep -vE "$STRIP")
done
git diff 94b70bab..f4b573cc | grep -E '^[+-]' | grep -vE '^(\+\+\+|---)' \
| grep -vE '^[+-][[:space:]]*//' | grep -vE '^[+-][[:space:]]*$' | wc -l
Output:
crates/bitty-runtime/tests/panel_generation_ownership.rs: identical after comment strip
crates/bitty-terminal/src/plugin_runtime.rs: identical after comment strip
--- non-comment, non-blank added/removed lines in the range ---
0
--- files touched ---
M crates/bitty-runtime/tests/panel_generation_ownership.rs
M crates/bitty-terminal/src/plugin_runtime.rs
Two files, zero executable lines changed: no statement, expression, argument, attribute or assertion moved. PASS. (PR-body edit is a GitHub-side change and cannot smuggle code.)
F1 — the corrected rationale matches the code (verified from the source, not from the body)
(a) the Close is queued, and drains after bind_successor commits.
AppPanelGenerationPort::release_generation(crates/bitty-terminal/src/plugin_runtime.rs:1019) only pushes into the shared queue:push_panel_layout_op(queue, PluginPanelLayoutOp::Close { … })at:1075–:1085. Nothing is applied at release time.- There is exactly one drain:
TerminalApp::apply_plugin_panel_requests(crates/bitty-terminal/src/terminal_app.rs:4375), called from one place,drive_tick:2528; itsClosearm is:4394→close_plugin_panel_leaf(crates/bitty-terminal/src/chrome_keys.rs:1551), which removes the layout leaf (:1567–:1581) and then disposes the record viadispose_panel(:1583–:1588). - Ordering inside the reload:
reload_inner(crates/bitty-runtime/src/plugin_runtime/mod.rs:4162) →dispose_inner(…, Reloaded):4188→release_panel_generation:3941→ port:1900; thenactivate_inner:4206andbind_panel_generation:4224→ port.bind_successor:1929→PanelRegistry::rebind_panel(plugin_runtime.rs:1112). No drain call exists anywhere between release and bind, so the leaf cannot be closed before the bind commits on any path. - Production reaches this: the only non-test generation-reload driver is
recover_wall_failed_plugins*(terminal_app.rs:2878,:3160,:3164), which runs after:2528in the samedrive_tick; the queue emptied at:2528therefore cannot contain theClosethat reload queued, so it drains on the followingdrive_tick.
So the old code rebound successfully, then a queued Close removed the leaf and disposed the just-rebound record — the comment's "a successful reload whose container and record were destroyed right afterwards" is accurate, and the previous "rebind a container whose leaf was already gone" reading is gone.
(b) what survives is the container + leaf, not the placeholder.
record.placeholder = Noneatcrates/bitty-runtime/src/registry/panel.rs:4342, insidePanelRegistry::rebind_panel(:4190), phase 2 step 2 — whose own comment (:4335–:4336) says "The placeholder a predecessor's end presented is cleared with it: a controller owns the content again." The new comment's "D.2 phase 2 step 2" citation is exactly right.detach_panel_scene(panel)atplugin_runtime.rs:1056runs before the branch, andrebind_panelattaches no scene (it writes capabilities:4333, binding:4338, then the facade's lease/ceiling).
Post-bind state = bound container, placeholder None, no scene. "bound, placeholder-free and scene-less" is literally the code. PASS.
F2 — both new end states named, in both required places, and both genuinely new
- Test-file note:
crates/bitty-runtime/tests/panel_generation_ownership.rs:2360–:2381— a# What the retention change does *not* measuresection with (i):2367–:2373the content-less retained leaf after a successful reload, (ii):2374–:2381the failed-after-dispose_inner/ refused-bind orphans with noCloseever queued. Module header repeats it at:116, and the table row at:63points at it. - PR body, "What this does not prove": both bullets at lines 194–198 and 199–205, plus the closing paragraph at 209–212 naming the two venues. The review allowed either a row or this disclaimer; the disclaimer is present in both required places.
Genuineness — neither is a pre-existing condition relabelled:
- A persistent content-less pane is new. Before the change
Closewas queued for every release, so the leaf disappeared one drain later; the only content-less window that existed before was the single tick between release and that drain. Also the successor cannot re-materialize the retained container:bitty.panel.create→PanelRuntime::create_panel(registry/host.rs:305) mints a newPanelId, andmaterialize_plugin_panel_leaf(chrome_keys.rs:1439) early-returns unless the state isPanelState::Created, which a rebound container is not. - The orphaned
Reloadedcontainers are new.reload_innercan return early afterdispose_innerat the?on:4191(load_index),:4196(resolve_record),:4200and:4203(verify_module_tree) and:4206(activate_inner), and a refused bind lands in:1141; under the new predicate none of those queue aClose, where the old code always did. The stated inability of a later reload to repair them checks out:held()(plugin_runtime.rs:1010–:1015) enumeratespanels_bound_toandpanels_ended_at(owner, generation), and the next reload passes the generation that just ended, so records ended atG1are not revisited by a reload whose predecessor isG2. PASS.
F3 — dispose row wording
plugin_runtime.rs:5002–:5009 now says what is unchanged is the assertion quartet (leaf_count 2→1, panel_count 0) and the four facts, not the path — the old row only ever called reload. The body says the same at lines 108–112. That matches the hunk: the same four assertions, with dispose substituted for reload in the middle. PASS.
F4 — module-table wording
:63 now reads "homed as a report … no production caller reads the report, and the two end states the retention change creates are listed as not measured in the note below"; :116 and :2344, :2356–:2358 say it again. The missing consumer is named, not implied. Independently: presentation_observation_of is called only from registry/host.rs:2037–:2080 (inside the #[cfg(test)] block opening at :1527) and plugin_runtime.rs:5107/:5168 (inside mod tests, :1662) — no production reader. PASS.
No new overclaim
Every changed sentence was checked against the tree; all of them hold, including the ones I could have been lenient about: "the old code removed them at the next tick", "held() enumerates panels_ended_at(owner, predecessor)", "bitty.panel.create mounts a new container", "close_plugin_panel_leaf removed its leaf and disposed the record". The evidence-only claim ("nothing derives placement, paint, a lease, or a grant from the observation") also still holds — presentation_observations (host.rs:126) is written at :1134, read only by the accessor at :1146, cleared at :639. Nothing in this round reaches the round-2 bar.
Non-blocking nit (pre-existing, not introduced here)
The body's step table line 25 ("plugin_runtime.rs:1153 … Ok(committed) arm, placement_view_of") and the call-chain block lines 81/83 ("bind_successor … :1095", "push ObservePresentation … :1157") are stale: at f4b573cc bind_successor is :1103, placement_view_of inside it is :1132, and the push is :1134–:1138. They were already wrong at 94b70bab (:1092 / :1119 / :1123), so this is not a regression smuggled in by the fix commit — but the +11-line comment shift moved them further out. One-line correction, not a blocker.
Gates at f4b573cc (lane worktree, read-only, own target dirs)
CARGO_TARGET_DIR=…/.targets/ctx-1870-recheck cargo test -p bitty-runtime --test panel_generation_ownership --offline
test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
CARGO_TARGET_DIR=…/.targets/ctx-1870-recheck cargo test -p bitty-terminal --bin bitty --offline presentation_mode_it_retained
test plugin_runtime::tests::a_reload_keeps_the_leaf_and_reports_the_presentation_mode_it_retained ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1647 filtered out
cargo +1.85 check -p bitty-runtime --tests --offline
Finished `dev` profile [unoptimized + debuginfo] target(s) exit 0
MSRV/lints: the added lines contain no code at all (git diff … | grep -E '^\+' | grep -v '^+ *//' is empty), so no let-chain or if let guard was introduced and clippy cannot have moved; CI's clippy and MSRV 1.85 legs are green at this head.
CI note as briefed: Supply chain (deny/audit) is the chrono RUSTSEC-2026-0543 red being fixed by #3221 — not a defect of this PR. Linux X11 (xvfb) now passes at f4b573cc; the previous WallClockExceeded flake in cli_config_fail_soft.rs did not recur.
Bottom line
F1–F4 are all closed on the evidence the review asked for, the graph of the retention claim is now correct in both venues, and the commit is provably confined to comments and rustdoc. I did not re-run the mutation set: with no executable line changed, discrimination is inherited unchanged from round 2. Ship it; fix the three stale line refs when convenient.
VERDICT: APPROVE
…s a dated exception (bitty#3220) (#3221) * [CTX-1872] chore(security): record the chrono unmaintained advisory as a dated exception (bitty#3220) RUSTSEC-2026-0543 marks chrono unmaintained with `patched = []`, so no lockfile move can clear it; the supply-chain leg went red on every branch, including PRs that touch no dependency (#3218, #3219). The crate is used for the restricted Lua `os.date` local-calendar conversion (bitty-lua/src/stdlib.rs) plus one bitty-runtime test, the advisory is informational (no source-visible vulnerability), and both recommended replacements are blocked today: `time >= 0.3.47` needs rustc 1.88 (MSRV is 1.85) and the jiff migration is its own dependency-adoption decision. Record the exception where the repo already records this class (deny.toml, ADR-0004 exception policy) with a 2027-03-31 re-audit bound, and pass the same ignore to the cargo-audit step so the two lists cannot drift apart. Verified: cargo deny check -> advisories ok, bans ok, licenses ok, sources ok. * [CTX-1872] fix(ci): correct the audit-step rationale flagged in the review (bitty#3220) The comment claimed a deny.toml-only ignore "turns this leg red". It does not: cargo-audit 0.22.2 reports the unmaintained class as a warning and exits 0, so `cargo deny check` is the enforcing half. Keep the ignore for list parity and state why, instead of asserting an enforcement that does not exist.
Xuepoo
left a comment
There was a problem hiding this comment.
Guard tick (2026-11-17 21:2x CST): head moved via update-branch, reviewed content byte-identical
gh pr update-branch was run after #3221 (the RUSTSEC-2026-0543 / chrono exception)
merged to main as 361fa068; the supply-chain leg was the only red left on this head
and it was red repo-wide because of that advisory.
Head moved f4b573cc → 618006e1. What the update added is exactly main's #3221
commit, nothing else:
$ git diff f4b573cc 618006e1 --stat
.github/workflows/ci.yml | 11 ++++++++++-
deny.toml | 14 +++++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
Round-3 review verdict on f4b573cc — VERDICT: APPROVE (carryctx PX-8729) — still
covers the reviewed content: the round-2 findings F1-F4 were addressed and the fix
commit was proven comment/rustdoc-only (zero non-comment changed lines after stripping
comments from both files).
Residual noted by the reviewer, non-blocking and pre-existing: three line references in
the PR body (:1095/:1153/:1157) are stale (actual :1103/:1132/:1134-1138) and
were already stale at 94b70bab.
What this homes
bitty#2476 AC-1's
PresentationModeclause: a reload-driven rebind leaves the panel's presentationmode intact — as an observably production fact, not an assertion over a tree a test built.
The mode is a workspace fact on the leaf
View(crates/bitty-ui/src/view.rs:227, stamped throughthe single gate
crates/bitty-ui/src/presentation.rs:157).PanelRuntimeholds aPlacementmirror,leases, and scenes, never a
LayoutNode, so the host can neither write nor read the mode, andPanelRuntime::rebind_panelpresents nothing. Until now the only would-be row built its own layout,so it stayed green with the reload edge deleted.
Shape chosen: (a) observe-and-record, not (b) re-present. (b) would add a re-assert step at a seam
that presents nothing, on a per-reload path no consumer reads. (a) records a read of the retained
leaf and exposes one accessor.
The seam (shape (a), with the report split where the layout is)
AppPanelGenerationPortcannot reach a layout (the app ownsRuntime, and the port lives insidePluginRuntime, whichTerminalAppmutably borrows on the reload call — a self-referential handle),so the bind edge names the retained leaf and the app's existing generation-edge drain reads and
records it. No new public parameter that never varies, no stored duplicate of the truth.
crates/bitty-terminal/src/plugin_runtime.rs:1153(bind_successor,Ok(committed)arm,placement_view_of)crates/bitty-terminal/src/plugin_runtime.rs:589(PluginPanelLayoutOp::ObservePresentation { panel_id, view_id })crates/bitty-terminal/src/terminal_app.rs:4397(TerminalApp::apply_plugin_panel_requests→record_plugin_panel_presentation)crates/bitty-runtime/src/runtime/layout_focus.rs:2550(Runtime::view_presentation, layout / floats / pins / scratchpads)crates/bitty-runtime/src/registry/host.rs:1121(PanelRuntime::note_presentation_observation)crates/bitty-runtime/src/registry/host.rs:1146(presentation_observation_of)crates/bitty-runtime/src/registry/host.rs:238(PanelPresentationObservation { view, mode })crates/bitty-runtime/src/registry/host.rs:639(release_panel_mirrors)Nothing derives placement, paint, a lease, or a grant from the observation. Rows are keyed by panel,
replaced at the next observation (bounded by live panels), and dropped by
dispose_panel, so theleaf stays the only truth and the row can never outlive its container or name a leaf a later panel
occupies.
presentation_observation_oftherefore has no production caller — only the two testfiles read it — which is the declared evidence design and is now said the same way in the code (see
"homed as a report" below).
The one behaviour change this required
A reload's release no longer queues
PluginPanelLayoutOp::Close(
crates/bitty-terminal/src/plugin_runtime.rs:1075). The release reason is the closed vocabulary'sPlaceholderReason::Reloaded; every other reason still closes the leaf.Why, precisely — the ordering matters, because the old failure was the opposite of a failed bind:
Closeis queued, not applied. It drains in the app's next tick, i.e. afterbind_successoron the same edge has already committed. So the old code rebound the containersuccessfully and then, one tick later,
close_plugin_panel_leaf(
crates/bitty-terminal/src/chrome_keys.rs:1551) removed its leaf and disposed the just-reboundrecord. That is the defect worth writing down: a successful reload whose container and record
were destroyed immediately afterwards. Nothing in the bind failed, and no
not reboundrefusalwas ever logged. (Measured: restoring the old close leaves the bind silent and drops
panel_count()to 0 on the following tick.)PanelRegistry::rebind_panelclearsrecord.placeholderin D.2 phase 2 step 2(
crates/bitty-runtime/src/registry/panel.rs:4342) anddetach_panel_scenehas already removedthe render scene before the bind, so the rebound container is bound, placeholder-free and
scene-less. The placeholder a release presents is the transient state between the release and the
successor bind — it is not something the retained container keeps presenting.
The previous row (
plugin_panel_generation_dispose_and_reload_remove_dwindle_leaf) asserted the oldbehaviour; it is split: dispose still removes the leaf, reload now keeps container + leaf and is
covered by the new row.
reload_inner's own doc already says a reload that fails before itssuccessor activates "leaves the containers presenting the reload placeholder"
(
crates/bitty-runtime/src/plugin_runtime/mod.rs:4184), which is only true if the container stays —and is one of the two end states this PR does not prove, listed below.
Call chain (grep-confirmed, not assumed)
AppPanelGenerationPortis installed by the composition root (discover_with_roots,crates/bitty-terminal/src/plugin_runtime.rs:1488), andpanel_layout_opsreaches the app inmain.rs:1300→TerminalApp::with_panel_layout_ops, so the drain is the live per-tick path(
terminal_app.rs:2528), not a test harness.Test rows and their real
test result:linesNew row, on the production chain end to end (composition root →
AppPanelGenerationPort→ app drain;the test's only authored input is the mode stamp, applied through the production gate
PresentationMode::request_transition):plugin_runtime::tests::a_reload_keeps_the_leaf_and_reports_the_presentation_mode_it_retained(
crates/bitty-terminal/src/plugin_runtime.rs:5067) — creates a panel through the real verb, ticks(leaf materialized), stamps
Floating, reloads, ticks, then asserts the container survived, theleaf is the same
ViewId, the controller generation moved, andpresentation_observation_of(panel) == Some(PanelPresentationObservation { view, mode: Floating }).registry::host::tests::presentation_observation_is_recorded_replaced_and_cleared(
crates/bitty-runtime/src/registry/host.rs) — record / replace / refuse-unknown / drop-on-dispose.plugin_runtime::tests::plugin_panel_generation_dispose_removes_the_dwindle_leaf— the split-outdispose half. What is unchanged is the assertion quartet (
leaf_count2 → 1,panel_count0),now run against a path —
dispose— that this row did not previously touch: the old row only evercalled
reload. It is not "dispose behaviour unchanged"; the assertion set simply moved onto a pathit had never exercised.
Every existing assertion in
crates/bitty-runtime/tests/panel_generation_ownership.rsis kept. Itsblocking note (
:2323) was rewritten to say what is asserted and where, and to record what is stillnot proven there; the module-doc coverage table (
:63, clause now described as "homed as areport") and the "still without a row" list were updated the same way.
Discrimination proof (scratch copy, own CARGO_TARGET_DIR, never the lane worktree)
Copy at
$SCRATCH/ctx-1870-mutation/tree(CARGO_TARGET_DIR=$SCRATCH/ctx-1870-mutation/target);each mutation applied there only, row re-run, then restored and re-run green.
bind_successor'spush_panel_layout_op(PluginPanelLayoutOp::ObservePresentation …)replaced withlet _ = (queue, view_id);→
panicked at crates/bitty-terminal/src/plugin_runtime.rs:5152:assertion left == right failed: the reload edge reports the mode the retained leaf still presentsleft: None/right: Some(PanelPresentationObservation { view: ViewId(2), mode: Floating }).ObservePresentationarm inapply_plugin_panel_requestsreduced tolet _ = (panel_id, view_id);→
panicked at crates/bitty-terminal/src/plugin_runtime.rs:5155: same assertion,left: None/right: Some(PanelPresentationObservation { view: ViewId(2), mode: Floating }).if !matches!(edge.reason, PlaceholderReason::Reloaded)forced true →
bitty: panel 1 presentation not observed (leaf ViewId(2) is gone)thenpanicked at crates/bitty-terminal/src/plugin_runtime.rs:5129:assertion left == right failed: a reload retains the container for its successor (D.3)left: 0/right: 1.Restored →
test result: ok. 1 passed; 0 failed; …. The row is sensitive to the edge, the drain, andthe retention; it is not tautological. The independent review added two more mutations of its own
(drain recording a constant
Tiledinstead of the read mode → fails on the value;Unloadedalsoskipping
Close→ kills the dispose row), both of which also discriminate.Gates (exit codes, as run)
cargo fmt --checkcargo clippy -p bitty-runtime -p bitty-terminal --all-targets --offline -- -D warningscargo test -p bitty-runtime --test panel_generation_ownership --test panel_rebind --test panel_unbind_release --test panel_grant_ceiling --offlinecargo test -p bitty-runtime --lib --offlinecargo test -p bitty-terminal --bin bitty --offlinecargo +1.85 check -p bitty-runtime -p bitty-terminal --tests --offline(MSRV: no let-chains /if letguards)RUSTFLAGS="-D warnings" cargo check -p bitty-runtime -p bitty-terminal --tests --target x86_64-pc-windows-gnu --offlineRUSTFLAGS="-D warnings" cargo check -p bitty-runtime -p bitty-terminal --tests --target aarch64-apple-darwin --offlineRUSTDOCFLAGS="-D warnings" cargo doc -p bitty-runtime --no-deps --offlineThe two cross-target legs are compile-only (no cross-runner): they prove both crates and their
test targets type-check for Windows GNU and Apple aarch64, nothing about behaviour there.
just ci-localwas not run (another lane holds it).What this does not prove
proves the production edge and the production drain produce the report; it does not prove a
placement, paint, or grant decision depends on it.
tick), so this is evidence of the leaf's mode at the edge, not a synchronous part of the bind
transaction. In the row the bind and the drain are separate steps for exactly that reason.
attachment (suspended + unmounted, PGO-2) queues nothing and therefore records nothing.
PluginRuntime::reloadstill has no non-test caller inbitty-terminal(only tests anddiscover_probe-built sessions drive it); this change homes the clause at the rebind edge, it doesnot add a user-visible reload trigger.
scene and
rebind_panelclears the placeholder record, and the successor does not re-present thatleaf —
bitty.panel.createmounts a new container — so a reload can leave a content-less panebeside whatever the successor creates. No row asserts what the retained leaf paints in that
window.
dispose_innerleaves its containers stuck. Ifreload_inner'sstore re-resolution or
activate_innerreturnsErr, or the successor bind is refused, thecontainers stay in the
Reloadedplaceholder and noCloseis ever queued (the old coderemoved them a tick later). A later reload does not repair them either:
held()enumeratespanels_ended_at(owner, predecessor)and the next reload names the generation that just ended, sothose records keep presenting "Its plugin is reloading." until the plugin is disposed or the pane is
closed. No row covers this arm.
headless
TerminalAppis the production composition root minus the window.Both end states of the retention change are therefore named and unmeasured — here and in
pgo_1_container_facts_survive_the_rebind_edge's rustdoc(
crates/bitty-runtime/tests/panel_generation_ownership.rs:2360, "What the retention change doesnot measure") and in the module header's PGO-1 bullet.
Round 3 — review follow-up (F1–F4)
Independent review at
94b70babreturned CHANGES-REQUESTED on accounting only ("I found no codedefect in it").
f4b573ccaddresses all four findings, comment/rustdoc only, no behaviour change:crates/bitty-terminal/src/plugin_runtime.rs:1057-:1074(comment) and "The one behaviour change this required" above: theClosewas deferred one tick (bind succeeded, container died afterwards), and the container + leaf survive — not the placeholdercrates/bitty-runtime/tests/panel_generation_ownership.rs:2360-:2381+ the module header's PGO-1 bullet (:116)crates/bitty-terminal/src/plugin_runtime.rs:5002-:5009and the test-row bullet above: the assertion quartet is unchanged, the path (dispose) is new for itcrates/bitty-runtime/tests/panel_generation_ownership.rs:63— "homed as a report", with the missing consumer namedGates re-run at
f4b573ccfrom the lane worktree withCARGO_TARGET_DIRpinned outside it:No assertion was weakened or deleted in this round: the diff touches doc comments, one code comment,
and one test comment. (The round-2 numbers in the table above stand for the unchanged rows.)
One reference correction: round 2's body cited the note as "
panel_generation_ownership.rs:2323"; thefile is
crates/bitty-runtime/**tests**/panel_generation_ownership.rs(the note starts at:2323;this round's new "what it does not measure" section is at
:2360-:2381), notsrc/runtime/. Thereview's own citations point at the same file.
Related #2476