Conversation
The Support Item step's Credit Card Fees formula label rounded the configured fee rate to 0 decimals, showing "1%" instead of the actual 0.6% used in the calculation. Format the rate with 2 fraction digits so the help text matches the underlying math. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bundle sizes [mpdx-react]Compared against 4a5f134 No significant changes found |
wjames111
left a comment
There was a problem hiding this comment.
Multi-Agent Review Summary — PR #1796
Verdict: APPROVED WITH SUGGESTIONS
Risk: LOW (1/10) — Single display-precision fix in a goal-calculator component, well-scoped and covered by a new unit test. The change correctly keeps rounding at the display boundary via Intl.NumberFormat (per the project's Financial Reporting rule). No calculation logic touched; totals.creditCardFees still uses the raw creditCardFeeRate with full precision.
Agents: Architecture, Testing, Standards, UX, Financial Reporting (5 agents, parallel)
Findings at a glance
| Severity | Count | Summary |
|---|---|---|
| Critical (9-10) | 0 | — |
| High (8-8.9) | 0 | — |
| Important (7-7.9) | 0 | — |
| Medium (5-6.9) | 1 | Cross-rate consistency (3 agents) |
| Suggestion (<5) | 5 | Edge-case tests, FYIs |
Highlights
- 3-agent consensus (Architecture + UX + Financial Reporting): Consider extending
{ fractionDigits: 2 }to the siblingattritionRate(line 110) andadminRate(line 137) calls in the same file. They flow from the same upstream shape (fee: Float!) and the samepdsGoalConstants.tssource — the same misrepresentation bug class can recur there. Out of scope for the MPDX-9617 ticket but worth a follow-up. - Testing: New assertion is correct and matches the project's i18next test convention (precedent: same file line ~220 asserts a resolved string for the attrition row). Edge-case coverage could be expanded (
0,0.0001,0.03). - Standards: Clean across every applicable checklist item — named exports, i18n preserved, no
any, no debug output, nonew Date(), colocated test. - Financial Reporting: Fix exemplifies the "round at the display boundary" rule. Calculation path verified untouched.
Notes (informational, not actionable in this PR)
.CLAUDE/rules/code-review.mdreferencessrc/components/Reports/PdsGoalCalculator/**for the Financial Reporting agent trigger, but the actual location issrc/components/HrTools/PdsGoalCalculator/**. Worth a separate rules-file update so future automated review fires the right domain agent.
| rate: percentageFormat(constants.creditCardFeeRate, locale), | ||
| rate: percentageFormat(constants.creditCardFeeRate, locale, { | ||
| fractionDigits: 2, | ||
| }), |
There was a problem hiding this comment.
Out of scope for MPDX-9617 (the ticket is scoped to Credit Card Fees), but recommended as a small follow-up to close the bug class. If you keep the scope tight, a tiny helper at the top of the file would prevent option-object duplication when you do extend it:
const formatRate = (value: number, locale: string) =>
percentageFormat(value, locale, { fractionDigits: 2 });| { | ||
| rate: percentageFormat(constants.creditCardFeeRate, locale), | ||
| rate: percentageFormat(constants.creditCardFeeRate, locale, { | ||
| fractionDigits: 2, |
There was a problem hiding this comment.
There was a problem hiding this comment.
AI Review Auto-Approval
Risk Level: LOW (1/10)
Verdict: APPROVED_WITH_SUGGESTIONS (suggestions posted, no blockers)
This PR was auto-approved because:
- The multi-agent AI review determined it is low risk
- No blocking issues were found
- All suggestions have been posted as review comments for the developer to consider
If you believe this PR needs human review, dismiss this approval and request a review manually.
|
Sorry this test failure (chunk 2) has been driving me crazy. It's a timeout. I'll fix that, hopefully will be sorted out soon. |
Description
CREDIT_CARD_FEE_RATE.fee(0.006 / 0.6%) to "1%" becausepercentageFormatdefaulted to 0 fraction digits, while the underlying calculation correctly used 0.6%fractionDigits: 2topercentageFormatat the credit-card-fees call site so the formula renders "0.60%" and matches the mathTesting
/accountLists/<id>/hrTools/pdsGoalCalculator/<goalId>on staging (impersonatesarah_1.single_staff_applicant@cru.org, designation 1334191) or create a default-type PDS goal(Subtotal + Attrition) ÷ (1 - 0.60%) - (Subtotal + Attrition)(no more "1%")yarn jest src/components/HrTools/PdsGoalCalculator/SupportItem/otherBreakdown.test.tsxand confirm all tests passChecklist:
/pr-reviewcommand locally and fixed any relevant suggestions🤖 Generated with Claude Code