contract: un-gate mint_for + default-on guid-v3-tail; route ocr/aiwar mints#663
contract: un-gate mint_for + default-on guid-v3-tail; route ocr/aiwar mints#663AdaWorldAPI wants to merge 1 commit into
Conversation
… mints Executes the structural half of ISS-V1-TAIL-RESIDUE (operator ruling 2026-07-04, "default-on guid-v3-tail now so production mints route through mint_for in every build"). - canonical_node.rs: `mint_for` moved to an unconditional `impl NodeGuid` — V1 arm always available; V2/V3 arms feature-gated (`guid-v2-tail`) with a dead V1 fallback so `--no-default-features` still compiles. - Cargo.toml: `default = ["guid-v3-tail"]` — every normal build has the V3 mint path. - ocr.rs + aiwar.rs: route through `mint_for(classid_read_mode(c).tail_variant, …)` instead of hardcoded `NodeGuid::new`. ocr is classid-param-driven (V3- ready). aiwar stays on the V1 `CLASSID_OSINT` (see below), behavior-preserving. - .claude/commands/v3-audit.md: check #6 forbids `NodeGuid::new(` in non-test production code (mechanical guard). Discovered blocker (documented, deferred): flipping aiwar to `CLASSID_OSINT_V3` broke `projects_to_family_node_graph` — the V3 tail puts `family` at bytes 12..14 (u16) but `soa_graph::project_snapshot` reads it via the V1 `family()` u24 accessor. So aiwar's V3-classid flip is now gated on making that consumer tail-aware (I-LEGACY-API-FEATURE-GATED), not on the feature gate the issue originally named. ISSUES.md carries the progress + remaining work. Verification: 854 contract lib tests green (default); `--no-default-features` compiles; `lance-graph` + `lance-graph-planner` check clean (default-on propagates safely); fmt + clippy clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MLBnPuScZy6w9di2QEjsXM
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_ce8a3e4a-1ac6-4c8c-8921-6c21a7586a7a) |
📝 WalkthroughWalkthroughThis PR un-gates ChangesV1-Tail-Residue Migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/lance-graph-contract/src/aiwar.rs (1)
112-125: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winClarify the V3 note in
crates/lance-graph-contract/src/aiwar.rs:112-125:mint_fordoes not narrowfamily/identityautomatically; the V2/V3 arm asserts both fit in 16 bits and panics otherwise, so the& 0x00FF_FFFFmasks must be tightened if this path ever flips.🤖 Prompt for 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. In `@crates/lance-graph-contract/src/aiwar.rs` around lines 112 - 125, The `NodeGuid::mint_for` call in `aiwar.rs` is annotated as if V3 would automatically narrow `family` and `identity`, but the `V2/V3` path actually asserts 16-bit fit and will panic if those values exceed it. Update the comment and the masking logic around the `mint_for` invocation so it reflects the real behavior, and tighten the `fam`/`identity` masks to 16 bits if this path can ever switch to V3.
🧹 Nitpick comments (2)
crates/lance-graph-contract/src/ocr.rs (1)
104-132: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winRedundant
classid_read_mode(classid)lookup.
classid_read_mode(classid)is invoked twice — once at Line 105 for.value_schemaand again at Line 124 for.tail_variant— for the sameclassidwithin the same call. SinceReadModeappears to carry both fields, cache the result once and reuse it.♻️ Proposed refactor
pub fn to_node_row(&self, classid: u32, identity: u32) -> NodeRow { - let schema = classid_read_mode(classid).value_schema; + let mode = classid_read_mode(classid); + let schema = mode.value_schema; let mut value = [0u8; VALUE_SLAB_LEN]; @@ key: NodeGuid::mint_for( - classid_read_mode(classid).tail_variant, + mode.tail_variant, classid,🤖 Prompt for 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. In `@crates/lance-graph-contract/src/ocr.rs` around lines 104 - 132, The to_node_row method is doing the same classid_read_mode(classid) lookup twice for one call. Cache the returned ReadMode once at the start of to_node_row, then reuse its value_schema and tail_variant fields when building the NodeRow. This keeps the logic in to_node_row unchanged while removing the redundant lookup.crates/lance-graph-contract/src/aiwar.rs (1)
75-131: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winHoist
classid_read_mode(osint_classid)out of the per-row closure.
osint_classidis loop-invariant (fixed at Line 81), butclassid_read_mode(osint_classid).tail_variant(Line 117) is re-resolved inside.map()on every row. Hoist it once before the.map()call to avoid a redundant lookup per graph node.♻️ Proposed refactor
let view = AiwarClassView::from_graph(graph); let ids = graph.all_node_ids(); + let tail_variant = classid_read_mode(osint_classid).tail_variant; let fam_of = |id: &str| -> Option<u32> { graph.node(id).and_then(|n| view.family_of(&n.label)) }; ids.iter() .enumerate() .map(|(i, id)| { @@ key: NodeGuid::mint_for( - classid_read_mode(osint_classid).tail_variant, + tail_variant, osint_classid,🤖 Prompt for 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. In `@crates/lance-graph-contract/src/aiwar.rs` around lines 75 - 131, The per-row closure in the `ids.iter().enumerate().map(...)` pipeline is re-resolving `classid_read_mode(osint_classid).tail_variant` for every `NodeRow`, even though `osint_classid` is ثابت and invariant. Hoist the `classid_read_mode(osint_classid)` result (or at least its `tail_variant`) once before the `.map()` call in `aiwar.rs`, then reuse that value inside `NodeGuid::mint_for` so the lookup happens only once per batch instead of once per node.
🤖 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.
Outside diff comments:
In `@crates/lance-graph-contract/src/aiwar.rs`:
- Around line 112-125: The `NodeGuid::mint_for` call in `aiwar.rs` is annotated
as if V3 would automatically narrow `family` and `identity`, but the `V2/V3`
path actually asserts 16-bit fit and will panic if those values exceed it.
Update the comment and the masking logic around the `mint_for` invocation so it
reflects the real behavior, and tighten the `fam`/`identity` masks to 16 bits if
this path can ever switch to V3.
---
Nitpick comments:
In `@crates/lance-graph-contract/src/aiwar.rs`:
- Around line 75-131: The per-row closure in the
`ids.iter().enumerate().map(...)` pipeline is re-resolving
`classid_read_mode(osint_classid).tail_variant` for every `NodeRow`, even though
`osint_classid` is ثابت and invariant. Hoist the
`classid_read_mode(osint_classid)` result (or at least its `tail_variant`) once
before the `.map()` call in `aiwar.rs`, then reuse that value inside
`NodeGuid::mint_for` so the lookup happens only once per batch instead of once
per node.
In `@crates/lance-graph-contract/src/ocr.rs`:
- Around line 104-132: The to_node_row method is doing the same
classid_read_mode(classid) lookup twice for one call. Cache the returned
ReadMode once at the start of to_node_row, then reuse its value_schema and
tail_variant fields when building the NodeRow. This keeps the logic in
to_node_row unchanged while removing the redundant lookup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5b4fb986-befb-4ad7-ba34-da9ccfeae001
📒 Files selected for processing (6)
.claude/board/ISSUES.md.claude/commands/v3-audit.mdcrates/lance-graph-contract/Cargo.tomlcrates/lance-graph-contract/src/aiwar.rscrates/lance-graph-contract/src/canonical_node.rscrates/lance-graph-contract/src/ocr.rs
What
Executes the structural half of
ISS-V1-TAIL-RESIDUE(operator ruling 2026-07-04: "default-onguid-v3-tailnow so production mints route throughmint_forin every build").Changes
canonical_node.rs—mint_formoved to an unconditionalimpl NodeGuid: V1 arm always available; V2/V3 arms feature-gated (guid-v2-tail) with a dead V1 fallback so--no-default-featuresstill compiles.lance-graph-contract/Cargo.toml—default = ["guid-v3-tail"]. Every normal build has the V3 mint path.ocr.rs+aiwar.rs— route throughmint_for(classid_read_mode(c).tail_variant, …)instead of hardcodedNodeGuid::new.ocris classid-param-driven (V3-ready);aiwarstays on the V1CLASSID_OSINT(behavior-preserving — see below)..claude/commands/v3-audit.md— check feat(graph): add SPO triple store with bitmap ANN, TruthGate, semirin… #6 forbidsNodeGuid::new(in non-test production code (the mechanical guard the issue asked for)..claude/board/ISSUES.md— progress + the newly-discovered blocker.Discovered blocker (deferred, documented)
Flipping
aiwartoCLASSID_OSINT_V3(a real V3 mint) brokeaiwar::tests::projects_to_family_node_graph: the V3 tail laysfamilyat bytes 12..14 (u16), butsoa_graph::project_snapshotreads it via the V1family()u24 accessor (bytes 10..13) → family grouping reads leaf-dominated garbage. So aiwar's V3-classid flip is now gated on making that consumer tail-aware (an I-LEGACY-API-FEATURE-GATED consumer migration), not on the feature gate the original issue named. OnceCLASSID_OSINT's registrytail_variantflips, the aiwar mint auto-follows throughmint_for.Verification
guid-v3-tailon).--no-default-featurescompiles (the un-gate's purpose).lance-graph+lance-graph-plannercheck clean — the default-on flip propagates safely to consumers.cargo fmt+cargo clippy -p lance-graph-contractclean.Remaining (still open in ISS-V1-TAIL-RESIDUE)
project_snapshot/OSINT_GOTHAMreadfamilytail-aware.CLASSID_OSINT's registrytail_variant(or point aiwar/ocr at a V3-marked classid).ocris already V3-ready.🤖 Generated with Claude Code
Generated by Claude Code
Summary by CodeRabbit
New Features
Bug Fixes