Skip to content

feat(querier): plan-time body-literal candidate matcher (RFC 0044 slice 1) - #671

Merged
jensholdgaard merged 4 commits into
mainfrom
rfc0044-slice1
Jul 29, 2026
Merged

feat(querier): plan-time body-literal candidate matcher (RFC 0044 slice 1)#671
jensholdgaard merged 4 commits into
mainfrom
rfc0044-slice1

Conversation

@jensholdgaard

Copy link
Copy Markdown
Owner

Summary

RFC 0044 slice 1 — the pure plan-time half of the template arm. body_match::body_literal_candidates resolves a body == literal against the tenant's TemplateRegistry:

  • tokenized with the miner's own tokenizer (the only way the inversion is sound against the §3.3 reconstruction invariant),
  • unified position-wise per (template_id, version)Fixed byte-equal, Wildcard captures the implied parameter values in order,
  • deterministic output (sorted), and a tokenizer-rejected literal (embedded NUL) yields the empty set — exact, because the parse-failure ingest path always retains such bodies for the physical arm.

The result is deliberately a candidate superset: separators and overflow-spilled parameter values are per-record, so exact equality settles at scan time inside candidate-admitted row groups only — that split is what keeps the arm prunable. The scan-time exactness + two-arm compile is slice 2; nothing user-visible changes yet.

Verification

6 co-located unit tests (zero-param, parameterized capture, multi-template determinism, arity/fixed mismatches, independent versions, NUL). fmt clean, clippy 0 warnings, querier suite green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Qtny6z6cA74xPZa4qRhk4F

…ce 1)

body_literal_candidates tokenizes a body == literal with the miner's
own tokenizer and unifies it position-wise against every registered
(template_id, version): Fixed tokens byte-equal, Wildcard positions
capture the implied parameter values, output deterministically sorted.
The result is the template arm's prunable candidate superset — exact
per-record equality (separators, overflow-spilled params) settles at
scan time in the compile slice. A tokenizer-rejected literal (embedded
NUL) matches no template, which is exact: the parse-failure ingest path
always retains such bodies, so the physical arm alone covers them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qtny6z6cA74xPZa4qRhk4F
Signed-off-by: Jens Holdgaard Pedersen <Jens@holdgaard.org>
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jensholdgaard, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c61058f0-e014-4c9c-8ff0-1f9254d0a4d4

📥 Commits

Reviewing files that changed from the base of the PR and between 8a31f61 and 1dea812.

📒 Files selected for processing (2)
  • crates/ourios-querier/src/body_match.rs
  • crates/ourios-querier/src/lib.rs

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces the first (plan-time) building block for RFC 0044’s template-arm compilation in the querier: resolving a body == <literal> predicate into a deterministic, version-qualified set of template candidates plus implied wildcard parameters, using the miner’s tokenizer to preserve reconstruction soundness.

Changes:

  • Add body_match::body_literal_candidates to unify a body literal against (template_id, version) → tokens from the tenant TemplateRegistry, producing a deterministic candidate set.
  • Add focused unit tests covering exact match, wildcard capture order, determinism, mismatch cases, version independence, and tokenizer-rejected literals (embedded NUL).
  • Export the new module from ourios-querier’s crate root.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/ourios-querier/src/lib.rs Exposes the new body-match functionality from the crate root.
crates/ourios-querier/src/body_match.rs Implements plan-time literal→template candidate unification + unit tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ourios-querier/src/lib.rs
jensholdgaard and others added 3 commits July 29, 2026 02:23
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qtny6z6cA74xPZa4qRhk4F
Signed-off-by: Jens Holdgaard Pedersen <Jens@holdgaard.org>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qtny6z6cA74xPZa4qRhk4F
Signed-off-by: Jens Holdgaard Pedersen <Jens@holdgaard.org>
@jensholdgaard
jensholdgaard merged commit f7b0c36 into main Jul 29, 2026
27 checks passed
@jensholdgaard
jensholdgaard deleted the rfc0044-slice1 branch July 29, 2026 00:36
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