refactor(types): drop BackendCollectorConfig — pure shadow state of AgentCollectorConfig - #242
Merged
Merged
Conversation
…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>
4 tasks
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
Follow-up to #241. With the legacy backend-collector emitter gone,
BackendCollectorConfig { merge_sketch_type, group_by }onCollectionPlanis pure shadow state — both fields are derivative ofAgentCollectorConfig:merge_sketch_typewas always set toagent_config.sketch_type.clone()(literally — see the deletedlet backend_sketch = sketch_type.clone()line and the deletedbackend_config_matches_sketch_typeregression test).group_bywas alwaysagent_config.aggregate_by.clone()when set, elsevec![].Only one site read these fields: the
metrics_exposerplan-id hash. Replacedbackend_config.group_by→agent_config.aggregate_byto preserve the "plan_id changes when grouping changes" observability semantic. Droppedmerge_sketch_typefrom the hash (redundant withagent_config.sketch_typealready there).Removed
pub struct BackendCollectorConfig+CollectionPlan.backend_configfieldcost/mod×2,pareto)backend_config_matches_sketch_typetestBackendCollectorConfiginemit/asapquery_backend.rsRisk 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 checkclean (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