Add compounding-lock score + fix rate borrowing#21
Merged
Conversation
Candidate alternatives were priced through a customer_rates view, so one box could be scored against a *different* box's old locked rate — a rate a new order or rescale can't actually obtain. This inflated the reported saving on multi-machine fleets. Price every same-spec candidate at its prevailing list rate instead (floored at paid). Adds a two-box guard test.
A second scoring number: what an admin who locks each cheapest same-spec rate before it rises and holds it would pay, versus Scenario 1's re-optimise-every-month. The gap between them is the permanent penalty. optimal_locked is a per-box running minimum of the cheapest same-spec rate - computed separately per billing unit (monthly vs hourly), reset at every price change except 15-Jun-2026 (the only one that grandfathers existing boxes), and partitioned by spec so a resize can't carry a smaller box's rate. Floored at paid. Adds hermetic tests for the lock, the scale-up bound, hourly/monthly separation, the grandfathering reset, and the spec-resize reset.
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.
No description provided.