feat(ir): add AggIntent::Extension for deployment-model-specific intents - #137
Merged
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes/addresses #131 for the L3 vocabulary specifically. Adds a small,
generic escape hatch to
AggIntent:Rather than growing
AggIntentfor every capability a single deploymentmodel 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
payloaditself.Core's own methods treat it opaquely and conservatively:
requires()→DataModel::Anyis_per_series()→falseinput_col()→Noneoutput_column()names the column afterext_kind, unconstrained typeplan::boundary::realize()→Realization::PassThroughField is named
ext_kind, notkind--kindis already the enum's owninternal serde tag (
#[serde(tag = "kind")]) and collides.Motivation
ASAPQuery-backend's
control_planeis mid-way through merging its ownAggIntentonto 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 samething as this crate's
RankingMeasure::Frequency(which classifies whata
TopKranks by, not a queryable intent on its own). Adding acontrol_plane-specific variant directly to this enum would be exactly the
"dumping ground" problem;
Extensionlets them carry it through theshared type without that.
This isn't the general
inventory-based registration API #131 sketchesfor the PromQL parser's function list (L1) -- that's a bigger, separate
design (Rust's exhaustive-match
enums don't compose with a runtimeregistry the way a lookup table does). This is a minimal, compatible
first step at L3 specifically.
Test plan
cargo build --workspace-- cleancargo test --workspace-- all passing (0 failures across everycrate)
rustfmtapplied to changed files🤖 Generated with Claude Code