feat(contract): canonicalise #489 — wire-in + self-describing Display + retire Phase-A wrapper#490
Conversation
… + retire Phase-A wrapper
OGAR/CLAUDE.md P0 audit of `canonical_node.rs` group-by-group:
- key: classid·HEEL·HIP·TWIG·family·identity (8·4·4·4·6·6 hex) — matches
- RFC-WAIVED ("No UUID ceremony") — matches
- 3×4 uniform tiers (each u16, tier-of-level = level>>2) — matches
- 16-byte EdgeBlock at fixed row offset — row-layout zero-fallback ladder
(default class reserves it, registry-resolved opt-out, "reserve-don't-
reclaim" applied at row level)
- self-describing Display — gap closed in this PR
Changes:
1. lib.rs: pub mod canonical_node; (size-asserts + tests now CI-enforced)
2. canonical_node.rs: impl Display emitting
`{classid:08x}-{heel:04x}-{hip:04x}-{twig:04x}-{family:06x}{identity:06x}`
so every printed GUID is self-describing at sight per canon. LE in-memory
bytes fold through the accessors so hex print is canon-ordered regardless.
3. Phase-A wrapper retired: identity.rs deleted (UUIDv8 NodeGuid + RFC
ceremony bits + IDENTITY_LAYOUT_VERSION + SHAPE_HASH_BITS/LOCAL_BITS —
all canon-incompatible per "wrappers adapt to the canon, never the
reverse"). lib.rs re-export switched to canonical_node::{EdgeBlock,
NodeGuid, NodeRow}.
4. Stale doc references reworded: hhtl.rs:192 (from_packed is a general HHTL
utility), lance-graph-ontology/src/registry.rs:405 (niblepath_of points
at the canon's classid·HEEL·HIP·TWIG resolution).
Tests: cargo test -p lance-graph-contract --lib → 594/594 green (−10
retired UUIDv8 tests, +2 Display, +8 wire-in canonical_node tests now
visible). cargo check -p lance-graph-ontology: clean (5 pre-existing
oxrdf::Subject deprecations in untouched files). cargo clippy -p
lance-graph-contract --all-targets -D warnings: clean.
Anchored on #482 (GUID canon) + #489 (canonical_node merged) + OGAR/CLAUDE.md
P0 (the canon: "wrappers audited against this canon group-by-group — never
the reverse").
https://claude.ai/code/session_01VysoWJ6vsyg3wEGc5v7T5v
📝 WalkthroughWalkthroughThis PR migrates canonical NodeGuid formatting from the retired ChangesCanonical Node Migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/lance-graph-contract/src/lib.rs`:
- Line 45: The crate removed the legacy identity namespace and the
IDENTITY_LAYOUT_VERSION symbol; restore a v1-compat identity bridge that
re-exports the canonical types and a compatibility constant and documents
migration: add an identity module in the crate root that pub use-s EdgeBlock,
NodeGuid, NodeRow from canonical_node (e.g. pub mod identity { pub use
crate::canonical_node::{EdgeBlock, NodeGuid, NodeRow}; pub const
IDENTITY_LAYOUT_VERSION: u32 = /* previous v1 value */; } ), mark the module
behind a feature (e.g. "v1-compat") if desired, and add a short doc comment on
the identity module pointing callers to the new canonical_node path and advising
migration to crate::canonical_node::{EdgeBlock, NodeGuid, NodeRow}; ensure
symbols match the existing names so downstream code using identity::NodeGuid or
IDENTITY_LAYOUT_VERSION continues to compile.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b3baf718-13d0-4d14-9d62-f5c3310a3287
📒 Files selected for processing (6)
.claude/board/AGENT_LOG.mdcrates/lance-graph-contract/src/canonical_node.rscrates/lance-graph-contract/src/hhtl.rscrates/lance-graph-contract/src/identity.rscrates/lance-graph-contract/src/lib.rscrates/lance-graph-ontology/src/registry.rs
💤 Files with no reviewable changes (1)
- crates/lance-graph-contract/src/identity.rs
…solution docs(plans): SoA migration diff resolution — catch-up audit + post-#490 supersession map
Summary
Operator pin: #489 is canonical. Audited
canonical_node.rsagainst OGAR/CLAUDE.md P0 group-by-group, closed the one wrapper gap (noDisplay), and retired the Phase-A wrapper now that the canon is settled.Canon audit (OGAR/CLAUDE.md P0 ↔
canonical_node.rs)classid= 8 hex = 4Bclassid: u32at[0..4]HEEL= 4 hex = 2Bheel: u16at[4..6]HIP= 4 hex = 2Bhip: u16at[6..8]TWIG= 4 hex = 2Btwig: u16at[8..10]family-basin-leaf= 6 hex = 3Bfamily: u24at[10..13]identity= 6 hex = 3Bidentity: u24at[13..16]level >> 2DisplayimplChanges
lib.rs:pub mod canonical_node;(theconst _: () = assert!(size_of…)size-locks and 8 unit tests are now CI-enforced).canonical_node.rs:impl Display for NodeGuidemitting{classid:08x}-{heel:04x}-{hip:04x}-{twig:04x}-{family:06x}{identity:06x}so every printed GUID is self-describing per canon. LE in-memory bytes fold through the accessors so hex print is canon-ordered regardless. +2 Display tests.identity.rsdeleted — UUIDv8 NodeGuid + RFC ceremony bits +IDENTITY_LAYOUT_VERSION+SHAPE_HASH_BITS/LOCAL_BITSwere all canon-incompatible per "wrappers adapt to the canon, never the reverse".lib.rsre-export switched:pub use identity::{NodeGuid, IDENTITY_LAYOUT_VERSION}→pub use canonical_node::{EdgeBlock, NodeGuid, NodeRow}.hhtl.rs:192(from_packedis a general HHTL utility, no longer identity-specific),lance-graph-ontology/src/registry.rs:405(niblepath_ofnow points at the canon'sclassid·HEEL·HIP·TWIGresolution).Tests
cargo test -p lance-graph-contract --lib→ 594/594 green (−10 retired UUIDv8 tests, +2 Display, +8 wire-in canonical_node tests now visible).cargo check -p lance-graph-ontology→ clean (5 pre-existingoxrdf::Subjectdeprecations in untouched files).cargo clippy -p lance-graph-contract --all-targets -- -D warnings→ clean.Out of scope
cargo check --workspace— failed locally on a disk-full duringaws-lc-sysC compilation (env, not code). CI will run it.u16tier = 2×u8 axes; classid prefix = codebook scope) but not key-wrapper concerns.Anchors
canonical_node(now wired + Display'd).Test plan
cargo test -p lance-graph-contract --libgreencargo clippy -p lance-graph-contract --all-targets -D warningscleancargo check -p lance-graph-ontologycleanhttps://claude.ai/code/session_01VysoWJ6vsyg3wEGc5v7T5v
Generated by Claude Code
Summary by CodeRabbit
New Features
Tests
Refactor
Documentation