feat(plan): extend CostModel with a size_params hook - #146
Merged
Merged
Conversation
`CostModel::rank_candidates` already lets a deployment reorder which `SummaryKind` answers an intent, but `SummaryParams` sizing (k / width / depth / precision) was still hardcoded in `boundary::bind_summary_with`, unreachable by any cost model. A deployment with its own accuracy-bound math (or a downstream catalog that only recognizes discrete parameter rungs) had no extension point short of forking `implementation_for_with`. Add `CostModel::size_params`, defaulting to the now-extracted `boundary::default_size_params` (byte-for-byte the same formulas `bind_summary_with` used inline before) so `DefaultCostModel` and every existing caller keep today's behavior unchanged. A deployment can now override ranking, sizing, or both, independently. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Jul 22, 2026
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
CostModel::rank_candidateslets a deployment reorder whichSummaryKindanswers anAggIntent, butSummaryParamssizing (k/width/depth/precision) was hardcoded inline inboundary::bind_summary_with, unreachable by any cost model.CostModel::size_params(kind, intent, eps, delta) -> SummaryParams, with a default body delegating to the newly-extractedboundary::default_size_params(the exact same formulas that were inline before — no behavior change forDefaultCostModelor any existing caller).control_planehas its own KLL/CMS/HLL parameter-sizing logic (in some cases tied to a downstream catalog's discrete supported-K rungs, not a continuous formula) that it needs to keep using while still adoptingimplement_tree_in_with's IR construction (schema/col/by plumbing) instead of forking it. This is the same "one extension point per deployment-specific decision" patternrank_candidatesalready established, one level deeper.Test plan
cargo test -p asap-plan— 26 passed (24 pre-existing + 2 new:size_params_default_body_matches_default_size_params,custom_cost_model_can_override_sizing_independently_of_ranking)cargo test --workspace— all green, no regressionscargo clippy -p asap-plan --all-targets— clean🤖 Generated with Claude Code