feat(spec,platform-objects): action param 'visible' predicate; gate create-user phone on features.phoneNumber#2871
Merged
Conversation
…reate-user phone on features.phoneNumber ActionParamSchema gains an optional 'visible' (ExpressionInputSchema / CEL), evaluated against the same scope as action 'visible'. The sys_user create_user action's phoneNumber param is gated on features.phoneNumber == true, so the form only offers a phone field when the opt-in phoneNumber auth plugin is loaded — otherwise admin/create-user rejects the phone. Pairs with objectui's ActionParamDialog honoring param.visible (objectstack-ai/objectui#<pr>). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 96 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
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
The create-user form offers a Phone Number field that the default backend rejects —
{"code":"invalid_request","message":"Phone numbers require the phoneNumber auth plugin (auth.plugins.phoneNumber)"}— becausephoneNumberis an opt-in better-auth plugin (off by default), yet thesys_usercreate_useraction statically advertises the param. This makes the form follow the plugin: no phone field unless the plugin is loaded.How
ActionParamSchema(spec/ui/action.zod.ts) gains an optionalvisiblepredicate (ExpressionInputSchema/ CEL), evaluated against the same scope as action-levelvisible(current_user/app/data/features). A dialog that honors it omits the param when it's false.sys_user.create_user(platform-objects/identity/sys-user.object.ts) gates itsphoneNumberparam onfeatures.phoneNumber == true.features.phoneNumberis already served in/api/v1/auth/config(getPublicConfig), so the client can evaluate it.Back-compat:
visibleis optional; params without it are unaffected.Verified
ActionParamSchema.safeParse({...visible})parses + preserves the predicate; a param withoutvisiblestill parses.ActionParamDialoghonoringparam.visible) is unit-tested (6 tests: feature-off hides, feature-on shows, absent-flag hides, malformed fails open, and the normalized{dialect,source}served form) with a browser regression showing the create-user dialog renders cleanly.Pairs with
objectui objectstack-ai/objectui#2406 —
ActionParamDialogevaluatesparam.visible. Both must land for the phone field to hide (spec adds the field; objectui honors it).Alternative considered — default-loading the phoneNumber plugin — was rejected: it turns an opt-in auth/sign-in surface (with an SMS-provider dependency for OTP) on for every deployment. "Form follows plugin" is the conservative fix.
🤖 Generated with Claude Code