Skip to content

feat(explain): decompose the Fargate residual into a Charges dimension - #49

Merged
agenticode merged 1 commit into
mainfrom
wave/s4-charges
Aug 26, 2026
Merged

agenticode merged 1 commit into
mainfrom
wave/s4-charges

Conversation

@agenticode

Copy link
Copy Markdown
Owner

charges is an ordinary member of Terms whose Of children are charge-volume,
charge-kind-mix, charge-class-mix, charge-rate and charge-unattributed. Residual
is still computed last as the remainder, so sum(Terms)+Residual == Delta is
untouched and check, Verify, Citations, Sum and Prose cover the new dimension
with no new code — an invariant enforced in two places is enforced in neither.

Attribution.check asserts charges.Micro == ChargeDeltaMicro, the exact int64
difference of the two supplied dimensions. Without it sum(Of) == parent is
vacuous and charge-unattributed absorbs whatever the parent claims.
FuzzChargeInvariants (6.0M execs clean) additionally pins that the chain's
remainder never exceeds what 2 microUSD/h quantization can explain.

Charges stated at one window edge only are not attributed at all: reading the
silent edge as zero would report a cluster's whole Fargate bill as appearing
from nothing. TestResidualStillGrowsWhenChargesCannotExplainIt pins the
complementary direction, and TestChargesShrinkTheResidualTheyUsedToBe asserts
the microUSD leaving the residual equals the charges term with no node term
moving to make room.

Charge.Evidence is exported so a CostBasis still round-trips through JSON;
enforcement lives in NewCharge and at the input boundary, where an uncitable
charge fails the whole answer rather than being dropped.

charges is an ordinary member of Terms whose Of children are charge-volume,
charge-kind-mix, charge-class-mix, charge-rate and charge-unattributed. Residual
is still computed last as the remainder, so sum(Terms)+Residual == Delta is
untouched and check, Verify, Citations, Sum and Prose cover the new dimension
with no new code — an invariant enforced in two places is enforced in neither.

Attribution.check asserts charges.Micro == ChargeDeltaMicro, the exact int64
difference of the two supplied dimensions. Without it sum(Of) == parent is
vacuous and charge-unattributed absorbs whatever the parent claims.
FuzzChargeInvariants (6.0M execs clean) additionally pins that the chain's
remainder never exceeds what 2 microUSD/h quantization can explain.

Charges stated at one window edge only are not attributed at all: reading the
silent edge as zero would report a cluster's whole Fargate bill as appearing
from nothing. TestResidualStillGrowsWhenChargesCannotExplainIt pins the
complementary direction, and TestChargesShrinkTheResidualTheyUsedToBe asserts
the microUSD leaving the residual equals the charges term with no node term
moving to make room.

Charge.Evidence is exported so a CostBasis still round-trips through JSON;
enforcement lives in NewCharge and at the input boundary, where an uncitable
charge fails the whole answer rather than being dropped.

Co-authored-by: kording <74226694+kording@users.noreply.github.com>
@agenticode
agenticode merged commit 7ed836a into main Aug 26, 2026
2 checks passed
@agenticode
agenticode deleted the wave/s4-charges branch August 26, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant