Skip to content

MPDX-9597 UI - Add validation for required salary cap fields in MaxAllowableStep#1785

Merged
zweatshirt merged 1 commit into
mainfrom
split-cap-validation
May 19, 2026
Merged

MPDX-9597 UI - Add validation for required salary cap fields in MaxAllowableStep#1785
zweatshirt merged 1 commit into
mainfrom
split-cap-validation

Conversation

@zweatshirt
Copy link
Copy Markdown
Contributor

@zweatshirt zweatshirt commented May 19, 2026

Description

Testing

  • Go to Salary Calculator > Your Information > Maximum Allowable Salary (CAP) section, select the checkbox to split the cap, and ensure that the input fields display as required.

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

@zweatshirt zweatshirt self-assigned this May 19, 2026
@zweatshirt zweatshirt added the Preview Environment Add this label to create an Amplify Preview label May 19, 2026
@zweatshirt zweatshirt marked this pull request as ready for review May 19, 2026 19:47
@github-actions
Copy link
Copy Markdown
Contributor

Preview branch generated at https://split-cap-validation.d3dytjb8adxkk5.amplifyapp.com

@github-actions
Copy link
Copy Markdown
Contributor

Bundle sizes [mpdx-react]

Compared against 0e06980

No significant changes found

Copy link
Copy Markdown
Contributor Author

@zweatshirt zweatshirt left a comment

Choose a reason for hiding this comment

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

Multi-Agent Code Review - PR #1785

Agents: Architecture, Testing, Standards, UX (4 agents, standard mode)


CLEAN

No significant issues found. All 4 agents returned zero blockers and zero important concerns.

Risk: LOW (1/10) - Single component schema change with colocated test. Required reviewer level: ANY.

Dependency Impact: LOW - MaxAllowableSection is imported only by YourInformation.tsx. The yup schema is not exported (internal useMemo). No breaking changes. RequestedSalaryCard already uses required: true on the same helper, confirming this is an established pattern.


Pre-existing Issues (Informational)

These issues predate this PR and do not block merge.

[Pre-existing] MaxAllowableSection.tsx - yup fieldName vs visible label - Severity: 4.0/10

The yup fieldName passed to amount() is 'Maximum Allowable Salary' / 'Spouse Maximum Allowable Salary', but the visible TextField label includes the person's name. The required error therefore reads "Maximum Allowable Salary is required" rather than "John Maximum Allowable Salary is required." Mild UX disconnect - the same pattern already exists for the max error message. Consider aligning in a follow-up PR.


Agent Critical High Important Suggestions Confidence
Architecture 0 0 0 0 High
Testing 0 0 0 1 High
UX 0 0 0 2 High
Standards 0 0 0 0 High
Total 0 0 0 3


return yup.object({
salaryCap: amount(t('Maximum Allowable Salary'), t, {
required: true,
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] Required errors display immediately on mount when this section first appears (before the user has interacted), because `useAutoSave` validates synchronously on every render. Consistent with existing behavior - the `max` error works the same way. Correct for this opt-in context (user checked the split-cap checkbox). Flagged for design awareness only. If validate-on-blur is ever desired, that is a `useAutoSave` change, not a change here.

);
});

it('shows required errors when split cap fields are empty', async () => {
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] Optional: consider a test for the partial-empty state (one field filled, one null) to confirm only the empty field shows the required error. Not blocking - useAutoSave handles fields independently and the existing tests cover the fully-filled happy path.

);

expect(
await findByText('Maximum Allowable Salary is required'),
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] Optional: asserting `aria-invalid="true"` on the field alongside the text check would verify the error is wired to the correct input, not just present somewhere in the DOM. Current pattern matches the rest of this file (`warns when cap exceeds hard cap` uses the same getByText style), so no change required.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

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 merged commit ea75b46 into main May 19, 2026
43 of 44 checks passed
@zweatshirt zweatshirt deleted the split-cap-validation branch May 19, 2026 19:56
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