Fix for disappearing goals on RTTAPA#3716
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a race condition on the RTTAPA standard goal edit flow where objectives could fail to load into the form, leading the backend update service to delete objectives that were omitted from the payload. It also includes a corrective migration intended to undelete objectives that were wrongly soft-deleted.
Changes:
- Backend: tighten objective deletion during
updateExistingStandardGoalto only remove non-report objectives created via RTR. - Data repair: add a migration to undelete standard-goal objectives that are still referenced by non-deleted activity reports.
- Frontend: refactor Update/Restart goal pages to mount the form only after the goal is loaded, and add a test to ensure objectives populate on initial render.
Impact assessment
- Benefits: High (prevents data loss and restores impacted data for standard goals/objectives).
- Risks: Medium (changes deletion semantics and includes a production data-repair migration; should be reviewed carefully before merge/deploy).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/services/standardGoals.ts | Restricts objective deletions during standard goal updates to safer subsets (RTR-created, not on any report). |
| src/services/standardGoal.test.js | Updates test setup for createdVia and adds cleanup to keep tests isolated. |
| src/migrations/20260621225954-revert-bad-objective-deletions.js | Undeletes Objectives that are still referenced by non-deleted activity reports for standard goal templates. |
| frontend/src/pages/StandardGoalForm/UpdateStandardGoalForm.js | New component that initializes the form with the fetched goal’s objectives/root causes. |
| frontend/src/pages/StandardGoalForm/UpdateStandardGoal.js | Refactors page to fetch the goal first, then render the new form component. |
| frontend/src/pages/StandardGoalForm/RestartStandardGoalForm.js | New component for restart flow, keeping form initialization local to the form. |
| frontend/src/pages/StandardGoalForm/RestartStandardGoal.js | Refactors restart page to fetch goal first, then render the new restart form component. |
| frontend/src/pages/StandardGoalForm/tests/UpdateStandardGoal.js | Adds coverage to verify objectives are populated into the update form on initial render. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…' into mb/fix-rttapa-disappearing-goals
AdamAdHocTeam
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of change
Race condition meant goal form loaded without objectives. This caused objectives to be erroneously deleted by an overly permissive backend service. A migration here restores the objective we know were deleted erroneously. We may need a follow on PR to revive the deleted ones, if that is possible.
How to test
Load up an existing goal on the RTTAPA with objectives. Note that all objectives on the RTTAPA load on the edit form. Add an objective. Save. Note that all existing objectives appear on the RTTAPA (we aren't down to one)
Jira Issue(s)
Checklists
Every PR
Before merge to main
Production Deploy
ready_for_reviewtransition triggers the Slack/Jira automation)elainaparrishis the authorized approver under normal circumstances)After merge/deploy