feat(phases): add override + set_ratings table#146
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Deploy →
|
There was a problem hiding this comment.
Pull request overview
Implements Issue #139’s “single migration + phase override” slice: adds a nullable phase_override to festival_editions, introduces set_ratings storage, and centralizes the rule effectivePhase = override ?? derived with an admin control to set/clear the override.
Changes:
- Adds a Supabase migration introducing
festival_phase,festival_editions.phase_override, and a newset_ratingstable with RLS mirroringvotes. - Introduces
getEffectiveFestivalPhaseand updatesuseFestivalPhase()to use the override-first seam (with unit tests). - Adds an admin UI control beside
ScheduleRevealControlfor Core Team to set/clear the phase override.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| supabase/migrations/20260710010000_add_phase_override_and_set_ratings.sql | Adds festival_phase enum, phase_override column, and set_ratings table + RLS/trigger. |
| src/pages/admin/festivals/PhaseOverrideControl.tsx | New admin control to set/clear phase_override. |
| src/pages/admin/festivals/FestivalEdition.tsx | Places the new override control beside the existing schedule reveal control. |
| src/lib/festivalPhase.ts | Adds getEffectiveFestivalPhase (override ?? derived). |
| src/lib/festivalPhase.test.ts | Unit tests covering override precedence and null fallthrough. |
| src/integrations/supabase/types.ts | Updates generated DB typings for festival_phase, phase_override, and set_ratings. |
| src/hooks/useFestivalPhase.ts | Switches hook to read effective phase (override-first). |
| docs/prd/festival-phases/0-epic.md | Adds the festival phases epic doc. |
| docs/prd/festival-phases/1-foundation-pre-schedule-planning.md | Adds PRD for PR 1 scope and decisions. |
| docs/prd/festival-phases/2-live-phase.md | Adds PRD for PR 2 scope and decisions. |
| docs/prd/festival-phases/3-post-festival.md | Adds PRD for PR 3 scope and decisions (override + ratings). |
cc61517 to
8855710
Compare
8855710 to
cc32ff6
Compare
Adds the epic's one schema change: a nullable phase_override column on festival_editions and the set_ratings table (RLS mirrors votes) for a later rating ticket. Extends getFestivalPhase with getEffectiveFestivalPhase (override ?? derived) and wires it through useFestivalPhase, plus a Core Team admin control to set/clear the override beside ScheduleRevealControl. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FUwNzs67viT4UnYJwqjSWo
- Drop idx_set_ratings_user_set: redundant with the unique constraint's own index on the same columns. - Point the set_ratings comment at the actual PRD doc instead of a nonexistent ADR-0004. - Guard the phase-override Select's onValueChange with a type predicate instead of casting an arbitrary string to FestivalPhase.
Select value={override ?? undefined} didn't reliably reset the
trigger's displayed label back to the placeholder after clearing, since
Radix Select doesn't round-trip a controlled value through undefined.
Making "Automatic" a real option keeps the value always a defined
string and removes the separate clear button.
cc32ff6 to
e75914b
Compare
|
do you think instead of "derived" we can say in the select "automatic(actual)"? |
"Automatic (derived)" didn't say what "derived" currently resolves to. Compute the derived phase alongside the override in FestivalEdition and show it, e.g. "Automatic (Live)".
|
Done — the "Automatic" option now shows the currently-derived phase, e.g. "Automatic (Live)" or "Automatic (Planning)", recomputed live from the edition's reveal level + dates + festival timezone. Generated by Claude Code |
Adds the epic's one migration — nullable
phase_overrideon the edition plusset_ratings(RLS mirroringvotes) — and thegetEffectiveFestivalPhaseseam (override ?? derived), with a Core Team admin control to set/clear the override. Per #139.Note: this PR does not by itself change how the edition's default-tab redirect picks a phase (that logic lives in #137's branch). Once both #137 and #139 are merged,
src/routes/festivals/$festivalSlug/editions/$editionSlug.tsx'sbeforeLoadshould be updated to callgetEffectiveFestivalPhaseinstead ofgetFestivalPhaseso an admin override also affects the landing tab, not just the banner/label — flagging this as a small follow-up once both land.Verification
useFestivalPhase()-driven UI (banner/label) reflects it immediately.pnpm test src/lib/festivalPhase.test.ts— override-wins-over-every-derived-case and null-falls-through-to-derived cases pass.set_ratingsrows for the same(user_id, set_id)as different users — both succeed; as the same user — second insert violates the unique constraint.supabase db push/db resetwas run; migration is timestamp-prefixed undersupabase/migrations/.Closes #139.
Generated by Claude Code