Skip to content

[CTX-1776] fix(runtime,ui): release every generation family at the panel unbind edge and key panel restore by workspace+persistent id - #3094

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-1776/fix-panel-generation-residuals
Nov 9, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-1776/fix-panel-generation-residuals

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Related #2476 (not Closes: the issue's code-side acceptance is not fully satisfied — see deferred list).

Bounded residual slice for OQ-084 panel generation ownership, re-verified against current origin/main (9db82bb9) before editing.

# Item Status Verification command
1 release_generation_scope releases queued bus events, the generation's panel commands, and its overlay attribution for (panel, generation); retired-ceiling tombstone write order/fail-closed refusal unchanged done cargo test -p bitty-runtime --test panel_unbind_release --test panel_grant_ceiling
2 unbind_release_count(PanelId) + per-family GenerationReleaseRecord, created even when every family releases nothing done cargo test -p bitty-runtime --test panel_unbind_release
3 Created -> Disposed and Focused -> Disposed added to PanelLifecycle::can_transition done cargo test -p bitty-ui --lib disposes
4 PersistedPanel key is (WorkspaceId, PersistentId) at manifest v2; plan_restore refuses StableIdentity done cargo test -p bitty-ui --lib panel_persist; cargo test -p bitty-ui --test pw_series

Verification

  • cargo check -p bitty-runtime -p bitty-ui --tests --offline — clean.
  • cargo test -p bitty-runtime -p bitty-ui --offline — exit 0 (242 test binaries/suites, 0 failures).
  • cargo clippy -p bitty-runtime -p bitty-ui --all-targets --locked -- -D warnings — clean.
  • cargo fmt --all -- --check — clean. (There is no just fmt recipe in this repo; fmt-check is cargo fmt --all -- --check.)
  • just check — failed at pty-gate on five pre-existing ungated live-spawn markers (bitty-daemon/src/service/dispatch.rs, bitty-daemon/src/worker.rs, bitty-daemon/tests/service_loop.rs, bitty-runtime/src/runtime/panes.rs, bitty-runtime/tests/spawn_pane_cwd.rs), none in this diff. The same five hits and exit 1 reproduce byte-identically on a pristine origin/main export, so this is a base-tree gate failure, not a regression here. Everything before it passed: fmt-check, workspace clippy, workspace nextest (10,978 passed / 24 skipped), supply-chain, scratch-paths.
  • Discrimination: each new test was re-run with its production change temporarily reverted — item 1/2 (5 of 6 panel_unbind_release tests red), item 3 (both lifecycle tests red), item 4 (both refusal tests red) — then restored and green.

Deferred (explicitly out of scope)

PanelRecord owner + controller-generation re-key (audit items 2/3), rebind_panel (4), unbound/placeholder state + recovery counter (9), bulk dispose-by-workspace (11), PGO matrix (13), docs edits (separate lane).

Residual risk

  • create_panel_overlay is the new attribution entry point but has no production caller yet; overlays created through create_overlay remain unattributed, and the edge release is still reached only via dispose_panel (plugin-boundary wiring is audit item 7, deferred). The machinery is enforced and tested; the wiring is not in this slice.
  • Manifest v2 rejects v1 documents fail-closed. plan_restore has no production caller today, so no live migration is involved.

…nel unbind edge and key panel restore by workspace+persistent id

release_generation_scope now drains the generation's queued bus events,
unregisters the panel commands it registered, and dismisses its attributed
overlays in addition to the grant row, and writes a per-family
GenerationReleaseRecord (created even when every family releases nothing).
The retired-ceiling tombstone write order and fail-closed refusal are
unchanged. Panel overlays gain (PanelId, generation) attribution through
create_panel_overlay.

PanelLifecycle::can_transition gains Created->Disposed and
Focused->Disposed (OQ-084 C.8). PersistedPanel carries the
(WorkspaceId, PersistentId) restore key at manifest v2, and plan_restore
refuses PersistencePolicy::StableIdentity (B.4/B.5).

Related #2476
@Xuepoo Xuepoo added fix Bug fix P1 Priority: high area:runtime Area: runtime orchestration labels Nov 9, 2026
@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown

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 42 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: 2f39fc38-929d-4e3e-ba39-0ecf8682d154
Commits

Reviewing files that changed from the base of the PR and between 9db82bb and bb3765d.

Files selected for processing: 6

  • crates/bitty-runtime/src/registry/panel.rs
  • crates/bitty-runtime/tests/panel_unbind_release.rs
  • crates/bitty-ui/src/lib.rs
  • crates/bitty-ui/src/panel_persist.rs
  • crates/bitty-ui/src/panel_state.rs
  • crates/bitty-ui/tests/pw_series.rs
  • 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

@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 guard review of PR #3094 (CTX-1776) at head bb3765d — a different agent from the implementer, read-only on the lane worktree.

Scope checked: the four audit items this PR claims, plus gate integrity, MSRV, and bound/leak behaviour.

  1. release_generation_scope now releases four families (grants, queued bus events, panel commands, attributed overlays) after the tombstone write — PASS. Ordering is correct: retain_grant_ceiling runs first and a failure returns before any other family is touched (panel.rs:1808-1811), so the fail-closed contract is preserved. The already_ended early return still prevents a double release (:1794-1800).
  2. GenerationReleaseRecord + unbind_release_count — PASS. None (no edge) vs Some(0) (edge released nothing) is genuinely distinguishable, records are dropped with the container (:1471-1472) and cleared on registry disposal (:2083-2085), and the table is one-per-live-panel.
  3. Created -> Disposed and Focused -> Disposed in PanelLifecycle::can_transition — PASS, one test per edge that also drives the state machine (panel_state.rs:1014-1055).
  4. PersistedPanel.key: PanelRestoreKey{WorkspaceId, PersistentId} + manifest v2 + plan_restore refusing StableIdentity — PASS. PersistentId is bounded (1..=64 bytes, [a-z0-9_-]) and validated on both the constructor and decode paths; v1 documents are refused rather than reinterpreted, which is the fail-closed direction.

No gate weakening, no #[allow(...)] additions, no hardcoded host/environment values, no let-chains (MSRV 1.85 safe — the let (Some..) destructure form used here is stable). Overlay attribution cannot leak: the only OverlayManager::dismiss/clear call sites are the two attribution-cleaning paths and registry disposal.

Two caveats recorded rather than treated as defects, because the PR body already discloses them:

  • create_panel_overlay has no production caller yet, so in production the overlay family always releases 0. The overlay-attribution enforcement is implemented-only (unwired) until the plugin-boundary edge calls it (audit item 7).
  • plan_restore changes a public signature (Vec -> Result); it has no production caller today (only lib.rs re-export + tests), so nothing else needs migrating.

Base-tree note, verified independently: bash scripts/check-pty-gated-tests.sh on a clean checkout of origin/main 9db82bb reports the same five UNGATED live-spawn markers the lane hit, so that just check failure is pre-existing and not caused by this PR.

VERDICT: APPROVE

@Xuepoo
Xuepoo merged commit 7dd0a8e into main Nov 9, 2026
21 checks passed
@Xuepoo
Xuepoo deleted the ctx-1776/fix-panel-generation-residuals branch November 9, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:runtime Area: runtime orchestration fix Bug fix P1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant