Skip to content

Commit 4fe77e8

Browse files
committed
fix(spec): drill action/params liveness, grade params.widget planned with an author warning, declare Metadata-protocol: added
The contract review asked for the drill: each ActionParamSchema member gets its own verdict with in-repo evidence (options drilled too), action/params leaves the undrilled baseline, and params.widget is planned + authorWarn naming #30260. The key's describe says it is not read until #30260. The changeset's Metadata-protocol line takes the closed-set value added. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzhmTfrR3b13itPTmu3
1 parent 792c7ab commit 4fe77e8

7 files changed

Lines changed: 178 additions & 9 deletions

File tree

‎.changeset/30259-action-param-widget.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
feat(spec): an action param can name the widget that draws it (`widget`, same key as on a field), so a param can ask for the permission-set picker (ADR-0131 D4)
77

88
Clause-②: yes (widening)
9-
Metadata-protocol: additive
9+
Metadata-protocol: added
1010

1111
- **`@objectstack/spec`: `ActionParamSchema.widget`**, an optional string with the same key, vocabulary and meaning as `FieldSchema.widget`. It names a registered field component, looked up as `field:` plus the name, to draw the param in the action dialog instead of the `type` default. `type` stays the value's type. The case it exists for is `widget: 'permission-ref'` on a `text` param: it lists the permission sets of the security catalog and submits the chosen machine name, the picker the grant column `sys_user_permission_set.permission_set` already uses. Like the field key it is an open string: an unregistered name is kept, and the dialog draws the `type` renderer instead. A non-string is refused. A param that does not declare the key parses exactly as before. Until now a param naming `widget` was refused as an unknown key.
12-
- **Not read yet.** The console's param resolver does not carry the key to the dialog's widget until objectstack#30260 lands. Until then a param that declares it is drawn by its `type` renderer, and its value is submitted as before.
12+
- **Not read yet.** The console's param resolver does not carry the key to the dialog's widget until objectstack#30260 lands. Until then a param that declares it is drawn by its `type` renderer, and its value is submitted as before. The key's description says so, and the liveness ledger grades it `planned` with an author warning: `os validate` and `os lint` warn an author who writes it.
1313
- **`@objectstack/platform-objects`: the action form's Params repeater offers the key** as a `Widget` column, labelled in en, zh-CN, ja-JP and es-ES.

‎content/docs/references/ui/action.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ L2 sandboxed JS body — runs inside an isolated VM with declared capabilities
141141
| **objectOverride** | `string` | optional | Snake case identifier (lowercase with underscores only) |
142142
| **label** | `string \| Record<string, string>` | optional | Display label — the default-language string, or an inline locale map (`{ en, "zh-CN" }`) resolved at render time |
143143
| **type** | `Enum<'text' \| 'textarea' \| 'email' \| 'url' \| 'phone' \| 'password' \| 'secret' \| …>` | optional | |
144-
| **widget** | `string` | optional | Widget override for this param — names a registered field component (resolved as `field:<widget>`) to draw it instead of the `type` default; same key and vocabulary as FieldSchema.widget, and `type` stays the value's type. e.g. "permission-ref" on a text param picks a permission set by name (ADR-0131 D4). Degrades to the `type` renderer when unregistered. |
144+
| **widget** | `string` | optional | Widget override for this param — names a registered field component (resolved as `field:<widget>`) to draw it instead of the `type` default; same key and vocabulary as FieldSchema.widget, and `type` stays the value's type. e.g. "permission-ref" on a text param picks a permission set by name (ADR-0131 D4). Degrades to the `type` renderer when unregistered. Not read yet: until objectstack#30260 lands, the console's action dialog draws every param with its `type` renderer whatever this names. |
145145
| **required** | `boolean` | optional (default: `false`) | |
146146
| **options** | `{ label: string \| Record<string, string>; value: string; visibleWhen?: string \| object }[]` | optional | |
147147
| **placeholder** | `string` | optional | |
@@ -235,7 +235,7 @@ L2 sandboxed JS body — runs inside an isolated VM with declared capabilities
235235
| **objectOverride** | `string` | optional | Snake case identifier (lowercase with underscores only) |
236236
| **label** | `string \| Record<string, string>` | optional | Display label — the default-language string, or an inline locale map (`{ en, "zh-CN" }`) resolved at render time |
237237
| **type** | `Enum<'text' \| 'textarea' \| 'email' \| 'url' \| 'phone' \| 'password' \| 'secret' \| 'markdown' \| 'html' \| 'richtext' \| 'number' \| 'currency' \| 'percent' \| 'date' \| … +35 more>` | optional | |
238-
| **widget** | `string` | optional | Widget override for this param — names a registered field component (resolved as `field:<widget>`) to draw it instead of the `type` default; same key and vocabulary as FieldSchema.widget, and `type` stays the value's type. e.g. "permission-ref" on a text param picks a permission set by name (ADR-0131 D4). Degrades to the `type` renderer when unregistered. |
238+
| **widget** | `string` | optional | Widget override for this param — names a registered field component (resolved as `field:<widget>`) to draw it instead of the `type` default; same key and vocabulary as FieldSchema.widget, and `type` stays the value's type. e.g. "permission-ref" on a text param picks a permission set by name (ADR-0131 D4). Degrades to the `type` renderer when unregistered. Not read yet: until objectstack#30260 lands, the console's action dialog draws every param with its `type` renderer whatever this names. |
239239
| **required** | `boolean` | optional (default: `false`) | |
240240
| **options** | `{ label: string \| Record<string, string>; value: string; visibleWhen?: string \| object }[]` | optional | |
241241
| **placeholder** | `string` | optional | |
@@ -372,7 +372,7 @@ L2 sandboxed JS body — runs inside an isolated VM with declared capabilities
372372
| **objectOverride** | `string` | optional | Snake case identifier (lowercase with underscores only) |
373373
| **label** | `string \| Record<string, string>` | optional | Display label — the default-language string, or an inline locale map (`{ en, "zh-CN" }`) resolved at render time |
374374
| **type** | `Enum<'text' \| 'textarea' \| 'email' \| 'url' \| 'phone' \| 'password' \| 'secret' \| …>` | optional | |
375-
| **widget** | `string` | optional | Widget override for this param — names a registered field component (resolved as `field:<widget>`) to draw it instead of the `type` default; same key and vocabulary as FieldSchema.widget, and `type` stays the value's type. e.g. "permission-ref" on a text param picks a permission set by name (ADR-0131 D4). Degrades to the `type` renderer when unregistered. |
375+
| **widget** | `string` | optional | Widget override for this param — names a registered field component (resolved as `field:<widget>`) to draw it instead of the `type` default; same key and vocabulary as FieldSchema.widget, and `type` stays the value's type. e.g. "permission-ref" on a text param picks a permission set by name (ADR-0131 D4). Degrades to the `type` renderer when unregistered. Not read yet: until objectstack#30260 lands, the console's action dialog draws every param with its `type` renderer whatever this names. |
376376
| **required** | `boolean` | optional (default: `false`) | |
377377
| **options** | `{ label: string \| Record<string, string>; value: string; visibleWhen?: string \| object }[]` | optional | |
378378
| **placeholder** | `string` | optional | |

‎packages/lint/src/lint-liveness-properties.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,34 @@ describe('lintLivenessProperties', () => {
187187
}).filter((f) => f.message.includes('objectName'))).toEqual([]);
188188
});
189189

190+
// #30259 — `action.params[].widget` is declared before the console's dialog
191+
// reads it (#30260 adds the pass-through), so the drilled row is `planned` +
192+
// `authorWarn`. Pinned through the SHIPPED ledger and an array of params, so
193+
// the drill (`params.widget`) and the array fan-out both have to hold.
194+
it('warns on an action param that names a widget — planned, nothing reads it yet', () => {
195+
const findings = lintLivenessProperties({
196+
actions: [{
197+
name: 'create_user',
198+
params: [
199+
{ name: 'email', type: 'email', required: true },
200+
{ name: 'permissionSet', type: 'text', widget: 'permission-ref' },
201+
],
202+
}],
203+
});
204+
const warned = findings.filter((f) => f.message.includes('sets `params.widget`'));
205+
expect(warned).toHaveLength(1);
206+
expect(warned[0].rule).toBe('liveness-planned-property');
207+
expect(warned[0].hint).toContain('nothing reads it yet');
208+
// The live siblings the drill graded stay silent.
209+
for (const key of ['name', 'type', 'required', 'options', 'helpText', 'carryOver']) {
210+
expect(ruleOf(findings, `params.${key}`), key).toBeUndefined();
211+
}
212+
// And an action whose params name no widget draws nothing about it.
213+
expect(lintLivenessProperties({
214+
actions: [{ name: 'a2', params: [{ name: 'note', type: 'text' }] }],
215+
}).filter((f) => f.message.includes('widget'))).toEqual([]);
216+
});
217+
190218
it('warns on an experimental prop with no authorWarn of its own (tool.outputSchema)', () => {
191219
// `experimental` warns implicitly — shouldWarn() treats a declared-but-
192220
// unenforced guarantee like an opted-in dead prop. Repointed from

0 commit comments

Comments
 (0)