This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 18d1a0a
fix(plugin-grid,components,react): row-menu and data-table row-action disabled gates fail closed while permissions load, and ActionProvider binds current_user on its runner (objectui#11242) (#11268)
Fixes #11242
Clause-②: yes (widening)
Rider 1 of objectui#4421 on the last two authored-action `disabled`
legs, and the "one bag" rule (objectui#6493) for the shared action
runner. The ruling, verbatim: "permission-shaped bindings are
**fail-closed while the permissions payload has not loaded** — the
opposite of the predicate default — or the first-paint leak reappears.
Pin this." For a `disabled` gate, closed means DISABLED.
## What changed
Measured through the real `MePermissionsProvider`, `ExpressionProvider`,
`ActionProvider` and the production renderers, one verb (`delete`),
three states. The "before" column was measured at the base `615346d61`
with the new pin copied into an unmodified tree, before any source edit:
exactly the 6 arms marked in capitals were red there.
| leg | before: not loaded / granted / denied | after |
|:--|:--|:--|
| row menu item (`RowActionMenu`), `disabled:
!current_user.can('account', 'delete')` | ENABLED / enabled / disabled |
DISABLED / enabled / disabled |
| data-table row action (`data-table`, a related list's rows), same gate
| ENABLED / enabled / disabled | DISABLED / enabled / disabled |
| built-in Delete `disabledWhen`, both menus (the control) | enabled /
enabled / disabled | unchanged |
| runner `disabled` re-check through `useAction()`, no action-engine
block on the page | refused / REFUSED / refused | refused / runs /
refused |
| `page:header` click, granted, no action-engine block on the page |
button enabled, runner REFUSED | button enabled, runner runs |
- **Row menu item (`@object-ui/plugin-grid`) and data-table row action
(`@object-ui/components`).** The same mechanism PR objectui#11237 gave
`page:header`'s `disabled` leg: the caller passes its key's own fail
direction (`fallback: true`) to the row-predicate entry, and the policy
is per key, not a `can()` special case. That entry's fallback also
answers an ABSENT predicate, so the verdict counts only where a gate is
declared, read through core's one definition of that question
(`hasDeclaredPredicate`). An absent, empty or blank `disabled` stays not
disabled (pinned).
- **Scope question (not-loaded only, or every fault?).** Every fault, as
PR objectui#11237 did for `page:header`: a `disabled` that faults on an
unbound root (`nope.deep == 1`) is DISABLED on both legs (pinned).
- **Built-in `disabledWhen` (`RowActionMenu`, `data-table`) is
untouched** and stays fail-soft, as documented and pinned since PR
objectui#4515 (option B was not taken). The `BuiltinRowActionPredicates`
docblock in `RowActionMenu.tsx` said that posture renders the item
disabled; it leaves it enabled (the spec's own wording, and the existing
`RowActionMenu.test.tsx` pin). The docblock is corrected in the file
this PR already edits, and now says where the two families part.
- **`ActionProvider` (`@object-ui/react`)** binds the predicate scope's
subject (`usePredicateScope().current_user`) as `current_user` on its
runner: the same object, not a copy, bound during render and keyed on
the subject's serialisable fields and its permissions map, never on its
identity (AGENTS.md #10). The runner's `user` / `ctx.user` / `os.user`
stay the host's object. So every `execute` gate under a provider mounted
inside the scope answers `current_user`, whatever else the page mounts.
- **`useActionEngine`'s PR objectui#11237 write is KEPT, because it is
measured still needed** (ablation legs A4 and A5 below). Under a
provider mounted inside the scope it only re-binds the object the
provider already bound (A4: 0 red). It is the only writer for two
runners: the hook's own standalone runner (A5: the standalone arm goes
red), and a shared runner whose provider sits ABOVE the scope (probe P1:
`record:quick_actions` GRANTED reads HIDDEN without it). The console's
global provider is that shape: `GlobalActionRuntimeProvider` wraps the
routes and `ExpressionProvider` is mounted inside them. Only its comment
changed.
- **`ActionRunner.execute`'s `disabled`-gate comment
(`@object-ui/core`), comment only.** It said a fault "defaults to
NOT-disabled". `evaluateCondition` handles its own faults and answers
its fail-soft `true`, which on this key refuses the action; the `catch`
is reached only by a throw from outside that handling. The code is
right.
- **Docs (`content/docs/layout/page-header.mdx`).** The row menu's items
now take the same `disabled` direction as the header, in a grid and in a
related list's table, and the built-in `disabledWhen` is named as the
exception. The page also states that on the runner's own gates
`current_user.can(…)` answers while `user.can(…)`, `ctx.user.can(…)` and
`os.user.can(…)` fault (probe P3), as the review of PR objectui#11237
noted. No `user` binding is added.
## Mechanism assumptions (PM Zone 2), measured
- PR objectui#11237 is on `main` as `8bab1571d` (`merge-base
--is-ancestor` exit 0), and its diff and review were read first.
- `usePredicateScope` is exported from
`packages/react/src/hooks/useExpression.ts`, same package as
`ActionProvider`: held.
- The not-loaded reach is the one objectui#11212 measured (outside
`MePermissionsProvider`: `/forms/:name`, standalone embeds). It was not
re-measured through the real `App` here.
## Ablation (HEAD `17a2920d9`, fix committed first)
Every mutation went through `ablation-replace.mjs` (the anchor had to
hit once, the landing was proven by the anchor count and the blob hash,
and each restore was proven as blob == HEAD with an empty `git diff
HEAD`). Each leg ran 7 files, 100 tests: this pin, the objectui#11212
and objectui#4421 pins, `RowActionMenu.test.tsx`, two data-table
row-action suites, and the throwaway probe. The red counts were written
down before the run, and all eight matched:
| leg | predicted | red |
|:--|:--|:--|
| A1 row-menu `fallback: true` back to `false` | row menu NOT LOADED,
unbound | 2, exactly those |
| A2 data-table `fallback: true` back to `false` | data-table NOT
LOADED, unbound | 2, exactly those |
| A3 `ActionProvider` binding off | runner GRANTED, header click GRANTED
| 2, exactly those |
| A4 `useActionEngine` shared-runner write off | 0; P1 prints HIDDEN |
0; P1 HIDDEN |
| A5 `useActionEngine` standalone binding off | standalone quick_actions
GRANTED | 1, exactly that |
| A6 row-menu declared-gate check off | row menu NOT LOADED (companion),
absent/blank | 2, exactly those |
| A7 data-table declared-gate check off | same two, data-table | 2,
exactly those |
| A8 A3 and A4 together | A3's two, plus objectui#11212 quick_actions
GRANTED and DENIED | 4, exactly those |
All four mutated files ended as their HEAD blobs, and the tree was clean
afterwards.
## Tests and gates (HEAD `17a2920d9`, clean tree, heavy runs through the
shared verify lock)
- New pin
`packages/app-shell/src/providers/__tests__/currentUserCan-disabledLegs-11242.render.test.tsx`,
23 tests: both legs × three states, plus unbound and absent/blank arms;
the built-in control × two menus × three states; the runner gate × three
states, plus a real `page:header` click; and `record:quick_actions` with
no provider × three states. Each arm has an ungated companion and its
own action name.
- Union, `pnpm exec vitest run` from the root, in chunks under `timeout
300`, every chunk exit 0:
- `packages/plugin-grid/src/`: 174 files, 1595 tests, all passed (two
halves: 87 / 758 and 87 / 837). A first single-chunk attempt hit the
`timeout 300` wall after 125 files with 0 failures and was replaced by
the two halves.
- `packages/components/src/__tests__/` and
`packages/components/src/renderers/complex/`: `Test Files 105 passed | 1
skipped (106)`, `Tests 1158 passed | 7 skipped`; then `Test Files 106
passed (106)`, `Tests 905 passed`.
- `packages/react/src/` and `packages/app-shell/src/providers/`: `Test
Files 129 passed (129)`, `Tests 1609 passed`.
- 87 consumer test files outside those trees that name `ActionProvider`,
`useActionEngine`, `RowActionMenu`, `DataTableRowActionItem` or
`rowActionDefs` (app-shell views, plugin-detail, plugin-view,
plugin-dashboard, core, …): `Test Files 87 passed (87)`, `Tests 957
passed`.
- Root `scripts/__tests__/` (this diff edits markdown): `Test Files 177
passed | 2 skipped (179)`, `Tests 5371 passed | 2 skipped`.
- Build: `turbo run build --filter='@object-ui/app-shell^...'
--concurrency=2`, 28 tasks successful (after the `plugin-grid^...`
closure, 13 tasks).
- `type-check` exit 0 for `@object-ui/core`, `@object-ui/react`,
`@object-ui/components`, `@object-ui/plugin-grid` and
`@object-ui/app-shell` (its `tsconfig.test.json` includes
`src/**/*.test.tsx`, so the new pin is typed).
- eslint on the 6 changed source and test files: 0 errors. Warnings per
file equal the base counts; the new pin has 2 (`registered()`'s
`ComponentType` of any, as in the objectui#11212 pin).
- Exit 0: `node scripts/check-changeset-presence.mjs`,
`check:control-bytes`, `check:new-line-citations`, `changeset:check`,
`check:changeset-claims` (report-only),
`check:pending-changeset-literals`, `check:doc-types`,
`check:doc-fences`, `check:doc-example-ids`, `docs:check-links`, `node
scripts/markdown-test-inputs.mjs --audit`,
`check:action-forward-parity`, `check:test-path-roots`.
`check-governed-queue-guard.mjs --test` over the 8 paths: NOT GOVERNED.
- NOT MEASURED: `check:doc-snippets` and `check:doc-examples`. Both
printed PRECONDITION NOT MET (exit 2): they need the 36-package docs
build filter, and this tree has the 28-package closure. The doc edit
adds prose only, with no fenced code.
## Acceptance notes (not filed)
- **Open for the seat: the console's global runner.** `ActionProvider`
binds only from a scope above it. The console's
`GlobalActionRuntimeProvider` sits above `ExpressionProvider`, so probe
P2 (provider above the scope, no engine block) still refuses a grant
holder at this head. The routes that execute through that runner alone
(dashboard, report, component, `/forms/:name`) answer `current_user` on
`execute` gates only after an engine consumer has mounted, as before. No
authored gate there was found to reach it: dashboard header defs carry
only name, type, target and label. The options are in the report.
- **Inline primary row action ignores `disabled`.**
`RowActionInlineButton` (`RowActionMenu.tsx`) never reads the key. Probe
P4: `disabled: true` and a denied `disabled: !current_user.can(…)` both
render an enabled button, and only the runner refuses the click. This is
the declared-gate class (objectui#3812), not this card's fault-policy
class, and no producer of a primary `list_item` action with `disabled`
was found. The docs above say "the row menu's items" deliberately.
Carrier: none.
- **`page:header` renders a BLANK `disabled` disabled.** Probe P5:
`disabled: ' '` and a `{ dialect: 'cel', source: ' ' }` envelope render
DISABLED. `''` and the empty-source envelope render enabled.
`resolveDisabled` tests `!src` without trimming, and since PR
objectui#11237 the blank branch of the row-predicate entry returns the
header's `true` fallback. Core's `hasDeclaredPredicate` (objectui#3850 /
objectui#3960) calls both values not declared, as `ActionRunner`,
`action:button` and now both row legs do. So on a blank `disabled` the
header and the row menu disagree. `containers.tsx` is outside this
claim. Carrier: none.
---
_Generated by [Claude
Code](https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7d074ba commit 18d1a0a
8 files changed
Lines changed: 541 additions & 21 deletions
File tree
- .changeset
- content/docs/layout
- packages
- app-shell/src/providers/__tests__
- components/src/renderers/complex
- core/src/actions
- plugin-grid/src/components
- react/src
- context
- hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
163 | 169 | | |
164 | | - | |
165 | | - | |
166 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
167 | 175 | | |
168 | 176 | | |
169 | 177 | | |
| |||
0 commit comments