Skip to content

lance-graph-r2il: production alias views for the polyfill lens (D-DT64-7 L4) - #1902

Merged
AdaWorldAPI merged 2 commits into
mainfrom
ccr-85acaff0-oszq40-l4b
Oct 31, 2026
Merged

AdaWorldAPI merged 2 commits into
mainfrom
ccr-85acaff0-oszq40-l4b

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Step 1 of the execution order recorded in plan §1d (decisions in #1901). This PR adds the R2IL, SQL and Quack views of the polyfill lens as library code; until now they existed only as test-local helpers.

What changed in lance_graph_r2il::polyfill

  • SQL and Quack names are now explicit per word. Each POLYFILL word gains sql_at / quack_at: the index of its existing alias that is its SQL name or its Quack name.
    • No name is spelled twice.
    • No spelling heuristic decides the language. The test helper's contains("::") check is not used here.
  • New FrozenWord methods:
    • name_of(lang) -> Option<&str>: the word's name in that language, if it has one.
    • name_in(lang) -> &str: same, but falls back to the R2IL name, so a view always has one label per position.
    • is_alias(label): whether a label is one of the word's aliases.
  • PolyfillView::new(AliasLanguage::{R2il, Sql, Quack}): a ClassView that answers concept 0xFFFF with one label per position and returns nothing for any other concept.
    • predicate_iri identifies the word (lg:polyfill:f000/<R2IL name>). Only the label changes per language.
    • SQL has no name for SUM, MIN, MAX or ALL, so those positions carry their R2IL name. SQL returns NULL on an empty selection where these words return a value.
  • WithPolyfill::new(&consumer_view, &polyfill_view): answers 0xFFFF from the polyfill view. Every other concept, its template and its DOLCE category come from the consumer's view.
    • It routes that one concept and checks nothing else. Activation checks come later as L3, in host composition (O8).

Unchanged: binding.rs, the name-bound 0xC401 reading, the FnIndex contract, and the 9 existing polyfill tests.

Tests and disable runs

New tests are in tests/integration/polyfill_views.rs (6 tests). They were written first and did not compile (10 errors) until the API existed. They check:

  • every language view labels every position with that language's name, and each label names exactly that position;
  • the IRI is the same in every language while the labels differ (IntSLess / < / Cmp::LtI32);
  • the names come from the table: R2IL names match R2ILVocabulary, SQL and Quack names are among the word's aliases, and the fallback applies only where a language has no name;
  • R2IL, SQL and Quack views over the same consumer view bind the same steps and plan id;
  • the consumer's own stale 0xFFFF labels are refused when the consumer view is used alone, and are hidden when wrapped in WithPolyfill.

Each guard was disabled once to check that a test fails; all seven went red:

guard disabled tests failing
SQL reads the Quack index 2
one wrong index 2
no R2IL fallback 3
polyfill view answers every concept 1
adapter does not route 0xFFFF 2
per-language IRI 1
adapter drops the consumer's DOLCE category 1

The "one wrong index" disable first failed to apply because cargo fmt had reflowed the line. It was re-run on the formatted text, so that row is a real result.

Local gates:

  • cargo test -p lance-graph-r2il: 46 integration tests pass, plus the other suites.
  • clippy --all-targets -D warnings and fmt are clean.
  • entries_index, citation_decay and append_only_gate pass.

Board entry: .claude/board/entries/2026-10-31-polyfill-alias-views-l4.md. The STATUS_BOARD row for L4 arrives with #1901.


Generated by Claude Code

…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
@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: 6fc5dc01-493e-4f28-9b3d-b4d51d04ded3
  • 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

@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:40:27.193900Z aac42f7 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 bedd999 into main Oct 31, 2026
17 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aac42f7053

ℹ️ 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".

Comment on lines +261 to +262
impl<V: ClassView + ?Sized> ClassView for WithPolyfill<'_, V> {
fn fields(&self, class: ClassId) -> &[FieldRef] {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Delegate the remaining ClassView metadata to the consumer

When the consumer overrides optional ClassView methods, wrapping it in WithPolyfill silently replaces those answers with trait defaults even for concepts other than HARDCODED. For example, compute_dag becomes empty, is_a_parent becomes None, and epistemic_reading becomes undeclared; consequently, recomputation can be skipped, inherited rendering loses its ancestor lookup, and epistemic projection can refuse previously valid data. These defaults are defined in crates/lance-graph-contract/src/class_view.rs and are not derived from the three methods forwarded here. Delegate the remaining metadata methods for non-polyfill concepts so adding the polyfill view preserves the consumer's existing class behavior.

Useful? React with 👍 / 👎.

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