refactor(managedBy): one parser for the userActions override shape (completes #2712)#2724
Merged
Merged
Conversation
…ompletes #2712, framework#3343) #2712 consolidated the bucket union + affordance set mirrors but left four surfaces still parsing the `userActions.{create,edit,delete}` override shape by hand. They now all route through the shared @object-ui/core policy — no package re-implements the boolean / #2614-object-form parse locally. - core: promote internal `normalizeOverride` to exported `normalizeUserAction` (the one parser) + add `userActionPredicates` for per-record predicate extraction. - app-shell/managedByEmptyState: writable-`system` create check + local `EmptyStateUserActions` → `resolveCrudAffordances({ managedBy, userActions }).create`. - plugin-grid/rowCrudAffordances: local `isOptedOut`/`predicatesOf` + duplicated types fold into `normalizeUserAction`; historical type names stay re-exported. - plugin-detail/RelatedList: inline `predicatesOf` → `userActionPredicates`. - plugin-form/ObjectForm: hand-rolled `managedBy !== 'platform'` blanket lock + userActions unlock → resolved affordance for the mode (edit/create), the same `resolveCrudAffordances` contract detail (`isObjectInlineEditable`) and grid use. Behavior-preserving for platform/system/append-only/better-auth, with one deliberate alignment: an admin-editable `config` object (sys_webhook, sys_permission_set) is now editable in ObjectForm — it was over-locked as non-`platform` while detail/grid already treated it as editable (config resolves edit:true). New unit coverage for the shared parser + the config/create-mode form gate; all existing affordance/edit-gate tests stay green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
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.
Completes the objectui#2712 de-dup and closes item #1 of the framework tracking issue objectstack-ai/framework#3343. Follows framework ADR-0103.
Problem
#2712 consolidated the
managedBybucket union + affordance set mirrors, but deliberately left the small inlineuserActionshandlers that still parse the override shape (bare boolean vs. #2614{ enabled, visibleWhen, disabledWhen }object form) by hand. There were actually four such surfaces — three named in the issue plusRelatedList, which had its own copy ofpredicatesOf.Approach — one parser in
@object-ui/core@object-ui/corepromotes the internalnormalizeOverrideto the exportednormalizeUserAction(v, base)— THE single parser — and addsuserActionPredicates(v)for per-record CEL predicate extraction.resolveCrudAffordancesnow calls it too.app-shell/utils/managedByEmptyState.ts— the writable-systemcreate check and its localEmptyStateUserActionsinterface →resolveCrudAffordances({ managedBy, userActions }).create.plugin-grid/rowCrudAffordances.ts— localisOptedOut/predicatesOf(and duplicatedRowCrudUserAction/RowCrudPredicatestypes) fold intonormalizeUserAction; the historical type names stay re-exported for import compat.plugin-detail/RelatedList.tsx— inlinepredicatesOf→userActionPredicates.plugin-form/ObjectForm.tsx— the hand-rolledmanagedBy !== 'platform'blanket lock +userActionsunlock → the resolved affordance for the current mode (edit/create), the sameresolveCrudAffordancescontract the detail (isObjectInlineEditable) and grid surfaces use.Acceptance (from #3343): no package re-parses the
userActionsoverride shape locally. ✔Behavior
Behavior-preserving for
platform/system/append-only/better-auth, with one deliberate alignment: an admin-editableconfig-bucket object (e.g.sys_webhook,sys_permission_set) is now editable inObjectForm. It was previously over-locked as "non-platform", while detail/grid already treated it as editable (configresolvesedit: true, and the framework declaresconfigpermits direct mutation). This is exactly the "match detail/grid exactly" fix the issue calls for.Tests
@object-ui/core: new unit coverage fornormalizeUserAction+userActionPredicates.plugin-form: newObjectForm.managedEditcases pinning the alignedconfigedit gate and the create-mode routing (engine-owned locked vs.userActions.createunlocked).core+plugin-grid+plugin-form+plugin-detail+app-shell/utils: 1767 + 226 pass locally);type-checkgreen for all five packages; no new lint errors introduced.🤖 Generated with Claude Code