Repository navigation
Conversation
…AI gating
What was broken
On a launched challenge, switching the AI review mode between AI_ONLY and
AI_GATING did not change Timeline & Schedule. AI_GATING kept the AI Review
and Approval phases, and AI_ONLY kept AI Screening and the review phases.
After the first submission the whole AI review configuration was also
read-only, so the mode could not be switched at all.
Root cause
- The editor never asked challenge-api to move an ACTIVE challenge to the
timeline matching its new mode. challenge-api did not do it for ACTIVE
challenges either (fixed in challenge-api-v6 for PM-5573).
- The form also kept the old phases. Leaving AI_ONLY requires a manual
reviewer, but the only phases offered were AI Review and Approval.
- AiReviewTab locked every field, and skipped autosave, whenever the
challenge had submissions.
What was changed
- ReviewersField:
- When a persisted AI config's mode no longer matches an ACTIVE
challenge's timeline, it PATCHes the challenge reviewers right away so
challenge-api moves the challenge to the matching template. It then
loads the returned phases and timelineTemplateId into the form.
- Both steps only happen before a review phase starts.
- It passes canSwitchReviewMode to AiReviewTab until a review phase
starts.
- AiReviewTab: with submissions, canSwitchReviewMode keeps the Review Mode
select (AI_GATING / AI_ONLY) enabled and autosaving. This works for both
manual and template configs. Every other setting stays locked, and the
lock banner says the mode can still be switched.
- reviewers-field.utils: add hasAiOnlyTimelinePhases() and
hasStartedReviewPhase().
- ChallengeEditorPage README documents the behaviour.
Added/updated tests
- ReviewersField.spec:
- an active AI_ONLY challenge moves to the AI gating timeline, and the
reverse
- nothing is patched when the timeline already matches the mode
- the mode is locked and the timeline kept once review starts
- AiReviewTab.spec:
- only the review mode is editable and autosaves with submissions (manual
and template configs)
- the mode is locked once review starts
- reviewers-field.utils.spec: hasAiOnlyTimelinePhases and
hasStartedReviewPhase.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
JIRA: PM-5573
What's in this PR?
This is the work app part of a three-repo fix:
What was broken
On a launched challenge, switching the AI review mode between AI_ONLY and AI_GATING did not change Timeline & Schedule:
Also, once the challenge had a submission, the whole AI review configuration was read-only, so the mode could not be switched at all.
Root cause
AiReviewTablocked every field, and skipped autosave, whenever the challenge had submissions.What was changed
timelineTemplateIdinto the form, so Timeline & Schedule and the manual reviewer phase options update.canSwitchReviewModetoAiReviewTabuntil a review phase starts.canSwitchReviewModekeeps the Review Mode select (AI_GATING / AI_ONLY) enabled and autosaving, for manual and template configs.hasAiOnlyTimelinePhases()andhasStartedReviewPhase(). A review phase is any phase whose name contains "review" or "screening" that is open or has an actual start date. review-api and challenge-api apply the same cut-off.Any added/updated tests
ReviewersField.spec.tsx:devcomponent.AiReviewTab.spec.tsx:reviewers-field.utils.spec.ts:hasAiOnlyTimelinePhasesandhasStartedReviewPhase.Validation
~/module mapper): 392 passed, 1 failed. The failing suites areReviewContextEditor,ReviewContextTabandChallengePrizesField, which also fail ondev.AiReviewTabtest "does not refetch a removed persisted AI review config" also fails, as it does ondev.yarn lintandtsc --noEmitare clean, andyarn run buildsucceeds.react-hooks/exhaustive-depswarning. The new reviewer-patch callback leavespatchChallengeout of its deps, the same wayhandleAiConfigRemovedalready does.Notes
handleAiConfigPersistedblock for drafts. Its spec "does not change the timeline of an active AI only challenge" asserts the opposite of this ticket for ACTIVE challenges. Whichever PR merges second needs a small conflict resolution and should drop that assertion.🤖 Generated with Claude Code