Skip to content

UniquenessValidation's deprecation JSDoc points authors at the retired indexes[].partial key #4765

Description

@os-zhuang

Found while converging the console's index fallback schema for objectstack-ai/objectstack#5247 (PR touches EmbeddedItemEditor.tsx only; this sits outside that card's declared file surface, so it is filed rather than fixed).

What

packages/types/src/data-protocol.ts (~line 1013), on the @deprecated tag of UniquenessValidation:

 * @deprecated The spec removed this deliberately: a SELECT-then-INSERT check is
* racy (TOCTOU) where a DB constraint is not. Declare a unique **index**
* (`ObjectSchema.indexes`, `{ fields, unique: true }`, `partial` for a scoped
* constraint) or field-level `unique: true` instead.

Two of the three spellings it prescribes are no longer correct:

Why it is worth fixing

This is guidance that claims more than the platform delivers — the class objectstack-ai/objectstack#5247 calls out explicitly, citing the strictness ledger's finding 18 (four pieces of false guidance already shipped in that campaign). It sits on a @deprecated tag, i.e. precisely the text an author reads at the moment they are migrating off the old shape, so the wrong spelling is maximally likely to be copied.

The interface itself is correctly deprecated and unreachable from the server (ValidationRuleSchema rejects type: 'unique') — only the replacement advice is stale. A comment-only change; no runtime behaviour.

Suggested shape

Rewrite the @deprecated prescription to { fields, unique: 'global' | 'organization' }, drop the partial clause, and point partial constraints at the database-layer migration route.

Backlink: objectstack-ai/objectstack#5247 · PR #4772


Generated by Claude Code

Metadata

Metadata

Assignees

Labels

domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:dispatched

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions