Skip to content

refactor(contract): remove CollapseGateEmission + MailboxSoA::emit(); in-place consume_firing() successor#487

Merged
AdaWorldAPI merged 3 commits into
mainfrom
claude/splat3d-cpu-simd-renderer-MAOO0
Jun 13, 2026
Merged

refactor(contract): remove CollapseGateEmission + MailboxSoA::emit(); in-place consume_firing() successor#487
AdaWorldAPI merged 3 commits into
mainfrom
claude/splat3d-cpu-simd-renderer-MAOO0

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jun 11, 2026

Copy link
Copy Markdown
Owner

What

PR #477's "what does NOT exist (and must not be reintroduced)" table, made source-true. #477 documented the target state; this PR removes the superseded emission artifacts from source.

Removed

Artifact Disposition
CollapseGateEmission (contract::collapse_gate) Deleted + lib.rs re-export updated. MailboxId / MergeMode / GateDecision survive — addressing / merge / gate concepts, not emission concepts. A dated removal marker explains the lineage at the old site.
MailboxSoA::emit() Deleted. Successor: in-place consume_firing(row) -> bool — same threshold + same-cycle-idempotency semantics, zero carrier object. The owner reads the row's columns in place (edge / qualia / meta / entity_type), then stamps. This is the ownership-transfer shape: no DTO, the SoA itself is the active record.
last_emission_cycle Renamed last_active_cycle (in-place consumption stamp), per the #477 follow-up list verbatim.
wire_cost_bytes() = 13 + 10·baton_count Gone with the struct.

Doc reality sync (same commit)

  • 4 stale doc references reworded to the three-tier zero-copy framing (docs/architecture/soa-three-tier-model.md): kanban.rs (R4 witness-as-pointer ×2), episodic_edges.rs (LE byte grammar consumers), witness_tombstone.rs (E-BATON-1 scoping), mailbox_soa.rs module header.
  • CLAUDE.md Baton-scoping block superseded with a dated note — what survives (Vsa16kF32-never-crosses-boundaries, mailbox-as-owner compile-time safety, bundle math) is named explicitly.
  • cycle-coherent-soa-snapshot-v1.md D-SOA-SNAP-1/2 fixed to generic MailboxSoaSnapshot<C> + SnapshotProvider::Column — closes the SoA envelope: zero-copy register-file model + LE contract + ontology resolution audit #477 CodeRabbit Critical (the original sketch put Vec<Arc<MultiLaneColumn>> in contract, which would have created a contract → ndarray dependency). Contract stays zero-dep; lance-graph binds Column = MultiLaneColumn; same triangulation as SoaEnvelope.

Verified, not re-fixed

The #477 codex P2 on verify_layout() (column end-offset past stride passing the summed-width check) is already fixed on mainColumnOutOfBounds with checked_add overflow guard + regression test column_past_stride_caught using codex's exact example. The GitHub thread was never marked resolved; the code is correct. No change needed.

Board hygiene (same commit)

  • LATEST_STATE.md contract inventory: CollapseGateEmission marked REMOVED; TD row updated.
  • TECH_DEBT.md: TD-COLLAPSE-GATE-SMALLVEC-1 closed as moot (no carrier, no Vec, nothing to optimize).
  • AGENT_LOG.md: entry prepended.

Gates

Gate Result
cargo test -p lance-graph-contract --lib 594 (−8 emission tests, +2 gate/merge-ordinal tests)
cargo test -p cognitive-shader-driver --lib 85 (emit tests rewritten as consume tests, +1 OOB rejection test)
cargo clippy -p lance-graph-contract -p cognitive-shader-driver --all-targets clean (remaining warnings pre-existing in causal-edge)
cargo check --workspace clean

Not in scope

#477 three-tier model

The PR #477 'what does NOT exist' table, made source-true:

- Remove CollapseGateEmission from contract::collapse_gate (+ lib.rs
  re-export). MailboxId, MergeMode, GateDecision survive — they are
  addressing/merge concepts, not emission concepts.
- Remove MailboxSoA::emit(); rename last_emission_cycle →
  last_active_cycle. New in-place consume_firing(row) keeps the
  threshold + same-cycle-idempotency semantics with no carrier object
  (zero-copy: owner reads row columns in place, then stamps).
- Reword 4 stale doc references (kanban, episodic_edges,
  witness_tombstone, mailbox_soa module header) to the three-tier
  zero-copy framing.
- Supersede the CLAUDE.md Baton-scoping block (dated note; bundle math
  + mailbox-as-owner safety argument survive untouched).
- Fix cycle-coherent-soa-snapshot-v1 D-SOA-SNAP-1/2: generic
  MailboxSoaSnapshot<C> + SnapshotProvider::Column so contract never
  imports MultiLaneColumn (closes #477 CodeRabbit Critical; contract
  stays zero-dep).
- Board: LATEST_STATE contract inventory updated, TD-COLLAPSE-GATE-
  SMALLVEC-1 closed as moot, AGENT_LOG entry prepended.

Verified: #477 codex P2 on verify_layout (ColumnOutOfBounds) already
fixed on main with regression test column_past_stride_caught.

Tests: contract 594 (-8 emission, +2 gate/merge), driver 85
(emit tests rewritten as consume tests, +1 OOB), clippy clean,
workspace check clean.

https://claude.ai/code/session_017GFLBnDy23AWBqvkbHHC41
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@AdaWorldAPI, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 41 minutes and 59 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2509418c-1f6c-45ea-9cd7-f7ba15757a21

📥 Commits

Reviewing files that changed from the base of the PR and between 925887a and 93d15c0.

📒 Files selected for processing (2)
  • .claude/board/AGENT_LOG.md
  • .claude/board/EPIPHANIES.md
📝 Walkthrough

Walkthrough

This PR documents and implements the architectural follow-up to PR #477: removing the CollapseGateEmission inter-mailbox carrier, refactoring MailboxSoA from an emission-based API to in-place consumption via consume_firing(), embedding mailbox-owned columns, and updating documentation to reflect the zero-copy three-tier model where SoA envelopes flow directly from creation through calcification to Lance tombstone without serialization between mailboxes.

Changes

Three-Tier Model Implementation & Cleanup

Layer / File(s) Summary
Architectural Board & Documentation Updates
.claude/board/AGENT_LOG.md, .claude/board/EPIPHANIES.md, .claude/board/LATEST_STATE.md, .claude/board/TECH_DEBT.md, CLAUDE.md
Board decision ledger, epiphanies entry, and state tracking updated to record CollapseGateEmission removal (PR #477), rename of last_emission_cyclelast_active_cycle, new consume_firing() method, and the architectural boundary insight that only the outer ORM boundary exists; tech debt item closed as moot.
Contract Type Removal & Export Update
crates/lance-graph-contract/src/collapse_gate.rs, crates/lance-graph-contract/src/lib.rs
CollapseGateEmission struct and all its methods removed; MailboxId, MergeMode, and GateDecision retained with updated unit tests validating semantics and stable discriminant ordinals; public re-exports adjusted accordingly.
MailboxSoA In-Place Consumption Refactoring
crates/cognitive-shader-driver/src/mailbox_soa.rs
Per-row state field renamed from last_emission_cycle to last_active_cycle with u32::MAX sentinel; emit() method removed; new consume_firing(row) -> bool checks threshold, idempotency guard, and resets energy; four new embedded mailbox-owned columns (edges, qualia, meta, entity_type) added with read/write accessors; apply_edges parameter renamed to deliveries; test suite updated to validate consumption behavior across threshold, idempotency, and reset cycles.
Supporting Module Documentation Updates
crates/lance-graph-contract/src/episodic_edges.rs, crates/lance-graph-contract/src/kanban.rs, crates/lance-graph/src/graph/witness_tombstone.rs
Doc comments clarified to remove references to CollapseGateEmission inter-mailbox carrier, reframe semantics around zero-copy and ownership transfer, and confirm HotWitness remains local/ephemeral with no cross-boundary transmission.
Snapshot Contract Generification Plan
.claude/plans/cycle-coherent-soa-snapshot-v1.md
MailboxSoaSnapshot and SnapshotProvider trait redesigned to be generic over column type C, deferring concrete MultiLaneColumn binding to implementation and eliminating contract-level SIMD column dependency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • AdaWorldAPI/lance-graph#427: Earlier PR that extended MailboxSoA with embedded mailbox-owned "thoughtspace" columns and row accessors; this PR completes the refactoring by replacing the emission API with in-place consumption.

Poem

🐰 A carrier vanishes, the boundary simplifies,
From baton-batons to firing that thrives,
Consumption in-place, the ORM stands guard,
Zero-copy flows make the architecture bard!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main refactoring objective: removing CollapseGateEmission (an outer-boundary emission DTO) and clarifying that SoA↔Lance is the canonical ORM boundary.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

…ry commit, not a cleanup

Reframes PR #487 correctly: removing CollapseGateEmission was not dead-code
hygiene, it was a boundary-shape correction. The inner seam (mailbox-to-
mailbox) does not exist as a typed crossing — it is ownership transfer
under Rust move semantics (E-CE64-MB-4). The outer seam (SoA ↔ Lance) is
ontology-mediated:

    OGAR class    = table schema  (label + fields + tools + templates)
    SoaEnvelope   = column mapping (byte geometry)
    Lance I/O     = SQL writer    (LE bytes from in-place store)
    hand-DTO      = ORM-bypass    (CollapseGateEmission was the last)

The class supplies semantics; the envelope supplies geometry; Lance does
the writing. Any independent carrier struct at this seam is schema drift
by definition (per #477's 'every DTO is a derived view of an OGAR class').

MailboxId / MergeMode / GateDecision survive because they are vocabulary
*of* the ontology side (addressing, merge policy, gate decision), not
parallel descriptions of row data.

Consequences for future PRs:
  - inner seams are moves, never carrier types
  - the outer seam has exactly one description (class + envelope + Lance)
  - hand-rolled active records are ORM-bypass — reach for ClassView +
    FieldMask + class-template specialization instead

Cross-refs: PR #477 three-tier model; PR #487 tombstone commit;
soa-three-tier-model.md; E-OGAR-NORTHSTAR-1 (class spine);
I-LEGACY-API-FEATURE-GATED (removal is the canonical path).

https://claude.ai/code/session_017GFLBnDy23AWBqvkbHHC41
@AdaWorldAPI AdaWorldAPI changed the title refactor(contract): tombstone commit — remove emission artifacts per PR #477 three-tier model refactor(contract): outer-boundary tombstone — emission DTO removed; SoA↔Lance is the one ORM seam Jun 12, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/board/AGENT_LOG.md:
- Line 3: Update the AGENT_LOG entry by replacing the placeholder "Commit: in
PR." with the concrete git commit SHA for the recorded run; locate the entry in
.claude/board/AGENT_LOG.md (the line containing "Commit: in PR.") and stamp the
full commit hash, and ensure the same entry also explicitly lists D-ids, the
tests run, and the outcome so the record is immutable and auditable.

In @.claude/board/EPIPHANIES.md:
- Around line 51-53: The cross-reference line contains an unescaped leading hash
(`#487`) that is being parsed as an ATX heading; edit the cross-ref so `#487` is
not at the start of its line — either move it to the same line as the preceding
"PR" token (e.g., "PR `#487`") or escape the hash (`\`#487``) so the markdown linter
(MD018) no longer treats it as a heading.

In @.claude/board/TECH_DEBT.md:
- Around line 939-941: The file contains conflicting status lines for the
CollapseGateEmission debt row: one line says "Status: CLOSED 2026-06-11 (moot)"
and later it still has "**Status:** Open"; remove or update the
redundant/incorrect line so only a single authoritative status remains for the
CollapseGateEmission entry (keep the CLOSED line per the PR `#477` note and delete
the "**Status:** Open" line or replace it with matching closed status).

In `@crates/cognitive-shader-driver/src/mailbox_soa.rs`:
- Around line 129-133: The sentinel collision occurs because last_active_cycle
(the array named last_active_cycle) uses u32::MAX as "never consumed" while
current_cycle wraps with wrapping_add(1); fix by changing last_active_cycle from
[u32; N] with u32::MAX sentinel to [Option<u32>; N] initialized to None, update
all checks/assignments to use Some(cycle) / None (e.g., replace comparisons
against u32::MAX and direct assignments with Some(current_cycle)), and update
any logic in the same module referencing current_cycle and last_active_cycle
(including the other occurrence around the 223-225 region) to handle Option<u32>
accordingly so a wrapped current_cycle will never collide with the "never
consumed" state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eaf6f32a-1384-4477-93b0-0bd342bdbe51

📥 Commits

Reviewing files that changed from the base of the PR and between 5363f43 and 925887a.

📒 Files selected for processing (12)
  • .claude/board/AGENT_LOG.md
  • .claude/board/EPIPHANIES.md
  • .claude/board/LATEST_STATE.md
  • .claude/board/TECH_DEBT.md
  • .claude/plans/cycle-coherent-soa-snapshot-v1.md
  • CLAUDE.md
  • crates/cognitive-shader-driver/src/mailbox_soa.rs
  • crates/lance-graph-contract/src/collapse_gate.rs
  • crates/lance-graph-contract/src/episodic_edges.rs
  • crates/lance-graph-contract/src/kanban.rs
  • crates/lance-graph-contract/src/lib.rs
  • crates/lance-graph/src/graph/witness_tombstone.rs

@@ -1,3 +1,7 @@
## 2026-06-11 — tombstone commit: emission artifacts removed per PR #477 follow-up

**Main thread (Fable, session splat3d-cpu-simd-renderer).** Executed the PR #477 documented follow-up (the "what does NOT exist" table → source reality): removed `CollapseGateEmission` from `lance-graph-contract::collapse_gate` (+ lib.rs re-export; `MailboxId`/`MergeMode`/`GateDecision` survive), removed `MailboxSoA::emit()`, renamed `last_emission_cycle` → `last_active_cycle`, added in-place `consume_firing(row)` successor (same threshold + same-cycle-idempotency semantics, no carrier object), reworded 4 stale doc references (kanban/episodic_edges/witness_tombstone/mailbox_soa header), superseded the CLAUDE.md Baton-scoping block, fixed cycle-coherent-soa-snapshot-v1 D-SOA-SNAP-1/2 to generic `SnapshotProvider::Column` (closes #477 CodeRabbit Critical — contract stays zero-dep), closed TD-COLLAPSE-GATE-SMALLVEC-1 as moot. Verified #477 codex P2 (`verify_layout` ColumnOutOfBounds) already fixed on main with regression test. Tests: contract 594 (−8 emission, +2 gate/merge), driver 85 (emit tests → consume tests, +1 OOB), clippy clean, workspace check clean. Commit: in PR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Record the exact commit SHA in this AGENT_LOG entry.

Commit: in PR. is not immutable/auditable for run traceability. Please stamp the concrete commit hash in this prepended record.

As per coding guidelines, .claude/board/AGENT_LOG.md entries for completed runs must include D-ids, commit, tests, and outcome in the same commit.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/board/AGENT_LOG.md at line 3, Update the AGENT_LOG entry by
replacing the placeholder "Commit: in PR." with the concrete git commit SHA for
the recorded run; locate the entry in .claude/board/AGENT_LOG.md (the line
containing "Commit: in PR.") and stamp the full commit hash, and ensure the same
entry also explicitly lists D-ids, the tests run, and the outcome so the record
is immutable and auditable.

Source: Coding guidelines

Comment on lines +51 to +53
**Cross-ref:** PR #477 (three-tier model + "what does NOT exist" table); PR
#487 (tombstone commit — emission artifacts removed; `consume_firing` is the
in-place ownership successor); `docs/architecture/soa-three-tier-model.md`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep #487 off its own line.

#487 at the start of Line 52 is parsed as an ATX heading (MD018), which breaks the cross-reference and trips markdownlint. Keep it on the same line as PR or escape the hash.

Fix
- **Cross-ref:** PR `#477` (three-tier model + "what does NOT exist" table); PR
- `#487` (tombstone commit — emission artifacts removed; `consume_firing` is the
+ **Cross-ref:** PR `#477` (three-tier model + "what does NOT exist" table); PR `#487` (tombstone commit — emission artifacts removed; `consume_firing` is the
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Cross-ref:** PR #477 (three-tier model + "what does NOT exist" table); PR
#487 (tombstone commit — emission artifacts removed; `consume_firing` is the
in-place ownership successor); `docs/architecture/soa-three-tier-model.md`
**Cross-ref:** PR `#477` (three-tier model + "what does NOT exist" table); PR `#487` (tombstone commit — emission artifacts removed; `consume_firing` is the
in-place ownership successor); `docs/architecture/soa-three-tier-model.md`
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 52-52: No space after hash on atx style heading

(MD018, no-missing-space-atx)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/board/EPIPHANIES.md around lines 51 - 53, The cross-reference line
contains an unescaped leading hash (`#487`) that is being parsed as an ATX
heading; edit the cross-ref so `#487` is not at the start of its line — either
move it to the same line as the preceding "PR" token (e.g., "PR `#487`") or escape
the hash (`\`#487``) so the markdown linter (MD018) no longer treats it as a
heading.

Source: Linters/SAST tools

Comment on lines +939 to 941
**Status: CLOSED 2026-06-11 (moot)** — `CollapseGateEmission` was removed entirely per the PR #477 three-tier model (zero-copy SoA, no inter-mailbox handoff type; tombstone commit). No carrier, no Vec, nothing to optimize.

**Status:** Open

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Resolve conflicting status lines for this debt row.

Line 939 marks this row as closed, but Line 941 still says **Status:** Open. Keep a single authoritative status line to avoid conflicting board state.

🛠️ Proposed fix
-**Status: CLOSED 2026-06-11 (moot)** — `CollapseGateEmission` was removed entirely per the PR `#477` three-tier model (zero-copy SoA, no inter-mailbox handoff type; tombstone commit). No carrier, no Vec, nothing to optimize.
-
-**Status:** Open
+**Status:** CLOSED 2026-06-11 (moot) — `CollapseGateEmission` was removed entirely per the PR `#477` three-tier model (zero-copy SoA, no inter-mailbox handoff type; tombstone commit). No carrier, no Vec, nothing to optimize.

As per coding guidelines, governance files should keep status updates authoritative on the status line.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Status: CLOSED 2026-06-11 (moot)**`CollapseGateEmission` was removed entirely per the PR #477 three-tier model (zero-copy SoA, no inter-mailbox handoff type; tombstone commit). No carrier, no Vec, nothing to optimize.
**Status:** Open
**Status:** CLOSED 2026-06-11 (moot) — `CollapseGateEmission` was removed entirely per the PR `#477` three-tier model (zero-copy SoA, no inter-mailbox handoff type; tombstone commit). No carrier, no Vec, nothing to optimize.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/board/TECH_DEBT.md around lines 939 - 941, The file contains
conflicting status lines for the CollapseGateEmission debt row: one line says
"Status: CLOSED 2026-06-11 (moot)" and later it still has "**Status:** Open";
remove or update the redundant/incorrect line so only a single authoritative
status remains for the CollapseGateEmission entry (keep the CLOSED line per the
PR `#477` note and delete the "**Status:** Open" line or replace it with matching
closed status).

Source: Coding guidelines

Comment on lines +129 to +133
// u32::MAX is the "never consumed" sentinel. current_cycle starts at 0
// and advances via wrapping_add(1); in practice it never reaches
// u32::MAX during a session, so the first emit on any cycle is always
// permitted (u32::MAX != any valid cycle stamp).
last_emission_cycle: [u32::MAX; N],
// u32::MAX during a session, so first consumption on any cycle is
// always permitted (u32::MAX != any valid cycle stamp).
last_active_cycle: [u32::MAX; N],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Prevent sentinel collision at cycle wraparound.

last_active_cycle uses u32::MAX as the “never consumed” sentinel, but current_cycle wraps with wrapping_add(1). When cycle reaches u32::MAX, untouched rows are incorrectly treated as already-consumed for that full cycle.

💡 Suggested fix
-    // u32::MAX is the "never consumed" sentinel. current_cycle starts at 0
-    // and advances via wrapping_add(1); in practice it never reaches
-    // u32::MAX during a session, so first consumption on any cycle is
-    // always permitted (u32::MAX != any valid cycle stamp).
+    // u32::MAX is the "never consumed" sentinel. `tick()` reserves this value
+    // so `current_cycle` never equals the sentinel.
     last_active_cycle: [u32::MAX; N],

@@
-    pub fn tick(&mut self) {
-        self.current_cycle = self.current_cycle.wrapping_add(1);
-    }
+    pub fn tick(&mut self) {
+        // Reserve u32::MAX for last_active_cycle sentinel.
+        self.current_cycle = if self.current_cycle == u32::MAX - 1 {
+            0
+        } else {
+            self.current_cycle + 1
+        };
+    }

Also applies to: 223-225

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/cognitive-shader-driver/src/mailbox_soa.rs` around lines 129 - 133,
The sentinel collision occurs because last_active_cycle (the array named
last_active_cycle) uses u32::MAX as "never consumed" while current_cycle wraps
with wrapping_add(1); fix by changing last_active_cycle from [u32; N] with
u32::MAX sentinel to [Option<u32>; N] initialized to None, update all
checks/assignments to use Some(cycle) / None (e.g., replace comparisons against
u32::MAX and direct assignments with Some(current_cycle)), and update any logic
in the same module referencing current_cycle and last_active_cycle (including
the other occurrence around the 223-225 region) to handle Option<u32>
accordingly so a wrapped current_cycle will never collide with the "never
consumed" state.

…conflicts

Board prepend zones (AGENT_LOG, EPIPHANIES) auto-merged; no semantic
overlap — main-side additions (#485 helix probe, #486 docs) reference
none of the tombstoned emission identifiers (verified by grep: only
intentional historical mentions in comments remain).

https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY
AdaWorldAPI pushed a commit that referenced this pull request Jun 13, 2026
Scope: harden the SurrealDB kv-lance backend so it's production-grade
for the VIEW path (external SurrealQL surface over the leading Lance
dataset). Does NOT touch the production cognitive-state writer —
per the 2026-05-28 ruling (E-RUBICON-RACTOR) and the 2026-06-09
polyglot plan, LanceDB leads as the in-binary writer; SurrealDB is
a view/dialect, and lance-graph commits direct.

Key inventory finding pulled from polyglot §2.2: kv-lance is 18/19
implemented in-tree (get/keys/keysr/scan/scanr + writes + savepoints,
MVCC via Lance versions, Timeline time-travel, background optimizer,
~6 k internal tests). The surreal_container BLOCKED(C/D) marker is
stale — work is hardening + closing named gaps, not building.

8 deliverables D-KVL-1..8:
- D-KVL-1: lance =7.0.0 / lancedb =0.30.0 pin discipline (in-binary
  consumer = no external pressure to chase upstream); CI assertion
- D-KVL-2 (P0): Gap #2 fix — replace the LWW MergeInsert relic in
  flusher.rs:251 with MergeMode-tagged dispatch (recommended) or
  hard-partitioning proof; regression test for silent-drop
- D-KVL-3: WAL — ciborium CBOR -> raw #[repr(C)]-LE + CRC32C +
  WAL-version byte (per I-LEGACY-API-FEATURE-GATED)
- D-KVL-4: consumer-side crash-recovery suite (WAL-fsync /
  memtable-flush / Lance-commit / Lance-GC kill phases)
- D-KVL-5: 1-hour multi-writer + multi-reader soak; budget <0.01%
- D-KVL-6: schema-evolution boundary doc + tests under the pin
- D-KVL-7: surreal_container unblock = polyglot D-PG-6; kanban VIEW
  smoke test against Tier-A direct-Lance writer (the contract test)
- D-KVL-8: doctrine record — EPIPHANIES E-KVLANCE-VIEW-NOT-WRITER
  extends #487's E-OUTER-BOUNDARY-IS-ORM-1 over the four-tier map
  (A: in-binary = lance-graph direct; B-view: SurrealDB on hardened
  kv-lance; B-HA: kv-tikv; B-fallback: kv-rocksdb)

Out of scope: kv-rocksdb hardening (SurrealDB-upstream tested);
kv-tikv HA (separate plan); lance-graph Tier-A writer improvements;
chasing lance/lancedb past the pin.

This commit lands the plan file + INTEGRATION_PLANS prepend +
STATUS_BOARD section (Board-Hygiene Rule). EPIPHANIES E-KVLANCE-*
+ TECH_DEBT TD-KVLANCE-LWW-RELIC wording pending user review.

https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY
AdaWorldAPI pushed a commit that referenced this pull request Jun 13, 2026
Scope: harden the SurrealDB kv-lance backend so it's production-grade
for the VIEW path (external SurrealQL surface over the leading Lance
dataset). Does NOT touch the production cognitive-state writer —
per the 2026-05-28 ruling (E-RUBICON-RACTOR) and the 2026-06-09
polyglot plan, LanceDB leads as the in-binary writer; SurrealDB is
a view/dialect, and lance-graph commits direct.

Key inventory finding pulled from polyglot §2.2: kv-lance is 18/19
implemented in-tree (get/keys/keysr/scan/scanr + writes + savepoints,
MVCC via Lance versions, Timeline time-travel, background optimizer,
~6 k internal tests). The surreal_container BLOCKED(C/D) marker is
stale — work is hardening + closing named gaps, not building.

8 deliverables D-KVL-1..8:
- D-KVL-1: lance =7.0.0 / lancedb =0.30.0 pin discipline (in-binary
  consumer = no external pressure to chase upstream); CI assertion
- D-KVL-2 (P0): Gap #2 fix — replace the LWW MergeInsert relic in
  flusher.rs:251 with MergeMode-tagged dispatch (recommended) or
  hard-partitioning proof; regression test for silent-drop
- D-KVL-3: WAL — ciborium CBOR -> raw #[repr(C)]-LE + CRC32C +
  WAL-version byte (per I-LEGACY-API-FEATURE-GATED)
- D-KVL-4: consumer-side crash-recovery suite (WAL-fsync /
  memtable-flush / Lance-commit / Lance-GC kill phases)
- D-KVL-5: 1-hour multi-writer + multi-reader soak; budget <0.01%
- D-KVL-6: schema-evolution boundary doc + tests under the pin
- D-KVL-7: surreal_container unblock = polyglot D-PG-6; kanban VIEW
  smoke test against Tier-A direct-Lance writer (the contract test)
- D-KVL-8: doctrine record — EPIPHANIES E-KVLANCE-VIEW-NOT-WRITER
  extends #487's E-OUTER-BOUNDARY-IS-ORM-1 over the four-tier map
  (A: in-binary = lance-graph direct; B-view: SurrealDB on hardened
  kv-lance; B-HA: kv-tikv; B-fallback: kv-rocksdb)

Out of scope: kv-rocksdb hardening (SurrealDB-upstream tested);
kv-tikv HA (separate plan); lance-graph Tier-A writer improvements;
chasing lance/lancedb past the pin.

This commit lands the plan file + INTEGRATION_PLANS prepend +
STATUS_BOARD section (Board-Hygiene Rule). EPIPHANIES E-KVLANCE-*
+ TECH_DEBT TD-KVLANCE-LWW-RELIC wording pending user review.

https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY
@AdaWorldAPI AdaWorldAPI merged commit f0f02d4 into main Jun 13, 2026
6 checks passed
@AdaWorldAPI AdaWorldAPI changed the title refactor(contract): outer-boundary tombstone — emission DTO removed; SoA↔Lance is the one ORM seam refactor(contract): remove CollapseGateEmission + MailboxSoA::emit(); in-place consume_firing() successor Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants