Skip to content

glove-parity: an edge table as the anchor, and distinct targets of a hop (D-CMH-G1-4b) - #1520

Merged
AdaWorldAPI merged 6 commits into
mainfrom
ccr-9f3b8075-74u47l-mn
Oct 12, 2026
Merged

AdaWorldAPI merged 6 commits into
mainfrom
ccr-9f3b8075-74u47l-mn

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Stacked on #1518; merge that first. Until it merges, this diff also shows #1518's commits. This PR adds the last two commits.

What

Step 3 of the plan from the #1510–#1515 synergy review: the edge-table hop. Every hop's filter is applied at the source, and no program's output feeds another program.

  • An M:N relation becomes its own concept, with one functional relation to each end. Each edge row is then one traverser:
    • V(edge).where(p()).out(end).count() is the bag (edge rows);
    • V(edge).where(p()).out(end).dedup().count() is the set: a new Fold::Distinct { rel }, the number of distinct live targets reached.
  • Conditions on both ends are read through the key, with EqU32Via plus the liveness semijoin, as in glove-parity: functional relation carrier — out(rel) as a method (D-CMH-G1-4a) #1514.
  • Fold::Distinct lowers to two parts:
    • the relation's liveness test, emitted once even when a condition already names the relation;
    • COUNT(DISTINCT key) over the key lane, using Terminal::CountKeyRunsU32, which keeps two words of state and builds no target mask.
  • The key lane must be stored in key order. A lane in any other order is refused at run time with LaneNotOrdered, never miscounted. ScatterCountU32 (a seen-set the size of the population) is held for now, so it is not used. A distinct count over the other end needs the edges stored in that end's order, i.e. a second projection of the concept.
  • Composer: dedup() after out(rel) moves the cursor to the distinct targets. has commutes with it, and count() folds it. Ending on the distinct targets, or any other step after them, still returns DedupThroughRelation.
  • Also wired: the text form, the awareness projection (fold:distinct(rel)), and R2IL (FrontendGap { R2il, "GATHER" }).

What stays refused

Evidence

tests/distinct.rs has 6 tests. The fixture is synthetic method, field and reads tables with dangling keys and dead rows in each, plus two projections of reads: one stored by field, one by method. Every answer is checked against a row loop over the field text at n ∈ {1, 64, 65, 4097}, and the bag and set answers differ on this data.

Each of these seven disable runs turns the test that checks it red:

  1. the fold's liveness test removed;
  2. the liveness test emitted twice;
  3. the fold lowered as COUNT(*);
  4. the R2IL refusal removed;
  5. has after dedup dropped;
  6. ending on the distinct targets accepted;
  7. the key left out of required.

tests/relation.rs had pinned out(rel).dedup().count() as refused; that pin now covers dedup() without count(), which is still refused.

The vocabulary matrix moves six rows from COMPOSE to DIRECT. It now reads DIRECT 20, COMPOSE 12 of 67.

Gates: cargo test (all suites), cargo clippy --all-targets -D warnings and cargo fmt pass for the crate.

🤖 Generated with Claude Code

https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh


Generated by Claude Code

MIN/MAX lower to mask-risc's MaskedMinI32/MaskedMaxI32. An empty selection
pushes the fold's identity (i64::MAX / i64::MIN), the same seed the grouped
terminals leave in an empty group; no I32 value equals it. procs::min/max
and procs::and_cmp_i32 (<, <=, >, >= via IntSLess and IntNot) are named
sequences over existing calls. No new opcode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
Cond::Order (<, <=, >, >= on an I32 field, in the lane's units) binds to
Quack's Cmp::{Lt,Le,Gt,Ge}I32 and to R2IL's and_cmp_i32. Fold::Min/Max bind
to Agg::MinI32/MaxI32 and R2IL's MIN/MAX; FoldValue::Extremum is None for an
empty selection on both frontends. Gremlin: has(f, lt|lte|gt|gte(n)),
values(f).min()/max(), and their text forms. min/max of vertices, and an
ordered has after out(rel), are refused by name.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
…(D-CMH-G1-4b)

Fold::Distinct { rel } is Gremlin's out(rel).dedup().count(): the number
of distinct live targets the selected rows reach. It lowers to the
relation's liveness semijoin (emitted once, whether or not a condition
already named the relation) and COUNT(DISTINCT key) over the key lane,
Terminal::CountKeyRunsU32: two words of state, no target mask, nothing a
second program reads. The key lane must be stored in key order; a lane in
another order is refused at run time (LaneNotOrdered), never miscounted.

An M:N relation is carried as its own concept: each edge row is one
traverser with a functional relation to each end, so count() is the bag
and dedup().count() the set of reached ends, both ends filtered at the
source through the key. A distinct count over the other end needs the
edges stored in that end's order: a second projection of the concept.

Composer: dedup() after out(rel) moves to the distinct targets; has()
commutes with it; count() folds; anything else, or ending there, stays
DedupThroughRelation. Text form, awareness projection (fold:distinct) and
R2IL (FrontendGap GATHER) follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
Six matrix rows move from COMPOSE to DIRECT (E(), dedup after a fan-out,
in spelled from the child, M:N one hop, outE/inE, outV/inV): DIRECT 20,
COMPOSE 12 of 67. A second hop stays refused pending the chained-hop
decision.

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

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 62 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 03c7c67f-3e8b-4615-9619-36545f96d677

📥 Commits

Reviewing files that changed from the base of the PR and between c1ce262 and ef27527.


📒 Files selected for processing (17)
  • .claude/board/STATUS_BOARD.md
  • .claude/board/entries/2026-10-12-edge-table-anchor-distinct.md
  • .claude/board/entries/2026-10-12-ordered-conditions-and-extrema.md
  • .claude/board/entries/README.md
  • .claude/plans/gremlin-composable-algebra-v1.md
  • crates/lance-graph-glove-parity/src/awareness.rs
  • crates/lance-graph-glove-parity/src/decl.rs
  • crates/lance-graph-glove-parity/src/gremlin.rs
  • crates/lance-graph-glove-parity/src/method.rs
  • crates/lance-graph-glove-parity/tests/distinct.rs
  • crates/lance-graph-glove-parity/tests/gremlin.rs
  • crates/lance-graph-glove-parity/tests/ordered.rs
  • crates/lance-graph-glove-parity/tests/relation.rs
  • crates/lance-graph-r2il/src/lib.rs
  • crates/lance-graph-r2il/src/procs.rs
  • crates/lance-graph-r2il/tests/dialect.rs
  • crates/lance-graph-r2il/tests/procs.rs

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


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

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

chatgpt-codex-connector Bot commented Oct 12, 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-12T20:27:22.990070Z ef27527 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 8ae5bce into main Oct 12, 2026
12 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: ef2752749e

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

| second fan-out (fan-in carried) | traversal | V->V'' | bag | — | pure | YET | #1311 `many_to_many_two_hop_is_refused…`; #1312 §D | barrier / fan-in operand (G2) |
| outE/inE/bothE | traversal | V->E | edge rows | — | pure | COMPOSE | edge table as anchor | relation carrier |
| outV/inV/otherV/bothV | traversal | E->V | fk read | — | pure | COMPOSE | EqU32Via from edge row | relation carrier |
| outE/inE/bothE | traversal | V->E | edge rows | — | pure | DIRECT (G1-4b) | `V(edge).where(p())` with `p` over `out(src)`; anchored on the edge or child concept (tests/distinct.rs); `bothE` needs the union below | — |

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 Remove bothE from the DIRECT capability row

This row marks the combined outE/inE/bothE capability as DIRECT and includes it in the reported DIRECT total, but the same plan keeps bothE queued at line 355, and compose still rejects every Step::Both unconditionally in gremlin.rs. Anyone relying on this matrix will therefore treat an unsupported traversal as available; split bothE into its own row or retain a non-DIRECT status for the combined row.

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