Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 0d97642

Browse files
fix(plugin-detail): record:quick_actions draws its refused-array box on preview surfaces only (#13002)
Fixes #13000 Clause-②: no ## What `record:quick_actions` drew its dashed "KEY refused at index N (see console)" box in every view when its declared action array was refused (the objectui#7182 rule: a mixed id/object array). A customer on a published page then saw developer copy pointing at a console they cannot read. Per the triage ruling on the card (comment 6256246172), the box now follows the rule objectui#12995 set for the "no actions configured" placeholder: - under `PreviewModeProvider` (`usePreviewMode()` true) the refused box is still drawn, unchanged; - in a runtime view the block draws nothing; - the `console.error` naming the key, index and rule is unchanged and still fires in both. The guard in the empty branch of `RecordQuickActionsBody` moves from `declared.kind !== 'refused' && (actions.length > 0 || !authoring)` to `!authoring || (declared.kind !== 'refused' && actions.length > 0)`. How an array is refused, and the withheld / "named none" cases objectui#12995 set, are untouched. The stale `noRecord` comment (it still said the bar "draws its empty state") is corrected, comment only. ## Tests - `record-quick-actions.declared-action-ids-7182.test.tsx`: the two refused cases now mount under `PreviewModeProvider`, every assertion kept. New case: a refused array (index 2, so the reporter's warn-once ledger cannot silence it) draws nothing at runtime, no placeholder of either kind, empty `textContent`, and the console error still fires once, naming index 2. - `declaredActionIds.twoRenderers-7182.test.tsx` (in `src/__tests__`, outside the claim's "tests beside it" wording; declared in the report): its refused case mounts both surfaces at runtime, so the bar half now asserts no "refused at index" text and an empty bar. The cross-surface console assertions are unchanged. - CONTROL: `record-quick-actions.withheldEmpty-12995.test.tsx` is unchanged and green. Ablation (one-off, no permanent file): restoring the old guard through `ablation-replace.mjs` (anchor 1 to 0, blob `8f3fed2d4f61` to `2ecd76149a17`) turned both runtime pins red (`2 failed | 6 passed`); the restore was proven by blob hash (`8f3fed2d4f61` == HEAD) and an empty `git diff HEAD`. Measured at `b897f7d28b`: - targeted vitest (3 files): 14 passed; family run (48 test files naming `record-quick-actions` / `record:quick_actions` / `recordQuickActionsInputs` / `recordBinding`): 48 files, 2221 tests passed. - `@object-ui/plugin-detail` closure build, then `type-check` (`tsc --noEmit` and `tsconfig.test.json`, which includes the test files): exit 0. - eslint on the 3 changed files (the package's `eslint .` form): 0 errors, warnings equal to base on each file (12/4/4). eslint config is not type-aware, so the diff cannot move the verdict for an untouched file. - pre-tsc battery and changeset gates: all exit 0 except `check:spec-floors` exit 1, the known main-side state the dispatch named. - NOT MEASURED locally: the full `packages/plugin-detail/` directory, declared to CI per the dispatch. ## Acceptance notes - `src/index.tsx`: the registered `actionNames` description does not describe the refused box at runtime, so it is unchanged. - The branch commit's message carries a `Fixes objectui#13000` line, which the dev contract keeps out of commits. It names this same card, so a squash changes nothing about which card closes; it is not rewritten (no force-push in this repo). Session: `https://claude.ai/code/session_01XVp19E1MYUTFM3dnkwz8gB` --- _Generated by [Claude Code](https://claude.ai/code/session_01XVp19E1MYUTFM3dnkwz8gB)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9e7e1a5 commit 0d97642

4 files changed

Lines changed: 44 additions & 7 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
---
4+
5+
`record:quick_actions`: a refused declared action array (a mixed id/object array) no longer draws its "refused at index N (see console)" box in a runtime view. That box is developer copy, so it is drawn on a design / preview surface only, the same rule the block's "no actions configured" placeholder follows. The console error naming the offending index still fires in every view (objectui#13000).

‎packages/plugin-detail/src/__tests__/declaredActionIds.twoRenderers-7182.test.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ describe('page:header and record:quick_actions — one authored array, one meani
198198
header.unmount();
199199

200200
const bar = mount('record:quick_actions', mixed);
201-
expect(await screen.findByText(/actions refused at index 1/i)).toBeInTheDocument();
201+
// Both mounts are runtime views, so the bar draws nothing: its dashed
202+
// "refused at index N" box is preview-only developer copy (objectui#13000),
203+
// and the index is named in the console below, as the header names it.
204+
expect(screen.queryByText(/refused at index/i)).toBeNull();
205+
expect(bar.container.textContent).toBe('');
202206
expect(buttonNames(bar.container)).toEqual([]);
203207
bar.unmount();
204208

‎packages/plugin-detail/src/renderers/__tests__/record-quick-actions.declared-action-ids-7182.test.tsx‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
* applies to an already-resolved list — `locations` (`list_only` never renders
2626
* here) and `requiredPermissions` (`gated` is denied for this user) — so one
2727
* equivalence assertion measures both.
28+
*
29+
* The dashed "refused at index N (see console)" box is developer copy, drawn
30+
* on a design / preview surface only (objectui#13000): the refusal cases that
31+
* read it mount under `PreviewModeProvider`, and one more case pins that a
32+
* runtime view of a refused array draws nothing while the console error still
33+
* fires.
2834
*/
2935

3036
import * as React from 'react';
@@ -146,7 +152,7 @@ describe('record:quick_actions — declared action ids through the shared rule (
146152
});
147153

148154
it('refuses a mixed id/object array — no buttons, and the placeholder and the console name the offending index', async () => {
149-
const { container } = mount({ actions: ['convert', ACTIONS.qualify] });
155+
const { container } = mount({ actions: ['convert', ACTIONS.qualify] }, { preview: true });
150156
// The refusal is visible on the surface, not only in the console.
151157
expect(await screen.findByText(/actions refused at index 1/i)).toBeInTheDocument();
152158
expect(buttonNames(container)).toEqual([]);
@@ -163,14 +169,30 @@ describe('record:quick_actions — declared action ids through the shared rule (
163169
});
164170

165171
it('refuses a mixed `actionNames` array under the key it was authored on', async () => {
166-
const { container } = mount({ actionNames: [ACTIONS.convert, 'qualify'] });
172+
const { container } = mount({ actionNames: [ACTIONS.convert, 'qualify'] }, { preview: true });
167173
expect(await screen.findByText(/actionNames refused at index 1/i)).toBeInTheDocument();
168174
expect(buttonNames(container)).toEqual([]);
169175
const hits = errorMessages().filter((m) => m.includes('[record:quick_actions] actionNames refused'));
170176
expect(hits.length).toBe(1);
171177
expect(hits[0]).toContain('element 1 is an action id but element 0 is an inline action object');
172178
});
173179

180+
it('a refused array draws nothing in a runtime view, and the console still names the offending index', () => {
181+
// A refusal at index 2, not the index-1 arrays above: the reporter's
182+
// warn-once ledger is keyed by index and message, so a repeat of an
183+
// earlier refusal would be silenced and the console half could not be read.
184+
const { container } = mount({ actions: ['convert', 'qualify', ACTIONS.list_only] });
185+
expect(screen.queryByText(/refused at index/i)).toBeNull();
186+
expect(screen.queryByText(/no actions configured/i)).toBeNull();
187+
expect(buttonNames(container)).toEqual([]);
188+
expect(container.textContent).toBe('');
189+
expect(getItem).not.toHaveBeenCalled();
190+
191+
const hits = errorMessages().filter((m) => m.includes('[record:quick_actions] actions refused'));
192+
expect(hits.length).toBe(1);
193+
expect(hits[0]).toContain('refused at index 2');
194+
});
195+
174196
it('a lone unresolvable id renders the empty placeholder, not a refusal', async () => {
175197
// The control that separates "refused" from "resolved to nothing": a typo
176198
// is an all-id array that resolves nothing, and the bar says so in its

‎packages/plugin-detail/src/renderers/record-quick-actions.tsx‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ const RecordQuickActionsBody: React.FC<RecordQuickActionsRendererProps> = ({
209209
// A record context that names an object but NO record has nothing to run a
210210
// record action against. That is what a `dataSource` binding matching no row
211211
// provides (objectui#12294, `./recordBinding`): the bar then offers no action
212-
// and draws its empty state, the 0-row semantics of a bound record block.
212+
// and draws nothing, the 0-row semantics of a bound record block (the empty
213+
// bar's rules are below, objectui#12995).
213214
// The record page always names its record, so its bar is unaffected.
214215
const noRecord = ctx != null && ctx.recordId == null;
215216

@@ -345,11 +346,16 @@ const RecordQuickActionsBody: React.FC<RecordQuickActionsRendererProps> = ({
345346
* - the block names NO action (or only ids that resolve to none) → the
346347
* dashed placeholder is developer copy, so it is drawn on a design /
347348
* preview surface only; a runtime view draws nothing.
348-
* - the declared array was REFUSED → unchanged: the refusal is named on
349-
* the surface and in the console (objectui#7182).
349+
* - the declared array was REFUSED (objectui#7182) → the console error
350+
* above names it in every view; the dashed "refused at index N" box is
351+
* developer copy too, so it is drawn on a design / preview surface only
352+
* and a runtime view draws nothing (objectui#13000).
353+
*
354+
* Only an authoring surface reaches the placeholder at all, and there only
355+
* when nothing was named that could be withheld.
350356
*/
351357
if (visibleActions.length === 0) {
352-
if (declared.kind !== 'refused' && (actions.length > 0 || !authoring)) return null;
358+
if (!authoring || (declared.kind !== 'refused' && actions.length > 0)) return null;
353359
return (
354360
<div className={className} {...designer}>
355361
<div className="text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded">

0 commit comments

Comments
 (0)