Skip to content

MPDX-9813 - NSO MPD Questionnaire Spouse Phone Number input#1879

Merged
zweatshirt merged 2 commits into
mainfrom
MPDX-9813
Jul 2, 2026
Merged

MPDX-9813 - NSO MPD Questionnaire Spouse Phone Number input#1879
zweatshirt merged 2 commits into
mainfrom
MPDX-9813

Conversation

@zweatshirt

@zweatshirt zweatshirt commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

  • Adds a single row table for collecting Staff and Spouse phone numbers in ContactInformation
  • Makes the repeated hasSpouse logic a shared function and variable in the context.

Testing

  • Go to NSO Questionnaire
  • Test that the Contact Information section works as expected and that both staff and spouse phone numbers are required if married
  • Check that Continue is blocked until both inputs are filled
  • Check that error handling works correctly
  • Check that this step works for single, married, SOSA, and senior spouse

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 Jul 2, 2026

Copy link
Copy Markdown
Contributor

Bundle sizes [mpdx-react]

Compared against 837d6e6

No significant changes found

@zweatshirt zweatshirt self-assigned this Jul 2, 2026
@zweatshirt zweatshirt added the Preview Environment Add this label to create an Amplify Preview label Jul 2, 2026
@zweatshirt zweatshirt marked this pull request as ready for review July 2, 2026 14:33
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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

@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

6 specialized agents (Architecture, Testing, Standards, UX, Data Integrity, Financial Reporting) plus a focused delta pass on the new test. 0 blockers. The change reduces technical debt (centralized getHasSpouse, extracted a reusable PhoneNumberField, and converted a pre-existing sx-callback to useTheme()).

The one Medium finding from the initial pass — the untested single-staff stepCompletion branch — is resolved by stepCompletion.test.ts (verified: genuinely typed fixture, exercises both single→100% and married 75%→100%).

Everything remaining is an optional suggestion (severity < 5), posted inline. None block merge and none require /dismiss.

Risk: MEDIUM. The repo's flat per-file scoring mechanically rated this higher, but this is a shallow, fully-tested, single-feature addition with no auth / data-model / money / migration surface; the GraphQL change is a single scalar added to an existing fragment (id intact).

Severity Count
Blockers (>= 8) 0
Important (7–7.9) 0
Medium (5–6.9) 0
Suggestions (< 5) 8

schema,
});
const userName = firstName ?? t('You');
const spouseColumnName = spouseFirstName ?? t('Spouse');

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] (Testing) The `You` / `Spouse` / `your spouse` fallbacks (when `firstName`/`spouseFirstName` are null) are never exercised — the shared mock always sets names. Consider a `firstName: null, spouseFirstName: null` test asserting the fallback column/aria-label names.

? t('Please provide a cell phone number for each person below.')
: t('Please provide your cell phone number.')}
</Typography>
<Table size="small" sx={{ maxWidth: theme.spacing(90) }}>

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] (UX) Fixed-width table (`maxWidth ~720px`) with two person columns, each holding an input capped at ~320px, has no explicit small-screen handling. Matches the SalaryCalculator reference (consistent, not a regression) — worth a manual check at `xs`.

<TableCell scope="col" sx={{ color: theme.palette.mpdxBlue.main }}>
{userName}
</TableCell>
{hasSpouse && (

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] (UX) Before the questionnaire loads, `hasSpouse` is false, so a married user briefly sees a single column before the spouse column appears. Consistent with existing load/seed behavior; acceptable.

label: t('Spouse name'),
value: formatText(spouseFirstName),
value:
[spouseFirstName, lastName].filter(Boolean).join(' ') ||

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] (Data Integrity / Testing) The Spouse name row now renders `[spouseFirstName, lastName]`, assuming the spouse shares the staff member's last name — a product assumption, not a bug. Also, no test asserts the rendered spouse full-name value (`Jane Doe`); existing tests only check row presence/absence. Consider a `getByRole('cell', { name: 'Jane Doe' })` assertion.

@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: MEDIUM (5/10)
Verdict: CLEAN (no issues found)

This PR was auto-approved because:

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

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

Extract the marital-status check into a shared getHasSpouse helper and expose
hasSpouse from NsoMpdQuestionnaireContext, so consumers stop recomputing it.
StaffInformation now reads hasSpouse from context.
Add spousePhoneNumber to the questionnaire fragment and a reusable
PhoneNumberField, and render a per-person phone column in ContactInformation
(user + spouse) with person-scoped labels for screen readers. Require the
spouse phone for step completion when married, and show it in the Summary.

@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

Re-review after the per-person-label change. Fresh UX, Testing, and Standards agents. 0 blockers.

This change resolves both Medium findings from the prior review:

  • Duplicate accessible name → resolved. Each phone input now has a distinct, person-scoped accessible name equal to its visible label ("John's cell phone number" / "Jane's cell phone number"). WCAG 2.5.3 satisfied (no aria-label override), matches the SalaryCalculator per-person-label convention, and the required asterisk is preserved.
  • Vacuous test → resolved. Tests now query each field by its distinct name (getByRole/findByRole), which throw if a field is missing — the "two fields exist" guarantee is genuinely restored.

Standards: i18n interpolation keys are correct (variable form, static keys, double-quote-wrapped possessives — extraction-verified against existing en-locale precedent); no any, named exports, test conventions upheld.

Severity Count
Blockers (>= 8) 0
Important (7–7.9) 0
Medium (5–6.9) 0
Suggestions (< 5) 2

Both remaining items are optional suggestions (severity < 5), posted inline — neither blocks merge.

Risk: MEDIUM — a shallow, fully-tested, single-feature change with no auth / data-model / money / migration surface.

fieldName: 'phoneNumber',
schema,
});
const userLabel = firstName

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] (Testing) The null-name fallback branches introduced here are untested: `userLabel` falls back to "Your cell phone number" when `firstName` is null, and the spouse label falls back to "your spouse's cell phone number" (`spouseName = spouseFirstName ?? t('your spouse')`). Consider a `firstName: null, spouseFirstName: null` test case to cover them. Low priority — `firstName` is HCM-prepopulated, so realistically always present.

{t('Cell Phone Number')}
</TableCell>
<TableCell>
<PhoneNumberField fieldName="phoneNumber" label={userLabel} />

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] (UX) The person's name now appears in both the column header and the field label. This is intentional and correct for accessibility — the column header isn't programmatically associated with the input, so the per-person label is what disambiguates the two fields for screen readers in forms-navigation mode. Keep as-is; noted only for awareness.

@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: MEDIUM (5/10)
Verdict: CLEAN (no issues found)

This PR was auto-approved because:

  • The multi-agent AI review determined it is medium 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 5e57129 into main Jul 2, 2026
23 of 24 checks passed
@zweatshirt zweatshirt deleted the MPDX-9813 branch July 2, 2026 18:34
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