Skip to content

refactor(capability_matching): move serving-time routing logic to data_plane - #406

Merged
zzylol merged 3 commits into
mainfrom
refactor/split-serving-time-capability-routing-to-data-plane
Jul 22, 2026
Merged

zzylol merged 3 commits into
mainfrom
refactor/split-serving-time-capability-routing-to-data-plane

Conversation

@zzylol

@zzylol zzylol commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the find_compatible_aggregation dead-code audit (#404) — auditing the rest of asap_types::capability_matching.rs for what's genuinely shared vs. what only looks shared because it's housed in the shared crate.

  • Confirmed via full-repo grep (real call sites, not comment mentions): compatible_storage_backends's only two real callers are both inside data_plane/src/query_engines/routing/query_engine_routing.rs. AccuracyTarget is never a field on any shared struct -- only a parameter to that function. control_plane has zero callers of either.
  • StorageBackend stays in asap_types -- it's a real field on the shared StreamingConfig wire format both control_plane (constructs) and data_plane (serves against) need to agree on. Its data_source_id/parse_storage_backend_engine_id helpers and ENGINE_ID_*/CANONICAL_QUERY_ENGINE_IDS constants stay alongside it since they're tightly coupled to the type itself, not the routing decision.
  • Moved AccuracyTarget + compatible_storage_backends (+ their 3 tests) to a new data_plane/src/query_engines/routing/capability_matching.rs, re-exported from routing::mod.
  • Same audit surfaced two more confirmed-dead functions (zero real callers anywhere, same "grep excluding comments/own-tests" method as chore(asap_types): delete dead find_compatible_aggregation #404): compatible_agg_types and required_sub_type. Deleted both, along with compatible_agg_types's one test (which only exercised the dead function).

Test plan

🤖 Generated with Claude Code

zzylol and others added 3 commits July 21, 2026 10:19
…a_plane

asap_types::capability_matching mixed a genuinely shared type
(StorageBackend, a real field on the shared StreamingConfig wire
format) with routing *decisions* that have zero control_plane callers.
Confirmed via full-repo grep: compatible_storage_backends' only real
callers are both inside data_plane/query_engines/routing/
query_engine_routing.rs; AccuracyTarget is never a shared-struct field,
only a parameter to that function.

Moved to a new data_plane/src/query_engines/routing/capability_matching.rs:
AccuracyTarget, compatible_storage_backends, and their three tests.
asap_types keeps StorageBackend, its data_source_id/parse helpers, and
the ENGINE_ID_*/CANONICAL_QUERY_ENGINE_IDS constants they're tightly
coupled to -- these stay because StorageBackend is a real
StreamingConfig field, not because anything here calls the routing
logic.

Also deleted two more confirmed-dead functions surfaced by this audit
(same "grep for real callers, not comment mentions" method as the
find_compatible_aggregation cleanup): compatible_agg_types (zero
callers outside its own now-deleted test) and required_sub_type (zero
callers anywhere).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…d.rs

Follow-up to the previous commit: with the routing/matching logic
moved to data_plane, this file only contains StorageBackend and its
string-mapping helpers -- "capability_matching" no longer describes
its contents, and the name collided with two other, unrelated
capability_matching.rs files (control_plane/sketch_algebra's own
capability classifier, and the new one in
data_plane/query_engines/routing).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Correction to the previous commit's reasoning: I'd claimed
control_plane needed StorageBackend because it's a StreamingConfig
field control_plane constructs. That was never actually verified --
every real (non-comment) StreamingConfig mention in control_plane is
its own, separately-typed StreamingConfigEmitter, which hand-builds
wire-compatible JSON via serde_json::Value and never imports
asap_types::StreamingConfig or StorageBackend at all.

The one thing that looked like real coupling -- PolicyRegistry::
from_streaming_config(&StreamingConfig) -- was pure sugar over
from_configs with exactly one real caller anywhere in the workspace:
StreamingConfig::policy_registry() itself. control_plane's own
production code (asap_tier_analysis.rs) only ever calls
PolicyRegistry::from_configs directly.

So StreamingConfig and StorageBackend move to
data_plane/src/storage_engines/types/, alongside the config types
already re-exported there. PolicyRegistry::from_streaming_config{,
_with_collisions} are deleted from asap_types (dead once their only
caller moves); StreamingConfig::policy_registry() now calls
PolicyRegistry::from_configs directly.

MonitorSpec stays in asap_types, split out to its own file --
unlike StreamingConfig/StorageBackend, control_plane genuinely needs
it: emit/monitor.rs hand-builds the StreamingConfig.monitors[] JSON
entry and has a real regression test deserializing it into this exact
type, and control_plane cannot depend on data_plane (the dependency
runs the other way) to reach a data_plane-hosted definition.

All real call sites across data_plane updated to
crate::storage_engines::types::{StreamingConfig, StorageBackend, ...}.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@zzylol
zzylol merged commit 005ee32 into main Jul 22, 2026
@zzylol
zzylol deleted the refactor/split-serving-time-capability-routing-to-data-plane branch July 22, 2026 16:47
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