feat: the symbiont contract surface — lance-graph-ogar (OGAR activation) + node_rows_from_le_bytes (zero-copy SoA read)#564
Conversation
…GAR separation) The OGAR half of the operator's clean separation: lance-graph-ontology = OGIT (TTL/RDF hydration spine) lance-graph-ogar = OGAR (Active-Record Class / ClassView / adapters) OGAR is the Active-Record Core and ALREADY speaks the contract: ogar-class-view::OgarClassView impl lance_graph_contract::ClassView (32 promoted concepts), ogar-vocab::Class = the AR shape (attributes + family Associations), canonical_concept_id == ClassId == NodeGuid.classid low u16. So the lance-graph side needs ACTIVATION, not a new bridge. NEW crates/lance-graph-ogar (EXCLUDED, own [workspace]): - re-exports the FULL OGAR AR surface: ogar-vocab + ogar-class-view + ogar-ontology + ogar-adapter-surrealql (+ OgarClassView / Class / contract) - parity-guard (parity::assert_codebook_parity): bijective ogar_codebook::CODEBOOK <-> ogar_vocab::class_ids::ALL + domain agreement; FAILS THE BUILD on codebook drift - features: default (light, emit-only) / surrealql-parser (the unmap() parser half, rust 1.95+) / serde - git-deps OGAR@main + lance-graph-contract@main = ONE contract source (same as ogar-class-view's) so the impl ClassView matches the trait the guard checks — NO [patch] (the symbiont alignment); a path+git mix = two types - .gitignore drops Cargo.lock (re-resolve to branch tip; living-activation, symbiont pattern) Auto-activation = Cargo presence (no runtime detection): a build pulling this crate gets the real OGAR Class/ClassView/codebook + full from_alias normalizer + the drift fuse; a build without it carries the contract's zero-dep ogar_codebook mirror + the bare ClassView trait (OGAR stays headless-capable — depending on the zero-dep contract is the compile-time handshake, not "needing lance-graph"). Contract stays zero-dep; OGAR never deps the lance-graph engine. Verified: cargo test --manifest-path crates/lance-graph-ogar/Cargo.toml 3/3 (parity bijection >=32 concepts, classid<->codebook-id identity, OgarClassView-is-a-ClassView); contract resolved to ONE source (git main #ff1a3452 = merged #563); clippy -D warnings + fmt clean; root workspace metadata valid (ogar correctly excluded). Board: AGENT_LOG (cont.13), LATEST_STATE IN-PR entry, EPIPHANIES E-OGAR-IS-AR-CORE-AUTOACTIVATED-BY-CARGO-PRESENCE, plan D-OVC-5. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
|
Warning Review limit reached
More reviews will be available in 22 minutes and 15 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3350d78e33
ℹ️ 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".
… (surrealdb second-brain primitive)
The inverse of NodeRowPacket::as_le_bytes (the WRITE cast): a CHECKED zero-copy
read of a &[NodeRow] out of an external LE byte buffer — the load-bearing
primitive for "a store hands lance-graph its SoA view without a copy."
node_rows_from_le_bytes(&[u8]) -> Option<&[NodeRow]>
- Some(view) iff len % 512 == 0 AND ptr % align_of::<NodeRow>() (64) == 0
- None otherwise (caller copies rather than risk UB); empty -> Some(&[])
- SAFETY documented: NodeRow is #[repr(C, align(64))], size 512
(const-asserted), every 512-byte pattern is a valid NodeRow.
This IS the LE contract a backing store satisfies: hand a 64-aligned,
512-multiple LE buffer and its bytes ARE the SoA the cognitive shader reads in
place. Intended consumer: surrealdb kv-lance storing each node as an
UNcompressed arrow FixedSizeBinary(512) blob (64-aligned value buffer) — then
surrealdb's bytes are a zero-copy &[NodeRow], a "second brain" sharing one byte
layout with no serialize boundary.
Brutal caveats documented in the fn + EPIPHANY:
- A variable-length Binary column does NOT qualify (no fixed stride / no align);
the SoA value path needs FixedSizeBinary(512).
- Value zero-copy holds only if the column is UNcompressed (a compressed column
decodes to a buffer first = one copy, still no per-field deserialize). The KEY
(address) is always zero-copy (OGAR canon: the key is never compressed).
Re-exported from lib.rs (+ NodeRowPacket). 2 tests (zero-copy round-trip with
ptr-identity assert; rejects non-multiple-512 + a misaligned-but-correct-length
window). 712 contract lib green; clippy -D warnings (default + guid-v2-tail) +
fmt clean.
Board: AGENT_LOG (cont.14), LATEST_STATE IN-PR entry, EPIPHANIES
E-SURREALDB-SECOND-BRAIN-IS-ZERO-COPY-IFF-FIXEDSIZEBINARY.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
… fuse codex P2 #1 (contract source unification): lance-graph + symbiont path-dep lance-graph-contract; lance-graph-ogar git-dep'd it, so when composed Cargo sees two distinct crates and OgarClassView impls the git ClassView, unusable where the engine expects the path one. Fix: path-dep ../lance-graph-contract (the canonical in-repo copy) + a [patch."…/lance-graph"] that folds ogar-class-view's transitive git contract onto the SAME path copy = one source. Documented the cargo limitation: an in-repo workspace root (symbiont) adding this crate MUST repeat the patch ([patch] only applies at the workspace root). codex P2 #2 (parity guard only ran in tests): the drift fuse was #[cfg(test)] only, so a downstream cargo build never ran it — the "fails the build on drift" claim was false for normal builds. Fix: added parity::COUNT_FUSE, a compile-time const assert (mirror::CODEBOOK.len() == ogar_vocab::class_ids::ALL.len()) that fires in ANY build (cargo build included) on add/remove drift; kept the runtime assert_codebook_parity for the full id/domain bijection (tested + callable at startup); corrected the docs to state both depths precisely (no overclaim). Re-verified: cargo test --manifest-path crates/lance-graph-ogar/Cargo.toml 3/3 (the ogar_class_view_implements_contract_class_view test compiling proves one-source unification), clippy -D warnings + fmt clean, no "patch not used". Board: AGENT_LOG (cont.15). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
…t patch)
The golden image was missing lance-graph-ogar: symbiont git-dep'd raw
ogar-vocab/ogar-ontology/ogar-adapter-surrealql but NOT the activation crate, so
it never linked ogar-class-view (impl lance_graph_contract::ClassView) or the
codebook parity-guard — i.e. the unified binary wasn't proving the OGAR
Active-Record surface compiles.
- add `lance-graph-ogar = { path = "../lance-graph-ogar", features =
["surrealql-parser"] }` (transitively pulls ogar-class-view + the parity guard).
- add `[patch."https://github.com/AdaWorldAPI/lance-graph"] lance-graph-contract =
{ path = "../lance-graph-contract" }` — REQUIRED (PR #564 CONSUMER REQUIREMENT):
symbiont is the workspace root, so lance-graph-ogar's own patch is ignored;
ogar-class-view git-deps contract@main and must unify onto symbiont's path copy,
else OgarClassView's `impl ClassView` won't typecheck against the engine's.
Docker needs no change: the Dockerfile runs `cargo build` on symbiont's manifest
and lance-graph-ogar is in-repo (already COPY'd in) — cargo-missing == docker-missing.
Verified by resolve (`cargo metadata` exit 0): lance-graph-ogar + ogar-class-view
now in the golden-image graph; lance-graph-contract instances = 1 (the path copy)
→ patch folded the git contract onto one source; no "patch not used" warning.
Full compile is the Railway/CI build-validation job (protoc + lance7 + surrealdb).
Board: AGENT_LOG (cont.18).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
Two related commits that together form the contract surface for the symbiont (the full-stack golden image): activate OGAR's Active-Record surface, and add the zero-copy LE read contract that lets a Lance-backed store (surrealdb kv-lance) become a zero-copy "second brain."
1 —
lance-graph-ogaractivation crate (clean OGIT/OGAR separation)OGAR is the AR Core and already speaks the contract:
ogar-class-view::OgarClassViewimpl lance_graph_contract::ClassView(32 promoted concepts),ogar-vocab::Class= the AR shape,canonical_concept_id == ClassId == NodeGuid.classidlow u16. The new EXCLUDED crate (own[workspace], git-deps OGAR@main + contract@main = one source, no[patch]) re-exports the full AR surface + a parity-guard (bijectiveogar_codebook::CODEBOOK ⇄ ogar_vocab::class_ids::ALL, fails the build on drift). Auto-activation = Cargo presence; OGAR stays headless-capable. 3/3 tests green.2 —
node_rows_from_le_bytes— zero-copy SoA read contractThe inverse of
NodeRowPacket::as_le_bytes(the WRITE cast):node_rows_from_le_bytes(&[u8]) -> Option<&[NodeRow]>, a checked zero-copy read (len % 512 == 0ANDptr % 64 == 0, elseNone→ caller copies, no UB). This IS the LE contract a backing store satisfies so its bytes ARE the SoA the cognitive shader reads in place.Brutal feasibility verdict (grounded in both repos): lance-graph side is now zero-copy-ready end-to-end. surrealdb's
kv-lancedoes NOT qualify as scaffolded (val: DataType::Binaryvariable-length → needsFixedSizeBinary(512)); and value zero-copy holds only if the column is uncompressed (key/address always zero-copy, per OGAR canon). The surrealdb-sideFixedSizeBinary(512)SoA value path is the follow-up (its.claude/lance-backendwiring).Verification
cargo test --manifest-path crates/lance-graph-ogar/Cargo.toml→ 3/3 (one contract source = git main #ff1a3452)cargo test -p lance-graph-contract --lib→ 712 (+2 zero-copy reader)-D warnings --all-targets(default +guid-v2-tail) + fmt clean; root workspace metadata validBoard: AGENT_LOG (cont.¹³/¹⁴), LATEST_STATE, EPIPHANIES
E-OGAR-IS-AR-CORE-AUTOACTIVATED-BY-CARGO-PRESENCE+E-SURREALDB-SECOND-BRAIN-IS-ZERO-COPY-IFF-FIXEDSIZEBINARY, plan D-OVC-5.🤖 Generated with Claude Code