Skip to content

[MPDX-10001] - Show the MPD Goal admin table and NSO questionnaire only to those who need them - #2044

Open
wjames111 wants to merge 2 commits into
mainfrom
MPDX-10001
Open

wjames111 wants to merge 2 commits into
mainfrom
MPDX-10001

Conversation

@wjames111

@wjames111 wjames111 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Description

Two HR Tools menu items were showing to people who cannot use them. This narrows both.

  • MPD Goal Calculator Admin Table now appears only for MPD Goals admins and MPD coordinators, using the new canViewNewStaffCohorts flag on the user instead of the Senior Staff group check. Everyone else used to see the item and then hit an authorization error from the API.
  • NSO MPD Questionnaire now disappears once a new staff member has completed it, and stays hidden for anyone who has no questionnaire waiting.
  • The admin table's three pages (the table, Staff Details and a scenario goal) move to the same gate, so the menu item and the pages behind it agree. A goals admin who is not Senior Staff would otherwise have landed on a Limited Access screen.

Depends on CruGlobal/mpdx_api#3625, which adds the canViewNewStaffCohorts field. CI codegen will fail here until that PR is on staging; add the Staging API label once it is.

Jira: https://jira.cru.org/browse/MPDX-10001

Testing

MPD Goal admin table:

  • Sign in as a user who is neither an MPD Goals admin nor an MPD coordinator
  • Open the HR Tools menu and check that "MPD Goal Calculator Admin Table" is gone
  • Visit /accountLists/<id>/hrTools/mpdGoalAdmin directly and check that you get the Limited Access screen
  • Sign in as an MPD Goals admin (or a coordinator) and check that the item is back and the table loads

NSO MPD Questionnaire:

  • Sign in as a new staff member with an unfinished questionnaire
  • Open the HR Tools menu and check that "NSO MPD Questionnaire" is listed
  • Complete the questionnaire, then reopen the menu and check the item is gone while "New Staff Goal Calculator" stays

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 /quality:agent-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

🤖 Generated with Claude Code

…s from the HR Tools menu

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@wjames111 wjames111 self-assigned this Sep 14, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

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

Review of MPDX-10001 (senior level). The gating swap itself is clean: canViewNewStaffCohorts replaces a group check that never matched the API's own rule, and moving the three admin pages onto the same gate keeps the menu item and its destination in agreement. Two issues with the questionnaire half:

  • A failed NewStaffQuestionnaireStatus query silently hides the questionnaire item from new staff who still owe one, with no error shown.
  • Folding questionnaireLoading into the hook's returned loading hides the entire HR Tools tab and menu for new staff while that one query is in flight, because useNavPages gates the whole tab on it.

Both have the same fix shape: scope the questionnaire query's loading and error state to the questionnaire item rather than to the whole hook.

Everything else checked clean: developer bypass still short-circuits every gate, the skip condition correctly waits for the user before deciding, the new useMemo deps are complete, no missing localisation (no new user-visible strings), and the nav hook's new useAccountListId() dependency is safe because both callers already require one.

Comment thread src/hooks/useHrToolsNavItems.ts
Comment thread src/hooks/useHrToolsNavItems.ts Outdated
Comment thread src/hooks/useHrToolsNavItems.test.tsx
@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 Staging API Run GraphQL codegen against the staging API labels Sep 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@wjames111 wjames111 removed the On Staging Will be merged to the staging branch by Github Actions label Sep 14, 2026
@wjames111

Copy link
Copy Markdown
Contributor Author

Holding the On Staging label off for now. GetUser is an app-wide query, so requesting canViewNewStaffCohorts against a staging API that does not have the field yet fails the whole query and degrades every page, not just the two menu items. Ready to go on staging as soon as CruGlobal/mpdx_api#3625 is deployed there.

Staging API and Preview Environment are on, so CI codegen will go green at the same moment.

Posted by Claude Code.

@wjames111 wjames111 removed the Staging API Run GraphQL codegen against the staging API label Sep 17, 2026
@wjames111
wjames111 requested a review from dr-bizz September 17, 2026 18:12
@github-actions

Copy link
Copy Markdown
Contributor

Bundle sizes [mpdx-react]

Compared against 60c41be

No significant changes found

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