Skip to content

refactor(types): drop BackendCollectorConfig — pure shadow state of AgentCollectorConfig - #242

Merged
zzylol merged 1 commit into
mainfrom
retire-backend-collector-config
May 15, 2026
Merged

zzylol merged 1 commit into
mainfrom
retire-backend-collector-config

Conversation

@zzylol

@zzylol zzylol commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #241. With the legacy backend-collector emitter gone, BackendCollectorConfig { merge_sketch_type, group_by } on CollectionPlan is pure shadow state — both fields are derivative of AgentCollectorConfig:

  • merge_sketch_type was always set to agent_config.sketch_type.clone() (literally — see the deleted let backend_sketch = sketch_type.clone() line and the deleted backend_config_matches_sketch_type regression test).
  • group_by was always agent_config.aggregate_by.clone() when set, else vec![].

Only one site read these fields: the metrics_exposer plan-id hash. Replaced backend_config.group_byagent_config.aggregate_by to preserve the "plan_id changes when grouping changes" observability semantic. Dropped merge_sketch_type from the hash (redundant with agent_config.sketch_type already there).

Removed

  • pub struct BackendCollectorConfig + CollectionPlan.backend_config field
  • 8 initializer sites
  • 3 mutation sites in optimizer sketch-type tuning loops (cost/mod ×2, pareto)
  • The redundant backend_config_matches_sketch_type test
  • One import of BackendCollectorConfig in emit/asapquery_backend.rs

Risk note

Plan-id hash values shift on this release. They're opaque per-plan identifiers — anyone alerting on specific values was already on shaky ground. The semantics (changes-on-replan, stable-on-refresh) are preserved.

Test plan

  • cargo check clean (only pre-existing warnings)
  • cargo test --lib: 686 passed; 0 failed (1 less than before — the deleted redundant-invariant test)
  • cargo test --tests --bins: 27 passed; 0 failed

🤖 Generated with Claude Code

…gentCollectorConfig

Now that the legacy backend-collector emitter is retired (#241), the
`BackendCollectorConfig { merge_sketch_type, group_by }` struct on
`CollectionPlan` has no real consumers — both fields are derivative of
`AgentCollectorConfig`:

- `merge_sketch_type` was always set to `agent_config.sketch_type.clone()`
  (literally — see the deleted `let backend_sketch = sketch_type.clone();`
  line in RulesPlanner, and the deleted `backend_config_matches_sketch_type`
  test that asserted the equality as an invariant).
- `group_by` was always `agent_config.aggregate_by.clone()` when set, else
  `vec![]`. The shadow was a true field-by-field duplicate.

Only one site read these fields: the `metrics_exposer` plan-id hash, which
already includes `agent_config.sketch_type`. Replaced `backend_config.group_by`
with `agent_config.aggregate_by` in the hash (option (b) from review) to
preserve the "plan_id changes when grouping changes" observability semantic.

Removes:
- `pub struct BackendCollectorConfig` + the `pub backend_config` field
- 8 initializer sites (store, replan, optimizer/{rules×2, cost test,
  cost/delta test, cost/mod test}, emit/asapquery_backend test,
  metrics_exposer test)
- 3 mutation sites in the optimizer's sketch-type tuning loops
  (cost/mod ×2, pareto)
- The redundant `backend_config_matches_sketch_type` test in rules/mod.rs
- One import of `BackendCollectorConfig` in emit/asapquery_backend.rs

Plan-id hash values shift on this release — they're opaque per-plan
identifiers, so anyone alerting on specific values was already on shaky
ground. The semantics (changes-on-replan, stable-on-refresh) are
preserved.

Build clean. 686 lib tests + 27 binary tests pass (1 less than before
this PR — the deleted redundant-invariant test).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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