[MPDX-9531] Swap spouse salary request fields#1761
Conversation
|
Preview branch generated at https://9531-swapped-salary-request-spouse.d3dytjb8adxkk5.amplifyapp.com |
Bundle sizes [mpdx-react]Compared against 2f90b0b No significant changes found |
canac
left a comment
There was a problem hiding this comment.
Multi-Agent Review — PR #1761
Verdict: CLEAN — no blockers, no Important/Medium findings.
Risk: 8/10 (HIGH — graphql + multiple component files, mechanical fix)
Agents: Architecture, Testing, Standards, UX (4)
Summary
Targeted, correct fix for swapping user/spouse salary fields when the spouse initiated the request. Code traces cleanly in both useLandingData.ts and SalarySummaryCard.tsx. Test coverage extended to both the component (SalarySummaryCard.test.tsx) and the landing hook path (NewSalaryCalculatorLanding.test.tsx). Redundant ?. cleaned up. personNumber is required per schema, so the undefined === undefined edge case is moot.
Suggestions (informational, do not block)
- Duplicated
ownRequestswap logic —src/components/HrTools/SalaryCalculator/Landing/useLandingData.ts:157-170andsrc/components/HrTools/SalaryCalculator/Summary/SalarySummaryCard.tsx:21-28both reimplement the same predicate + 4-field swap. Two callsites is borderline; if a third surface needs the swap, consider extracting a smallprojectForViewerhelper intoSalaryCalculator/Shared/. Severity 4.0.
Standards Checklist
All items PASS. Codegen, named exports, id selections, no any, no debug output, test colocation — all clean.
Financial Checklist
N/A — no arithmetic, rounding, or currency-mixing changes. Domain agent (Financial Reporting) skipped because the file lives under HrTools/SalaryCalculator/, not Reports/SalaryCalculator/.
9613a43 to
8b2f2aa
Compare
canac
left a comment
There was a problem hiding this comment.
Multi-Agent Review (Quick) — PR #1761
Verdict: CLEAN — no findings at severity ≥ 5.
Risk: 8/10 (HIGH — file-pattern based; mechanical fix limited to HrTools/SalaryCalculator)
Agents: Testing, Architecture, Standards (3, sonnet)
Summary
Follow-up review after addressing the prior round's feedback:
- Tests added in
NewSalaryCalculatorLanding.test.tsxcover both own-request and spouse-request paths viagetAllByRole('cell')cell-array assertions matching theRequestedSalaryCard.test.tsxconvention. LandingTestWrappernow exports its props interface and supportshasSpouseApprovedCalculation.- The redundant inline
?.chains inSalarySummaryCard.tsxwere dropped. - Cell-content verification removed from the older heading-based spec in favor of the broader cell-array assertion.
Findings
All three agents traced the swap math through both useLandingData.ts and SalarySummaryCard.tsx and confirmed every expected cell value in both new tests is correct. useMemo dependency array on useLandingData.ts:255 is complete. No N+1 or waterfall introduced.
Standards Note (informational, not in diff)
SalarySummaryCard.test.tsx:66 — the GqlMockedProvider generic omits EffectiveSalaryCalculation: EffectiveSalaryCalculationQuery. Pre-existing setup; this PR makes the gap more visible because the new swap test exercises that mock key. The mock is still type-checked at the variable declaration via DeepPartial<EffectiveSalaryCalculationQuery['salaryRequest']>, so practical risk is low. Optional cleanup in a follow-up.
Standards Checklist
All PASS. yarn lint:ts clean. Named exports, id selections on both queries, no any, no debug output, no new Date(), test colocation correct.
8b2f2aa to
6366a30
Compare
|
@wjames111 Sorry, AI calls this high-risk for some reason |
wjames111
left a comment
There was a problem hiding this comment.
Looks great! My only gripe is that there's multiple places where spouse vs user is checked throughout this PR. Some might be unavoidable but where possible it would nice to have consolidated.
Description
When the spouse created the effective salary request, the fields will be swapped from the perspective of the current user. This PR swaps them back.
MPDX-9531
Related backend PR: https://github.com/CruGlobal/mpdx_api/pull/3309
Testing
Checklist:
/pr-reviewcommand locally and fixed any relevant suggestions