Repository navigation
report: AbiBatch lanes through the DT64 lane socket (D-LANESOCK-2) #1969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+900
−3
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8d11da0
report: AbiBatch lanes through the DT64 lane socket (D-LANESOCK-2)
claude 3c5a3e5
report: falsifiers for the old row order and a foreign frame store
claude 26dfc6d
ontology: pin RegistryClassView concept-half key and its DOLCE defect…
claude e3fd38b
report: cap a batch at the u16 lane space; checked lane index
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| 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, | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.