Skip to content

PM-5573: Adjust active challenge timeline when switching AI only and AI gating - #2476

Merged
jmgasper merged 1 commit into
devfrom
PM-5573
Oct 9, 2026
Merged

jmgasper merged 1 commit into
devfrom
PM-5573

Conversation

@jmgasper

@jmgasper jmgasper commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

JIRA: PM-5573

What's in this PR?

This is the work app part of a three-repo fix:

  • challenge-api-v6#165 moves an ACTIVE challenge to the timeline that matches its AI review mode.
  • review-api-v6#364 allows the mode-only config update after submissions, until review starts.
  • This PR unlocks the mode select and reloads the timeline in the editor.

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.
  • AI_ONLY kept AI Screening and the review phases.

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

  • The editor never asked challenge-api to move an ACTIVE challenge to the timeline for its new mode, and challenge-api did not do it for ACTIVE challenges either (fixed in challenge-api-v6#165).
  • 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. challenge-api then moves the challenge to the matching template:
      • AI_ONLY: Registration, Submission, AI Review, Approval
      • AI_GATING: Registration, Submission, AI Screening, Review, Appeals, Appeals Response
    • It then loads the returned phases and timelineTemplateId into the form, so Timeline & Schedule and the manual reviewer phase options update.
    • This only happens 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, for manual and template configs.
    • Every other setting stays locked, and the lock banner says the mode can still be switched until the review phase starts.
  • reviewers-field.utils: add hasAiOnlyTimelinePhases() and hasStartedReviewPhase(). 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.
  • The ChallengeEditorPage README documents the behaviour.

Any added/updated tests

  • ReviewersField.spec.tsx:
    • 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
    • Three of these fail against the dev component.
  • AiReviewTab.spec.tsx:
    • 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.ts: hasAiOnlyTimelinePhases and hasStartedReviewPhase.

Validation

  • ChallengeEditorPage specs (run with the ~/ module mapper): 392 passed, 1 failed. The failing suites are ReviewContextEditor, ReviewContextTab and ChallengePrizesField, which also fail on dev.
  • In the ReviewersField-only run, the AiReviewTab test "does not refetch a removed persisted AI review config" also fails, as it does on dev.
  • yarn lint and tsc --noEmit are clean, and yarn run build succeeds.
  • The build reports one new react-hooks/exhaustive-deps warning. The new reviewer-patch callback leaves patchChallenge out of its deps, the same way handleAiConfigRemoved already does.

Notes

  • Overlap with PM-5342: Restore default timeline when AI review leaves AI only #2464 (PM-5342): that open PR changes the same handleAiConfigPersisted block 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.
  • The reviewer PATCH also self-heals active challenges whose mode was switched before this fix, the next time the editor is opened, as long as review has not started.
  • With Instant Review on, AI runs exist right after the first submission, so review-api keeps the mode locked.

🤖 Generated with Claude Code

…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>
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