Skip to content

Fix for disappearing goals on RTTAPA#3716

Merged
thewatermethod merged 10 commits into
mainfrom
mb/fix-rttapa-disappearing-goals
Jun 23, 2026
Merged

Fix for disappearing goals on RTTAPA#3716
thewatermethod merged 10 commits into
mainfrom
mb/fix-rttapa-disappearing-goals

Conversation

@thewatermethod

@thewatermethod thewatermethod commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

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

  • Linked Jira issue
  • JIRA issue status updated
  • Code is meaningfully tested
  • Meets accessibility standards (WCAG 2.1 Levels A, AA)
  • API Documentation updated
  • Boundary diagram updated
  • Logical Data Model updated
  • Architectural Decision Records written for major infrastructure decisions
  • UI review complete
  • QA review complete

Before merge to main

  • OHS demo complete
  • Ready to create production PR

Production Deploy

  • PR created as Draft
  • Staging smoke test completed
  • PR transitioned to Open (this ready_for_review transition triggers the Slack/Jira automation)
  • Reviewer added after the PR is Open (elainaparrish is the authorized approver under normal circumstances)
    • Sequence: Draft PR → Smoke test → Open PR (automation runs) → Add reviewer
    • Confirm that the Slack notification was sent after the PR was opened
    • Confirm that linked Jira ticket(s) transitioned as expected; if not, review the GitHub Actions workflow logs

After merge/deploy

  • Update JIRA ticket status

Copilot AI 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.

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 updateExistingStandardGoal to 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.

Comment thread src/services/standardGoal.test.js Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread src/migrations/20260621225954-revert-bad-objective-deletions.js
@thewatermethod thewatermethod marked this pull request as ready for review June 22, 2026 14:56
Comment thread src/services/standardGoals.ts
Comment thread src/services/standardGoals.ts Outdated
@thewatermethod thewatermethod added this pull request to the merge queue Jun 23, 2026
Merged via the queue into main with commit ee08774 Jun 23, 2026
21 of 22 checks passed
@thewatermethod thewatermethod deleted the mb/fix-rttapa-disappearing-goals branch June 23, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants