Skip to content

refactor: align backend summary types with ASAPPlanner - #500

Merged
zzylol merged 1 commit into
mainfrom
refactor/reuse-asapplanner-types
Sep 4, 2026
Merged

zzylol merged 1 commit into
mainfrom
refactor/reuse-asapplanner-types

Conversation

@zzylol

@zzylol zzylol commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Align ASAPQuery-backend terminology and domain types with the ASAPPlanner developer guide:

  • use Planner SummaryFamilyType for the summary family
  • use Planner SketchCategory only for query category
  • use Planner SketchAlgorithm for an algorithm identity
  • use Planner SketchKind only for the validated committed algorithm + parameters choice
  • remove backend-owned SummaryKind, SummaryParams, and SketchKindHandle domain types
  • remove the OTLP ingest-only SketchKind enum and carry Planner SketchAlgorithm directly
  • move shared backend-only monitor/storage types into asap_types where Planner has no equivalent

The legacy protobuf SummaryParams / SketchKindHandle names and serialized sketch_kind keys remain only at compatibility boundaries. They are decoded immediately into the canonical Planner types, so this PR does not break deployed wire/config formats.

Runtime and E2E coverage

The migration also closes the frequency-oracle gap needed by the production E2Es:

  • bind the conventional item="..." equality matcher to Planner SketchQuery::PointCount
  • do not reinterpret ordinary spatial labels as sketch item keys
  • allow process-local live accuracy overrides for explicit oracle contracts
  • validate KLL, HLL, CMS, CountSketch, and DDSketch through production binaries with independent raw-data oracles

Data/oracle coverage:

  • DDSketch: raw numeric values -> quantile oracle and instant/range endpoint consistency
  • KLL: raw numeric values -> quantile oracle
  • HLL: raw identifiers with duplicates -> exact distinct-count oracle
  • CMS: repeated raw items across two windows -> total-frequency oracle
  • CountSketch: repeated raw items across two windows -> keyed point-frequency oracle

CountSketch uses an explicit weaker test-only delta because the current packed-hash runtime cannot execute Planner default depth at the selected width; production defaults are unchanged.

Validation

  • cargo check --workspace --all-targets
  • cargo test --locked -p asap_types --quiet (43 passed)
  • cargo test --locked -p control_plane --lib --quiet (615 passed)
  • cargo test --locked -p data_plane --lib --quiet (935 passed)
  • ASAP_E2E_CARGO_TARGET_DIR=$PWD/target ./scripts/e2e.sh sketch-oracles (5 production-binary oracle tests passed)
  • ASAP_E2E_CARGO_TARGET_DIR=$PWD/target ./scripts/e2e.sh whole (controller -> backend -> OTLP -> PromQL passed)

Terminology reference: https://github.com/ProjectASAP/ASAPPlanner/blob/main/docs/developer_docs/ASAP-aware-mapping-developer-guide.md

Follow-up to #478.

@zzylol
zzylol merged commit 74df1ca into main Sep 4, 2026
1 check passed
@zzylol
zzylol deleted the refactor/reuse-asapplanner-types branch September 12, 2026 14:48
@zzylol
zzylol restored the refactor/reuse-asapplanner-types branch September 12, 2026 14:48
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