Fix convert capacity double-counting bug#185
Merged
fr1jo merged 5 commits intofrijo/release/PI-15from Feb 14, 2026
Merged
Conversation
7dc04fc to
052c51e
Compare
When multiple converts occurred in the same block, the convert capacity tracking was double-counting usage because calculateConvertCapacityPenalty() returned cumulative values that applyStalkPenalty() added to storage again. Changes: - calculateConvertCapacityPenalty() now returns delta values instead of cumulative - calculatePerWellCapacity() now returns delta values and removes unused parameter - Added NatSpec documentation for pdCapacity return value - Added tests verifying sequential converts consume linear capacity Before fix: storage = old + (old + delta) = 2*old + delta After fix: storage = old + delta Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
124f8ca to
694be8d
Compare
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
eb9f17f to
ff25c68
Compare
pocikerim
reviewed
Feb 12, 2026
Changed variable names in the convert capacity call chain to better reflect that they now represent delta values (incremental amounts) rather than cumulative totals after the double-counting fix: - overallConvertCapacityUsed → overallCapacityDelta - inputTokenAmountUsed → inputTokenCapacityDelta - outputTokenAmountUsed → outputTokenCapacityDelta This addresses the naming confusion identified in code review where variables suggested cumulative semantics but actually contained deltas. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: frijo <fr1jo@users.noreply.github.com>
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
calculateConvertCapacityPenalty()was returning cumulative values thatapplyStalkPenalty()added to storage againstorage = old + (old + delta) = 2*old + deltainstead of correctstorage = old + deltaExample before fix:
Changes
calculateConvertCapacityPenalty()now returns delta values instead of cumulativecalculatePerWellCapacity()now returns delta values and removes unusedpdCapacityTokenparameterpdCapacityreturn valueTest plan
🤖 Generated with Claude Code