Skip to content

Commit c181fec

Browse files
committed
fix(mailbox): pub(crate) phase so the owner-trait invariant is compiler-enforced (#507 review)
Codex P2: MailboxSoA.phase was `pub`, so a downstream crate could assign an arbitrary KanbanColumn directly, bypassing MailboxSoaOwner::try_advance_phase (the lifecycle-DAG check) and the KanbanMove emission this change centralizes. The field doc already claims "mutated only via the owner trait" — but `pub` left that as documentation, not enforcement. Change `pub phase` -> `pub(crate) phase`. Verified safe across the whole workspace (cargo check --workspace --all-targets exits 0): - the only writer is the in-crate impl MailboxSoaOwner for MailboxSoA<N> (advance_phase, mailbox_soa.rs); pub(crate) keeps that working. - the soa_view.rs write is on the FakeSoa test double, not MailboxSoA. - no external crate reads the field directly; reads go through the MailboxSoaView::phase() getter, which is unchanged. mailbox_soa lib tests (12) + soa_view tests (3) green. https://claude.ai/code/session_01VysoWJ6vsyg3wEGc5v7T5v
1 parent 08b6417 commit c181fec

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

crates/cognitive-shader-driver/src/mailbox_soa.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@ pub struct MailboxSoA<const N: usize> {
112112
/// `ActorStatus`; see `.claude/knowledge/orchestration-boundary-v1.md`).
113113
/// Mutated only via [`MailboxSoaOwner::advance_phase`] /
114114
/// [`MailboxSoaOwner::try_advance_phase`]; starts at
115-
/// [`KanbanColumn::Planning`].
116-
pub phase: KanbanColumn,
115+
/// [`KanbanColumn::Planning`]. Read it through the
116+
/// [`MailboxSoaView::phase`] getter. `pub(crate)` (not `pub`) so the
117+
/// "mutated only via the owner trait" invariant is compiler-enforced — a
118+
/// downstream crate cannot assign an arbitrary column directly and bypass
119+
/// the lifecycle DAG check + `KanbanMove` emission (PR #507 review).
120+
pub(crate) phase: KanbanColumn,
117121
}
118122

119123
/// Default capacity: 1024 rows (4× current BindSpace row count).

0 commit comments

Comments
 (0)