Skip to content

refactor(sets): share SET_TYPES across frontend and edge - #526

Open
chiptus wants to merge 2 commits into
mainfrom
fix/UPL-50/consolidate-set-types
Open

chiptus wants to merge 2 commits into
mainfrom
fix/UPL-50/consolidate-set-types

Conversation

@chiptus

@chiptus chiptus commented Oct 16, 2026

Copy link
Copy Markdown
Owner

UPL-50: collapses the two TS copies of SET_TYPES into supabase/functions/_shared/setTypes.ts (re-exported from src/api/sets/types.ts) and adds a unit test pinning sets_set_type_check to it, so drift fails a test.

Verification

  • Run pnpm exec vitest run src/lib/setTypeConstraint.test.ts; it passes.
  • Add a value to SET_TYPES without a migration; the test fails.
  • Create a set in the admin form with each set type; saves as before.
  • Run a schedule import with a set type column; imports as before.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CMhMAja3g8dwyMnAjVCLN2


Generated by Claude Code

Pin the sets_set_type_check constraint to SET_TYPES with a unit test.

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

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

@github-actions

Copy link
Copy Markdown

Deploy → staging — workflow run
Last updated: 2026-10-16 05:10:14 UTC

  • ⏭️ DB migrations skipped (no changes)
  • ✅ Edge functions succeeded
  • ⏭️ 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.

🟢 Approval recommended

The focused refactor preserves validation behavior, adds drift detection, and has no unresolved findings.

0 open findings

What changed in this PR

Centralizes set-type definitions shared by the frontend and edge functions, with a test to detect database constraint drift.

Changes:

  • Reuses shared constants, types, and validation through frontend exports.
  • Adds a migration-based constraint consistency test.
  • Updates documentation to describe the shared definition.
File Description
supabase/​functions/​_shared/​setTypes.ts Documents the shared definition and drift test.
src/​lib/​setTypeConstraint.test.ts Checks constraint values against SET_TYPES.
src/​api/​sets/​types.ts Replaces duplicate definitions with shared exports.

🧠 Review effort: Balanced


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

@chiptus

chiptus commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

test / run failed before any test ran: supabase start couldn't pull its Docker images (toomanyrequests: Data limit exceeded). That is a registry rate limit, not caused by this PR, which only touches SET_TYPES and a unit test. Unit tests, typecheck/lint and edge function tests are green. I'm re-running the failed job once.


Generated by Claude Code

@github-actions

Copy link
Copy Markdown

Playwright test results

passed  68 passed

Details

stats  68 tests across 22 suites
duration  1 minute, 21 seconds
commit  4dc341c

This branch was successfully deployed

2 active deployments
Preview — 4dc341c5 Deployed Oct 16, 2026 by vercel[bot]
staging — 4dc341c5 Deployed Oct 16, 2026 by chiptus via functions / Deploy edge functions (staging) #146
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