Skip to content

[CTX-1821] fix(runtime): keep the controller predecessor pair across an allocation-epoch edge (bitty#2476 7f) - #3150

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-1821/controller-predecessor-pair
Nov 14, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-1821/controller-predecessor-pair

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

[CTX-1821] fix(runtime): keep the controller predecessor pair across an allocation-epoch edge (bitty#2476 7f)

PanelRegistry::release_generation_scope (crates/bitty-runtime/src/registry/panel.rs)
ends every generation edge, and its non-repeat path wrote the controller
predecessor pair unconditionally:

if let Some(record) = self.panels.get_mut(&panel_id.0) {
    record.last_controller_generation = Some(generation);
    record.last_controller_owner = ended_owner;
    record.release_controller_binding(generation);
}

generation is the panel's binding-key generation: the bound controller
generation when one is bound, otherwise the allocation epoch. So an edge that
ends the allocation epoch (no controller bound) overwrote the pair a controller
edge had stamped with (None, epoch). panels_ended_at(owner, generation)
(panel.rs:3355) is then the only query that can still name the ended
generation — the release cleared the binding — and the generation edge's
successor enumeration (bind_successor, crates/bitty-terminal/src/plugin_runtime.rs)
enumerates exactly that set, so the container was never rebound. The pair and
the tombstone must be understood together: PanelRecord::last_controller_owner
is documented as "written and retained with last_controller_generation, never
on its own", and N-13 keys the tombstone by the same pair, so an epoch
tombstone written over the controller's would leave the retained pair
unreadable at phase 0 and refuse the successor's own bind as CeilingLost.

What changed

release_generation_scope now separates the two edges it can be handed:

  • a controller edge (bound == Some(generation)) writes the pair and the
    tombstone exactly as before;
  • an allocation-epoch edge that finds a controller predecessor
    (!ends_bound_controller && last_ended.is_some()) writes neither half
    and keeps the controller's tombstone. The epoch is never a controller
    generation (B.1/B.2), so it has no predecessor fact of its own to record.
    Every other effect is unchanged: the live row keyed by generation is still
    released, the epoch row is still swept on a controller edge, the queued
    events/commands/overlays are still drained, and the GenerationReleaseRecord
    is still written;
  • an allocation-epoch edge on a panel with no controller predecessor at all
    still stamps the epoch as that panel's first, ownerless predecessor. That is
    where a never-bound panel's ceiling comes from, and it is what the existing
    grant-ceiling tests read.

The repeat branch got the same rule, and the duplicate is now also recognised
from the GenerationReleaseRecord the first pass wrote: an epoch edge that kept
a controller predecessor leaves no tombstone of its own to be named by, and the
retained pair names the controller, so neither previous test could see the
repeat. Without that, a repeated epoch edge would re-run the non-repeat path and
overwrite the release record the docs say it must leave untouched.

Docs corrected to match: PanelRecord::last_controller_generation,
PanelRecord::last_controller_owner, PanelRegistry::last_controller_owner,
and release_generation_scope itself.

A/B revert proof

With the production hunk reverted in place (git checkout -- ...panel.rs, tests
kept) the three tests below fail; with the hunk restored they pass.

$ cargo test -p bitty-runtime --offline --test panel_generation_ownership   # pre-fix
test an_allocation_epoch_edge_keeps_the_controller_predecessor_pair ... FAILED
test an_allocation_epoch_edge_leaves_the_container_enumerable_for_its_successor ... FAILED
test a_bind_after_an_allocation_epoch_edge_reads_the_controller_it_names ... FAILED
test result: FAILED. 6 passed; 3 failed

left: None / right: Some(PluginId("acme.notes"))
left: [] / right: [PanelId(1)]
left: Some(Generation(2)) / right: Some(Generation(3))

$ cargo test -p bitty-runtime --offline --test panel_generation_ownership   # post-fix
test result: ok. 9 passed; 0 failed

New tests (crates/bitty-runtime/tests/panel_generation_ownership.rs), all
public-API only, no sleeps, no private-field access:

  • an_allocation_epoch_edge_keeps_the_controller_predecessor_pair — controller
    edge then epoch edge: the pair still names (acme.notes, N), the tombstone is
    still the controller's, the epoch row is released, the release record is
    written, and the epoch edge's repeat is inert.
  • an_allocation_epoch_edge_leaves_the_container_enumerable_for_its_successor —
    same sequence: controller_generation is None, panels_bound_to is empty,
    panels_ended_at(acme.notes, N) yields the panel, and a later legitimate
    successor bind is accepted, bounded by N's ceiling, after which the panel
    appears in panels_bound_to(acme.notes, N+1) and not in panels_ended_at.
  • a_bind_after_an_allocation_epoch_edge_reads_the_controller_it_names — the
    bind after the epoch edge is measured against the controller that actually
    ended: provenance names (acme.notes, N), another plugin is refused
    CeilingLost (the pre-existing cross-plugin fence, N-13), and the
    predecessor's own owner still binds.

Tests whose expectations had to be re-read

#3149 (CTX-1820) fixed residual 7(a) by making the epoch edge stamp
(None, epoch) and key the tombstone None, and two tests in
tests/panel_generation_ownership.rs pin that ordering. That ordering is what
7(f) reports as the defect, so both expectations were re-read against the field
docs rather than kept:

  1. an_allocation_epoch_edge_retains_no_owner_from_the_previous_edge asserted
    last_controller_owner == None and last_controller_generation == Some(epoch) after an epoch edge. last_controller_owner is "the plugin that
    owned the most recently ended controller generation", and
    last_controller_generation is "the most recently ended controller
    generation" — the epoch is never a controller generation (B.1/B.2), so an
    epoch edge ends no controller generation and has nothing to stamp. Rewritten
    as an_allocation_epoch_edge_keeps_the_controller_predecessor_pair: the pair
    still reads (acme.notes, N) and the tombstone is still that pair's. 7(a)'s
    real invariant — no half-copied pair, i.e. an owner from one edge beside a
    generation from another — is asserted head-on and still fails for the
    pre-#3149 bound_owner.or(last_ended_owner) code.
  2. a_bind_after_an_allocation_epoch_edge_is_not_measured_against_the_previous_owner
    asserted that the bind after an epoch edge is bounded by the epoch's tombstone
    and that another plugin may bind. That only held because the epoch edge had
    erased the controller predecessor; with the pair intact the record's
    predecessor is the controller generation, so its own owner binds against its
    ceiling and a different plugin is refused CeilingLost, exactly as after any
    controller edge (a_bind_by_another_owner_is_refused_as_a_lost_ceiling).
    Rewritten as a_bind_after_an_allocation_epoch_edge_reads_the_controller_it_names.

No assertion was weakened: each rewritten test fails for the code it describes
as broken, and the two #3149 intents they encoded (no mixed pair; no phantom
owner refusing a legitimate bind) are asserted by the replacements.

Behaviour deliberately left alone: on a panel with no controller
predecessor, an epoch edge still stamps (None, epoch) and its tombstone, so a
never-bound panel's first bind keeps reading that ownerless ceiling
(tests/panel_grant_ceiling.rs::panel_after_an_epoch_edge_and_a_controller_bind
and the in-module an_unbound_panel_mounts_through_its_allocation_epoch_exactly_as_before).

Gates (from the worktree, CARGO_TARGET_DIR=.targets/ctx-1821)

# command exit
1 cargo fmt --all -- --check 0
2 cargo clippy -p bitty-runtime --all-targets --offline -- -D warnings 0
3 cargo test -p bitty-runtime --offline 0 (all 232 suites/doctest groups ok; 1622 lib tests incl. the new ones)
4 cargo +1.85 check -p bitty-runtime --tests --offline 0
5 RUSTDOCFLAGS="-D warnings" cargo doc -p bitty-runtime --no-deps --offline 0

Note on gate 3: plugin_runtime::spawn::tests::admitted_git_spawn_runs_under_inherited_confinement
fails on this host when PATH carries more than MAX_PATH_SEARCH_DIRS (64)
entries, because git sits past the cap; it is unrelated to this change and
passes with a normal PATH. It also passed on the first full run before a
shell had grown PATH.

Refs #2476

Summary by CodeRabbit

  • Bug Fixes
    • Fixed panel releases so allocation-epoch changes no longer overwrite the most recent controller’s ownership history or limits.
    • Repeated releases now preserve the existing ownership history and do not release resources a second time.
    • Successors can continue using the retained controller’s limits when rebinding, while owners without valid authorization are prevented from taking over the panel.

…an allocation-epoch edge (bitty#2476 7f)

`PanelRegistry::release_generation_scope` (crates/bitty-runtime/src/registry/panel.rs)
wrote the controller predecessor pair unconditionally on its non-repeat path, so
an edge that ended the allocation epoch (no controller bound) overwrote the pair
a controller edge had stamped with `(None, epoch)`. `panels_ended_at` then named
no one for that generation, and the generation edge's successor bind — which
enumerates that set — never rebound the container (bitty#2476 residual 7(f)).

The pair now records only what it is documented to record, "the controller
generation that ended a binding":

- a controller edge (`bound == Some(generation)`) writes the pair and the
  tombstone exactly as before;
- an allocation-epoch edge that finds a controller predecessor writes neither
  half and keeps the controller's tombstone, because the epoch is never a
  controller generation (B.1/B.2) and the tombstone is keyed by the same pair
  (`N-13`) — keeping the pair without its ceiling would refuse the successor's
  bind as `CeilingLost`;
- an allocation-epoch edge on a panel with no controller predecessor still
  stamps `(None, epoch)` and its own tombstone, so a never-bound panel's first
  bind reads the same ownerless ceiling as before.

The live row, the epoch sweep, the queue/command/overlay drain, and the
`GenerationReleaseRecord` write are unchanged. The repeat branch follows the
same rule, and a repeat is now also recognised from the release record (an epoch
edge that keeps a predecessor leaves no tombstone of its own). Docs on the two
`PanelRecord` fields, `PanelRegistry::last_controller_owner` and
`release_generation_scope` were corrected to match.

Tests (tests/panel_generation_ownership.rs, public API only): the epoch edge
keeps the pair and the tombstone; `panels_ended_at(acme.notes, N)` still yields
the container while `panels_bound_to` stays empty; a later successor bind is
accepted against `N`'s ceiling; a foreign owner is refused `CeilingLost`. All
three fail with the production hunk reverted (A/B proof in the PR).

Two `#3149` expectations were re-read rather than kept: they pinned the
`(None, epoch)` stamp this residual reports as the defect.

Refs #2476
@Xuepoo Xuepoo added fix Bug fix P1 Priority: high area:panel Area: panel surface labels Nov 14, 2026
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Allocation-epoch releases now preserve an existing controller predecessor pair and tombstone. Tests cover release behavior, repeated edges, ended-panel enumeration, and successor binding under the controller’s grant ceiling.

Changes: Panel generation ownership

Layer / File(s) Summary
Allocation-epoch release semantics
crates/bitty-runtime/src/registry/panel.rs, crates/bitty-runtime/tests/panel_generation_ownership.rs
An allocation-epoch edge preserves an existing controller owner, generation, and tombstone. Release handling detects repeated edges and retains the epoch’s release record and grant-row behavior. Tests verify these outcomes.
Controller successor rebinding
crates/bitty-runtime/tests/panel_generation_ownership.rs
Tests verify that the retained controller remains enumerable as ended and that its successor can bind using the controller’s grant ceiling. A different owner’s bind is refused with CeilingLost.

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

Change: Bug fix

Merge Risk: Minimal · up to 811e9

This fixes a case where releasing an allocation epoch could overwrite a controller's predecessor record, so the panel was missing from ended-panel enumeration and its successor could not rebind. The change is narrow and comes with tests for the controller and no-controller cases. No remaining merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the actual change: an allocation-epoch edge in the runtime's panel registry now keeps the controller predecessor owner/generation pair instead of overwriting it. The changeset matches …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the actual change: an allocation-epoch edge in the runtime's panel registry now keeps the controller predecessor owner/generation pair instead of overwriting it. The changeset matches this, including the release_generation_scope fix and the new tests in panel_generation_ownership.rs. The title is specific and accurate. Its length (109 characters) and the ticket and bitty#2476 references are slightly noisy, but the primary change is clear.

Finishing Touches

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

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: 38d405b0-f3ea-45f9-96ba-84c2e499ea1a
Commits

Reviewing files that changed from the base of the PR and between 524cc69 and 811e936.

Files selected for processing: 2

  • crates/bitty-runtime/src/registry/panel.rs
  • crates/bitty-runtime/tests/panel_generation_ownership.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.

@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.

PR #3150 review — CTX-1821 (bitty#2476 residual 7(f))

Repo bitty-terminal/bitty, head 811e9363ea0a50318f197e8585b18de0793522fb,
branch ctx-1821/controller-predecessor-pair. Reviewed read-only in the lane
worktree; all mutation, builds and revert-proofs ran in
/tmp/hermes/pr3150-revert/pr (byte copy of the lane) with
CARGO_TARGET_DIR=/tmp/hermes/pr3150-revert/target{,-msrv}.

Diff under review: crates/bitty-runtime/src/registry/panel.rs (+125/-),
crates/bitty-runtime/tests/panel_generation_ownership.rs (rewrites 2 tests,
adds 1).

1. Claim vs code — PASS

Defect fixed: PanelRegistry::release_generation_scope
(crates/bitty-runtime/src/registry/panel.rs:3010-3186). Before this PR, an
edge whose generation was the allocation epoch (i.e. bound == None) fell
through the same write path as a controller edge: it re-stamped the retained
predecessor pair with last_controller_generation = Some(epoch) and
last_controller_owner = None, and replaced the retained-ceiling tombstone
with an epoch-keyed one ((None, epoch)). Three facts were destroyed at once:
the pair the successor enumerates, the tombstone keyed to that pair, and the
controller's grant ceiling.

New code preserves the pair exactly at the named edge:

  • panel.rs:3119 let ends_bound_controller = bound == Some(generation); —
    true only for the edge that ends a binding (the released_generation != generation fence at :3094-3101 proves the binding key is generation, so
    the equality is exact).
  • panel.rs:3137 let keeps_controller_predecessor = !ends_bound_controller && last_ended.is_some();
  • panel.rs:3142-3152 the retain_grant_ceiling write is skipped, so the
    controller's tombstone (and hence its grant ceiling) survives.
  • panel.rs:3153-3162 both halves of PanelRecord's pair are left untouched
    before release_controller_binding.
  • panel.rs:3071-3074 the unbound repeat of that edge is now recognised from
    the GenerationReleaseRecord the first pass wrote, because a kept
    predecessor leaves no tombstone of the epoch edge's own to name it; the early
    return at :3075-3095 no longer mixes the epoch generation with the kept
    owner (:3087 if bound.is_some() || record.last_controller_generation.is_none()).

Everything else the edge owed still runs on both branches: the epoch-keyed row
is removed (:3164), the epoch row is not swept when no binding ended
(:3165-3175), queued events/commands/overlays are drained
(:3176-3179), and the release record is written (:3180-3187). The
ceiling-keep rule is not an epoch special case at the pair level: a never-bound
panel has last_ended == None, so keeps_controller_predecessor is false and
the epoch edge still stamps its own ownerless predecessor (:3126-3136,
comment).

2. Reachability — PASS (with a caveat)

The changed lines are reachable from production code, through
PanelRegistry::dispose_panel:

  • panel.rs:2172 self.release_generation_scope(panel_id, binding_key)?;
    where binding_key = rec.grant_key_generation() (:2140) resolves to the
    allocation epoch once no controller is bound (:694-696). A panel whose
    controller already left is was_controller == true (:2147-2151), so the
    release runs with bound == None, last_ended == Some(n) — the exact branch
    this PR changes.
  • dispose_panel facades: crates/bitty-runtime/src/registry/host.rs:383-389
    (PanelRuntime::dispose_panel), reached at the plugin generation boundary via
    crates/bitty-runtime/src/scene_host.rs:493, :517, :545
    (SceneHost::release_panel) and by workspace close
    (crates/bitty-runtime/src/runtime/workspaces.rs:2213).
  • Other production call sites do not reach the branch: panel.rs:2376 is
    guarded by bound == Some(presented); panel.rs:3941 releases
    capture.predecessor_generation() and the retained tombstone recognises the
    repeat.

Caveat (non-blocking, worth a follow-up note): the observable consequence the
commit message names — "the generation edge's successor could neither find the
container nor rebind it" — is not reachable from production today, because
dispose_panel removes the record (:2224-2249) immediately after the release,
so no surviving panel carries the kept pair out of dispose_panel. The fix is
therefore a correctness/prospective-API fix on a pub method whose only
surviving-panel caller is a test-side sequence; the successor path that consumes
it (crates/bitty-terminal/src/plugin_runtime.rs:777 panels_ended_at inside
held, called from bind_successor at :815-825) is real production code, so
the invariant is load-bearing the moment a non-dispose epoch edge appears.

3. Test discrimination — PASS (proved red on pre-fix code)

Copy, not the lane: /tmp/hermes/pr3150-revert/pr (cp -a, git rev-parse HEAD = 811e9363…), CARGO_TARGET_DIR=/tmp/hermes/pr3150-revert/target.

Baseline at HEAD:

running 9 tests
test result: ok. 9 passed; 0 failed; 0 ignored

Production hunk reverted only (git checkout origin/main -- crates/bitty-runtime/src/registry/panel.rs; the two files are the whole diff, so
this is exactly the production hunk). The reverted tree still compiles with the
new tests (they use only pre-existing public API), then:

test an_allocation_epoch_edge_leaves_the_container_enumerable_for_its_successor ... FAILED
test an_allocation_epoch_edge_keeps_the_controller_predecessor_pair ... FAILED
test a_bind_after_an_allocation_epoch_edge_reads_the_controller_it_names ... FAILED
test result: FAILED. 6 passed; 3 failed

Verbatim panic bodies:

---- an_allocation_epoch_edge_leaves_the_container_enumerable_for_its_successor ----
panicked at crates/bitty-runtime/tests/panel_generation_ownership.rs:402:5:
assertion `left == right` failed: the container is still the ended controller generation's, so the successor bind enumerates it
  left: []   right: [PanelId(1)]

---- an_allocation_epoch_edge_keeps_the_controller_predecessor_pair ----
panicked at crates/bitty-runtime/tests/panel_generation_ownership.rs:305:5:
assertion `left == right` failed: the pair still names the controller generation that ended a binding, so both halves come from that one edge and never from the epoch edge
  left: None   right: Some(PluginId("acme.notes"))

---- a_bind_after_an_allocation_epoch_edge_reads_the_controller_it_names ----
panicked at crates/bitty-runtime/tests/panel_generation_ownership.rs:470:5:
  left: Some(Generation(2))   right: Some(Generation(3))

The first failure is the defect itself (panels_ended_at empty ⇒ the
successor's held() enumeration cannot find the container). Restoration
verified: git checkout HEAD -- crates/bitty-runtime/src/registry/panel.rs,
then git status --porcelain empty. The changed tests also pin the two wrong
"fixes" the commit message names — carrying an owner forward (:305/:309
assert (Some(acme), n), so (acme, epoch) fails) and overwriting the pair with
(None, epoch) plus an epoch tombstone (:317-336 assert
ceiling.ended_generation == n, ceiling.owner == Some(acme),
ceiling.grants == {create, focus}, and :345-352 assert the epoch row is
still released and a release record exists). Test ids :280, :377, :453.

4. Invariants — PASS

Single owner + generation semantics:

  • Stale handle still fails closed before any family is touched:
    panel.rs:3094-3101 returns PanelError::StaleHandle { expected_generation, found_generation, id_raw }, computed before capabilities.get/remove. The
    already_ended probe above it (:3058-3074) is read-only
    (retained_grant_ceiling, release_records.get), and the new
    release_records clause (:3071-3074) is only reachable when
    bound == None, so a foreign generation presented to a bound panel is still
    refused.
  • The pair is written as one fact: :3087-3092 (repeat branch) and
    :3156-3161 (main branch) both gate the last_controller_generation write
    with its last_controller_owner; neither half can move alone, matching the
    PanelRecord contract at :621-656 and the N-13 fence in
    capture_rebind_source (:3524-3560, tombstone accepted only when
    ended_generation == last && owner == last_owner).
  • Validate-then-commit: in the keep branch nothing can fail (no tombstone write,
    no pair write), so no partial commit exists; on the non-keep branch
    retain_grant_ceiling still runs before the pair write and row removal and
    returns PanelError::ResourceExhausted with the live row, the pair and every
    other family intact (:3142-3152). dispose_panel propagates it before its
    own teardown (:2172).
  • Refusal variants exercised by the new tests: PanelError::CeilingLost { panel_id, bind_generation, last_controller_generation, tombstone_generation }
    (tests/panel_generation_ownership.rs:474-484), plus error_count /
    controller_generation == None assertions proving the refusal committed
    nothing (:485-490).
  • One owner per panel: panels_ended_at (:3355-3375) filters on the retained
    pair, and panels_bound_to remains its complement; the test asserts both
    (tests/…:397-410, :424-431).

Two behavioural notes, both acceptable and neither a violation: the epoch edge
no longer copies the epoch row's grants into a tombstone (pre-fix the successor
could inherit {panel.focus} that no controller held — the fix removes that
widening), and a repeat of a generation edge now returns Ok(false) instead of
StaleHandle because the kept tombstone names it (idempotence, which is what
A.2 phase-1 repetition expects).

5. MSRV 1.85 — PASS

No let-chains and no if let match guards in the added code: the only new
conditions are if bound.is_some() || record.last_controller_generation.is_none()
(:3087) and !ends_bound_controller && last_ended.is_some() (:3137); the
match on the record (:3054-3069) has no guards. No new #[cfg] items.

Executed in the copy, fresh target dir, files touched so the crate re-checked:

$ CARGO_TARGET_DIR=/tmp/hermes/pr3150-revert/target-msrv cargo +1.85 check -p bitty-runtime --tests --offline
    Checking bitty-runtime v0.0.41 (/tmp/hermes/pr3150-revert/pr/crates/bitty-runtime)
    Checking bitty-terminal v0.0.41 (/tmp/hermes/pr3150-revert/pr/crates/bitty-terminal)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.12s

(cargo +1.85 --version = cargo 1.85.1 (d73d2caf9 2024-12-31).)

6. Lint — PASS

$ CARGO_TARGET_DIR=/tmp/hermes/pr3150-revert/target cargo clippy -p bitty-runtime --all-targets --offline -- -D warnings
    Checking bitty-runtime v0.0.41 (/tmp/hermes/pr3150-revert/pr/crates/bitty-runtime)
    Checking bitty-terminal v0.0.41 (/tmp/hermes/pr3150-revert/pr/crates/bitty-terminal)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.66s

No warnings. Bonus: cargo fmt --check -p bitty-runtime prints nothing
(clean).

7. Hygiene — PASS

Diff scanned for dbg!, println!, eprintln!, #[allow, unwrap(),
absolute host paths (/home/, /Users/), usernames, localhost, 127.0.0.1
and fixed ports: the only hits are .expect("…") in the test file (legitimate
assertions). No #[allow(...)], no #[cfg(...)] added. All added comments and
rustdoc are English and explain the mechanism (the keeps_controller_predecessor
block at :3120-3136 and the rustdoc at :2969-2996), and the record-field
docs (:618-656) were updated in the same commit, so no comment now contradicts
the code.

8. Docs / docs-claims — PASS (draft drift noted, no edit made)

bitty-docs + bitty-terminal-docs grepped for last_controller_owner,
panels_ended_at, allocation epoch, retired-ceiling, tombstone, OQ-084,
2476.

  • The accepted corpus does not describe this rule: bitty-terminal-docs/ specifications/panel-runtime-rfc.md (status: accepted) contains no
    predecessor/tombstone/last-controller text; bitty-docs/docs/decisions/adrs/ ADR-0013-core-ontology-identity.md and open-questions.md (OQ-084) only fix
    ontology terms; bitty-docs/docs/security/README.md (status: accepted) is an
    index line with no mechanism detail.
  • Drift, in a draft document only: bitty-terminal-docs/specifications/ panel-generation-ownership-decision.md (status: draft) still lists
    "(a) The allocation-epoch edge inherits the previous controller's owner" as an
    open follow-up (:458-467, "the field's contract and the write disagree; one
    of the two must move") — this PR moves the write, i.e. closes (a) — and the
    summary row at :383 describes release_generation_scope as stamping the pair
    "from the binding before releasing it" without the 7(f) exception. Its
    panel.rs line citations (:622, :638, :2964, :3044, :3146, …) are
    already stale against this head.
    Not blocking (draft, forward-only), but a follow-up should close (a) and
    refresh the row.

Non-blocking observations

  1. Reachability caveat in §2: the fixed invariant has no surviving-panel
    production caller yet; only dispose_panel reaches the epoch edge, and it then
    removes the record. The invariant is still worth landing (it makes the pub
    method self-consistent with panels_ended_at/capture_rebind_source), but the
    commit message overstates the present-day blast radius.
  2. already_ended's new release_records clause (:3071-3074) widens the
    pre-fence acceptance window for an unbound panel to "this generation's edge
    already ran", returning Ok(false) and removing any row keyed by that
    generation. It is the same shape the pre-existing last_ended == Some(generation) / tombstone_names_generation tests had, only now
    reachable for the epoch edge on a previously-bound panel; no live binding is
    reachable from it (the clause is excluded whenever bound.is_some()).
  3. Draft-spec drift in §8 — fix-forward, no edit made per instructions.

Verification summary

Check Result Anchor
1 claim vs code PASS panel.rs:3119, :3137, :3142-3162, :3071-3074
2 reachability PASS (caveat) panel.rs:2172 ← host.rs:388 ← scene_host.rs:493/517/545
3 test discrimination PASS (3 red on revert) tests/panel_generation_ownership.rs:305, :402, :470
4 invariants PASS panel.rs:3094-3101, :3142-3152, :3524-3560
5 MSRV 1.85 PASS cargo +1.85 check … --tests --offline finished clean
6 clippy -D warnings PASS clean, no warnings
7 hygiene PASS no allow/dbg/println/host-path/cfg additions
8 docs PASS (draft drift noted) panel-generation-ownership-decision.md:383, :458-467

VERDICT: APPROVE

@Xuepoo
Xuepoo merged commit f85aef3 into main Nov 14, 2026
21 checks passed
@Xuepoo
Xuepoo deleted the ctx-1821/controller-predecessor-pair branch November 14, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:panel Area: panel surface fix Bug fix P1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant