Skip to content

DT64: behaviour lenses read their basis by the full classid (D-DT64-7 O9, L1) - #1903

Merged
AdaWorldAPI merged 4 commits into
mainfrom
ccr-85acaff0-oszq40-l1
Oct 31, 2026
Merged

AdaWorldAPI merged 4 commits into
mainfrom
ccr-85acaff0-oszq40-l1

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Step 2 of the execution order in plan §1d (decision O9; see #1901).

No longer stacked. #1902 (L4) has merged, so the diff against main is only the two L1 commits: e0c14c76c and 67243df8f.

Contract change and compatibility impact

  • ClassView::lens_fields. lance_graph_contract::class_view::ClassView gains fn lens_fields(&self, lens: u32) -> Option<&[FieldRef]>, whose default returns None.
    • Source-compatible: every existing impl ClassView compiles unchanged. A test view that implements only the required methods pins this.
  • is_behaviour_lens. New class_view::is_behaviour_lens(classid). It returns true when the classid's right (custom) half is in 0xF000..=0xFFFF.
  • Refusal::UnknownLensBasis(u32). New variant on lance_graph_dt64::Refusal. No crate in crates/ matches Refusal exhaustively, so no match breaks.

Behaviour change

BindStore::resolve_algebra now reads a behaviour lens's basis from view.lens_fields(lens). If the view does not know the lens, the call refuses with UnknownLensBasis. It never falls back to the left half's basis, even when that basis has the right field count.

Unchanged:

  • every lens whose right half is below 0xF000, including the 0xC401 R2IL reading and lab lenses such as 0x7F0A_0001;
  • every data class (resolve);
  • AlgebraRef.word, WideFieldMask and the 256-position limit.

The only lens on main this affects is the polyfill lens 0xFFFF_F000:

  • PolyfillView now answers it through lens_fields and no longer holds a concept basis.
  • WithPolyfill forwards lens_fields for lenses under 0xFFFF.
  • The existing polyfill test views gain a lens_fields method. Their assertions are unchanged, except that the L4 view tests now read the lens through lens_fields.

Tests

Red first. With only the trait method and the variant added (no new lookup yet), 4 of the 5 new DT64 tests failed and the compatibility twin passed.

New tests in crates/lance-graph-dt64/tests/bind_store.rs:

  • 0xFFFF_F000 (17 words) and 0xFFFF_F200 (5 words) resolve independently, while concept 0xFFFF holds a 3-label basis.
  • Data class 0x7F0B_0001 (2 fields) and behaviour lens 0x7F0B_F001 (3 words) do not read each other's basis.
  • An unknown behaviour lens refuses, even when the concept's basis has a matching count.
  • Twin: a non-behaviour lens still reads its concept, and lens_fields is not consulted.
  • Twin: a view without lens_fields compiles and refuses behaviour lenses.

Disable runs, all red:

disabled check tests failing
behaviour branch off 4
unknown lens inherits the concept basis 2
every lens treated as a behaviour lens 2
WithPolyfill does not forward lens_fields 2

Local runs:

  • lance-graph-contract (1562 unit tests plus integration suites), lance-graph-dt64 and lance-graph-r2il pass.
  • The excluded dependents xlog-relcomp-probe, dt64-admission-probe and math-polyfill-probe pass; their lenses use right halves 0x0000 or 0x0001.
  • clippy --all-targets -D warnings is clean for contract, dt64 and r2il, and fmt is clean.
  • entries_index, citation_decay and append_only_gate pass.
  • CI is green on 67243df.

Board entry: .claude/board/entries/2026-10-31-behaviour-lens-full-classid-l1.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF

…4-7 L4)

Each POLYFILL word now records which alias is its SQL and which its
Quack name (sql_at, quack_at index into the existing aliases, so no name
is spelled twice). FrozenWord gains name_of, name_in and is_alias.

PolyfillView is a ClassView answering 0xFFFF with one label per position
in R2IL, SQL or Quack; the predicate IRI names the word, the label the
language. WithPolyfill puts it over a consumer's view, answering 0xFFFF
and delegating every other concept. The binding path and the 0xC401
reading are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
… O9, L1)

The contract's ClassView gains a defaulted lens_fields(u32), and
is_behaviour_lens names a lens whose right half is 0xF000..=0xFFFF.
BindStore::resolve_algebra reads such a lens's basis through
lens_fields; a view that does not know it refuses with the new
Refusal::UnknownLensBasis, and the concept's basis is never inherited.
Every other lens, and every data class, keeps the left-half lookup, so
the 0xC401 R2IL reading and existing lab lenses are unchanged.

lance-graph-r2il follows: PolyfillView answers the polyfill lens through
lens_fields and holds no concept basis; WithPolyfill routes lens_fields
for lenses under 0xFFFF. The existing polyfill test view gains
lens_fields; its assertions are unchanged.

Tests (red first: 4 behavioural failures on the old resolve_algebra):
two lenses under 0xFFFF with 17 and 5 words resolve independently; a
data class and a behaviour lens sharing a left half do not cross-read;
an unknown behaviour lens fails closed even when the concept's basis has
the right count; a non-behaviour lens still reads its concept; a view
without lens_fields compiles and refuses behaviour lenses.

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

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eaf02f58-ee25-4f94-958b-165ae66f4706
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 31, 2026 23:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T23:41:11.528386Z 67243df Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@AdaWorldAPI
AdaWorldAPI merged commit c0bb5b9 into main Oct 31, 2026
26 checks passed
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