Skip to content

fix(platform-objects): drop invalid unique validation on sys_user#1492

Closed
os-zhuang wants to merge 1 commit into
mainfrom
claude/fix-sys-user-unique-validation
Closed

fix(platform-objects): drop invalid unique validation on sys_user#1492
os-zhuang wants to merge 1 commit into
mainfrom
claude/fix-sys-user-unique-validation

Conversation

@os-zhuang
Copy link
Copy Markdown
Contributor

Problem

main is currently red on Test Core for every PR. packages/platform-objects/src/identity/sys-user.object.ts declares:

validations: [
  { name: 'email_unique', type: 'unique', severity: 'error', message: 'Email must be unique', fields: ['email'], caseSensitive: false },
],

But #1485 ("enforce all declared validation-rule types; trim the unenforceable three") removed 'unique' from the allowed validation-rule discriminator (script | state_machine | format | cross_field | json_schema | conditional). The two changes were a semantic merge conflict — each passed independently, but together sys_user fails schema parse at registration:

ZodError: invalid discriminator value. Expected 'script' | 'state_machine' | 'format' | 'cross_field' | 'json_schema' | 'conditional'
  at packages/platform-objects/src/identity/sys-user.object.ts:16

Fix

Remove the redundant validations block. Email uniqueness is already enforced by the unique index declared on the same object:

indexes: [ { fields: ['email'], unique: true }, ... ]

Uniqueness is an index concern, not an enforceable validation rule — which is exactly why #1485 dropped the type. No behavior change; just removes a now-invalid declaration.

Verification

  • @objectstack/platform-objects tests: 52 passed.
  • Scanned the repo — sys_user was the only object carrying a trimmed validation-rule type.

This unblocks Test Core on main and on the in-flight ADR-0031 PRs (#1489).

https://claude.ai/code/session_012ti8cx3TkdiQdjCnZXZg2Q


Generated by Claude Code

#1485 removed `'unique'` from the enforceable validation-rule types, but
sys_user still declared a `type: 'unique'` validation — a semantic merge
conflict on main that fails FlowSchema/ObjectSchema parse (ZodError: invalid
discriminator value) and breaks Test Core for every PR.

Email uniqueness is already enforced by the unique index
(`indexes: [{ fields: ['email'], unique: true }]`), so the redundant
validation block is removed.

https://claude.ai/code/session_012ti8cx3TkdiQdjCnZXZg2Q
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Error Error Jun 1, 2026 8:59pm

Request Review

Copy link
Copy Markdown
Contributor Author

Closing as redundant — main no longer carries the invalid type: 'unique' validation on sys_user (it's already been removed upstream), so Test Core is unblocked without this change. The related docs-build break was also fixed independently on main by #1493. No action needed here.


Generated by Claude Code

@os-zhuang os-zhuang closed this Jun 2, 2026
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