Repository navigation
fix: round the cumulative price breakdown like its totals - #303
Merged
Merged
Conversation
computeCumulativeValue formatted each breakdown line at full precision: a quantity normalised from 1000 kWh a year showed as "83.333333 kWh" with an amount of "€28.333333333333", next to a total rounded to the cent. The journey's cumulative price tooltip and the entity price table render these lines as they are. quantityUsed is now rounded to 2 decimals and totalAmountDecimal to 2 decimals like `total`. tierAmountDecimal keeps the tier's real precision, and the *WithPrecision totals are unchanged. Refs STABLE360-13364 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ZVb2xHqHs2s2bUy7Ut25g
🦋 Changeset detectedLatest commit: e2a0712 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
jnmau
approved these changes
Oct 27, 2026
jnmau
left a comment
Member
There was a problem hiding this comment.
It's a breaking change in theory, so it should maybe be a minor version bump.
Otherwise, approved. ✅
The breakdown's display strings change, which a consumer could rely on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ZVb2xHqHs2s2bUy7Ut25g
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
computeCumulativeValueformatted eachbreakdownline at full precision. With a quantity normalised from a yearly consumption (1000 kWh / 12 = 83.333… kWh), the journey's cumulative price tooltip showed:The same breakdown is rendered by the entity price table in 360.
This changes what the breakdown displays:
quantityUsed: rounded to 2 decimals (was up to 6)totalAmountDecimal:precision: 2,useRealPrecision: false, the same astotaltierAmountDecimal(the tier's unit price) keeps its real precision, so34.56 cents/kWhstays as it istotalWithPrecision/subtotalWithPrecisionare unchangedOnly display strings change. The tier amounts and totals are computed exactly as before.
The only existing expectations that change are the sub-cent tiers:
27.7255 cents→27.73 centsand10.866 cents→10.87 cents. These now matchtotal: '38.59 cents'. The rounded lines can differ from the rounded total by a cent (27.73 + 10.87 vs 38.59), as with any per-line rounding.Changeset: minor. The strings a consumer may rely on change.
Jira: STABLE360-13364. The 360 entity app (
^5.9.0) picks this up with the next release. journey-monorepo is pinned to5.6.8and gets it when it upgrades@epilot/pricing, which crosses the@epilot/sdkmigration (5.8.0) and thei18next ^25peer (5.9.0). That upgrade is a separate change.Test plan
1000 / 12kWh →50 kWh/33.33 kWh, line totals€17.28/€10.00, unit price34.56 cents/kWhkept. It fails onmain.vitest run: 639 passing, andtsc --noEmitis clean (both also ran in the lefthook pre-commit)eslint src/tiers: no new warnings (the 4 non-null-assertion warnings are on existing lines)🤖 Generated with Claude Code
https://claude.ai/code/session_018ZVb2xHqHs2s2bUy7Ut25g