Skip to content

Remove the legacy plan endpoints and the dead capability-miss loop - #718

Merged
zzylol merged 2 commits into
mainfrom
refactor/703-remove-legacy-plan-endpoints
Sep 14, 2026
Merged

zzylol merged 2 commits into
mainfrom
refactor/703-remove-legacy-plan-endpoints

Conversation

@zzylol

@zzylol zzylol commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

#703 item 18, second deletion step. Stacked on #715 (which is stacked on #713) — review those first.

The finding that makes this a deletion, not a rewrite

The issue treats POST /api/v1/plan as "still fully alive". It is routed, but it has no working consumer. Both apparent ones are broken or unwired:

1. The capability-miss feedback loop never worked. The data plane POSTs a CapabilityMissPayload:

{"kind": "...", "metric": "...", "statistics": [...], "data_range_ms": 300000,
 "grouping_labels": [...], "spatial_filter_normalized": "..."}

handle_plan accepts a QuerySpec, whose accuracy_sla has no #[serde(default)]. Verified by deserializing the exact payload against QuerySpec:

missing field `accuracy_sla`

No control-plane handler accepts that payload at all — there is no capability_miss route and no field named spatial_filter_normalized anywhere in the crate. The resulting non-2xx becomes an Err that spawn_capability_miss_notify logs at WARN and drops, so the loop has been a silent no-op in production.

2. config_fetcher::ControlPlaneClient — which polls GET /plan/:metric and posts /plan — is never constructed outside its own module.

That left control_plane/tests/component_process_e2e.rs as the only real caller, and it exercises the legacy path itself.

Consequence: the three gaps that would have made porting handle_plan onto PhysicalCompiler awkward — QuerySpec::query_string being Option, the absent LifecyclePlanningInput cost evidence, and the absent window_implementations (select_lifecycle hard-errors without a concrete implementation) — do not need to be closed at all.

What goes

  • POST /api/v1/plan, GET /api/v1/plan/:metric, and their handlers
  • data_plane/src/drivers/control_plane_client/ entirely, plus the engine's control_plane_client field, with_control_plane_client, and both spawn_capability_miss_notify call sites
  • --control-plane-endpoint and its --profile asapquery exclusion check, now unreachable
  • control_plane/tests/component_process_e2e.rs and data_plane/src/tests/capability_miss_http_e2e_tests.rs
  • 14 tests in main.rs covering the deleted routes
  • AppState::{analyzer, planner, store, scraper, backend_routing_cache} — all unread once the handlers are gone

2,031 lines removed, 10 added.

What deliberately stays

pipeline.rs, physical/plan_cache.rs, physical/workload_planner.rs and store/ are untouched. The startup workloads.yaml pre-population (main.rs) still runs Analyzer and DeploymentPlanCompiler to fill workload_store, which handle_bootstrap_agent_config reads. That chain retires together with the collector-facing emitters in the next step; splitting it here would leave a state that does not compile.

Testing

  • cargo +1.98.0 check -p control_plane -p data_plane --all-targets — clean, no warnings.
  • cargo +1.98.0 test -p control_plane --lib — 705 passed, 0 failed.
  • cargo +1.98.0 test -p data_plane --lib — 1193 passed, 0 failed.

Unrelated note

rustc 1.98.0 ICEs on evaluate_obligation under incremental compilation while checking this change. CARGO_INCREMENTAL=0 (or cargo clean -p control_plane) works around it. Not caused by anything here, but worth knowing if CI hits it.

🤖 Generated with Claude Code

@zzylol
zzylol force-pushed the refactor/703-remove-legacy-endpoints branch from c85021f to 5fe87fc Compare September 13, 2026 21:04
@zzylol
zzylol force-pushed the refactor/703-remove-legacy-plan-endpoints branch from 79fdbf5 to 71e6f4c Compare September 13, 2026 21:06
@zzylol
zzylol force-pushed the refactor/703-remove-legacy-plan-endpoints branch from 71e6f4c to 7305832 Compare September 13, 2026 21:16
@zzylol
zzylol force-pushed the refactor/703-remove-legacy-endpoints branch from 794befe to 7588fbb Compare September 13, 2026 22:25
@zzylol
zzylol force-pushed the refactor/703-remove-legacy-plan-endpoints branch from 7305832 to a1749b7 Compare September 13, 2026 22:37
@zzylol
zzylol changed the base branch from refactor/703-remove-legacy-endpoints to main September 13, 2026 22:42
@zzylol
zzylol force-pushed the refactor/703-remove-legacy-plan-endpoints branch from a1749b7 to ebb601c Compare September 14, 2026 00:27
zzylol and others added 2 commits September 13, 2026 18:43
…ss loop

`POST /api/v1/plan` and `GET /api/v1/plan/:metric` have no working
consumer. The apparent one does not function: the data plane's
capability-miss notifier POSTs a `CapabilityMissPayload` — `{kind,
metric, statistics, data_range_ms, grouping_labels,
spatial_filter_normalized}` — while `handle_plan` accepts a `QuerySpec`,
whose `accuracy_sla` carries no serde default. Every notification fails
deserialization with `missing field accuracy_sla`, and no control-plane
handler accepts that payload at all. The non-2xx becomes an `Err` that
`spawn_capability_miss_notify` logs at WARN and drops, so the loop has
been a silent no-op.

That left `control_plane/tests/component_process_e2e.rs` as the only
real caller, and it exercises the legacy path itself.

Removing the endpoints therefore needs no rewrite. The three gaps that
would have made porting `handle_plan` onto `PhysicalCompiler` awkward —
`QuerySpec::query_string` being optional, the absent
`LifecyclePlanningInput` cost evidence, and the absent
`window_implementations` — do not have to be closed.

`AppState` loses `analyzer`, `planner`, `store`, `scraper` and
`backend_routing_cache`, all unread once the handlers are gone.

The legacy planner modules behind them stay for now: the startup
`workloads.yaml` pre-population still runs `Analyzer` and
`DeploymentPlanCompiler` to fill `workload_store`, which
`handle_bootstrap_agent_config` reads. That chain retires with the
collector-facing emitters.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zzylol
zzylol force-pushed the refactor/703-remove-legacy-plan-endpoints branch from ebb601c to 9e2117d Compare September 14, 2026 00:56
@zzylol
zzylol merged commit e691360 into main Sep 14, 2026
1 check passed
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