Skip to content

[MPDX-9561] - Submit button on PDS Goal Calculator final step#1784

Merged
wjames111 merged 4 commits into
mainfrom
MPDX-9561
May 19, 2026
Merged

[MPDX-9561] - Submit button on PDS Goal Calculator final step#1784
wjames111 merged 4 commits into
mainfrom
MPDX-9561

Conversation

@wjames111
Copy link
Copy Markdown
Contributor

@wjames111 wjames111 commented May 19, 2026

Description

  • Adds a "Finish & Apply Goal" submit button on the last step of the PDS Goal Calculator that saves the calculated overall total as the account's monthlyGoal via updateAccountPreferences.
  • On success, surfaces a localized snackbar showing the formatted goal that was applied.
  • Disables the submit action while the mutation is in flight and when required fields are incomplete.
  • Extends DirectionButtons with a disabledNextTooltip prop so the final step can show "Complete all required fields to submit" instead of the generic "...to continue" copy.

Work for MPDX-9561.

Testing

  • Go to the PDS Goal Calculator (HR Tools)
  • Step through each section, filling in required fields
  • On any intermediate step, hover the disabled Next button with incomplete fields and confirm the tooltip reads "Complete all required fields to continue"
  • Advance to the final step
  • With required fields incomplete, hover the disabled submit button and confirm the tooltip reads "Complete all required fields to submit"
  • Complete all required fields and confirm the button label reads "Finish & Apply Goal"
  • Click "Finish & Apply Goal" and confirm:
    • The button is disabled while the request is in flight
    • A success snackbar appears with the formatted monthly goal (e.g. "Successfully updated your monthly goal to $X,XXX!")
    • The account's monthly goal is updated (verify on the dashboard / preferences)

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

@wjames111 wjames111 changed the title MPDX-9561 Submit button on PDS Goal Calculator final step [MPDX-9561] - Submit button on PDS Goal Calculator final step May 19, 2026
@wjames111 wjames111 self-assigned this May 19, 2026
@wjames111 wjames111 added On Staging Will be merged to the staging branch by Github Actions Preview Environment Add this label to create an Amplify Preview labels May 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Bundle sizes [mpdx-react]

Compared against 6a47b26

No significant changes found

Copy link
Copy Markdown
Contributor Author

@wjames111 wjames111 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 Summary

5 specialized agents reviewed this PR in parallel: Architecture, Testing, Standards, UX, and Financial Reporting.

Verdict: APPROVED_WITH_SUGGESTIONS — no blockers, but 4 Important findings (severity 7.0–7.9) are strongly recommended before merge. The PR is small and focused, but propagates the no-error-handling / no-cache-update pattern from GoalApplicationButtonGroup rather than the more robust pattern from MonthlyGoalAccordion.

Risk Assessment

  • Risk Score: 3/10 (LOW)
  • Files: 2 (both .tsx components)
  • Lines: +55 / -5
  • Single domain: PDS Goal Calculator UI

Headline Findings

  1. Silent $0 save when summaryData is null (Sev 7.0) — allValid only validates form fields; if summaryData hasn't loaded, the submit handler will silently persist monthlyGoal: 0 and the snackbar reads "Successfully updated your monthly goal to $0!" — overwriting any prior real goal. See inline comment on the rounding line.
  2. No onError handler on the mutation (Sev 7.0) — failures will hit the global Apollo error link but bypass the localized snackbar pattern used in MonthlyGoalAccordion. The button also re-enables silently after failure. See inline comment.
  3. No tests cover the new submit flow (Sev ~7.5 consensus) — the existing PdsGoalCalculator.test.tsx doesn't advance to the final step, so the mutation call shape, loading state, success snackbar, and error path are all unexercised. GoalApplicationButtonGroup.test.tsx is the canonical pattern to mirror. The new disabledNextTooltip prop on DirectionButtons is also untested. See inline comments.
  4. Mutation doesn't refresh top-level AccountList.monthlyGoal (Sev 6.5) — Dashboard's MonthlyGoal widget and DonationsReport read accountList.monthlyGoal (not accountList.settings.monthlyGoal), and that top-level field is server-derived. Until refetch, those views will display the prior goal.

Medium / Suggestion Highlights

  • No in-button loading indicator (button only goes disabled, no spinner) — see inline.
  • Button stays clickable after success — re-click could re-submit. GoalApplicationButtonGroup hides buttons after success.
  • accountListId ?? '' silently coerces a missing account list.
  • Submit logic is now the third copy of "apply monthly goal" in the codebase. Consider extracting a useApplyMonthlyGoal() hook so the next change (currency, error handling, cache update) is applied in one place.
  • Rounding-to-display drift: summary shows $5,123.47, submit saves 5123 (rounded). Consider rendering the success snackbar with showTrailingZeros: true so the user reads the same value they submit.
  • Hardcoded 'USD' in the success snackbar is consistent with the rest of HrTools/** (15+ call sites) and the sibling GoalApplicationButtonGroup — not a new deviation, flagged informationally only.

Cross-Cutting Notes

  • This PR introduces the third site that fires UpdateAccountPreferences with monthlyGoal. MonthlyGoalAccordion (canonical) has onError and surfaces a localized error toast; GoalApplicationButtonGroup does not; this PR follows the latter. Worth aligning the three sites in a follow-up.
  • The "Important" tier findings (7.0–7.9) cannot be dismissed via /dismiss and don't block merge by themselves — but they're strongly recommended. Either address them here or open follow-up tickets.

Standards Checklist

All major checklist items PASS (exports, naming, i18n, TypeScript, Apollo routing, no debug output, no new Date()). The only WARN is on Testing — no new tests cover the submit flow or the new disabledNextTooltip branch.

Agent Summary

Agent Critical High Important Suggestions Confidence
Architecture 0 0 2 2 High
Testing 0 0 3 5 High
Standards 0 0 0 2 High
UX 0 0 3 6 High
Financial Reporting 0 0 1 4 High

Comment thread src/components/HrTools/PdsGoalCalculator/PdsGoalCalculator.tsx Outdated
Comment thread src/components/HrTools/PdsGoalCalculator/PdsGoalCalculator.tsx
Comment thread src/components/HrTools/PdsGoalCalculator/PdsGoalCalculator.tsx
Comment thread src/components/HrTools/PdsGoalCalculator/PdsGoalCalculator.tsx
Comment thread src/components/HrTools/PdsGoalCalculator/PdsGoalCalculator.tsx Outdated
Comment thread src/components/HrTools/PdsGoalCalculator/PdsGoalCalculator.tsx
Comment thread src/components/HrTools/PdsGoalCalculator/PdsGoalCalculator.tsx Outdated
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 (3/10)
Verdict: APPROVED_WITH_SUGGESTIONS (suggestions posted, no blockers)

This PR was auto-approved because:

  • The multi-agent AI review determined it is low 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.

@wjames111 wjames111 merged commit d5c2533 into main May 19, 2026
22 of 24 checks passed
@wjames111 wjames111 deleted the MPDX-9561 branch May 19, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

On Staging Will be merged to the staging branch by Github Actions 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