Skip to content

fix(types): regenerate Supabase types + fix masked payment-retry schema drift#135

Merged
TortoiseWolfe merged 1 commit into
mainfrom
chore/regen-supabase-types
Jun 6, 2026
Merged

fix(types): regenerate Supabase types + fix masked payment-retry schema drift#135
TortoiseWolfe merged 1 commit into
mainfrom
chore/regen-supabase-types

Conversation

@TortoiseWolfe

Copy link
Copy Markdown
Owner

Regenerates src/lib/supabase/types.ts from the live schema (Supabase Management API — no local CLI install). The stale types were masking real bugs:

What the regen surfaced + fixed

  1. auth_audit_logs.success/error_message — were missing from the old types. Removed the boundary-cast workaround added in feat(security): #23 user-facing security-activity dashboard #131 (UserAuditTrail.tsx).
  2. Broken payment-retry feature (the big one). The fresh types revealed that payment_intents.retry_count + parent_intent_id don't exist in the live DB — yet payment-service.ts (FR-009 retry limit) and usePaymentRetryStatus.ts read/write them. retryPayment() would have failed at runtime; only the mocked unit tests passed. The columns are in the monolithic migration (lines 69–76, [Gap-Audit] 040 Payment Retry UI: idempotency-key reuse, retry counter + cooling, error categorization, offline banner, audit log #43/B1) — they were just never applied to prod (same drift class as [Gap-Audit] auth_audit_logs sign_up events not written for all signup paths #49). Applied the idempotent ADD COLUMN IF NOT EXISTS to prod via the Management API + verified. The feature now actually works.
  3. messages.sequence_number — the stricter fresh types caught that my [Gap-Audit] 011 + 043 Group Chats / Group Service: implement 8 stub member-management methods #26 recordSystemMessage insert omitted this required column; added the :0 placeholder (the assign_sequence_number() trigger overwrites it, matching message-service.ts).

Also picks up edge_idempotency_keys (the #130 table) in the types.

Verification

  • ✅ type-check clean (was failing on retry_count until the prod columns were added)
  • ✅ lint clean
  • ✅ 41 affected tests pass (UserAuditTrail with cast removed, payment retry, group membership)

Prod impact: 2 idempotent columns added to payment_intents (already in the migration file; this just reconciled prod). No data migration; defaults to 0/null.

Part of the #115 Tier-2 sweep (quick-win). 🤖 Generated with Claude Code

…nt-retry schema drift

Regenerated src/lib/supabase/types.ts from the live schema via the Supabase
Management API (GET /v1/projects/{ref}/types/typescript — no local CLI install).
The old generated types were stale and were MASKING real bugs:

1. auth_audit_logs.Row was missing success/error_message → removed the
   boundary-cast workaround added in #131 (UserAuditTrail.tsx).
2. The fresh types exposed that payment_intents.retry_count + parent_intent_id
   DON'T EXIST in the live DB — yet payment-service.ts (FR-009 retry limit) and
   usePaymentRetryStatus.ts read/write them. retryPayment() would fail at
   runtime; only the mocked unit tests passed. The columns ARE in the monolithic
   migration (lines 69-76, #43/B1) — they were just never applied to prod
   (same prod-vs-migration drift class as #49). Applied the idempotent
   ADD COLUMN IF NOT EXISTS to prod via the Management API + verified; the
   payment-retry feature now actually works.
3. My #26 recordSystemMessage insert was missing the required messages.
   sequence_number — the fresh (stricter) types caught it; added the placeholder
   :0 (the assign_sequence_number() trigger overwrites it, matching
   message-service.ts:335/516).

Also picks up edge_idempotency_keys (the #130 table) now that it's in the types.

Gates: type-check clean (was failing on retry_count before the prod fix), lint
clean, 41 affected tests pass (UserAuditTrail / payment retry / group membership).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@TortoiseWolfe TortoiseWolfe merged commit 0a40151 into main Jun 6, 2026
18 checks passed
@TortoiseWolfe TortoiseWolfe deleted the chore/regen-supabase-types branch June 6, 2026 00:08
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.

2 participants