Skip to content

MPDX-9650 - Improve validation in Savings Fund Transfer#1814

Merged
zweatshirt merged 1 commit into
mainfrom
MPDX-9650
Jun 2, 2026
Merged

MPDX-9650 - Improve validation in Savings Fund Transfer#1814
zweatshirt merged 1 commit into
mainfrom
MPDX-9650

Conversation

@zweatshirt

@zweatshirt zweatshirt commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Description

  • Ensures the start and end date can't be the same date, since SAA has validation that raises in error for this case.
  • Adds information text for the recurring end date
    https://jira.cru.org/browse/MPDX-9580

Testing

  • Go to SavingsFundTransfer
  • Ensure that the user cannot set the start date and the end date to be the same date.

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels (Add the label "Preview" to automatically create a preview environment)
  • I have run the Claude Code /pr-review command locally and fixed any relevant suggestions
  • I have requested a review from another person on the project
  • I have tested my changes in preview or in staging
  • I have cleaned up my commit history

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Bundle sizes [mpdx-react]

Compared against 8544dce

No significant changes found

@zweatshirt zweatshirt left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Multi-Agent Code Review — Verdict: ✅ CLEAN

Mode: standard · Risk: 1/10 (LOW) · Blockers: 0

Agents run: Architecture, UX/a11y, Financial (domain). Testing + Standards were verified inline (their key concerns are addressed below). This is a small, focused change — end-date validation now requires the end date to be strictly at least one calendar day after the transfer date (day-granular Luxon comparison), plus a permanent descriptive helper text on the End Date field, with 4 colocated tests.

Findings

Only two severity-3 suggestions (informational — do not block merge). See the inline comment for the first; the second is below.

Verified — concerns from skipped agents

  • Type safety: Dropping the as string cast on errors.endDate is correct and type-safe. Because endDate is DateTime<boolean> | null, Formik's FormikErrors mapped type resolves it to string | undefined (the | null defeats the extends object branch). The sibling transferDate (non-nullable) resolves to a FormikErrors<DateTime> object — which is exactly why line 478 still needs its cast. tsc --noEmit is clean.
  • Tests using past dates: 12/01/2024 also fails the recurring start-date rule, but each new test asserts only the end-date error's presence/absence, which is independent and correct in isolation. Suite passes. Minor smell — future dates would read cleaner — but not a defect.

Findings on Related Files (Not on Changed Lines)

[Suggestion] TransferModal.tsx:478 — Cast asymmetry between sibling date fields

  • Severity: 3.0/10 · Flagged by: Architecture
  • The End Date helper (this PR) now passes errors.endDate directly, while the adjacent Transfer Date helper at line 478 still uses (errors.transferDate as string). The new pattern is the better one; line 478 is the outlier and is out of scope here. Consider dropping that cast if the line is touched in a future PR.

Domain note (non-blocking, pre-existing)

The submit path sends recurringStart/recurringEnd as full toISO() timestamps with a local offset, while validation compares at day granularity. Not reachable as a bug here (both fields are local-midnight date-only values), but worth a one-line confirmation with the API team that the backend treats these as calendar dates, not raw UTC instants — to avoid a boundary day-shift. This concerns the pre-existing toISO() submission, not the lines this PR adds.

@@ -491,7 +491,11 @@ export const TransferModal: React.FC<TransferModalProps> = ({
}}
error={touched.endDate && Boolean(errors.endDate)}
helperText={
touched.endDate && (errors.endDate as string)
touched.endDate && errors.endDate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The `touched.endDate && errors.endDate ? errors.endDate : t(...)` expression is correct but slightly over-conditioned — the leading `touched.endDate &&` only gates the error branch, while the default helper text always renders in the false branch. Behavior is verified correct across all touched/error states, so this is optional polish, not a fix.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review Auto-Approval

Risk Level: LOW (1/10)
Verdict: CLEAN (no issues found)

This PR was auto-approved because:

  • The multi-agent AI review determined it is low risk
  • No blocking issues were found

If you believe this PR needs human review, dismiss this approval and request a review manually.

@zweatshirt zweatshirt marked this pull request as ready for review June 1, 2026 21:19
@zweatshirt zweatshirt changed the title MPDX-9650 MPDX-9650 - Improve validation in Savings Fund Transfer Jun 1, 2026
@zweatshirt zweatshirt self-assigned this Jun 1, 2026
@zweatshirt zweatshirt added the Preview Environment Add this label to create an Amplify Preview label Jun 1, 2026
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Preview branch generated at https://MPDX-9650.d3dytjb8adxkk5.amplifyapp.com

@zweatshirt zweatshirt merged commit 70292ce into main Jun 2, 2026
23 of 24 checks passed
@zweatshirt zweatshirt deleted the MPDX-9650 branch June 2, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Preview Environment Add this label to create an Amplify Preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant