Skip to content

feat(ir): add AggIntent::Extension for deployment-model-specific intents - #137

Merged
zzylol merged 1 commit into
mainfrom
feat/agg-intent-extension-variant
Jul 18, 2026
Merged

zzylol merged 1 commit into
mainfrom
feat/agg-intent-extension-variant

Conversation

@zzylol

@zzylol zzylol commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes/addresses #131 for the L3 vocabulary specifically. Adds a small,
generic escape hatch to AggIntent:

Extension {
    ext_kind: String,             // deployment-model-chosen tag
    #[serde(default)]
    payload: serde_json::Value,   // opaque to core
},

Rather than growing AggIntent for every capability a single deployment
model needs -- which turns the shared vocabulary into a dumping ground,
against the "core only grows for intents ≥2 deployment models actually
use" principle -- a deployment model that needs something core doesn't
have carries it here and owns all interpretation of payload itself.

Core's own methods treat it opaquely and conservatively:

  • requires() → DataModel::Any
  • is_per_series() → false
  • input_col() → None
  • output_column() names the column after ext_kind, unconstrained type
  • plan::boundary::realize() → Realization::PassThrough

Field is named ext_kind, not kind -- kind is already the enum's own
internal serde tag (#[serde(tag = "kind")]) and collides.

Motivation

ASAPQuery-backend's control_plane is mid-way through merging its own
AggIntent onto this crate's version (their Phase 1:
ProjectASAP/ASAPQuery-backend#391). One of their intents --
Frequency { accuracy }, a standalone point-frequency-via-CMS query
(count(*) WHERE key = k) -- has no equivalent here and isn't the same
thing as this crate's RankingMeasure::Frequency (which classifies what
a TopK ranks by, not a queryable intent on its own). Adding a
control_plane-specific variant directly to this enum would be exactly the
"dumping ground" problem; Extension lets them carry it through the
shared type without that.

This isn't the general inventory-based registration API #131 sketches
for the PromQL parser's function list (L1) -- that's a bigger, separate
design (Rust's exhaustive-match enums don't compose with a runtime
registry the way a lookup table does). This is a minimal, compatible
first step at L3 specifically.

Test plan

  • cargo build --workspace -- clean
  • cargo test --workspace -- all passing (0 failures across every
    crate)
  • rustfmt applied to changed files

🤖 Generated with Claude Code

First concrete step toward #131 ("add an explicit registration API for
extending query/sketch/primitive/data types") applied to the L3 vocabulary.
Rather than growing AggIntent for every capability a single deployment
model needs -- which would turn the shared vocabulary into a dumping
ground -- a deployment model that needs something core doesn't have
carries it in Extension{ext_kind, payload}, tagged by its own string, and
owns all interpretation of payload itself.

Core treats it opaquely: requires() -> DataModel::Any, is_per_series() ->
false, input_col() -> None, output_column() names the column after
ext_kind with an unconstrained type, and plan::boundary::realize() ->
PassThrough. A deployment model that binds Extension intents is expected
to override/re-derive behavior itself.

Prompted by ASAPQuery-backend's Phase 1 IR merge needing to carry
control_plane's standalone point-frequency-via-CMS AggIntent (unrelated
to RankingMeasure::Frequency, which classifies what a TopK ranks by --
not the same capability) through the now-shared L3 type without adding
a single-deployment-model-specific variant to core.

promql-parser reviewer note: no dependency changes to crates/ir --
serde_json moves from dev-dependency to a real one (already vendored,
used in tests before this change).
@zzylol
zzylol merged commit c73c2a5 into main Jul 18, 2026
1 check passed
@zzylol
zzylol deleted the feat/agg-intent-extension-variant branch July 18, 2026 04:29
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.

1 participant