Repository navigation
MPDX-10409 Let new staff dismiss the MPD goal ready card - #2322
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bundle sizes [mpdx-react]Compared against aadea9a No significant changes found |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🤖 agent-review · ✅ no blockers · risk LOW BLOCKERS: fix or dismiss to pass✅ No blockers. OTHER FINDINGS (4)
🔧 Fix suggestions (0)No automated fixes for this review. 📦 Dependency impactBlast radius: 4 files.
📊 Review detail & statsGenerated: 2026-11-30 · Day: Monday · Files changed: 2 (+6 -5 lines) Risk factors detected: none Deterministic evidence:
Agent summary (bands: Critical 9-10 · High 7-8 · Important 5-6 · Suggestions 3-4):
Finding Per-agent perspectives on blockers: none. Engine: code-review (from config) · effort xhigh (from config) · model opus (from config) Review quality:
💬 How to act on this reviewEvery finding above is numbered. Severity ≥ 7 findings carry a checkbox and must each be fixed or |




Links
Description
New staff got a red "Validation failed: Key is invalid" error when they clicked View my MPD goal on the "Your MPD goal is ready" dashboard card. The goal page still opened, but the error toast showed on top of it, and the card came back on the next dashboard visit. The X on the card runs the same save (both buttons call
acknowledge()), so it failed the same way. This happens in production too.Both buttons save a user option named
new_staff_goal_acknowledged_<goal id>. Goal ids are UUIDs, so the name has hyphens. The API only accepts letters, numbers and underscores in option keys (User::Optionvalidates/\A[A-Za-z0-9_]*\z/), so every save failed._(for examplenew_staff_goal_acknowledged_01a22dd6_f909_7f70_...). The same key drives both the read (useUserOptionQuery) and the save, so they always match.Testing
Jest (
NewStaffGoalReadyCard.test.tsx, 13 tests):a1b2c3d4-e5f6-4a7b-8c9d-0e1f). The tests expect the literal keynew_staff_goal_acknowledged_a1b2c3d4_e5f6_4a7b_8c9d_0e1f, which fits the API's format.UserOptionquery now answers the stored figures only for that exact key, so the read side is pinned too, not just the save.gflag and only swaps the first hyphen. With the fix, all 13 pass.Local QA (local API and frontend, local dev data only): a new-staff user with a sent goal whose id is a UUID.
origin/maincode): clicking X (the same save as "View my MPD goal") showed the red "Validation failed: Key is invalid" toast. The API answeredcreateOrUpdateUserOption: nullwithkey: ["is invalid"], and the card was back after a reload.new_staff_goal_acknowledged_01a22dd6_f909_7f70_9f9a_956a609fd3b3with no error, and the card stayed away after a reload.Before and after screenshots are in a PR comment.
To check on staging, impersonate a new-staff user whose goal has been sent:
AI review
Findings I did not fix, and why:
Round 1 (
/agent-review:review,/code-reviewxhigh plus the security, testing, standards and ux lanes; not posted): no blockers, 5 suggestions from/code-review, none from the other lanes. Fixed in 9acdf98:goal-1had one hyphen, so a replace without thegflag would still pass. The tests now use an id with four hyphens.Round 2 (posted, head 9acdf98, same engine and lanes): no blockers, 4 suggestions, all from
/code-review. Thegithub-actionsbot approved 9acdf98. Left as is:#1(4/10,deferred): a shared helper for building option keys nearuseUserPreference. This card is the only place that builds a key from an id today, so one inline line is enough for now.#2(3/10,pre-existing):Dashboard.test.tsxuses goal idgoal-1with a catch-allUserOptionmock. This PR does not touch that file, and the card's own tests pin the exact key.#3(3/10,intentional): turning every rejected character into_could map two ids to one key. Goal ids are UUIDs, whose only rejected character is-, so two UUIDs can never collide.#4(2/10,intentional): the test id is not a full UUID (its last group is short). It keeps the expected key on one line so the test file stays under CodeScene's 300-line test limit, and its four hyphens still catch a replace without thegflag.Checklist:
MPDX-1234 Add sortable columns)/agent-review:reviewcommand locally and fixed each finding or listed it abovegithub-actionsbot has approved the PR (it approves once/agent-review:reviewleaves no open blockers; it never approves a one-way door).github/CODEOWNERSgives an owner)🤖 Generated with Claude Code
Staging QA
11/30/2026 on stage.mpdx.org (build l0fYcm4sJ_Ovap8XpiJsh, after this PR landed on staging), impersonating the Pedra Pérez test user (temporarily New Staff) on a household whose goal was Run & Sent:
Result: PASS.