Skip to content

PM-4840: rehydrate persisted reviewer assignments after draft saves#1729

Merged
jmgasper merged 1 commit intodevfrom
PM-4840-1
Apr 15, 2026
Merged

PM-4840: rehydrate persisted reviewer assignments after draft saves#1729
jmgasper merged 1 commit intodevfrom
PM-4840-1

Conversation

@jmgasper
Copy link
Copy Markdown
Collaborator

@jmgasper jmgasper commented Apr 15, 2026

What was broken
The previous PM-4840 fix restored persisted copilot and reviewer assignments during refresh hydration, but saving an existing draft could still reset the editor from a sparse challenge payload that omitted resource-backed reviewer members. That left refreshed or reopened drafts showing blank reviewer assignments again even though the resources were already saved.

Root cause (if identifiable)
The post-save reset path rebuilt form state from the patchChallenge response and only reapplied single-member assignments from the in-memory hook state. When the hook cache did not already contain the saved reviewer resources, manual reviewer members were dropped from the form state until a later fetch happened.

What was changed
The draft save flow now reloads persisted resources and resource roles before resetting the form, then reapplies the shared copilot and manual-reviewer hydration logic to the saved draft state. This keeps saved reviewer assignments attached immediately after save and when the draft is reopened.

Any added/updated tests
Added ChallengeEditorForm coverage for saving a draft when the hook resource cache is empty but persisted reviewer assignments exist in freshly fetched resources.


Open with Devin

What was broken
The previous PM-4840 fix restored persisted copilot and reviewer assignments during refresh hydration, but saving an existing draft could still reset the editor from a sparse challenge payload that omitted resource-backed reviewer members. That left refreshed or reopened drafts showing blank reviewer assignments again even though the resources were already saved.

Root cause (if identifiable)
The post-save reset path rebuilt form state from the `patchChallenge` response and only reapplied single-member assignments from the in-memory hook state. When the hook cache did not already contain the saved reviewer resources, manual reviewer members were dropped from the form state until a later fetch happened.

What was changed
The draft save flow now reloads persisted resources and resource roles before resetting the form, then reapplies the shared copilot and manual-reviewer hydration logic to the saved draft state. This keeps saved reviewer assignments attached immediately after save and when the draft is reopened.

Any added/updated tests
Added ChallengeEditorForm coverage for saving a draft when the hook resource cache is empty but persisted reviewer assignments exist in freshly fetched resources.
@jmgasper jmgasper requested a review from kkartunov as a code owner April 15, 2026 00:42
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@jmgasper jmgasper merged commit 8f7fd9e into dev Apr 15, 2026
9 checks passed
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.

1 participant