Skip to content

impl(sprint-11/wave-D): D-CSV-7 MailboxSoA + D-CSV-6a WitnessCorpus core (parallel workers)#386

Merged
AdaWorldAPI merged 3 commits into
mainfrom
claude/sprint-11-wave-d-witness-mailbox
May 16, 2026
Merged

impl(sprint-11/wave-D): D-CSV-7 MailboxSoA + D-CSV-6a WitnessCorpus core (parallel workers)#386
AdaWorldAPI merged 3 commits into
mainfrom
claude/sprint-11-wave-d-witness-mailbox

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Summary

Sprint-11 Wave D — Phase B substrate primitives, two parallel Sonnet workers branched from main (PR #383 D-CSV-1 + D-CSV-4 already on main).

D-CSV-7 (W-D1) — MailboxSoA<N> core in cognitive-shader-driver

NEW crates/cognitive-shader-driver/src/mailbox_soa.rs (~431 LOC, source + 9 tests).

  • pub struct MailboxSoA<const N: usize> with mailbox_id: MailboxId, per-row energy: [f32; N], plasticity_counter: [u8; N], last_emission_cycle: [u32; N], current_cycle: u32, w_slot: u8 (panics if ≥ 64 per L-6), threshold: f32
  • apply_edges(batons) — baton receipt with W-slot filter (mismatched edges silently dropped); energy accumulated as mantissa/8.0 × confidence; plasticity_counter saturating-add
  • emit(source) -> CollapseGateEmission — single-shot per cycle (last_emission_cycle guard); above-threshold rows produce batons via with_inference_mantissa(...).with_w_slot(...); emitted rows reset to 0
  • tick() advances cycle; reset_row(row) clears one row; pending_count() + inspectors
  • pub type DefaultMailboxSoA = MailboxSoA<1024>;

9 tests: zeros init, w_slot panic >63, accumulation, wrong-w-slot reject, out-of-range target reject, emit-above-thresh, emit-below-thresh-no-baton, double-emit-same-cycle-idempotent, tick-then-re-emit.

D-CSV-6a (W-D2) — WitnessCorpus core in lance-graph arigraph

NEW crates/lance-graph/src/graph/arigraph/witness_corpus.rs (~398 LOC, source + 8 tests).

  • WitnessEntry { spo: u64, timestamp_ns: u64, source_url: Option<String>, evidence_blob: Bytes } with tie_break_hash() (DefaultHasher of source_url; None → 0) and ord_key() = (timestamp_ns, tie_break_hash)
  • WitnessId(pub u64) opaque handle; CamPqIndexPlaceholder (D-CSV-6b replaces with real ndarray CAM-PQ wiring)
  • WitnessCorpus { entries: Arc<Vec<WitnessEntry>>, cam_pq_index } — copy-on-write via Arc::make_mut
  • insert(entry) -> WitnessId — binary-search position to maintain W5-INV-CHAIN-ORDER (timestamp_ns ASC + hash tie-break)
  • query(spo) -> impl Iterator — linear scan placeholder; D-CSV-6b swaps for CAM-PQ-backed lookup
  • iter(), len(), is_empty(), evict_stale_before(cutoff_ns) -> usize

8 tests: empty init, ord_key correctness, insert chain-order with reverse insertion, tie-break ordering, query SPO filter, unbounded 100-entry insert (W5-INV-WITNESS-UNBOUNDED), evict_stale_before threshold semantics, Arc CoW (clone shares; mutate splits).

crates/lance-graph/Cargo.toml adds bytes = "1" for WitnessEntry.evidence_blob.

Out of scope (follow-up PRs)

D-CSV-6b (next iteration): real CAM-PQ index integration via ndarray; cam_pq_search method; benches; WitnessCorpusStore 64-slot W-slot keyed array.

D-CSV-7 follow-ups: AttentionMask SoA / AttentionMaskActor (W6 §2-§3), ractor actor wrap (sprint-12 D-CSV-10), LRU eviction (sprint-12+), cross-cycle plasticity rollup (Zone 2; outside MailboxSoA scope per W6 §4.4).

Test plan

  • CI: cargo test --manifest-path crates/cognitive-shader-driver/Cargo.toml mailbox_soa — 9 tests
  • CI: cargo test -p lance-graph witness_corpus — 8 tests
  • CI: clippy + fmt clean

Local validation blocked by the same env constraints documented in PR #385 (cognitive-shader-driver workspace members/exclude conflict; lance-graph protoc dep). Worker reports clean; CI is the authoritative validator.

Process note (for the next loop iteration's hygiene write-up)

Wave D's branch carried two parallel-worker outputs from background Sonnet agents that wrote files into the shared workspace while main thread was rebasing #384/#385 for the merged-#383 conflict. Stashing across branches recovered all worker output cleanly. Worth a hygiene-process EPIPHANY entry next loop (the parallel-worker + background-rebase + stash-dance pattern is now confirmed-working but fragile; the failure mode is silent worker-write-loss between stash points).

https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS


Generated by Claude Code

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19a650e5a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// # Type alias
///
/// `DefaultMailboxSoA = MailboxSoA<1024>` — 4× current BindSpace row count.
pub struct MailboxSoA<const N: usize> {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Expose MailboxSoA from the crate

This new MailboxSoA implementation is never declared from crates/cognitive-shader-driver/src/lib.rs (I checked repo-wide for mailbox_soa/MailboxSoA, and only this file plus docs references exist), so Cargo will not compile it, export it, or run the unit tests in this file. As a result the D-CSV-7 surface added by this commit is unreachable to downstream users until the module is wired into the crate root.

Useful? React with 👍 / 👎.

Comment on lines +141 to +142
if self.last_emission_cycle[row] == self.current_cycle {
continue; // already emitted this cycle
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow first-cycle emissions

On a freshly constructed mailbox, current_cycle is 0 and every last_emission_cycle[row] is also initialized to 0, so this guard suppresses all rows on the first call to emit() even when their energy is already above threshold. Any caller that accumulates batons and emits before calling tick() will get an empty emission and stale energy until the next cycle; initialize the stamps to a sentinel or special-case rows that have not emitted yet.

Useful? React with 👍 / 👎.

AdaWorldAPI pushed a commit that referenced this pull request May 16, 2026
…ate-decisions knowledge doc

W-F10 — Sprint-11 meta-review (.claude/board/sprint-log-11/meta-review.md, 341 lines)
- Executive summary + sprint grade
- Per-PR grades for waves A-E (PRs #383..#387)
- Cross-sprint inconsistencies (CSI-1..6): TrustTexture ×2, v1-API-
  under-v2 alias anti-pattern (E-META-10 candidate), subagent
  permission isolation, SplatField/QualiaI4 bit-compat mirrors, plan
  §7.2 CONJECTURE-vs-FINDING ratification (OQ-CSV-1), bg-worker
  file-collision pattern
- Sprint-12 spawn decision YES with merge gates on Wave F + open
  PRs (#385 #386); recommended sprint-12 phase scope = SIMD vec for
  D-CSV-8 + ndarray streams productization + on-Think method
  migration for D-CSV-12 + Jirak-derived Σ10 threshold (TD-7)
- Per-worker grade placeholders for Wave F (W-F1..W-F12) — to be
  filled by the Opus meta-reviewer (W-Meta-Opus) when the fleet
  fully completes

W-F11 — i4-substrate-decisions knowledge doc (.claude/knowledge/, 200 lines)
- Tier-1 knowledge doc with READ BY: header
- i4 substrate doctrine: sign = direction, |magnitude| = NARS rule
  slot; i4 × i4 → i8 precision family
- All 20 locked decisions L-1..L-20 with one-sentence summary +
  shipping PR + canonical code site + deviations from plan
- Four-column SoA (EdgeColumn / QualiaColumn / MetaColumn /
  FingerprintColumns) — sprint-11 outcomes per column
- All six OQ-CSV-* ratifications recorded with wave evidence
- Codex P1 anti-pattern: 5 documented v1-API-under-v2-feature
  aliasing instances (temporal write, inference_type read,
  set_temporal no-op, pack raw discriminant, W3 spec temporal=1023)
- 12-mapping transcoder table (8 channels × NARS slots × Pearl
  rungs) with lossy-collapse equivalence classes
- Cross-refs: plan v1 + sprint-log-10/11 meta-reviews + STATUS_BOARD
  + PR_ARC + AGENT_LOG + TECH_DEBT + EPIPHANIES + TYPE_DUPLICATION_MAP
  + CLAUDE.md iron rules

Fleet status: 11 of 12 Sonnet workers complete; W-F12 (plan v2 draft)
still in flight. W-Meta-Opus (1 honest cross-cutting reviewer) dispatch
deferred until W-F12 finalizes.

https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS
claude added 3 commits May 16, 2026 04:03
…ore (parallel workers)

Wave D Phase B substrate primitives, two parallel Sonnet workers:

D-CSV-7 (W-D1) — MailboxSoA<N> core in cognitive-shader-driver
- NEW `crates/cognitive-shader-driver/src/mailbox_soa.rs` (~431 LOC,
  source + 9 tests).
- `pub struct MailboxSoA<const N: usize>` with `mailbox_id`, per-row
  `energy: [f32; N]`, `plasticity_counter: [u8; N]`,
  `last_emission_cycle: [u32; N]`, `current_cycle: u32`, `w_slot: u8`
  (panics if ≥ 64 per L-6), `threshold: f32`.
- `apply_edges(batons)` — baton receipt with W-slot filter (mismatched
  edges silently dropped); energy accumulated as
  `mantissa/8.0 × confidence`; plasticity_counter saturating-add.
- `emit(source) -> CollapseGateEmission` — single-shot per cycle
  (`last_emission_cycle` guard); above-threshold rows produce batons
  with `with_inference_mantissa(...)` + `with_w_slot(self.w_slot)`;
  emitted rows reset to 0.
- `tick()` advances cycle; `reset_row(row)` clears one row;
  `pending_count()`, `energy_at`, `plasticity_at`, `cycle`, `w_slot`
  inspectors.
- `pub type DefaultMailboxSoA = MailboxSoA<1024>;`
- 9 tests cover: zeros init, w_slot panic >63, accumulation,
  wrong-w-slot reject, out-of-range target reject, emit-above-thresh,
  emit-below-thresh-no-baton, double-emit-same-cycle-idempotent,
  tick-then-re-emit.

D-CSV-6a (W-D2) — WitnessCorpus core in lance-graph arigraph
- NEW `crates/lance-graph/src/graph/arigraph/witness_corpus.rs`
  (~398 LOC, source + 8 tests).
- `pub struct WitnessEntry { spo: u64, timestamp_ns: u64,
  source_url: Option<String>, evidence_blob: Bytes }` with
  `tie_break_hash()` (DefaultHasher of source_url; None → 0) and
  `ord_key() = (timestamp_ns, tie_break_hash)`.
- `pub struct WitnessId(pub u64)` — opaque handle from ord_key.
- `pub struct CamPqIndexPlaceholder` — empty unit; D-CSV-6b replaces
  with real ndarray CAM-PQ codec wiring. Out of scope here.
- `pub struct WitnessCorpus { entries: Arc<Vec<WitnessEntry>>,
  cam_pq_index: CamPqIndexPlaceholder }` — copy-on-write via
  `Arc::make_mut`.
- `insert(entry) -> WitnessId` — binary-search position to maintain
  W5-INV-CHAIN-ORDER (timestamp_ns ASC + hash tie-break).
- `query(spo) -> impl Iterator` — linear scan by SPO match; returns
  in chain order. D-CSV-6b will swap for CAM-PQ-backed lookup.
- `iter()`, `len()`, `is_empty()`, `evict_stale_before(cutoff_ns)`
  (returns count of evicted entries).
- 8 tests cover: empty init, ord_key correctness (None hash 0,
  same source_url → same hash), insert chain-order with reverse
  insertion, tie-break ordering, query SPO filter, unbounded
  100-entry insert (W5-INV-WITNESS-UNBOUNDED), evict_stale_before
  threshold semantics, Arc CoW (clone shares; mutate splits).

Out of scope (D-CSV-6b in follow-up PR)
- Real CAM-PQ index integration (ndarray hot-path wiring)
- `cam_pq_search` method (linear-scan `query()` is the placeholder)
- Benches
- WitnessCorpusStore (the 64-slot W-slot keyed array)

Out of scope (D-CSV-7 follow-ups)
- AttentionMask SoA / AttentionMaskActor (W6 spec §2-§3 — orthogonal)
- Ractor actor wrapping (sprint-12 Σ-tier dispatch in D-CSV-10)
- LRU eviction (sprint-12+)
- Cross-cycle plasticity rollup (Zone 2; outside MailboxSoA scope per
  W6 §4.4)

Cargo.toml: `crates/lance-graph` adds `bytes = "1"` (used by
WitnessEntry.evidence_blob). Cargo.lock files updated.

Validation note
The W-D1 + W-D2 workers may still be polishing; this commit captures
the current file state. If workers write additional refinements after
this commit, those land in a follow-up commit on the same branch.
Both workers report completion notifications fire when their cargo
test step finishes; main thread will validate via CI.

https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS
…l + lib re-export + ndarray hpc-extras

W-D1 worker completion notification (after the prior commit window)
landed three improvements:

1. **MailboxSoA cycle-0 same-cycle false positive (real bug)** — the
   prior commit initialized `last_emission_cycle: [0u32; N]`, but
   `current_cycle` also starts at 0. The `last_emission_cycle[row]
   == self.current_cycle` guard in `emit()` would then incorrectly
   suppress emissions during cycle 0 (the first cycle of any
   MailboxSoA's lifetime). Fixed by initializing the array to
   `u32::MAX` (the "never-emitted" sentinel — distinct from any
   valid cycle stamp during normal operation). `reset_row()` also
   restores the sentinel; `test_mailbox_soa_new_zero` updated to
   assert `u32::MAX`.

2. **`lib.rs` re-export missing** — added `pub mod mailbox_soa;` and
   `pub use mailbox_soa::{MailboxSoA, DefaultMailboxSoA};` next to
   the existing bindspace re-exports. The prior commit had the file
   but didn't expose the types to downstream consumers.

3. **`Cargo.toml` ndarray hpc-extras feature** — adds `"hpc-extras"`
   to the ndarray feature list. Resolves the pre-existing blake3
   compile failure that blocked `cargo test --manifest-path
   crates/cognitive-shader-driver/Cargo.toml` in this environment.
   Same fix W-C1 applied to PR #385's branch.

Cross-spec inconsistency noted by W-D1 (no action needed):
`CollapseGateEmission::new()` signature is `(source, chain_position,
merge_mode)`, not `(source, current_cycle, merge_mode)` as the W-D1
prompt documented. The `chain_position` field semantically maps to
`current_cycle` (per plan §8.1 "no explicit cycle_id field —
provenance via (source_mailbox, chain_position)"); emit() correctly
passes `self.current_cycle` as the `chain_position` arg. Naming
mismatch is a doc-comment polish for a future iteration.

Test status: **9/9 mailbox_soa tests pass; 65/65 lib tests pass total.**

https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS
Pre-existing assert_eq! macro single-line forms in W-D2's
witness_corpus.rs tests need multi-line wrapping per rustfmt 1.95
defaults. Pure mechanical reformat via `cargo fmt --manifest-path
crates/lance-graph/Cargo.toml`. No behavior change; 8/8 witness
tests still pass.

Same fmt-gate pattern as PR #383 (rustfmt 1.95 upgrade) and PR #384
(qualia.rs single-line guards).

https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS
@AdaWorldAPI AdaWorldAPI force-pushed the claude/sprint-11-wave-d-witness-mailbox branch from 73683f2 to f6a1f9f Compare May 16, 2026 04:03
AdaWorldAPI pushed a commit that referenced this pull request May 16, 2026
… lines)

W-F12 final Sonnet worker output. Plan v2 revision capturing sprint-
11 outcomes + sprint-12 forward plan.

Mirrors v1 structure with §0..§18; every changed section marked
[UPDATED 2026-05-16] / 🆕 vs v1 (21 annotations); unchanged sections
labeled UNCHANGED from v1.

Highlights:
- §0 status delta — Phase A/B/C outcomes: D-CSV-1/3/4 (#383), D-CSV-2
  (#384), D-CSV-5a/6a+7 (#385/#386), D-CSV-8+9 (#387), D-CSV-10
  (W-F1)
- §5 L-1..L-20 implementation-outcome annotations (PR #+commit+
  accessor file per row)
- §6/§8 UNCHANGED architecture, annotated with shipping commits +
  TD pointers for deviations (SmallVec)
- §11 D-CSV-* table — D-CSV-1..12 status; D-CSV-13/14/15 NEW Phase E
  sprint-12 entries (SIMD vec, on-Think method migration, Jirak Σ10)
- §12 OQ table — all 6 OQs annotated with ratification
- §13 Risk — 10 risks (vs 6 in v1); §13.7–13.10 new from sprint-11
  observations (subagent isolation, E-META-10 alias, two-TrustTexture)
- §15-§16 phasing + test growth — sprint-11 confirmed ~58 tests;
  sprint-12 projected ~70+

Fleet status: **12 of 12 Sonnet workers complete.** Honest cross-
cutting Opus meta-review (W-Meta-Opus) dispatched next.

https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS
AdaWorldAPI pushed a commit that referenced this pull request May 16, 2026
…ixes (CSI-7/8/9)

The Opus honest meta-review (final of the 12+1 fleet) graded sprint-11
+ Wave F at **B** (down from W-F10 Sonnet draft's B+) and surfaced 3
P0 integration gaps where worker output never reached the build path
because lib.rs / workspace registration was orphaned between worker
DONE and meta-review SPAWN. Fixed all three in this commit.

W-Meta-Opus review (~/sprint-log-11/meta-review-opus.md, 161 lines)
- Independent per-worker grades W-F1..W-F12 (W-F10 placeholders filled)
- CSI-7..13 cross-cutting findings missed by Sonnet drafts
- Sprint-11 grade: B (not B+) — Wave F integration discipline lapsed
- Recommends promoting E-META-10 (v1-API-under-v2 alias) to iron rule
  in CLAUDE.md alongside I-SUBSTRATE-MARKOV / I-NOISE-FLOOR-JIRAK
- Sprint-12 spawn recommendation: YES, conditional on Wave F + #386
  merge

P0 fix #1 — CSI-7: sigma-tier-router workspace registration
- Added `crates/sigma-tier-router` to `Cargo.toml` workspace `members`
- Removed the self-declared `[workspace]` table from
  `crates/sigma-tier-router/Cargo.toml` (it forced the crate into
  standalone mode, preventing parent-workspace inclusion)
- Validation: `cargo test --manifest-path crates/sigma-tier-router/Cargo.toml` — 12/12 tests pass; clean cargo check

P0 fix #2 — CSI-8: cognitive-shader-driver lib.rs gaps
- Added `pub mod attention_mask;` and `pub mod attention_mask_actor;`
  at the top of the pub-mod block (alphabetically before bindspace)
- W-F2 + W-F3 modules now reachable to downstream consumers; tests
  will execute on workspace cargo test

P0 fix #3 — CSI-9: ndarray hpc/stream/mod.rs (cross-repo, this commit
prepares ndarray for the companion change)
- Edited `/home/user/ndarray/src/hpc/stream/mod.rs` to register
  `pub mod qualia;` + `pub mod splat_field;` alongside the existing
  `pub mod inference;` (W-F5 had registered itself; W-F4/W-F6 left
  orphans)
- Re-exports: `QualiaI4Row`, `QualiaStream`, `SplatField`,
  `SplatFieldStream`
- Validation: `cargo test --lib hpc::stream` in ndarray — **18/18
  pass** (6 each × 3 streams)
- The ndarray-side change requires a separate commit + push to
  the `/home/user/ndarray` repo (its own git history); main thread
  will land that as a sibling PR

Aggregate Wave F test totals (verified via Opus review)
- Rust impl workers (W-F1/2/3/4/5/6/7): 60 tests across 7 files
- Governance/doc workers (W-F8/9/10/11/12): 5 markdown files, ~1500
  LOC docs
- Opus meta-review: 161 lines
- Total Wave F LOC: ~5000 (code + docs + plans)

Remaining gaps (per Opus review, NOT P0 but tracked)
- W-F2's local `type MailboxId = u32` shadow alias (CSI-10) → keep
  for back-compat; sprint-12 refactor consolidates
- E-META-10 promotion to iron rule → sprint-12 work
- ndarray companion PR for CSI-9 → sibling commit

https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS
@AdaWorldAPI AdaWorldAPI merged commit 33110c8 into main May 16, 2026
5 checks passed
AdaWorldAPI pushed a commit that referenced this pull request May 16, 2026
…ntries (#383..#390)

PP-9 (Opus) prepended 8 PR entries to PR_ARC_INVENTORY.md (1537→1903
lines, +366 / +50,619 bytes). APPEND-ONLY rule respected — no prior
entries touched. Top→bottom reverse chronological:

#390 sprint-12/wave-G (In PR, `bad0875`) — grade A−. D-CSV-5b cutover
   + D-CSV-6b WitnessCorpus + D-CSV-13 batch + D-CSV-15 Jirak math.
#389 sprint-12 wave-F codex P2 follow-up — AttentionMaskBackend impl
   + canonical MailboxId (CSI-10).
#388 sprint-12 Wave F fleet (12 Sonnet + 1 Opus) — grade B. D-CSV-
   10/11/12 scaffolds + AttentionMask + plan v2.
#387 sprint-11 Wave E — grade A−. D-CSV-8 MUL i4 scalar + D-CSV-9
   8-channel transcoder (Option R-3).
#386 sprint-11 Wave D — grade B+. D-CSV-7 MailboxSoA + D-CSV-6a
   WitnessCorpus core.
#385 sprint-11 Wave C — grade B+. D-CSV-5a sibling QualiaI4Column.
#384 sprint-11 Wave B — grade A. D-CSV-2 QualiaI4_16D + OQ-CSV-1
   Option α ratification.
#383 sprint-11 Wave A — grade A−. D-CSV-1 v2 layout + D-CSV-3 signed
   mantissa + D-CSV-4 CollapseGateEmission.

Every entry mirrors the #381/#379 template — Header / Confidence /
Added / Locked / Deferred / Docs / Cross-refs — with forward+backward
linkages (#383#385#390 D-CSV-5 chain; E-META-10 catch in #383 →
iron-rule promotion in #390 W-G5; etc.).

Total PR headers in file: 28 (was 20). 13 of 14 planners done.
Only PP-13 (brutally-honest-tester agent) still in flight.

https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS
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