Repository navigation
refact(gate): name the two cost-floor rules - #208
Merged
Merged
Conversation
minimumCost is one repo setting applied two ways. A comparison hides a move only when both costs are under the floor. A recommendation shows only when the base cost is strictly over it. So a query at 99 becoming 1500 is a reported regression, and a query costing exactly 100 with an index recommendation is not reported at all. Both rules keep their current behaviour. They now live in one module with names and tests, so the difference is visible instead of being two inline conditions in two files that look like they should agree. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
6 successful checks
More details via MCP → get_ci_run({ runId: "019fb957-584e-796e-b373-fe4930cb17d4" }) · view run · docs
3 queries read against main on assumed statistics of 10,000,000 rows per table. Sync production stats for costs measured against your real data.
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.
Goal
Make it possible to see what
minimumCostdoes. Follow-up to #205, which put the floor in the comment copy and exposed that the number means two different things.What
No behaviour changes. Both rules are preserved exactly and now have names, one home, and tests.
Measured against the real
compareRunswiththreshold=10, minimumCost=100:The two rules, as they stand:
minimumCost: 10099 -> 1500reported,99 -> 50silentHow
src/gate/cost-floor.tsholdscomparisonClearsFloorandrecommendationClearsFloor.site-api.tsandrunner.tscall them instead of repeating the conditions inline.Tests
cost-floor.test.tspins both rules, including the boundaries: a cost exactly at the floor, and a move that stays under it on both sides. Full suite: 393 passing, 40 files, typecheck clean.The decision this does not make
The comparison rule asks "is this query worth mentioning at all". The recommendation rule asks "is it expensive enough to bother indexing". Those are reasonable as separate questions, and they are configured by one field, so a repo setting
minimumCost: 100sets two policies without being told.There is also a cliff: a query wholly under the floor can move by any factor in silence. At 100 that is trivia. At 10,000 it would hide real movement.
Changing either rule changes which pull requests get blocked, so it belongs in a decision rather than a refactor.