Skip to content

D-CMH-1: class-qualified methods compile into Quack algebra, with no Rust per method - #1504

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

AdaWorldAPI merged 12 commits into
mainfrom
ccr-9f3b8075-74u47l

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

What this proves

A new method of a concept becomes executable by writing a declaration. No Rust function, adapter or interpreter is written for it.

SELECT billable_work_entry::billable_hours(cats) FROM cats
  → resolve_call     concept via ogar_vocab::canonical_concept_id
                     method label → MethodKey; payload = FROM table = bound table
  → MethodTable      prepared once per glove: SchemaSeal, ReadingId, Universe,
                     WideFieldMask required ⊆ available (Exact | Converted claims),
                     Quack programs lowered once
  → MethodBody::Query { filter: [Cond], folds: [Fold], law: Law }   (data)
  → prepared Quack programs → mask-risc                         (frontend 1)
  → R2IL procs: select_u32 + count | sum | group_sum            (frontend 2, parity)
  → Law finisher → Answer::Values | Answer::Truths

Rust supplies two reusable layers, each written once:

  • Algebra: conditions, Count, Sum, GroupSum.
  • Laws: certified finishers, today Values and NarsRevision.

A method composes these layers. It cannot supply its own algebra or law.

Each law declares the body shape it requires, and preparation checks that shape. For example, NarsRevision refuses a body that does not select independent evidence.

Experiments A–E

Full results and the capability / insufficiency ledger are in .claude/board/entries/2026-10-12-class-method-polyfill-ledger.md.

A. The seam

The class-qualified call, the same query built directly through Quack's binder, R2IL's procedures and a row loop all agree at n ∈ {1, 64, 65, 4097}.

A prepared method's programs() equals lower(direct query). So a method call executes exactly the program a direct Quack query would, and no separate row evaluator exists.

No SQL frontend reaches Quack today. resolve_call recognises one call form and is the seam such a frontend would hand its parsed call to.

B. Frozen executor

At e984885, hours_by_billable was declared in tests/method.rs only; that commit changes one file.

  • Quack: correct.
  • R2IL: typed refusal. Its SUM, GROUP_SUM and KEEP took their mask only from a computed slot. A body with no condition hands them the resident live plane instead.

Fixed in 8d5a36f: one shared mask resolution in R2IL, with no new op. Both frontends now agree. The method needed no Rust; the first condition-free method exposed an executor gap.

C. NARS revision

Built from two grouped sums plus Law::NarsRevision.

  • Independent positive and conflicting evidence: matches a floating-point oracle and OpenNARS's three reference revisions.
  • Repeated stamp, replayed delta, same stamp in two hypothesis layers: truth unchanged, given the producer's two marks (replay by delta_id, independence by (statement, stamp)).
  • Retraction: typed insufficiency, pinned by a test. A negative-weight delta gives the right answer for a stamp that was asserted, and a silently wrong one for a stamp that never was.

The missing reusable algebra is a first-occurrence mask over an ordered key, plus, for retraction, a semijoin of retraction stamps onto asserted stamps.

D. Faults

Each fault is either refused before execution with a typed error or turns its test red. A disable run was made for each guard: 13 so far, all red.

  • swapped lanes
  • schema seal
  • reading
  • population
  • NULL read as a value
  • duplicate stamps
  • law shape
  • basis of 257

A compute body has no MethodBody variant, so it cannot be written at all.

E. Cost

Measured on 1,048,576 rows at the repo's x86-64-v3 tier, with the hot paths interleaved per repetition:

path median allocations per call
prepare one method (cold) 0.8 µs 13
warm call, Quack 600 µs 2
warm call, R2IL 605 µs 5
direct Quack, lowered once 599 µs 0
scalar row loop 366 µs 0

Once prepared, the method layer adds no measurable cost over direct Quack. Both are about 1.6× slower than a fused scalar loop, because the program writes a mask and then sums it. That is the executor's cost, not the method layer's; fusing filter and fold is the lever.

Changes

  • glove-parity/src/method.rs: MethodSpec, Glove, MethodTable, PreparedMethod (with programs lowered once), the GroupSum fold, Law::NarsRevision, SchemaSeal / ReadingId / Universe.
  • glove-parity/src/call.rs: resolve_call.
  • glove-parity/examples/method_cost.rs: the Experiment E probe.
  • r2il/src/procs.rs: select_u32 and count.
  • r2il/src/lib.rs: POP_COUNT, SUM, GROUP_SUM and KEEP read a resident plane as their mask.
  • No new mask-risc or R2IL op.

Gates: fmt and clippy -D warnings pass on glove-parity and r2il. Tests pass for glove-parity (method 10, polyfill 12), r2il and r2il-mask-abi-probe.

Open

  1. A FirstOfRun predicate over an ordered key, so the dedup marks become algebra.
  2. Retraction via a semijoin onto asserted stamps.
  3. Three-valued conditions through Quack's sql_where.
  4. Mint method keys and the NARS concept in OGAR (feat(callcenter): add OGIT + OWL/DOLCE semantic layer foundation #357).
  5. Fix the compute-DAG check to 256 positions before any compute body lands.
  6. A fused filter + fold terminal.

🤖 Generated with Claude Code

https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh

Summary by CodeRabbit

  • New Features

    • Added support for preparing and calling class-qualified methods, with query results including counts, sums, grouped sums, and NAL revision truths.
    • Method calls can run through either Quack or R2IL, with checks for incompatible methods and mismatched data.
    • Added R2IL procedures for selecting rows by unsigned values and counting matches.
  • Improvements

    • R2IL folds can now use resident mask planes directly for counting, summing, grouped sums, and keeping rows.

First slice of D-CMH-1 (class × method × payload → shared algebra). A
MethodSpec belongs to the concept (0x0103) and names its fields in the
canonical ClassView basis. MethodTable::prepare binds each spec once
against one glove's claims and Binder; a call carries only numbers and
runs through either Quack (Query → lower → mask-risc) or R2IL
(FoldDialect → mask-risc).

- required is a WideFieldMask over the canonical basis; a method prepares
  only when required ⊆ available (fields with an Exact/Converted claim).
  `duration` (Hypothesized) is refused at preparation.
- An action body prepares and is refused by every pure call.
- Labels resolve to a MethodKey once; only keys reach a call.
- lance-graph-r2il: procs::count_eq (live plane AND U32 = v, popcount).

Tests: count_billable agrees across Quack, R2IL and an oracle that reads
the DTO's documented indicator values (n = 1, 64, 65, 4097); the bound
query equals the one Quack binds from names; a swapped lane breaks
parity on both frontends; wrong concept, unknown key, action refused.

Not yet zero-friction: the body kind is a closed enum and the R2IL path
calls a per-body procedure. The next commit makes the body declarative.

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

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: e3528047-b8d6-4724-a3a2-0837f315de2f

📥 Commits

Reviewing files that changed from the base of the PR and between ec3fee7 and 4b52305.


📒 Files selected for processing (13)
  • .claude/board/entries/2026-10-12-class-method-polyfill-ledger.md
  • .claude/board/entries/README.md
  • .github/workflows/glove-parity.yml
  • crates/lance-graph-glove-parity/Cargo.toml
  • crates/lance-graph-glove-parity/examples/method_cost.rs
  • crates/lance-graph-glove-parity/src/call.rs
  • crates/lance-graph-glove-parity/src/lib.rs
  • crates/lance-graph-glove-parity/src/method.rs
  • crates/lance-graph-glove-parity/tests/method.rs
  • crates/lance-graph-glove-parity/tests/polyfill.rs
  • crates/lance-graph-r2il/src/lib.rs
  • crates/lance-graph-r2il/src/procs.rs
  • crates/lance-graph-r2il/tests/procs.rs

 _____________________
< Git gud or git out. >
 ---------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

  • 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.

A method body is now MethodBody::Query { filter: [Cond], folds: [Fold],
law }: conditions (= / !=) over code fields, folds Count and Sum. One
generic binder turns any such body into Quack queries (one per fold) and
the same selection into R2IL calls. src/ names no method.

r2il: count_eq is replaced by the general select_u32 (live plane AND
per-condition U32 equality, optionally negated) and count; POP_COUNT now
counts a resident plane in place, so an empty condition list counts the
live rows.

Tests declare every method in the test file. Two new shapes added there
only (a negated condition; Count + Sum over one selection) run on both
frontends against row-loop oracles, with no change to src/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
- call.rs: `SELECT <concept>::<method>(<table>) FROM <table>` resolved
  once into a typed MethodCall: the concept through OGAR's codebook
  (canonical_concept_id), the method through the table's labels, the
  payload checked against the FROM table and the bound table. Exactly one
  form is recognised; everything else is refused by name.
- Binding seals: a spec carries the SchemaSeal of the canonical basis it
  was written for and the ReadingId it assumes; a call names the Universe
  of its planes. Any mismatch is refused. A basis wider than 256 positions
  is refused whole.
- Grouped SUM fold, and Law::NarsRevision: revision of independent
  evidence compiled from two grouped sums and one certified finisher. The
  body must select the payload's first-occurrence mark, or it is refused
  (EvidenceNotIndependent): the algebra cannot compute that mark yet.

tests/polyfill.rs: the call agrees with the same query written in Quack,
with R2IL procedures and with a row loop; refusals for concept, method,
payload, table, schema, reading, population, NULL and width; revision
agrees with a float oracle and OpenNARS's reference points on both
frontends; the repeated-stamp counterexample; the dropped out-of-domain
key, pinned as a known gap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
What the slice executes, what was measured, and the capability /
insufficiency ledger: first-occurrence mask (NARS dedup), dropped
out-of-domain group keys, NULL, the SQL frontend, unminted NARS concept
and method identity, fixture reading/population ids, the fail-open
compute-DAG check, unfused folds. Extension criteria for new algebra and
laws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
@AdaWorldAPI AdaWorldAPI changed the title D-CMH-1: a concept's method bound once, run through Quack and R2IL D-CMH-1: class-qualified methods compile into Quack algebra, with no Rust per method Oct 12, 2026
PreparedMethod now holds its Quack programs, lowered when the method is
prepared (a lowering error is PrepareError::Lower); a call executes them
and never lowers. `programs()` exposes them, and the tests assert they
equal the program the same query written directly in Quack lowers to:
no separate row evaluator sits behind a method.

examples/method_cost.rs measures cold preparation, resolution and
lowering apart from warm execution, with the hot paths interleaved per
rep, allocations counted, and every path's answer asserted first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
`hours_by_billable` (hours grouped by the billable code) is declared in
tests/method.rs only, against the executor frozen at e984885. No other
file changed (see this commit's stat).

Result: correct on Quack against a per-group row loop at n = 1, 65, 4097.
R2IL refuses it with a typed error: its GROUP_SUM (like SUM and KEEP)
takes its mask only from a computed slot, and a body with no condition
hands it the resident live plane. The test pins that refusal; the
executor gap is closed in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
SUM, GROUP_SUM and KEEP took their mask only from a computed slot;
POP_COUNT already read a resident plane. A fold over a body with no
condition (the live plane alone) was therefore refused. One shared
resolution now serves all four: shape first (`fold_mask`, so a
wrong-kind operand is still reported as wrong-kind), then the epoch for a
slot (`resolve_mask`). mask-risc's terminals already took any Operand.

Found by Experiment B (a method declared after the executor was frozen):
`hours_by_billable` now agrees with its row loop on both frontends.
r2il test: every_fold_takes_a_resident_plane_as_its_mask (failed before
this change on SUM with WrongOperandKind).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
Replay identity (delta_id) and evidential identity (stamp) are kept
apart: a replayed delta and the same stamp arriving in a second
hypothesis layer leave the revised truth unchanged on both frontends,
given the producer's marks; without them the raw sums move.

Retraction is a pinned typed insufficiency: Law::NarsRevision does not
declare it. A negative-weight delta is exact when the stamp was asserted
and silently wrong when it was not; the sums cannot tell which.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
Seam, frozen-executor authoring, NARS replay/layers/retraction, faults,
and measured cost, appended to the D-CMH-1 ledger entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
Regenerated the generated .claude/board/entries/README.md with
entries_index.py, keeping this branch's curated summaries; --check passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
The probe reports `avx512f` / `avx2` as compiled target features, so a
timing is labelled by the arm that produced it, not by whichever cargo
config happened to apply (lance-graph's default is x86-64-v3; native
gives AVX-512 on this host).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 12, 2026 16:35
@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-12T16:37:11.251585Z 89fd1c6 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.

@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: 89fd1c65c9

ℹ️ 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 thread crates/lance-graph-glove-parity/src/method.rs Outdated
Comment thread crates/lance-graph-glove-parity/src/method.rs Outdated
Comment thread crates/lance-graph-glove-parity/src/method.rs Outdated
Review fixes (Codex on #1504):
- a repeated MethodKey is refused (DuplicateKey) instead of resolving to
  the first entry; a repeated label is refused (DuplicateLabel) and
  resolves to nothing;
- two proven claims mapping different native fields onto one canonical
  field are refused (AmbiguousClaim) instead of binding by claim order;
  the same claim repeated is not ambiguous;
- Law::NarsRevision with a zero scale (NaN) or zero horizon (confidence
  exactly 1) is refused at preparation (LawParameter).

Each is pinned by a test with a twin that still prepares.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011BMJnDBAfzcuQh5HeT39Rh
@AdaWorldAPI
AdaWorldAPI merged commit c853cff into main Oct 12, 2026
9 of 10 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Oct 15, 2026
…#1504

Operator rulings 2026-10-15: CE64 header bits mean the same everywhere (K1
per-class readings withdrawn); 40..42 = Pearl method, 50..52 = the
plasticity ladder (the Maslov pyramid), 59..63 = licence; O25 is a defect
with a known fix over temporal.rs coordinates; N15 wires Pearl, Wang NAL
S-P and the other families as views on the one wire.

Records O22 and R1 as done, O20 and N10 as closed on main, O26 as dead
code behind a non-compiling wip feature. Adds the 11 missing arc entries
from the merged PR bodies, STATUS rows for D-RESIDUE-FP-0 /
D-MATURATION3-0/-1, and moves D-HL-0 / D-NALP-0 to Shipped (#1496).

Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
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