Skip to content

fix(db): guard ::uuid cast in provisioning trigger against malformed company_id (#62) - #70

Merged
BluegReeno merged 1 commit into
mainfrom
fix/issue-62-guard-uuid-cast
Jul 23, 2026
Merged

fix(db): guard ::uuid cast in provisioning trigger against malformed company_id (#62)#70
BluegReeno merged 1 commit into
mainfrom
fix/issue-62-guard-uuid-cast

Conversation

@BluegReeno

Copy link
Copy Markdown
Owner

Replaces #66, whose GitHub head object got stuck on a pre-merge commit (the synchronize webhook never fired after the conflict resolution was pushed, so its merge engine kept seeing a stale conflicting tree). Identical content, on a fresh branch flattened linearly onto main.

Adds a UUID-format regex to trg_provision_workspace_membership's WHEN clause so a malformed company_id fails WHEN (the function never runs, the auth.users write commits) instead of aborting the invite on 22P02. Trigger-only fix-forward, function body unchanged (no CREATE OR REPLACE), WHEN references only NEW (no 42P17). Already applied to prod zgkvbjqlvebttbnkklpo via apply_migration and verified in a rolled-back transaction.

Fixes #62.

🤖 Generated with Claude Code

…company_id (#62)

The WHEN clause of trg_provision_workspace_membership now regex-validates the
canonical UUID shape before the function's unconditional ::uuid cast runs, so a
malformed company_id fails WHEN, the function never executes, and the auth.users
write commits (provisioning silently skipped) instead of aborting on 22P02.
Trigger-only fix-forward — function body unchanged, WHEN references only NEW
(no 42P17). Already applied to prod zgkvbjqlvebttbnkklpo via apply_migration.

Flattened onto main (was a merge commit) to resolve the STATUS.md /
cross-repo-log.md overlap with #61 (#68) — both follow-ups now land in the same
backlog line and Done section.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@BluegReeno
BluegReeno merged commit 60ebedf into main Jul 23, 2026
4 checks passed
@BluegReeno
BluegReeno deleted the fix/issue-62-guard-uuid-cast branch July 23, 2026 08:46
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.

P2 — Guard ::uuid cast in provisioning trigger against malformed company_id

1 participant