Skip to content

Commit 5078f2f

Browse files
fix(spec): dashboard columns and bulk-param allowCreate texts say what the runtime does (#37373)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgT7HCvu6MdQGTH72Yw1Vm4R)_ Fixes #36913 Fixes #36927 repo:objectstack#5 · os-bill · session_01Utp6CahVE6H18HGhfsxm57 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:搭建者和 AI 读到的两处规格说明改成与平台实际行为一致:仪表盘不写列数时按组件宽度自动取 4 列或 12 列;批量操作参数被拒时的提示,说明字段上的“允许新建”会带到批量弹窗。只有文字变化。 - 为什么做:替照规格说明写元数据的搭建者和 AI 解决“说明与运行不一致”,避免按“默认 12 列”布局却得到 4 列,或被告知“允许新建”带不过去。 - 出错会怎样:最坏是说明措辞仍有偏差,运行行为和校验结果都不变;撤回即恢复旧文字。 - 要你做什么:无。 ## What changes Four commits: one per card, then the CLI mirror of the #36913 sentence (fence widened by the zone) and a test-hygiene import. Text only: no runtime change, no change to any parsed shape or refused key set. **#36913, `DashboardSchema.columns` describe.** It said `(default 12)`. The renderer (`ui/packages/plugin-dashboard/src/DashboardRenderer.tsx`, `inferredColumns`, ~L391–407 at 98bda0a) has no fixed default: with `columns` absent it takes the widest `layout.x + layout.w` (or `layout.w`) over the widgets and returns 12 if that exceeds 4, otherwise 4. The describe now reads: "Number of grid columns. When absent, inferred from the widgets: 12 if any widget layout reaches past column 4 (x + w > 4), otherwise 4". TSDoc follows; `content/docs/references/ui/dashboard.mdx` regenerated (`gen:docs`, the only stale artifact `check:generated` named). The `packages/rest` fixture that quotes the describe follows it, and the `os explain dashboard` table in `packages/cli/src/commands/explain.ts` now carries the same sentence. Because that rest test is edited, `check:test-source-alias` asked for its module-top `import '@objectstack/objectql'`; added. **#36927, `BULK_PARAM_WIDGET_CONFIG_KEYS` prescription and `list.bulkActionDefs` liveness note.** PR #36919 made a promoted bulk def's field-backed lookup param carry the field's `allowCreate` (`resolveActionParams` copies it, `ui/packages/plugin-grid/src/resolveBulkActions.ts` `toBulkParam` L191 forwards it). The prescription, its TSDoc, and the liveness note now list `allowCreate` with `lookupFilters` / `lookupColumns` / `lookupPageSize` / `descriptionField`; the counts move from "four picker settings / six keys" to "five / seven". Every other key named is unchanged and still true on main (re-read in the same two files). The spec test comment that paraphrases the prescription follows it. ## Tests Local, on 9a3c289: - `pnpm --filter @objectstack/spec build` · `check:generated` (after `gen:docs`: all artifacts current) - `vitest run` on `packages/spec/src/ui/bulk-action.test.ts`, `packages/spec/src/ui/dashboard.test.ts`, `packages/rest/src/meta-types-schema-titles.test.ts` (3/3), `packages/cli` `test/explain-rule-id.test.ts` (14/14), `pnpm --filter @objectstack/cli typecheck` exit 0 - the `dispatch-gates --commands` set for this diff; rows that need the whole workspace built exit 3 (prerequisite not met) and are NOT MEASURED locally, left to CI. 106 of 115 derived commands exit 0; 7 exit 3 (prerequisite); `check:test-source-alias` fixed and re-run green; `check:platform-checklist` red from main (see notes). ## Acceptance notes - `packages/cli/src/commands/explain.ts:292` repeated "(default 12)"; the zone widened the fence and it is fixed here. - `check:platform-checklist` is red locally on an ABSENT SYMBOL anchor (`FlowItemMoreMenu`) this diff does not touch; it comes from main. - No `skills/**` page repeats "default 12" (grep at 98bda0a). ## Verification Two-minute check: `grep -n "columns:" packages/spec/src/ui/dashboard.zod.ts` shows the inference wording; `grep -c allowCreate packages/spec/liveness/view.json` is non-zero. Read first: `packages/spec/src/ui/bulk-action.zod.ts` prescription hunk (the only place with wording risk), then `dashboard.zod.ts` L1822–1827. --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6CahVE6H18HGhfsxm57)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Utp6CahVE6H18HGhfsxm57 <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CahVE6H18HGhfsxm57 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 15e80d2 commit 5078f2f

9 files changed

Lines changed: 47 additions & 17 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@objectstack/spec': patch
3+
'@objectstack/cli': patch
4+
---
5+
6+
fix(spec): `DashboardSchema.columns` says what the renderer does when it is absent
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
The `columns` describe said "(default 12)". The dashboard renderer has no fixed default: when `columns` is absent it infers the grid from the widgets, 12 if any widget layout reaches past column 4 (`x + w > 4`), otherwise 4. The describe, its TSDoc, the generated reference page and the `os explain dashboard` table now say that. No runtime change.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
fix(spec): the bulk-param widget-config refusal names `allowCreate` among the field keys a promoted action carries
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Since #36919, a promoted bulk action's field-backed lookup param takes the field's `allowCreate`, so `allowCreate: false` on the field keeps the picker's create entry out of the selection bar's dialog. The `BULK_PARAM_WIDGET_CONFIG_KEYS` prescription and the `list.bulkActionDefs` liveness note still left it off the carried keys, telling authors the opposite. Both now name `allowCreate` with `lookupFilters` / `lookupColumns` / `lookupPageSize` / `descriptionField`. Text only; the refused key set is unchanged.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const result = DashboardSchema.parse(data);
3333
| **description** | `string \| Record<string, string>` | optional | Dashboard description |
3434
| **header** | `{ showTitle?: boolean; showDescription?: boolean; actions?: object[] }` | optional | Dashboard header configuration |
3535
| **widgets** | `{ id: string; title?: string \| Record<string, string>; description?: string \| Record<string, string>; type?: Enum<'bar' \| 'horizontal-bar' \| 'column' \| 'line' \| 'area' \| 'pie' \| 'donut' \| …>; … }[]` | ✅ | Widgets to display |
36-
| **columns** | `integer` | optional | Number of grid columns (default 12) |
36+
| **columns** | `integer` | optional | Number of grid columns. When absent, inferred from the widgets: 12 if any widget layout reaches past column 4 (x + w > 4), otherwise 4 |
3737
| **gap** | `integer` | optional | Space between widgets, in steps of 0.25rem (4 = 1rem) |
3838
| **refreshIntervalSeconds** | `number` | optional | Auto-refresh interval in seconds |
3939
| **refreshInterval** | `never` | optional | [REMOVED] `dashboard.refreshInterval` was renamed to `refreshIntervalSeconds` in @objectstack/spec 17 — the unit of a duration-shaped number lives in the key name, not only in the describe prose. Rename the key to `refreshIntervalSeconds`; the value (seconds) is unchanged. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |

‎packages/cli/src/commands/explain.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export const SCHEMAS: Record<string, SchemaInfo> = {
289289
],
290290
optional: [
291291
{ name: 'description', type: 'string', description: 'Dashboard description' },
292-
{ name: 'columns', type: 'number (1-24)', description: 'Number of grid columns (default 12)' },
292+
{ name: 'columns', type: 'number (1-24)', description: 'Number of grid columns. When absent, inferred from the widgets: 12 if any widget layout reaches past column 4 (x + w > 4), otherwise 4' },
293293
{ name: 'gap', type: 'number', description: 'Space between widgets, in steps of 0.25rem (4 = 1rem)' },
294294
// There is no dashboard-level `layout` template — the key is rejected by
295295
// name. Positioning is per-widget: `layout: { x, y, w, h }`, and a widget

‎packages/rest/src/meta-types-schema-titles.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818

1919
import { describe, it, expect, vi } from 'vitest';
2020
import { RestServer } from './rest-server.js';
21+
// Paid at collection, not inside a clocked case: the routes reached through
22+
// RestServer load it lazily (check:test-source-alias).
23+
import '@objectstack/objectql';
2124

2225
/** The served shape `getMetaTypes()` derives for a `dashboard` entry, trimmed to the header. */
2326
const DASHBOARD_SCHEMA = () => ({
2427
type: 'object',
2528
properties: {
26-
columns: { type: 'integer', description: 'Number of grid columns (default 12)' },
29+
columns: { type: 'integer', description: 'Number of grid columns. When absent, inferred from the widgets: 12 if any widget layout reaches past column 4 (x + w > 4), otherwise 4' },
2730
header: {
2831
type: 'object',
2932
properties: {
@@ -145,7 +148,7 @@ describe('#16458 — GET /meta serves a localised `schema` beside the localised
145148
expect(entry.form.sections[0].fields[0].label).toBe('列数');
146149
// The overlay wrote `title` and nothing else on the node.
147150
expect(rowProps(entry).label.type).toBe('string');
148-
expect(entry.schema.properties.columns.description).toBe('Number of grid columns (default 12)');
151+
expect(entry.schema.properties.columns.description).toBe('Number of grid columns. When absent, inferred from the widgets: 12 if any widget layout reaches past column 4 (x + w > 4), otherwise 4');
149152
});
150153

151154
it('control — an en request leaves the authored titles in place', async () => {

‎packages/spec/liveness/view.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
"bulkActionDefs": {
218218
"status": "live",
219219
"evidence": "packages/spec/src/ui/bulk-action.zod.ts",
220-
"note": "objectui: ListView.tsx:1343 forwards rich defs to ObjectGrid (BulkActionDialog). Dispatch: useBulkExecutor.ts run() — per-record fan-out by default; execution:'aggregate' defs go through the ONE-call bulkCall branch injecting params._selectedIds (ObjectGrid.runBulkActionAggregate, objectui#3139). Verified objectui@4bf612c. #4457 gave the def a SHAPE (it was z.record(z.any())): the entry schema is BulkActionDefSchema, strict, and it refuses the combinations that parse but the executor never reads — so this row's liveness now covers the keys inside a def, not just the array. A PROMOTED def's field-backed params (packages/spec/src/ui/bulk-action.zod.ts; moved out of spec source, #23434): resolved when the dialog opens by objectui main @dca25aff2 packages/plugin-grid/src/resolveBulkActions.ts#resolvePromotedBulkParams through `resolveActionParams` (objectui 29b99490), then renamed onto the bulk vocabulary by the same file's #toBulkParam, which carries the field's type, translated label, options, required, description, placeholder, defaultValue, multiple, `dependsOn`, `accept` and `maxSize` (plus a reference-bearing field's reference and display field) and that field's lookup settings `lookupFilters`, `lookupColumns`, `lookupPageSize` and `descriptionField`, which reach the selection bar's picker as they reach the single-record dialog's (objectstack#26951); `idField` / `titleFormat` are still not carried. An authored param's `options[]` entries (packages/spec/src/ui/bulk-action.zod.ts, the `.passthrough()` rationale; moved out of spec source, #23434): objectui @b9814b334 packages/plugin-grid/src/components/bulkParamToField.ts#bulkParamToField spreads each entry into the field metadata (`options?.map(o => ({ ...o, value: String(o.value) }))`), so every extra key reaches the widget, whose option vocabulary is objectui @b9814b334 packages/types/src/field-types.ts#SelectOptionMetadata, extending objectui @b9814b334 packages/types/src/select-option.ts#SelectOptionBase (`color`, `visibleWhen`, `disabled` and `icon` beyond the pair); the select cell reads `option?.color` in objectui @b9814b334 packages/fields/src/index.tsx#SelectCellRenderer. The renderer's own param type now agrees: objectui @b9814b334 packages/types/src/objectql.ts#BulkActionParam types an `options` entry open (an index signature, citing objectstack#4001), where the source's sha-less reading had it closed (`Array<{ label; value }>`). Re-read 2026-10-15, first cited by line, sha-less."
220+
"note": "objectui: ListView.tsx:1343 forwards rich defs to ObjectGrid (BulkActionDialog). Dispatch: useBulkExecutor.ts run() — per-record fan-out by default; execution:'aggregate' defs go through the ONE-call bulkCall branch injecting params._selectedIds (ObjectGrid.runBulkActionAggregate, objectui#3139). Verified objectui@4bf612c. #4457 gave the def a SHAPE (it was z.record(z.any())): the entry schema is BulkActionDefSchema, strict, and it refuses the combinations that parse but the executor never reads — so this row's liveness now covers the keys inside a def, not just the array. A PROMOTED def's field-backed params (packages/spec/src/ui/bulk-action.zod.ts; moved out of spec source, #23434): resolved when the dialog opens by objectui main @dca25aff2 packages/plugin-grid/src/resolveBulkActions.ts#resolvePromotedBulkParams through `resolveActionParams` (objectui 29b99490), then renamed onto the bulk vocabulary by the same file's #toBulkParam, which carries the field's type, translated label, options, required, description, placeholder, defaultValue, multiple, `dependsOn`, `accept` and `maxSize` (plus a reference-bearing field's reference and display field) and that field's lookup settings `lookupFilters`, `lookupColumns`, `lookupPageSize`, `descriptionField` and `allowCreate`, which reach the selection bar's picker as they reach the single-record dialog's (objectstack#26951; `allowCreate` since objectstack#36919, carried by #toBulkParam so `allowCreate: false` on the field keeps the picker's create entry out); `idField` / `titleFormat` are still not carried. An authored param's `options[]` entries (packages/spec/src/ui/bulk-action.zod.ts, the `.passthrough()` rationale; moved out of spec source, #23434): objectui @b9814b334 packages/plugin-grid/src/components/bulkParamToField.ts#bulkParamToField spreads each entry into the field metadata (`options?.map(o => ({ ...o, value: String(o.value) }))`), so every extra key reaches the widget, whose option vocabulary is objectui @b9814b334 packages/types/src/field-types.ts#SelectOptionMetadata, extending objectui @b9814b334 packages/types/src/select-option.ts#SelectOptionBase (`color`, `visibleWhen`, `disabled` and `icon` beyond the pair); the select cell reads `option?.color` in objectui @b9814b334 packages/fields/src/index.tsx#SelectCellRenderer. The renderer's own param type now agrees: objectui @b9814b334 packages/types/src/objectql.ts#BulkActionParam types an `options` entry open (an index signature, citing objectstack#4001), where the source's sha-less reading had it closed (`Array<{ label; value }>`). Re-read 2026-10-15, first cited by line, sha-less."
221221
},
222222
"conditionalFormatting": {
223223
"status": "live",

‎packages/spec/src/ui/bulk-action.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('BulkActionDefSchema — the def shape is typed, not `z.any()`', () =>
7878
// ⛔ The prescription must NOT send this author to the field: a key
7979
// declared there reaches the bulk dialog only through a PROMOTED action
8080
// (`bulkActions`), and of this family only `accept` / `maxSize` and the
81-
// four lookup picker settings make that trip. They are named by subject,
81+
// five lookup picker settings (`allowCreate` among them since #36919) make that trip. They are named by subject,
8282
// so the rejection says which route and which keys rather than implying
8383
// `min` would follow.
8484
expect(issues).toContain('`bulkActions`');

‎packages/spec/src/ui/bulk-action.zod.ts‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export type BulkActionResultParsed = z.infer<typeof BulkActionResultSchema>;
221221
* to name it beside min/max/step, and the sweep found no FORM widget reading it
222222
* at all.
223223
*
224-
* ⚠️ The prescription refuses the obvious-sounding remedy for all but six of
224+
* ⚠️ The prescription refuses the obvious-sounding remedy for all but seven of
225225
* these keys. An AUTHORED def's params reach the dialog as written: nothing on
226226
* that path consults the object's field definitions. The bulk surface's
227227
* field-backed route is the PROMOTED def, an action the object declares, named
@@ -235,13 +235,16 @@ export type BulkActionResultParsed = z.infer<typeof BulkActionResultSchema>;
235235
* `description` (as the help text), `placeholder`, `defaultValue`, `multiple`,
236236
* `accept` and `maxSize`, plus a reference-bearing field's `reference`,
237237
* `displayField` and `dependsOn`, and that field's lookup settings
238-
* `lookupFilters` / `lookupColumns` / `lookupPageSize` / `descriptionField`,
239-
* which reach the selection bar's picker as they reach the single-record
240-
* dialog's. From THIS list only those four and `accept` / `maxSize` make the
238+
* `lookupFilters` / `lookupColumns` / `lookupPageSize` / `descriptionField` /
239+
* `allowCreate`, which reach the selection bar's picker as they reach the
240+
* single-record dialog's (`allowCreate` since objectstack#36919: the resolver
241+
* copies it and `toBulkParam` carries it, so `allowCreate: false` on the field
242+
* keeps the picker's create entry out). From THIS list only those five and
243+
* `accept` / `maxSize` make the
241244
* trip, and the rest are never read off the field (`idField` has no
242245
* `FieldSchema` spelling to declare; the resolver's snake `id_field` read is
243246
* still not carried onto the bulk param). So
244-
* "declare it on the field and let the dialog inherit" is right for those six
247+
* "declare it on the field and let the dialog inherit" is right for those seven
245248
* keys on a promoted def, and a confidently wrong answer for every other key
246249
* here, the shape this campaign has already shipped more than once.
247250
*/
@@ -336,10 +339,10 @@ export const BulkActionParamSchema = lazySchema(() => strictObject(
336339
+ 'carries the field\'s `type`, `label`, `options`, `required`, `description` (as the help '
337340
+ 'text), `placeholder`, `defaultValue`, `multiple`, `accept` and `maxSize`, plus a '
338341
+ 'reference field\'s `reference`, `displayField` and `dependsOn` and its picker settings '
339-
+ '`lookupFilters` / `lookupColumns` / `lookupPageSize` / `descriptionField`, which reach '
340-
+ 'the selection bar\'s picker as they reach the single-record dialog\'s. ⛔ So of these '
341-
+ 'keys only `accept` / `maxSize` and those four picker settings arrive that way, and the '
342-
+ 'rest are never read off the field. Remove the key, or for one of those six move the '
342+
+ '`lookupFilters` / `lookupColumns` / `lookupPageSize` / `descriptionField` / `allowCreate`, '
343+
+ 'which reach the selection bar\'s picker as they reach the single-record dialog\'s. ⛔ So '
344+
+ 'of these keys only `accept` / `maxSize` and those five picker settings arrive that way, '
345+
+ 'and the rest are never read off the field. Remove the key, or for one of those seven move the '
343346
+ 'param onto a promoted action; open an issue if a bulk param genuinely needs a key '
344347
+ 'declared here.',
345348
}],

‎packages/spec/src/ui/dashboard.zod.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,8 +1820,11 @@ export const DashboardSchema = lazySchema(() => strictObject({
18201820
/** Collection of widgets */
18211821
widgets: z.array(DashboardWidgetSchema).describe('Widgets to display'),
18221822

1823-
/** Grid column count — defaults to 12 for a standard 12-column grid */
1824-
columns: z.number().int().min(1).max(24).optional().describe('Number of grid columns (default 12)'),
1823+
/**
1824+
* Grid column count. Absent, the renderer infers it from the widgets: 12 when
1825+
* any widget's layout reaches past column 4 (`x + w > 4`), otherwise 4.
1826+
*/
1827+
columns: z.number().int().min(1).max(24).optional().describe('Number of grid columns. When absent, inferred from the widgets: 12 if any widget layout reaches past column 4 (x + w > 4), otherwise 4'),
18251828

18261829
/** Space between widgets, in steps of 0.25rem (4 = 1rem) */
18271830
gap: z.number().int().min(0).optional().describe('Space between widgets, in steps of 0.25rem (4 = 1rem)'),

0 commit comments

Comments
 (0)