MPDX-9544 Frontend - Add validation to ensure the Requested Gross Salary for SOSA staff doesn't exceed their cap#1770
Conversation
|
Preview branch generated at https://MPDX-9544-frontend.d3dytjb8adxkk5.amplifyapp.com |
Bundle sizes [mpdx-react]Compared against d15e969 No significant changes found |
zweatshirt
left a comment
There was a problem hiding this comment.
Multi-Agent Code Review — PR #1770 (v2)
Verdict: APPROVED WITH SUGGESTIONS — No blockers. The v2 refactor cleanly addressed the previous round's two medium findings (Alert variant deviation + OverCapPerson field-name mismatch). Remaining items are non-blocking test-coverage gaps and minor stylistic polish.
Risk: 6/10 (MEDIUM) — 5 source files, 74 non-test lines, single-domain scope.
Agents: Architecture, Testing, Standards, UX, Financial Reporting.
Summary
| Tier | Count |
|---|---|
| Critical (9.0+) | 0 |
| High Priority (8.0–8.9) | 0 |
| Important (7.0–7.9) | 0 |
| Medium (5.0–6.9) | 2 |
| Suggestions (<5.0) | 7 |
| Pre-existing | 1 |
Top medium-priority items
- Continue-button gating contract untested —
useSosaBlockOnCap'smarkInvalid('over-cap')side effect (the entire reason the hook exists) is not asserted by any test. Carried over from round 1. - SOSA + spouse branch combinations untested — All new tests use
hasSpouse={false}. The invariantblockOnCap = isUserSosa && overUserCap(not&& overCapPerson !== null) is the most refactor-fragile line in the diff and has no regression net.
Both are non-blocking (severity 5) but would be quick wins.
What's confirmed good
- All 5
useCapsconsumers verified aligned with the new raw-number interface (Receipt,useSubmitDialogContentuse onlycombinedGross; the 3 over-cap consumers correctly wrap fields informatCurrency()at the display boundary). - Financial checklist: pass on every item (single source of truth = server, formatting at display boundary, USD-only, server-provided aggregations preferred, safe handling of
undefinedviaformatCurrency's?? 0). <Trans>{{ var: expr }}pattern matches 5+ precedents in the codebase.- All four affected test files were observed to pass after the refactor.
| } | ||
|
|
||
| export const useCaps = (): UseCapsResult => { | ||
| const { calculation, hcmUser, hcmSpouse } = useSalaryCalculator(); |
There was a problem hiding this comment.
Estimated ~40 lines via renderHook.
Flagged by Testing.
| />, | ||
| ); | ||
|
|
||
| await waitFor(() => expect(queryByRole('alert')).not.toBeInTheDocument()); |
There was a problem hiding this comment.
Flagged by Standards.
There was a problem hiding this comment.
AI Review Auto-Approval
Risk Level: MEDIUM (6/10)
Verdict: APPROVED_WITH_SUGGESTIONS (suggestions posted, no blockers)
This PR was auto-approved because:
- The multi-agent AI review determined it is medium 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.
4a52603 to
e2e01d3
Compare
|
@canac Waiting for Grace or CD to respond with the proper alert message. I am curious what you think about this in terms of UI design. I didn't choose to go with input field validation (see PR description). Thank you Caleb |
canac
left a comment
There was a problem hiding this comment.
I have a few suggestions, but the core logic looks good! Do you think we should hide the "Approval Process" card when the error message displays since they can't submit anyway?
0800dbe to
27990be
Compare
27990be to
98170b4
Compare
Description
Testing
Alertis sufficient in notifying the user.Checklist:
/pr-reviewcommand locally and fixed any relevant suggestions