Skip to content

Allow Delta Reign (TEF-DLR) Tournaments to be saved - #123

Merged
jamesembling merged 2 commits into
mainfrom
claude/sweet-cannon-g4ugjx
Nov 9, 2026
Merged

jamesembling merged 2 commits into
mainfrom
claude/sweet-cannon-g4ugjx

Conversation

@jamesembling

@jamesembling jamesembling commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Problem

Creating a Tournament with the default format fails with "Tournament format is not an allowed site format."

PR #114 added TEF-DLR to lib/formats/site-format-options.json and made it the default Standard format. But the database function commit_tournament_metadata has its own hardcoded allowlist, last updated in 20260926220343_allow_30c_tournament_format.sql, and that list still stops at TEF-30C. As a result, every new or edited Tournament using the new default is rejected.

Change

  • New migration supabase/migrations/20261109222734_allow_delta_reign_tournament_format.sql (sha256 f7f798e723a98f32562b2ea6be2a914d32ccce50d8a34d4eddb43965456f54e2): re-creates commit_tournament_metadata exactly as in the 30C migration, with TEF-DLR added to the allowlist. The grants are unchanged (authenticated can execute; public and anon cannot).
  • schema.sql: the same one-line allowlist change.
  • supabase/rehearsals/tournament_standard_format_allowlist.sql: now creates a TEF-DLR Tournament, updates it to the previous TEF-30C, and still checks that an unknown format is rejected.
  • tests/site-formats.test.ts: the existing site-format case now also fails if site-format-options.json contains a format that is missing from the allowlist in the latest commit_tournament_metadata migration or in schema.sql. This is the failure behind this bug. Executed-case count is unchanged (1 case in this file, before and after). It is a source-text check between the config file and the migration SQL, which docs/agents/testing.md allows for configuration and migration contracts. I confirmed it fails on the pre-fix tree and names TEF-DLR as missing.

Schema and data impact

This replaces one function body and adds one value to its allowlist. It rewrites no data and takes no table locks. It is backward compatible: the current production app and this version both work with the new function. The change only widens what the function accepts.

Verification

  • npm run lint, npm run typecheck, and npm run format:check -- tests/site-formats.test.ts all pass.
  • npm test: every case passes except tests/tournament-deck-list-independence.test.ts ("replaying the same Tournament Deck List FormData…"). That case also fails on the base commit a6fed6e without this change, so this PR did not cause it.
  • I tried npm run migration:rehearse:local, but it could not start the full local Supabase stack. Container registries refused the image pulls (403 and 429 responses), so the rehearsal never reached the migration.
  • Instead I ran a direct database check with the supabase/postgres:17.6.1.159 image. I loaded the pre-change schema.sql from a6fed6e, applied the new migration, and ran the rehearsal SQL. Because the bare image's auth.users is only a placeholder, I used a minimal user insert.
    • Before the migration, the rehearsal fails with Tournament format is not an allowed site format.
    • After the migration, it passes: the TEF-DLR create commits, the update to TEF-30C commits, and the unknown format is rejected. authenticated can still execute the function and anon cannot.
  • CI's Database behavior job applies every migration to a fresh local stack.

Release

  • Ordering: the production app already sends TEF-DLR, so the bug stays live until the database is updated. After merging, run the Deploy production database workflow from main.
  • Rollback / forward fix: if needed, add a forward migration that re-creates the function. No data depends on this change being reverted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WkSxRaMKK8UtSB1NivqRDs

The app made TEF-DLR its default Standard format, but the database's
commit_tournament_metadata allowlist still stopped at TEF-30C, so creating
a Tournament with the default format failed with "Tournament format is not
an allowed site format."

Add a forward migration that re-creates the function with TEF-DLR in the
allowlist, mirror it in schema.sql, point the format rehearsal at the new
default, and add a guard that fails when a site format is missing from the
database allowlist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WkSxRaMKK8UtSB1NivqRDs
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
poke-notes-app Ready Ready Preview Nov 9, 2026 10:34pm UTC

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T22:33:58.772291Z 415ad36 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 415ad36f99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/site-formats.test.ts Resolved
Keeps the executed-case count unchanged, per the zero-growth test policy
for non-feature changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WkSxRaMKK8UtSB1NivqRDs
@jamesembling jamesembling added the merge-when-green Squash-merge automatically once every check is green label Nov 9, 2026 — with Claude
@jamesembling
jamesembling merged commit 3c05b0a into main Nov 9, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 19bd4f0c Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-green Squash-merge automatically once every check is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants