Skip to content

feat(slug): generate group/stage/festival slugs in DB - #518

Open
chiptus wants to merge 6 commits into
mainfrom
claude/relaxed-wright-3berdm
Open

chiptus wants to merge 6 commits into
mainfrom
claude/relaxed-wright-3berdm

Conversation

@chiptus

@chiptus chiptus commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

UPL-54: adds BEFORE INSERT slug triggers for groups, stages, festivals and festival_editions (same idea as sets/artists) and stops the group/stage create hooks from computing slugs client-side.
Derived slugs get -2, -3, … within each table's unique scope; an explicit slug (admin festival dialogs) is kept as-is and still errors on conflict. The festival dialogs still auto-fill their visible slug field in the UI, so that path sends an explicit slug.

Verification

  • Create a group and a stage in the app; each gets a slug derived from its name.
  • Create a second group with the same name as your first group; its slug ends in -2.
  • Create a group/stage named in a non-Latin script (e.g. כנסיית השכל); it gets a non-empty n-xxxxxxxx slug.
  • Create a festival/edition via the admin dialog with a custom slug; it is kept, and reusing a taken slug keeps the dialog open with an error.
  • pnpm run test:integration -- slugTriggers against local Supabase passes.

Note: this adds a migration, so the PR needs the staging label (maintainer-applied) to pass the migration gate.

🤖 Generated with Claude Code

https://claude.ai/code/session_019fa8de7wuEMyUbpJgwn1Uv

UPL-54: extend the BEFORE INSERT dedupe triggers to groups, stages,
festivals and festival_editions and stop sending client-computed slugs
from the group and stage create paths.

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

vercel Bot commented Oct 5, 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 5, 2026 6:00am UTC

@chiptus

chiptus commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

"Require staging label for migrations" is red because this PR adds a migration and has no staging label. That is the gate working as intended, not a code failure. The staging label is off-limits to the autonomic worker, so it needs the maintainer to apply it. That should also let the migrate and integration jobs run. I'm not pushing anything for it.


Generated by Claude Code

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Deploy → staging — workflow run
Last updated: 2026-10-05 08:55:47 UTC

  • ✅ DB migrations succeeded
  • ⏭️ Edge functions skipped (no changes)
  • ⏭️ Type generation skipped (no changes)

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

🟡 Changes recommended

Slug allocation can race across overlapping bases, and an existing edition-dialog test contradicts the new behavior.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Extends database-managed slug generation to groups, stages, festivals, and editions, following the existing artist/set pattern.

Changes:

  • Adds scoped slug deduplication triggers.
  • Delegates group and stage slug creation to the database.
  • Adds integration coverage for generated slugs, collisions, and explicit values.
File Description
supabase/​migrations/​20261005050700_add_remaining_slug_dedupe_triggers.sql Adds four slug-generation triggers.
src/​test/​integration/​slugTriggers.integration.test.ts Tests slug generation and uniqueness scopes.
src/​api/​stages/​useCreateStage.ts Requests database-generated stage slugs.
src/​api/​groups/​useCreateGroup.ts Requests database-generated group slugs.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread supabase/migrations/20261005050700_add_remaining_slug_dedupe_triggers.sql Outdated
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Playwright test results

passed  68 passed

Details

stats  68 tests across 22 suites
duration  1 minute, 33 seconds
commit  68e7795

Copilot review on #518: different bases can resolve to the same final
slug, so the advisory lock is now keyed on the uniqueness scope. Explicit
slugs are no longer suffixed, so a taken one still surfaces as a conflict
in the admin dialogs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019fa8de7wuEMyUbpJgwn1Uv
Comment thread src/api/groups/useCreateGroup.ts
Comment thread src/test/integration/slugTriggers.integration.test.ts

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

🟡 Changes recommended

Explicit-slug inserts bypass allocation locks, allowing concurrent derived inserts to fail instead of receiving suffixes.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (2)

Copilot review on #518: an uncommitted explicit insert (e.g.
commit_schedule) must serialize with concurrent derived inserts, or the
derived one picks the same slug and hits the unique constraint.

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

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 changes preserve uniqueness scopes and explicit-slug conflicts, with no unresolved blocking issues identified.

Review effort: Balanced
Findings: None

Resolved since last review (1)

This branch was successfully deployed

2 active deployments
staging — 68e77958 Deployed Oct 5, 2026 by chiptus via types / Regenerate types (staging) #131
Preview — 68e77958 Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants