Skip to content

refactor(schedule): add phase-input adapter - #516

Merged
chiptus merged 3 commits into
mainfrom
refactor/UPL-17/phase-input-adapter
Oct 1, 2026
Merged

chiptus merged 3 commits into
mainfrom
refactor/UPL-17/phase-input-adapter

Conversation

@chiptus

@chiptus chiptus commented Oct 1, 2026

Copy link
Copy Markdown
Owner

UPL-17: adds phaseInputFromEdition, one adapter owning the edition-row → festival-phase-input defaulting policy that was independently reconstructed at each call site (useFestivalPhase, nowView, the edition route redirect, the admin settings page).

The admin settings call site intentionally keeps calling the non-override-aware getFestivalPhase (now fed by the adapter's derivedInput) for its "Automatic (...)" label, since that label previews what automatic derivation would produce even while an override is active — the override itself is already shown separately as the control's selected value. The brief described this as a bug ("silently ignores a manual phase override"), but reading PhaseOverrideControl.tsx shows this is the label's intended purpose, not a bug; switching it to the override-aware phase would make the "Automatic" option echo the override instead of previewing automatic derivation.

Verification

  • pnpm run typecheck, pnpm run lint, pnpm exec vitest run, pnpm run build all pass.
  • New unit tests cover phaseInputFromEdition's defaulting (missing reveal level → draft, missing dates → null, missing override → null, full passthrough).
  • Set an edition's phase override and confirm /festivals/:slug/editions/:slug still redirects to the override's tab (unchanged behavior, now adapter-backed).
  • On the admin edition settings page, confirm the phase-override <Select>'s "Automatic (...)" label still shows the derived phase, not the override, when an override is active.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QBenrJ8YAv3Zk81uWHvSLi


Generated by Claude Code

claude added 2 commits October 1, 2026 05:12
Consolidates the edition-row -> phase-input defaulting policy that was
independently reconstructed at each festival-phase call site into one
adapter, per UPL-17.

The admin settings call site keeps calling getFestivalPhase (not the
override-aware wrapper) for its "Automatic (...)" label, since that
label must reflect what automatic derivation would produce even when
an override is active — the override is already shown separately as
the control's selected value. Current code reads this correctly, so
the "silently ignores override" bug described in the ticket's brief
does not reproduce on this call site; only the reconstruction itself
was duplicated, which the adapter now owns.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QBenrJ8YAv3Zk81uWHvSLi
Use JSDoc blocks for the new adapter's comments (CLAUDE.md comment
policy) and move it below getFestivalPhase to match the repo's
implementation-first file ordering.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QBenrJ8YAv3Zk81uWHvSLi
Copilot AI balanced review requested due to automatic review settings October 1, 2026 05:15
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
upline Ready Ready Preview Oct 1, 2026 3:11pm UTC

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.

Copilot review overview

🟢 Approval recommended

The focused refactor preserves behavior, centralizes defaults, and includes adequate unit coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Centralizes edition-row phase defaults in a shared adapter while preserving existing override behavior.

Changes:

  • Adds and tests phaseInputFromEdition.
  • Migrates all phase consumers to the adapter.
  • Preserves automatic-phase preview behavior in admin settings.
File Description
src/​lib/​festivalPhase.ts Adds the shared adapter and input type.
src/​lib/​festivalPhase.test.ts Tests passthrough and defaults.
src/​lib/​nowView.ts Uses the adapter for phase evaluation.
src/​hooks/​useFestivalPhase.ts Uses the adapter in the phase hook.
src/​routes/​festivals/​$festivalSlug/​editions/​$editionSlug.tsx Uses the adapter for default-tab redirects.
src/​routes/​admin/​festivals/​$festivalSlug/​editions/​$editionSlug/​settings.tsx Uses derived adapter input for the automatic label.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Playwright test results

passed  68 passed

Details

stats  68 tests across 22 suites
duration  1 minute, 30 seconds
commit  ead17c5

Comment thread src/lib/festivalPhase.ts Outdated
Comment thread src/routes/admin/festivals/$festivalSlug/editions/$editionSlug/settings.tsx Outdated
…tion

Addresses review feedback on PR #516: phaseInputFromEdition now takes
{ edition, timezone, now } instead of three positional args, and the
settings.tsx comment explaining the deliberate non-override-aware
derivedPhase is compacted to one line.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QBenrJ8YAv3Zk81uWHvSLi
@chiptus
chiptus merged commit 2ed68b2 into main Oct 1, 2026
9 checks passed
@chiptus
chiptus deleted the refactor/UPL-17/phase-input-adapter branch October 1, 2026 15:13

This branch was successfully deployed

1 active deployment
Preview — ead17c50 Deployed Oct 1, 2026 by vercel[bot]
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