Skip to content

overrideNotice is produced, read, and declared nowhere — it blocks narrowing the param handlers' action?: any #5611

Description

@os-sales

Found while implementing #4282. That card's second half asked for paramCollectionHandler's action?: any to be narrowed to ActionDef — "the larger and more valuable half", since it is what makes the compiler cover that file at all. The narrowing was attempted, measured, and backed out; these are the diagnostics it produced.

What the narrowing costs today

ParamCollectionHandler already declares its second parameter as ActionDef, and ActionDef is already imported by useConsoleActionRuntime.tsx — so the narrowing needs no new import and no barrel export. It is a one-token change to the annotation. Applied and type-checked on origin/main @ 7a28e1e3f:

src/hooks/useConsoleActionRuntime.tsx(253,45): error TS2339: Property 'overrideNotice' does not exist on type 'ActionDef'.
src/hooks/useConsoleActionRuntime.tsx(253,83): error TS2339: Property 'overrideNotice' does not exist on type 'ActionDef'.
src/hooks/useConsoleActionRuntime.tsx(254,18): error TS2339: Property 'overrideNotice' does not exist on type 'ActionDef'.

Three diagnostics, one key. Nothing else in the handler moved — every other read (objectName, params, name, description, label) is a declared field.

Why this is the opposite of #4282's title

They look alike and are not. title had no producer — that is why #4282 deleted it. overrideNotice has a live producer and a live reader, and is simply undeclared:

  • producer: packages/app-shell/src/views/DeclaredActionsBar.tsx:305dispatch.overrideNotice = overrideNotice;, on an object literal that is then cast dispatch as ActionDef at :316. The cast is what makes it compile; the key never passes through a declaration.
  • reader: packages/app-shell/src/hooks/useConsoleActionRuntime.tsx:253-254, the three sites above.
  • declared: nowhere. Absent from ActionDef (packages/core/src/actions/ActionRunner.ts:112), from ACTION_DEF_KEYS, from SPEC_ACTION_KEYS, and from @objectstack/spec's ActionSchema (44 keys walked live at spec 17.0.0).

This is exactly the shape objectstack#4075 step 3 promoted description out of, and for the same stated reason — "authorable, forwarded, read, and undeclared". overrideNotice arrived later (#5178) and did not get the same treatment.

Worth noting where it currently sits in the warning path: because the key is unknown to KNOWN_ACTION_KEYS, warnOnUnknownActionKeys reports it in dev as "a key no reader recognizes" on every privileged-override dispatch — which is false, and points the author at a typo that isn't one.

Suggested disposition

Promote it, the way description was:

  1. declare overrideNotice?: string on ActionDef in packages/core/src/actions/ActionRunner.ts, documented at its declaration as objectui dialect (there is no spec counterpart, and console: an admin-override decision renders as an ordinary Approve — no affordance distinction, no confirm, and the via_override marker is never surfaced in any UI #5178's ruling is explicit that it must NOT be folded into descriptionactionDescription prefers a _actions.NAME.description bundle hit, and plugin-approvals ships one for approval_reject, so a warning routed through description gets silently translated away);
  2. add it to ACTION_DEF_KEYS in packages/core/src/actions/actionKeys.tsactionKeys.pin.test.ts re-derives that list from the interface's AST, so the two must move together or the pin goes red;
  3. then narrow both param handlers' action?: any to ActionDefuseConsoleActionRuntime.tsx:196 and RecordDetailView.tsx:500.

Step 3 is the payoff and should not be attempted before 1-2: the alternative that "works" today is casting the overrideNotice read at its use site, which swaps a visible any for an invisible cast and re-hides the undeclared key. That was rejected on #4282 and should stay rejected.

Scope note for whoever picks this up: it spans @object-ui/core (declaration + pinned inventory + pin test) and @object-ui/app-shell (two annotations). Step 3's RecordDetailView half overlaps #5610, which removes the dead title limb from that same handler — worth sequencing, not merging.

Refs #4282, #5178, #4046.

Metadata

Metadata

Assignees

Labels

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

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions