fix(platform-objects): drop unenforceable sys_user email_unique validation (#1485 regression)#1490
Merged
Conversation
…ation (#1485 regression) #1485 trimmed the `unique`/`async`/`custom` validation-rule types from the union, but sys_user still declared `email_unique` with type: 'unique', so ObjectSchema.create threw a ZodError at load and platform-objects.test.ts (and main CI) went red. The rule was redundant — sys_user already has a unique index on email and better-auth enforces it on the managed user table — so it's removed rather than migrated. No other object uses a trimmed type. Verified: platform-objects.test.ts 52/52 pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
mainhas been red since #1485 ("enforce all declared validation-rule types; trim the unenforceable three"). That PR removedunique/async/customfrom theValidationRuleSchemadiscriminated union, butsys_userstill declared:So
ObjectSchema.create(SysUser)throws at module load:…which fails
packages/platform-objects/src/platform-objects.test.ts(CI "Test Core"). CI history:11905faf8(#1484) green →764824299(#1485) red → still red throughf950b43d9(#1487).Fix
The validation rule was redundant:
sys_useralready declares a unique index onemail(indexes: [{ fields: ['email'], unique: true }]), and the table ismanagedBy: 'better-auth'which enforces email uniqueness at the source.uniquewas trimmed precisely because it's unenforceable as a synchronous validation rule. So the rule is removed (not migrated). Swept the repo — no other object uses a trimmed validation type.Verification
platform-objects.test.ts→ 52/52 pass locally with the fix (was a failing suite before).Unblocks #1488 (notification dispatcher test) which is red only due to this pre-existing failure.
🤖 Generated with Claude Code