Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .claude/board/LATEST_STATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2026-11-06 — branch `ccr-fd2682ed-sai06j-abi-lanes` (D-LANESOCK-2, in PR)

- `lance-graph-report::AbiLanes` (`lane_source` module): `LaneSource` over a resident `AbiBatch`; `PublishRefusal`. Field positions via ClassView basis → `Catalog` → `FieldId`; I32/U32 lanes only; one `FrameStore` per source over `(SourceId, generation)`. No production constructor (no DR reader-scope witness); test-only feature `unwitnessed-scope`.
- `rust-test.yml` now runs the `lance-graph-report` tests (plain and the lane-socket suite).
- Open: value ingress, durable writer, codebook, exact decimal, D4/S-INGRESS; `RegistryClassView` `entity_type_id` vs concept-key DOLCE defect.

## 2026-11-06 — main after #1964–#1967 (merged `9ca5daa`), OGAR #371

- OGAR `ogar_dir_core::correspond::Output::entra_mailbox`: the fold's sole Entra→EXO row ordinal (`NO_ROW` for none or several). `Ruler::from_fold` reads it instead of re-merging.
Expand Down
1 change: 1 addition & 0 deletions .claude/board/STATUS_BOARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
| --- | --- | --- |
| D-LANESOCK-0 | normative spec: socket, joint version witness, refusals | Shipped (#1966) |
| D-LANESOCK-1 | `LaneSource` + `BindStore::bind_lanes` + falsifiers in lance-graph-dt64 and the dir-sim lab | Shipped (#1967) |
| D-LANESOCK-2 | `AbiLanes`: resident `AbiBatch` I32/U32 lanes through `LaneSource` (read adapter; no production constructor until a DR reader-scope witness exists) | In PR |

## D-CGMM — Lazy Codegraph fact/demand + MeTTa class-method scratch (2026-11-04)

Expand Down
27 changes: 27 additions & 0 deletions .claude/board/entries/2026-11-06-abibatch-lane-socket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# AbiBatch lanes through the DT64 lane socket (D-LANESOCK-2)

**Date:** 2026-11-06. **Status:** read adapter, not production-admitted (no authoritative reader-scope witness). Follows D-LANESOCK-1 (#1967).

## What it is

`lance_graph_report::AbiLanes` implements `lance_graph_dt64::LaneSource` over a resident `AbiBatch`:
- field position → `ClassView::fields(view_class(class))[pos].predicate_iri` → `Catalog` → `FieldId` → `AbiBatch::column` lane index;
- `borrow` hands out the batch's own `Arc` lane as `LaneRef` (pointer equality tested);
- one `FrameStore` per source, revisions `(SourceId, 0, generation)`; `publish` takes a later generation of the same source and advances it;
- `I32` / `U32` only; a `U64` reference lane is unbound.

DT64 binds the class and admits the method; Quack / mask-RISC folds. No store, field registry, codebook or BindStore was added.

## Admission scope

- Reader scope: DR's `Scope` is a plain `{ id }` with no issuer. `AbiLanes` has no production constructor; `AbiLanes::unwitnessed` exists only under the test-only feature `unwitnessed-scope`.
- No writer: a read adapter over resident lanes.
- Open, unchanged: value ingress, durable writer, codebook, exact decimal, D4/S-INGRESS.

## Falsifiers (`crates/lance-graph-report/tests/lane_socket.rs`)

Borrowing (pointer equality), scalar parity on two folds with one binding, reuse with zero hot allocations, published replacement refuses the old binding, old row order refused after a publish, foreign frame, another source's frame + store, wrong route, incompatible coordinate space, unknown / absent / `U64` field, field outside the basis, foreign scope. Disable runs (committed first): admitting `U64`, copying the lane, skipping the frame advance, dropping the generation from the coordinate space, an allocation in `lane_of`, and dropping the adapter's own frame check each turn a test red.

## RegistryClassView

`class_resolver::tests::concept_half_keys_the_basis_but_not_the_registry_category`: keyed by `classid_concept` (= DT64 `view_class`), the basis resolves. Defect pinned, not fixed: `dolce_category_id` / `is_known` read the same key as the registry's append-order `entity_type_id`, so a registered class's DOLCE category is unreachable through the concept key.
3 changes: 2 additions & 1 deletion .claude/board/entries/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ index row, (3) no duplicate entry id. Checks 1 and 2 are deliberately
opposite directions; the stranding this convention prevents shows up in
exactly one of them, never both.

580 entries, 2026-08-06 .. 2026-11-06.
581 entries, 2026-08-06 .. 2026-11-06.

| date | entry id | finding | file |
|---|---|---|---|
| 2026-11-06 | `ruler-plane-batch-selection-lab` | | [2026-11-06-ruler-plane-batch-selection-lab.md](2026-11-06-ruler-plane-batch-selection-lab.md) |
| 2026-11-06 | `D-LANESOCK-2` | | [2026-11-06-abibatch-lane-socket.md](2026-11-06-abibatch-lane-socket.md) |
| 2026-11-05 | `hybrid-ordinal-chain-lab-v2` | | [2026-11-05-hybrid-ordinal-chain-lab-v2.md](2026-11-05-hybrid-ordinal-chain-lab-v2.md) |
| 2026-11-05 | `coresearch-workbook-hypercube-soa-projection` | | [2026-11-05-coresearch-workbook-hypercube-soa-projection.md](2026-11-05-coresearch-workbook-hypercube-soa-projection.md) |
| 2026-11-04 | `D-DRIVER-ZC-0` | | [2026-11-04-d-driver-zc-0-virtual-bus-contract.md](2026-11-04-d-driver-zc-0-virtual-bus-contract.md) |
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ jobs:
run: cargo test --manifest-path crates/lance-graph-dt64/Cargo.toml
- name: Run xlog tests
run: cargo test --manifest-path crates/lance-graph-xlog/Cargo.toml
# lance-graph-report: no workflow ran its tests. The second line runs the
# D-LANESOCK-2 socket suite, which needs the test-only `unwitnessed-scope`
# feature (the reader scope there is the test's assertion, not a DR
# witness) and is skipped by the plain run.
- name: Run report tests
run: cargo test --manifest-path crates/lance-graph-report/Cargo.toml
- name: Run report lane-socket tests (test-only scope)
run: cargo test --manifest-path crates/lance-graph-report/Cargo.toml --features unwitnessed-scope --test lane_socket
# lance-graph-codegraph is workspace-EXCLUDED (own [workspace], as
# sag-ra-probe), so no line above reaches it. Its suites pin the atomic
# refresh (a refused refresh changes nothing; a retry equals the refresh
Expand Down
60 changes: 60 additions & 0 deletions crates/lance-graph-ontology/src/class_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,66 @@ mod tests {
assert_eq!(cv.dolce_category_id(7), dolce_id::ENDURANT);
}

/// DT64 reads a basis with `view.fields(view_class(classid))`, and
/// `view_class` is `classid_concept`: the canon half under the codebook's
/// active split. Keyed by that half, the field basis resolves.
///
/// DEFECT, pinned as it stands (not fixed here): `dolce_category_id` and
/// `is_known` look the same key up as the registry's `entity_type_id`,
/// which is minted in append order and is not the OGAR concept. The
/// category of a registered class is therefore unreachable through the
/// concept key. When the registry learns a concept → entity_type link,
/// this test fails and must be re-pinned.
#[test]
fn concept_half_keys_the_basis_but_not_the_registry_category() {
use crate::namespace::OgitUri;
use crate::{MappingProposal, MappingProposalKind};
use lance_graph_contract::ogar_codebook::{classid_concept, compose_classid};
use lance_graph_contract::property::{Marking, Schema};

let uri = "ogit.Odoo:account.move";
assert_eq!(classify_odoo(uri), DolceCategory::Perdurant, "precondition");
let parsed = OgitUri::parse(uri).unwrap();
let reg = OntologyRegistry::new_in_memory();
let handle = reg
.append_mapping(MappingProposal {
public_name: "AccountMove".into(),
bridge_id: "odoo".into(),
namespace: parsed.namespace().unwrap().to_string(),
ogit_uri: parsed,
kind: MappingProposalKind::Entity {
schema: Schema::builder("account.move").build(),
},
marking: Marking::Internal,
confidence: 1.0,
source_uri: "test://account.move".into(),
checksum: "ck-account.move".into(),
created_by: "test".into(),
})
.unwrap();
let entity_type = handle.schema_ptr.entity_type_id();

let concept: ClassId = 0x0C1C;
let classid = compose_classid(concept, 1);
assert_eq!(classid_concept(classid), concept);
assert_ne!(classid as u16, concept, "the low half is not the key");

let mut views = HashMap::new();
views.insert(classid_concept(classid), invoice_view());
let cv = RegistryClassView::new(&reg, views);

// Compatible: the basis DT64 reads.
assert_eq!(cv.fields(classid_concept(classid)).len(), 3);
assert!(cv.fields(classid as u16).is_empty());

// The defect: the concept key misses the registered row.
assert_ne!(entity_type, concept);
assert!(!cv.is_known(concept));
assert_eq!(cv.dolce_category_id(concept), dolce_id::ENDURANT);
assert!(cv.is_known(entity_type));
assert_eq!(cv.dolce_category_id(entity_type), dolce_id::PERDURANT);
}

#[test]
fn dolce_id_mapping_is_total_and_stable() {
assert_eq!(dolce_to_id(DolceCategory::Endurant), dolce_id::ENDURANT);
Expand Down
13 changes: 13 additions & 0 deletions crates/lance-graph-report/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,18 @@ lance-graph-quack = { path = "../lance-graph-quack" }
lance-graph-mask-risc = { path = "../lance-graph-mask-risc" }
# ContentId / ContentStore / ContentSink: the KV ownership surface (zero-dep).
lance-graph-contract = { path = "../lance-graph-contract" }
# The DT64 lane socket (`lane_source`). Depends on the contract only, so
# report -> dt64 adds no cycle.
lance-graph-dt64 = { path = "../lance-graph-dt64" }

[features]
# TEST ONLY: exposes `AbiLanes::unwitnessed`, which takes a reader scope from
# the caller. DR has no authoritative scope issuer, so no production build
# may enable this.
unwitnessed-scope = []

[[test]]
name = "lane_socket"
required-features = ["unwitnessed-scope"]

[dev-dependencies]
11 changes: 10 additions & 1 deletion crates/lance-graph-report/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@ pub enum BatchError {
DuplicateField(FieldId),
/// Two masks share an id, or a mask claimed [`MaskId::ALPHA`].
DuplicateMask(MaskId),
/// The batch already holds [`MAX_COLUMNS`] columns: another one would
/// have no `u16` lane index.
TooManyColumns(FieldId),
}

/// The most columns a batch holds: every lane index fits a `u16`.
pub const MAX_COLUMNS: usize = u16::MAX as usize + 1;

/// The resident population a report is evaluated over.
///
/// Plane 0 is always the validity plane ([`MaskId::ALPHA`]): the table IS its
Expand Down Expand Up @@ -156,6 +162,9 @@ impl AbiBatch {
if column.domain.is_some() && !matches!(column.lane, LaneData::U32(_)) {
return Err(BatchError::DomainOnNonOrdinalLane(column.field));
}
if self.columns.len() >= MAX_COLUMNS {
return Err(BatchError::TooManyColumns(column.field));
}
if self.columns.iter().any(|c| c.field == column.field) {
return Err(BatchError::DuplicateField(column.field));
}
Expand Down Expand Up @@ -208,7 +217,7 @@ impl AbiBatch {
.iter()
.enumerate()
.find(|(_, c)| c.field == field)
.map(|(i, c)| (i as u16, c))
.and_then(|(i, c)| u16::try_from(i).ok().map(|i| (i, c)))
}

/// Plane index of a resident mask, or `None` when no resident mask has
Expand Down
183 changes: 183 additions & 0 deletions crates/lance-graph-report/src/lane_source.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
//! The DT64 lane socket over a resident [`AbiBatch`] (D-LANESOCK-2).
//!
//! [`AbiLanes`] implements [`LaneSource`] for lanes this crate already holds.
//! It binds nothing itself and owns no field table:
//!
//! - **WHAT / WHICH BEHAVIOUR** is DT64's: `BindStore::bind_lanes` resolves the
//! class, its schema revision and its field basis, and `BindStore::admit`
//! admits the method.
//! - **WHERE** is the frame's: one [`FrameStore`] per source, whose revisions
//! are `(SourceId, relation map, generation)`. Publishing a replacement batch
//! advances it, so every binding sealed under the old batch is refused.
//! - **VALUES** stay in the batch: `borrow` hands out the batch's own `Arc`
//! lane as a `LaneRef`. Nothing is copied.
//! - **HOW** is Quack / mask-RISC, over the borrowed lanes.
//!
//! A field position resolves through the same [`ClassView`] basis DT64 checked
//! (`view.fields(view_class(class))[field].predicate_iri`), then the
//! [`Catalog`] (name → [`FieldId`]), then [`AbiBatch::column`] (FieldId → lane
//! index). Name lookup happens per bind and per check, never per row.
//!
//! ## Admission scope
//!
//! - **Value kinds:** `I32` and `U32` lanes only. A `U64` reference lane is
//! unbound. Exact decimal and workbook values are not admitted here.
//! - **Reader scope: NOT production-admitted.** DR has no authoritative issuer
//! of a reader [`Scope`] (it is a plain `{ id }` value), so this adapter
//! cannot certify which scope a batch serves. Its only constructor,
//! [`AbiLanes::unwitnessed`], exists under the test-only feature
//! `unwitnessed-scope` and takes the scope from the caller. A default build
//! has no way to construct an `AbiLanes`.
//! - **Writer:** none. This is a read adapter over resident lanes; durable
//! value ingress is out of scope.

use std::sync::Arc;

use lance_graph_contract::class_view::ClassView;
use lance_graph_dt64::dr::{Frame, FrameRevisions, FrameStore, Scope};
use lance_graph_dt64::{view_class, CoordSpace, LaneAddr, LaneSource, SchemaRev};
use lance_graph_mask_risc::LaneRef;

use crate::batch::{AbiBatch, LaneData};
use crate::boundary::Catalog;
use crate::ids::SourceId;

/// The relation-map revision of every frame this adapter seals. The adapter
/// holds no relation map; the revision is fixed so that only a change of
/// source or generation moves the frame.
pub const RELATION_MAP: u64 = 0;

/// Why a replacement batch was refused.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PublishRefusal {
/// The replacement belongs to another source.
ForeignSource { bound: SourceId, offered: SourceId },
/// The replacement's generation does not exceed the current one.
StaleGeneration { current: u32, offered: u32 },
}

/// A resident batch presented to DT64's lane socket.
#[derive(Debug)]
pub struct AbiLanes<'v, V: ClassView + ?Sized> {
view: &'v V,
catalog: &'v Catalog,
batch: Arc<AbiBatch>,
frames: FrameStore,
scope: Scope,
}

impl<'v, V: ClassView + ?Sized> AbiLanes<'v, V> {
/// TEST ONLY. The caller asserts which reader scope the batch serves; no
/// DR authority stands behind it, which is why this constructor is not
/// available in a default build.
#[cfg(feature = "unwitnessed-scope")]
pub fn unwitnessed(
view: &'v V,
catalog: &'v Catalog,
batch: Arc<AbiBatch>,
scope: Scope,
) -> Self {
let frames = FrameStore::new(revisions_of(&batch));
Self {
view,
catalog,
batch,
frames,
scope,
}
}

/// The frame owner for this source. Pass it to `BindStore::bind_lanes`
/// and `LaneBinding::check`.
pub fn frames(&self) -> &FrameStore {
&self.frames
}

/// The current frame.
pub fn seal(&self) -> Frame {
self.frames.seal()
}

/// The row order of the current batch.
pub fn space(&self) -> CoordSpace {
space_of(&self.batch)
}

/// The resident batch.
pub fn batch(&self) -> &Arc<AbiBatch> {
&self.batch
}

/// Replace the batch with a later generation of the same source and
/// advance the frame. Every binding sealed before is refused afterwards.
pub fn publish(&mut self, batch: Arc<AbiBatch>) -> Result<Frame, PublishRefusal> {
if batch.source() != self.batch.source() {
return Err(PublishRefusal::ForeignSource {
bound: self.batch.source(),
offered: batch.source(),
});
}
if batch.generation() <= self.batch.generation() {
return Err(PublishRefusal::StaleGeneration {
current: self.batch.generation(),
offered: batch.generation(),
});
}
self.frames.advance(revisions_of(&batch));
self.batch = batch;
Ok(self.frames.seal())
}
}

fn revisions_of(batch: &AbiBatch) -> FrameRevisions {
FrameRevisions {
source: u64::from(batch.source().0),
relation_map: RELATION_MAP,
coordinates: u64::from(batch.generation()),
}
}

fn space_of(batch: &AbiBatch) -> CoordSpace {
CoordSpace {
population: u64::from(batch.source().0),
coordinates: u64::from(batch.generation()),
}
}

impl<V: ClassView + ?Sized> LaneSource for AbiLanes<'_, V> {
type Lane<'a>
= LaneRef<'a>
where
Self: 'a;

fn lane_of(&self, class: u32, _rev: SchemaRev, field: u8, frame: &Frame) -> Option<LaneAddr> {
// Only this source's current frame addresses its lanes.
self.frames.check(frame).ok()?;
let name = &self
.view
.fields(view_class(class))
.get(usize::from(field))?
.predicate_iri;
let id = self.catalog.field(name)?;
let (lane, column) = self.batch.column(id)?;
match column.lane {
LaneData::I32(_) | LaneData::U32(_) => Some(LaneAddr {
space: space_of(&self.batch),
lane,
Comment thread
AdaWorldAPI marked this conversation as resolved.
Resolved
scope: self.scope,
}),
LaneData::U64(_) => None,
}
}

fn borrow(&self, addr: &LaneAddr) -> Option<LaneRef<'_>> {
if addr.space != space_of(&self.batch) || addr.scope != self.scope {
return None;
}
match &self.batch.columns().get(usize::from(addr.lane))?.lane {
LaneData::I32(v) => Some(LaneRef::I32(v)),
LaneData::U32(v) => Some(LaneRef::U32(v)),
LaneData::U64(_) => None,
}
}
}
4 changes: 3 additions & 1 deletion crates/lance-graph-report/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ pub mod boundary;
pub mod exec;
pub mod explain;
pub mod ids;
pub mod lane_source;
pub mod plan;
pub mod render;
pub mod result;
pub mod selection;

pub use batch::{AbiBatch, BatchError, Column, LaneData};
pub use batch::{AbiBatch, BatchError, Column, LaneData, MAX_COLUMNS};
pub use exec::{Accumulator, ExecStats, PhysicalPlan, PlannerPolicy, Provider, SelectionCarrier};
pub use ids::{FieldId, MaskId, SourceId};
pub use lane_source::{AbiLanes, PublishRefusal};
pub use plan::{
AxisRole, AxisSpec, CellValue, CoordSpec, FoldState, Measure, MeasureKind, PhysicalKey,
ReportPlan, SourceRef, TopK,
Expand Down
Loading
Loading