Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .claude/skills/steward/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ If you are awake when the PR goes green, merge it yourself rather than waiting f

Merge with **squash**, keeping the PR title and number as the commit subject, and pin the merge to the head SHA you just checked (`expectedHeadSha`, or `gh pr merge --match-head-commit`) so a later push cannot slip in. Treat the merge call's result as a diagnostic: confirm with a separate read that the PR is merged at that SHA before telling James, in one line, and never retry a merge on the call's result alone. See `docs/verification-commands.md` **Pull request integration is a two-phase contract**.

## Deploy database migrations

If the merged PR added or changed files under `supabase/migrations/`, the change is not live until the production database workflow runs. Run it yourself right after confirming the merge, without asking James. The PR request already covers it (`docs/migration-release.md` **4. Deploy through GitHub Actions**).

- Confirm `origin/main` is the merge commit or a descendant of it, then dispatch `deploy-production-database.yml` on `main` with `confirmation=DEPLOY`.
- The run's completion does not wake you. Check it a few minutes later; it usually takes about two minutes.
- On success, confirm the new migration version is applied (the run's **Verify migration history** step, or a read-only migration list), and tell James in one line together with the merge.
- On failure, do not re-run. Read the failing step's log and tell James what failed.
- Never apply migration SQL to production any other way.

## Update local main

After confirming the merge (yours, or the workflow's when you next wake), bring James's local `main` up to date with `origin/main`. Fast-forward only, and never discard local work:
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This block is written and re-added by `next dev` — verify at `node_modules/nex

- **Domain language:** Before naming or changing a product concept, read `CONTEXT.md`. Deck Aggregate compatibility work also requires `docs/adr/0001-preserve-deck-aggregate-during-relational-cutover.md`; Deck List ownership, Deck Strategy association, or Tournament snapshot work also requires `docs/adr/0002-first-class-deck-lists-and-tournament-snapshots.md`.
- **Notion issues:** Before reading, creating, triaging, or updating an issue or specification, read `docs/agents/issue-tracker.md`.
- **Database migrations:** Before authoring, reviewing, or releasing a Supabase schema change, read `docs/migration-release.md`. Local hooks validate; only the controlled production workflow deploys.
- **Database migrations:** Before authoring, reviewing, or releasing a Supabase schema change, read `docs/migration-release.md`. Local hooks validate; only the controlled production workflow deploys, and the session that merges a migration dispatches it.
- **Reference data:** Before changing a catalog or cached reference dataset, read `docs/agents/reference-data.md`.
- **Battle Replay:** Before changing Battle Replay reconstruction, display, card information or its tests, read `docs/agents/battle-replay-rules.md`. It is James's authoritative game-rule contract and overrides any earlier "never infer" guidance, including the prototype's productisation note. Measure success against real saved logs, never invented log wording.
- **Deck-list ordering:** Before changing a deck-list sort, snapshot, share, or `sortedCards` path, read `docs/agents/deck-list-ordering.md`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cp .env.example .env

- For a new Supabase project, apply [`schema.sql`](./schema.sql). It is the complete schema snapshot; do not replay the historical incremental SQL over it.
- For an existing environment, inspect migration history and the target schema before applying anything. [`supabase/migrations`](./supabase/migrations) is the release authority. [`sql`](./sql) is historical reference material, not a fresh-install sequence or a destination for new migrations.
- Local Git hooks validate database changes without deploying them. Production migrations run only through the manually dispatched `Deploy production database` workflow after merge to `main`; see [`docs/migration-release.md`](./docs/migration-release.md).
- Local Git hooks validate database changes without deploying them. Production migrations run only through the `Deploy production database` workflow, which the merging session dispatches after merge to `main`; see [`docs/migration-release.md`](./docs/migration-release.md).

5. Configure Supabase Auth redirect URLs for each environment:

Expand Down
12 changes: 6 additions & 6 deletions app/(app)/tournaments/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,23 +257,23 @@ export default async function TournamentDetailPage({ params }: TournamentDetailP

<section className="flex flex-col gap-6 border-b border-border pb-6">
<div className="flex flex-col gap-4 sm:flex-row sm:items-center">
<div className="flex min-w-0 flex-1 items-center gap-4">
<div className="flex min-w-0 flex-1 flex-wrap items-center gap-4 sm:flex-nowrap">
{isJudge ? (
<PlayPokemonJudgeMark className="size-14" />
) : (
<SpriteStrip maxVisible={3} size="xl" sprites={tournament.deckSprites} />
)}
<div className="flex min-w-0 flex-1 items-center justify-between gap-3">
<div className="min-w-0">
<div className="contents sm:flex sm:min-w-0 sm:flex-1 sm:items-center sm:justify-between sm:gap-3">
<div className="min-w-0 flex-1">
<ItemTitle as="p" size="lg">
{isJudge
? getTournamentJudgeRoleLabel(tournament.judgeRole)
: stackDeckName(tournamentDeckName)}
</ItemTitle>
</div>
<div className="flex shrink-0">
<div className="flex w-full sm:w-auto sm:shrink-0">
{isJudge ? null : resolvedTournamentDeckList ? (
<div className="flex items-center gap-1">
<div className="flex flex-wrap items-center gap-1">
<DeckListViewDialog
deckListName={resolvedTournamentDeckList?.name ?? "Tournament Deck List"}
rawList={resolvedTournamentDeckList?.rawList}
Expand Down Expand Up @@ -329,7 +329,7 @@ export default async function TournamentDetailPage({ params }: TournamentDetailP
/>
</div>
) : (
<div className="flex flex-wrap items-center justify-end gap-2">
<div className="flex flex-wrap items-center gap-2 sm:justify-end">
<LazyDeckListEditorButton
deckId={tournament.linkedDeckId ?? ""}
defaultCreatedBy={defaultCreatedBy}
Expand Down
10 changes: 5 additions & 5 deletions docs/migration-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Use this path for every Supabase schema change. `supabase/migrations/` and Supabase's migration history are the release authority. `schema.sql` is the fresh-project snapshot; `sql/` is historical reference material.

Local agents and Git hooks validate migrations. They have no production-deployment step. Production changes run only from the reviewed `main` commit through the manually dispatched **Deploy production database** GitHub workflow.
Local agents and Git hooks validate migrations. They never apply SQL to production themselves. Production changes run only from the reviewed `main` commit through the **Deploy production database** GitHub workflow, which the session that merged the migration dispatches.

## 1. Author a native migration

Expand Down Expand Up @@ -72,11 +72,11 @@ the application cutover; it must not be included in this release.

## 4. Deploy through GitHub Actions

Configure the GitHub `Production` environment with the `SUPABASE_PRODUCTION_DB_URL` secret. Restrict that environment to `main` and add a required reviewer when the repository plan supports it.
Configure the GitHub `Production` environment with the `SUPABASE_PRODUCTION_DB_URL` secret and restrict it to `main`.

From the merged `main` commit, manually run **Deploy production database** and enter `DEPLOY`. The workflow serializes production database runs, previews pending migrations with `supabase db push --dry-run`, applies them with `supabase db push`, then verifies migration history, repository schema contracts, and Supabase security advisors.
**Standing decision — 9 November 2026:** James does not review or approve deployments. A migration is reviewed in its pull request (CI, `Database behavior` and review threads), and merging it authorizes deploying it. After a pull request that adds or changes files under `supabase/migrations/` merges, the session that drove it dispatches **Deploy production database** on `main` with the confirmation `DEPLOY` (`gh workflow run deploy-production-database.yml --ref main -f confirmation=DEPLOY`, or the GitHub Actions `run_workflow` tool), once `origin/main` is the merge commit or a descendant of it. Do not hand this step back to James. The workflow serializes production database runs, previews pending migrations with `supabase db push --dry-run`, applies them with `supabase db push`, then verifies migration history, repository schema contracts, and Supabase security advisors.

The workflow is the only production migration path. A local `git push`, agent command, Vercel build, or preview deployment never applies production SQL.
The workflow is the only production migration path. A local `git push`, direct SQL from an agent (Supabase connector, `psql`, or `supabase db push` against production), Vercel build, or preview deployment never applies production SQL.

If the workflow reports history drift, stop. Inspect `supabase migration list` and the target schema before considering `migration repair`; repairing history requires a separate reviewed decision because it changes the ledger without applying SQL.

Expand All @@ -90,7 +90,7 @@ Database work is complete when all applicable evidence is green:
4. the compatible production application path behaves as intended;
5. monitoring and the rollback or forward-fix owner are recorded.

If production deployment was not requested or could not run, report it as outstanding and keep the database work incomplete.
If the deployment could not run or failed, report it as outstanding and keep the database work incomplete.

## Import Draft retention release

Expand Down
Loading