Commit 19a650e
committed
impl(sprint-11/wave-D): D-CSV-7 MailboxSoA + D-CSV-6a WitnessCorpus core (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_01UwJuKqP828qyX1VkLgGJFS1 parent 03bd175 commit 19a650e
6 files changed
Lines changed: 867 additions & 1 deletion
File tree
- crates
- cognitive-shader-driver
- src
- lance-graph
- src/graph/arigraph
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments