Repository navigation
Commit 2daa6c0
fix(app-shell):
Fixes #9572
Clause-②: no
`@objectstack/spec` declares `requiredPermissions` as "enforced with 403
on the platform action route (script/flow/modal + MCP) and **mirrored as
a UI hide**". `DeclaredActionsBar` filters its own declared-action list
instead of routing through `ActionEngine.getActionsForLocation`, so the
engine's gate never reached it and the key was **inert** on every action
it drew — the last object-bound surface that did not mirror it, after
`action:bar`, the grid row menu, the selection bar and the data-table
row menu (objectui#9623).
⛔ **This restores a MIRROR, it does not move enforcement into the UI.**
The server stays the sole authority and still answers 403; the request
this bar sends is byte-identical either way. The fail-open-on-unknown
doctrine in `useCapabilityGate` is untouched.
## The repair
The shared `useCapabilityGate` is applied **once** to the located set,
inside the bar's **own** `ActionProvider` — the provider
`useConsoleActionRuntime` seeds with the same `user.systemPermissions`
the engine reads, and the same one the dispatch this bar is about to
make will carry.
⭐ **The placement is the repair, not an incidental.**
`useCapabilityGate` reads the nearest provider **above** its caller.
This bar is self-contained: it mounts its own provider and renders the
buttons under it. A gate called in the bar's outer body would therefore
read a *different* provider — the host's, if there is one — and in a
standalone host would read none at all and fail open on every action
forever: a gate that compiles, reviews as correct, and mirrors nothing.
The new suite supplies the held set **only** through
`useConsoleActionRuntime().actionProviderProps.context`, with no ambient
provider and no predicate scope above the render, so the outer placement
cannot pass it.
Applying it to the **list** rather than per button is the objectui#3562
invariant: the toolbar chrome and the buttons read one filtered source,
so a wholly denied set draws nothing instead of leaving the host an
orphan divider and section label.
## Why the fail-open / fail-closed boundary composes
The card fenced itself on this, correctly. It resolves by measurement,
not argument: the capability gate is **ANDed in front of** the existing
fail-closed `visible` CEL, so the composition is **monotone** — it can
only ever hide more than before, and can never expose something that is
hidden today. That is what makes a fail-OPEN gate safe to put in front
of a fail-CLOSED one, and it is pinned in both directions (a
`visible`-hidden action stays hidden even when the capability IS held).
## The `can_override` arm (objectui#5178) — re-derived, not inherited
`can_override` is a per-**record** viewer flag an action's own `visible`
CEL reads; `requiredPermissions` is a per-**caller** capability list
checked against `user.systemPermissions`. They are orthogonal, they are
ANDed, and `isOverrideDecision` still runs unchanged on every action
that survives the filter. Pinned both ways: an override-only viewer
keeps the override affordance on an action that declares no capability,
and gets **no exemption** from one that does.
DeclaredActionsBar mirrors the ADR-0066 D4 capability gate (#9805)1 parent 0b26acf commit 2daa6c0
3 files changed
Lines changed: 399 additions & 20 deletions
File tree
- .changeset
- packages/app-shell/src/views
- __tests__
| 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 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
421 | 422 | | |
422 | 423 | | |
423 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
424 | 514 | | |
425 | 515 | | |
426 | 516 | | |
| |||
432 | 522 | | |
433 | 523 | | |
434 | 524 | | |
435 | | - | |
436 | 525 | | |
437 | 526 | | |
438 | 527 | | |
| |||
468 | 557 | | |
469 | 558 | | |
470 | 559 | | |
471 | | - | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
472 | 565 | | |
473 | 566 | | |
474 | 567 | | |
475 | 568 | | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
494 | 578 | | |
495 | 579 | | |
496 | 580 | | |
| |||
0 commit comments