Skip to content

contract: unified ClassView render — facet value rows + is_a-walk resolution#650

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/classview-unified-render
Jul 6, 2026
Merged

contract: unified ClassView render — facet value rows + is_a-walk resolution#650
AdaWorldAPI merged 1 commit into
mainfrom
claude/classview-unified-render

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Additive, zero-dep extension of lance-graph-contract::class_view implementing the operator-ratified unified ClassView render: any app calls the same projection — resolve (is_a rail) → carve (FieldMask) → emit — with routes as thin per-app skins. This closes the two gaps the q2 cockpit-server OSINT card surfaced in the contract.

What's added (all defaulted trait methods / new type — non-breaking for every implementor)

pub struct ValueRow<'a> { pub label: &'a str, pub predicate: &'a str, pub position: u8, pub value: u8 }

// on trait ClassView:
fn facet_rows<'a>(&'a self, class: ClassId, mask: FieldMask, facet: &[u8; 12]) -> Vec<ValueRow<'a>>;
fn is_a_parent(&self, _class: ClassId) -> Option<ClassId> { None }
fn resolve_render_class(&self, class: ClassId) -> ClassId;
  • facet_rows — the value-projected sibling of render_rows: field position i binds to facet byte i per .claude/v3/soa_layout/le-contract.md §3 ("the 12-byte payload is a dumb byte register the ClassView projects"). Positions ≥ 12 are value-slab fields — skipped, never folded (mirrors the FieldMask 64-guard). C2 presence-never-semantics holds: the mask gates which rows exist, never what a byte means.
  • resolve_render_class — the zero-fallback render ladder: bespoke card → nearest is_a ancestor with a non-empty field set → return the original class (empty fields() on the result = caller renders the generic facet dump). 16-hop cap + on-stack visited array: cycle- and depth-safe, no allocation beyond the walk, never fails.
  • is_a_parent — the taxonomy hop, default None (walk degenerates to identity; OgarClassView wiring from its subClassOf cache is follow-up).

Verification

  • cargo test -p lance-graph-contract: class_view 21/21 (7 new), contract lib 822 passing, 0 failures
  • cargo clippy -p lance-graph-contract --all-targets -- -D warnings clean; fmt clean
  • Regression canary pins existing render_rows behavior unchanged

Board hygiene (same commit)

LATEST_STATE.md Contract Inventory entry + AGENT_LOG.md prepend. EPIPHANIES untouched deliberately — this wires the already-locked E-V3-FACET-4-PLUS-12 §3 register into a projection, no new doctrine.

Consumer notes

Call resolve_render_class(concept) first, then facet_rows on the resolved class. Per le-contract §3b, reading a new tenant lane downstream still owes an ICC/Spearman/Cronbach certification before the reading is trusted — facet_rows hands over bytes positionally, not a validated semantic reading.

Merge order

This PR merges first. The companion q2 PR (cockpit unified card routes + OSINT detail popup) consumes this API via the path dep, and q2's Railway Dockerfile clones lance-graph @ main HEAD — the q2 build only sees this once it's on main.

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for rendering class facets as value rows, including label, predicate, position, and byte value details.
    • Improved class rendering to follow parent relationships when a class has no direct fields, making output more complete.
    • Exposed the new value-row format for consumers of the contract API.
  • Bug Fixes

    • Added safeguards for cycles and depth limits during class resolution, preventing endless traversal.
    • Preserved existing render output when the new facet row support is present.

…olution

Additive, zero-dep extension of lance-graph-contract's class_view module
implementing the operator-confirmed "unified ClassView render": any app
calls the same projection — resolve (is_a rail) → carve (FieldMask) →
emit — with routes as thin per-app skins. Closes the two gaps the q2
cockpit-server OSINT card surfaced in the contract: a VALUE column read
from the node's 12-byte facet, and is_a-walk fallback so every classid
renders.

NEW `ValueRow<'a>` { label, predicate, position, value } — the
value-projected sibling of `RenderRow`: one populated field paired with
the byte it reads from the V3 content-blind 12-byte facet payload.
Position i binds to facet byte i per .claude/v3/soa_layout/le-contract.md
§3 (the payload is a dumb byte register the ClassView projects; the class
picks the reading, never a slot in the byte). Presence-only C2 holds: the
mask gates which rows exist, never what a byte means.

NEW provided trait methods (all defaulted → non-breaking for existing
implementors):
- `facet_rows(class, mask, &[u8;12]) -> Vec<ValueRow>` — emit a row for
  each position that is BOTH mask-present AND < 12 (facet-backed).
  Positions >= 12 are value-slab fields, out of facet scope — skipped,
  never folded (mirrors the FieldMask 64-guard style).
- `is_a_parent(class) -> Option<ClassId>` — the taxonomy hop; default
  None = no taxonomy.
- `resolve_render_class(class) -> ClassId` — the monotonic zero-fallback
  ladder: bespoke card → nearest ancestor's card → original (empty
  fields on the result = caller renders the generic facet dump). Walks
  is_a_parent while fields are empty; cycle- and depth-safe via a hard
  16-hop cap + an on-stack [ClassId;16] visited array (no HashSet).

Wires the already-locked E-V3-FACET-4-PLUS-12 §3 register into a
projection; no new doctrine. +7 tests (facet position/byte binding, off-
bit + >=12 skip, FULL-mask 3-field, is_a→ancestor, orphan→self, cycle +
self-loop termination, 20-parent depth cap, render_rows regression
canary). class_view 21/21, contract lib 822 green; fmt + clippy
(-D warnings, --all-targets) clean. Board: LATEST_STATE Contract
Inventory + AGENT_LOG entries same commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012jEwwaT5JZ5x8qWvcnaMYC
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2fa94673-c37b-4572-8433-04102fdcb510

📥 Commits

Reviewing files that changed from the base of the PR and between eda867b and b8ac0c8.

📒 Files selected for processing (4)
  • .claude/board/AGENT_LOG.md
  • .claude/board/LATEST_STATE.md
  • crates/lance-graph-contract/src/class_view.rs
  • crates/lance-graph-contract/src/lib.rs

📝 Walkthrough

Walkthrough

This PR extends the ClassView trait in lance-graph-contract with a new ValueRow<'a> struct and three methods: facet_rows (facet-to-value projection), is_a_parent (default None), and resolve_render_class (cycle-safe, hop-capped taxonomy walk). ValueRow is re-exported from lib.rs. Test fixtures and coverage are expanded, and board log files record the change.

Changes

ClassView facet projection and taxonomy resolution

Layer / File(s) Summary
ValueRow type, facet_rows, and resolve_render_class methods
crates/lance-graph-contract/src/class_view.rs, crates/lance-graph-contract/src/lib.rs
Adds ValueRow<'a> struct (label, predicate, position, value), facet_rows for mask/facet-based value projection, default is_a_parent, and resolve_render_class for a cycle-guarded, hop-capped taxonomy walk; re-exports ValueRow from the crate root.
Test fixtures and coverage
crates/lance-graph-contract/src/class_view.rs
Extends FakeClasses with extra/parents maps and with_class/with_isa builders, updates is_a_parent and fields implementations, and adds tests for facet binding/skipping, taxonomy ladder resolution, cycle/orphan handling, and a render_rows regression canary.
Board log entries
.claude/board/AGENT_LOG.md, .claude/board/LATEST_STATE.md
Appends dated entries documenting the ClassView unified render feature and reported test outcomes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • AdaWorldAPI/lance-graph#441: Both PRs modify crates/lance-graph-contract/src/class_view.rs, with the earlier PR introducing the base ClassView/render_rows and this PR extending it with facet_rows, ValueRow, and taxonomy resolution.

Poem

A rabbit hops through classes tall,
Following is_a till fields befall,
Twelve bytes of facet, bit by bit,
Rendered rows now snugly fit,
No cycle traps this bunny's stride —
Hop, hop, hooray, the tests all glide! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main API extension: unified ClassView rendering with facet value rows and is_a-based render-class resolution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AdaWorldAPI AdaWorldAPI merged commit 598f872 into main Jul 6, 2026
7 checks passed
AdaWorldAPI added a commit that referenced this pull request Jul 6, 2026
…e-handover-m54i4j

board: post-merge inventory entry for #651 WideFieldMask (+ record #650 merged)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants