From 70ce14d80397451d1f8751367bb42b50164c5efa Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 02:00:45 +0000 Subject: [PATCH 1/6] docs(skills): objectstack-ui keeps a long form simple and stacked instead of tabbed The Form Views table capped `simple` at 15 fields and sent objects with many field groups to `tabbed`, which hides a missed required field on another tab and overflows the tab strip on a phone. `simple` is now the default at any field count, `tabbed` names its cost, and one paragraph says how a long form stays `simple`: collapse the rarely filled groups, raise `columns`, size the dialog with `modalSize`. Two restatements in the file pay part of it; the token row moves by the measured remainder. One eval case pins the choice. Claude-Session: https://claude.ai/code/session_01ADHkmSMwg7iTEBBE4qY9Y3 Co-authored-by: Claude --- scripts/check-skills-token-ratchet.mjs | 14 +++++++++++++- skills/objectstack-ui/SKILL.md | 18 +++++++++--------- .../evals/views-apps-actions-pages.json | 10 ++++++++++ 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 5914db2d453..6d8ee42c8f7 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -823,7 +823,19 @@ export const CEILINGS = new Map([ // bytes (15233 priced, 3809 tokens, headroom 5) -> 15349 (15329 priced) -> 3833 tokens, // the 5 absorbed, ceiling +19, pinned AT the measurement, zero headroom. // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(15329 / 4) - ['skills/objectstack-ui/SKILL.md', 3833], + // 3833 -> 3888: Form Views stops steering a long form to `tabbed` — `simple` is the + // default at any field count, `tabbed` names its cost, and one paragraph says how a long + // form stays `simple` (collapsed groups, `columns`, `modalSize`). PAID DOWN FIRST by two + // restatements cut from this file, each keeping a home: the derived-FK / roll-up paragraph + // under Master-Detail Forms (-223 bytes; the line-item paragraph's "every behaviour is + // derived from the DATA MODEL" and objectstack-data `rules/relationships.md` § Roll-up + // Summaries) and the "row-by-row" sentence under Field Conditional Rules (-97; the + // objectstack-data SKILL.md § Conditional Field Rules the line above links). Remainder + // raised under the standing ruling 「A:先削重复,余额按实测提高」 (record 6513306068): + // 15349 bytes (15329 priced) -> 15569 (15549 priced) -> 3888 tokens, pinned AT the + // measurement, zero headroom. + // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(15549 / 4) + ['skills/objectstack-ui/SKILL.md', 3888], // 8333 -> 6193: RE-LOCK at the landed count after the #19715 split (decision // batch #213 item 1, maintainer 「1 2 4 同意」): the worked R1, the report // template and the v17-canonical shapes block moved VERBATIM into diff --git a/skills/objectstack-ui/SKILL.md b/skills/objectstack-ui/SKILL.md index 55437751b87..6af68d9fdaf 100644 --- a/skills/objectstack-ui/SKILL.md +++ b/skills/objectstack-ui/SKILL.md @@ -55,10 +55,17 @@ the empty board over a field added in the same change: | Type | When to Use | |:-----|:------------| -| `simple` | Single-page form — suitable for objects with ≤ 15 fields | -| `tabbed` | Tabbed sections — for complex objects with many field groups | +| `simple` | Stacked sections on one scrolling page — the default, at any field count | +| `tabbed` | One tab per section — only for sections read apart; a required field on another tab is flagged only on its tab, and the tab strip overflows on a phone | | `wizard` | Step-by-step flow — guided data entry (onboarding, applications) | +**A long form stays `simple`: collapse what is rarely filled** with +`collapse: 'collapsed'` on the object's `fieldGroups` entry, or `collapsed: true` +on a form section listing its own `fields`. `columns` (form or section) is a +per-row ceiling a narrow screen lowers; unset, a section draws two, so set `3` +for a wide data-entry form. `modalSize` (`sm` to `full`) sizes the New / Edit +dialog; unset, the field count picks `lg` or `xl`. + ### Master-Detail Forms (parent + child line items) To let users enter a record **together with its child line items** (invoice + @@ -91,10 +98,6 @@ custom page or form config. Prefer, in order: 3. **`object-master-detail-form` page block (bespoke layout).** Use a page only for free-form layouts. Same `details: [{ childObject }]` shorthand. -The relationship FK and grid columns are derived from the child object's -metadata in every case; select options and lookups carry through. A parent -`summary` field rolls child values up server-side (see objectstack-data). - **Line-item grid behaviors (`grid` mode).** The editable grid is a real spreadsheet-style line editor, and every behaviour is derived from the DATA MODEL — computed columns, catalog @@ -116,9 +119,6 @@ Conditions that belong to a field's lifecycle — `visibleWhen`, `readonlyWhen`, ObjectUI forms consume them. Their semantics and server behaviour: [objectstack-data → Conditional Field Rules](../objectstack-data/SKILL.md#conditional-field-rules). -UI-side: inline master-detail grids evaluate these rules **row-by-row** against -each child row. - --- ## Detailed Rules diff --git a/skills/objectstack-ui/evals/views-apps-actions-pages.json b/skills/objectstack-ui/evals/views-apps-actions-pages.json index c2e4276e7a4..e61cd0545f1 100644 --- a/skills/objectstack-ui/evals/views-apps-actions-pages.json +++ b/skills/objectstack-ui/evals/views-apps-actions-pages.json @@ -180,6 +180,16 @@ "must_contain": ["defineAction", "ctx.api.object('product').findOne", "unit_price: product.list_price", "api.read"], "must_not_contain": [] } + }, + { + "id": 19, + "prompt": "Author the default form view for `opportunity`: 42 fields in six sections (Basics, Amounts, Dates, Partner, Shipping, Internal Notes). Reps fill Basics and Amounts on every create and the other four rarely. The form opens in the New dialog, mostly on wide screens.", + "expected_output": "One form view with `type: 'simple'`: the six sections stacked on one scrolling page, each listing its own `fields`, with `collapsed: true` on the four rarely filled ones (or `collapse: 'collapsed'` on those `fieldGroups` entries of the object). `columns: 3` uses the wide dialog and `modalSize: 'xl'` sizes it. Not tabs: a required field on another tab is flagged only on its tab, and the tab strip overflows on a phone.", + "files": [], + "assertions": { + "must_contain": ["type: 'simple'", "collapsed: true", "modalSize"], + "must_not_contain": ["type: 'tabbed'"] + } } ] } From d67719d4a69cb4132bff21002c35911888ea485f Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 02:01:32 +0000 Subject: [PATCH 2/6] feat(lint): an inline-edited child whose parent or own apiMethods withhold bulk is warned about, and the skills name the precondition The parent's form saves an inlineEdit child's rows with the parent in one cross-object /api/v1/batch, which gates every op as bulk on the op's own object. A parent or child declaring enable.apiMethods without 'bulk' therefore gets a form that fills and then 405s on save, and neither skill said so. objectstack-ui Master-Detail Forms and objectstack-data Inline Editing now state the precondition. os lint gains relationship/inline-edit-needs-bulk, a warning beside relationship/line-items-inline-edit that judges the declared list through the spec's own resolver and names the object and value to add. Touched skill files pay by cutting restatement; ratchet rows follow. Claude-Session: https://claude.ai/code/session_01ADHkmSMwg7iTEBBE4qY9Y3 Co-authored-by: Claude --- .../34567-form-layout-inline-edit-bulk.md | 17 +++++++ packages/cli/test/data-model-rules.test.ts | 51 +++++++++++++++++++ packages/lint/src/data-model-rules.ts | 40 +++++++++++++++ scripts/check-skills-token-ratchet.mjs | 20 ++++++-- .../objectstack-data/references/lint-rules.md | 5 +- .../objectstack-data/rules/relationships.md | 10 ++-- skills/objectstack-ui/SKILL.md | 4 +- 7 files changed, 134 insertions(+), 13 deletions(-) create mode 100644 .changeset/34567-form-layout-inline-edit-bulk.md diff --git a/.changeset/34567-form-layout-inline-edit-bulk.md b/.changeset/34567-form-layout-inline-edit-bulk.md new file mode 100644 index 00000000000..160a1944c46 --- /dev/null +++ b/.changeset/34567-form-layout-inline-edit-bulk.md @@ -0,0 +1,17 @@ +--- +'@objectstack/skills': patch +'@objectstack/lint': patch +--- + +docs(skills): `objectstack-ui` keeps a long form `simple`, and both skills name the `bulk` an `inlineEdit` save needs; `os lint` warns when it is withheld + +Clause-②: no +Metadata-protocol: none + +`skills/objectstack-ui/SKILL.md` § Form Views no longer caps `simple` at 15 fields or sends objects with many field groups to `tabbed`. `simple` (stacked sections on one scrolling page) is the default at any field count. `tabbed` is for sections read apart, and the row names its cost: a required field missed on another tab is flagged only on its tab, and the tab strip overflows on a phone. A new paragraph says how a long form stays `simple`: `collapse: 'collapsed'` on the object's `fieldGroups` entry or `collapsed: true` on a form section, `columns` as a per-row ceiling (unset, a section draws two), and `modalSize` for the New / Edit dialog (unset, `lg` or `xl` by field count). One eval case asks for a 42-field form and fails an answer with `type: 'tabbed'`. + +The parent's form saves an `inlineEdit` child's rows with the parent in one `/api/v1/batch`, and that route asks every object in it for `bulk`. Master-Detail Forms in `objectstack-ui` and § Inline Editing in `objectstack-data` `rules/relationships.md` now say so: a parent or child that declares `enable.apiMethods` must list `'bulk'`, or the save is refused `405 OBJECT_API_METHOD_NOT_ALLOWED`. An undeclared `apiMethods` allows it. + +`os lint` gains the warning `relationship/inline-edit-needs-bulk`. It fires on an `inlineEdit` relationship (`true`, `'grid'` or `'form'`) whose parent or child declares `enable.apiMethods` without `'bulk'`, once per object, at that object's `enable.apiMethods`, and its fix line names the value to add. It refuses nothing. `references/lint-rules.md` lists it. + +The skill files pay for most of this by cutting text stated elsewhere, and the `objectstack-ui/SKILL.md` token ceiling moves by the measured remainder. diff --git a/packages/cli/test/data-model-rules.test.ts b/packages/cli/test/data-model-rules.test.ts index 74fcf8f7fef..58abdb9768b 100644 --- a/packages/cli/test/data-model-rules.test.ts +++ b/packages/cli/test/data-model-rules.test.ts @@ -87,6 +87,57 @@ describe('lintDataModel — relationships', () => { }); }); +// R5b — the parent's form saves parent + inline children in ONE cross-object +// `/api/v1/batch`, which gates every op as `bulk` on the op's own object. A +// declared `enable.apiMethods` without `bulk` on either side is warned about, +// naming the object to edit and the value to add; an undeclared list is open. +describe('lintDataModel — relationship/inline-edit-needs-bulk', () => { + const RULE = 'relationship/inline-edit-needs-bulk'; + const OPEN = ['get', 'list', 'create', 'update', 'delete']; + const budget = (enable?: unknown) => ({ name: 'project_budget', ...(enable ? { enable } : {}), fields: { title: { type: 'text' } } }); + const line = (inlineEdit: unknown, enable?: unknown) => ({ + name: 'project_budget_line', + ...(enable ? { enable } : {}), + fields: { + project_budget: { type: 'master_detail', reference: 'project_budget', required: true, deleteBehavior: 'cascade', ...(inlineEdit === undefined ? {} : { inlineEdit }) }, + amount: { type: 'currency' }, + }, + }); + const hits = (objects: any[]) => lintDataModel(objects).filter((i) => i.rule === RULE); + + it.each([true, 'grid', 'form'])('warns on the parent when inlineEdit is %s and its apiMethods omit bulk', (inlineEdit) => { + const [issue, ...rest] = hits([budget({ apiMethods: OPEN }), line(inlineEdit)]); + expect(rest).toEqual([]); + expect(issue?.severity).toBe('warning'); + expect(issue?.path).toBe('objects[0].enable.apiMethods'); + expect(issue?.fix).toBe("add 'bulk' to project_budget.enable.apiMethods"); + expect(issue?.message).toContain('OBJECT_API_METHOD_NOT_ALLOWED'); + }); + + it('warns on the child when the child declares apiMethods without bulk', () => { + const [issue, ...rest] = hits([budget(), line('grid', { apiMethods: OPEN })]); + expect(rest).toEqual([]); + expect(issue?.path).toBe('objects[1].enable.apiMethods'); + expect(issue?.fix).toBe("add 'bulk' to project_budget_line.enable.apiMethods"); + }); + + it('treats an empty apiMethods (deny-all) as withholding bulk', () => { + expect(hits([budget({ apiMethods: [] }), line(true)])).toHaveLength(1); + }); + + it('reports a parent once however many inline children it has', () => { + const second = { ...line('grid'), name: 'project_budget_item' }; + expect(hits([budget({ apiMethods: OPEN }), line('grid'), second])).toHaveLength(1); + }); + + it('is silent when apiMethods include bulk, are undeclared, or nothing is inline-edited', () => { + expect(hits([budget({ apiMethods: [...OPEN, 'bulk'] }), line('grid', { apiMethods: [...OPEN, 'bulk'] })])).toEqual([]); + expect(hits([budget(), line('grid')])).toEqual([]); + expect(hits([budget({ apiMethods: OPEN }), line(undefined)])).toEqual([]); + expect(hits([budget({ apiMethods: OPEN }), line(false)])).toEqual([]); + }); +}); + describe('lintDataModel — roll-ups', () => { it('suggests a roll-up when a parent owns master_detail children with numeric fields', () => { const issues = lintDataModel([ diff --git a/packages/lint/src/data-model-rules.ts b/packages/lint/src/data-model-rules.ts index a8f4393ba46..5252a8593a8 100644 --- a/packages/lint/src/data-model-rules.ts +++ b/packages/lint/src/data-model-rules.ts @@ -21,8 +21,10 @@ import { BOOLEAN_VALUE_TYPES, NUMERIC_VALUE_TYPES, isAggregateCompatibleWithFieldType, + isApiOperationAllowed, masterDetailRequiredOmitted, referenceCarrierOf, + resolveEffectiveApiMethods, type AggregationFunction, } from '@objectstack/spec/data'; @@ -266,6 +268,9 @@ export const RELATIONSHIP_MASTER_DETAIL_REQUIRED = 'relationship/master-detail-r /** The rule id R3 reports under (`master_detail` without `deleteBehavior`). */ export const RELATIONSHIP_DELETE_BEHAVIOR = 'relationship/delete-behavior'; +/** R5b — an inline-edited relationship whose parent or child withholds `bulk`. */ +const RELATIONSHIP_INLINE_EDIT_NEEDS_BULK = 'relationship/inline-edit-needs-bulk'; + /** * The rule id R13 reports under: a roll-up whose child field the function * cannot aggregate into the summary column — a `min`/`max` whose answer is not @@ -929,6 +934,13 @@ export function lintDataModel(objects: any[]): LintIssue[] { } } + // R5b's lookup: object name → its index (the path names the object to edit), + // and the objects it has already reported, so a parent with several inline + // children is reported once. + const indexByName = new Map(); + objects.forEach((o, j) => { if (o?.name && !indexByName.has(o.name)) indexByName.set(o.name, j); }); + const bulkReported = new Set(); + for (let i = 0; i < objects.length; i++) { const obj = objects[i]; if (!obj?.name) continue; @@ -1098,6 +1110,34 @@ export function lintDataModel(objects: any[]): LintIssue[] { } } + // R5b — an inline-edited child is saved with its parent in ONE + // cross-object `/api/v1/batch` (ADR-0035), and that route gates EVERY op + // as `bulk` plus its own write on the op's own object + // (`packages/rest/src/batch-routes.ts`). So a parent or child whose + // DECLARED `enable.apiMethods` omits `bulk` gets a form that renders and + // fills, then is refused 405 `OBJECT_API_METHOD_NOT_ALLOWED` on save. + // Undeclared `apiMethods` is unrestricted, so the spec's own resolver + // decides, never a copy of its table. A warning: it refuses nothing. + if (def.inlineEdit === true || def.inlineEdit === 'grid' || def.inlineEdit === 'form') { + for (const target of [parent, obj.name]) { + const j = indexByName.get(target); + if (j === undefined || bulkReported.has(target)) continue; + const enable = objects[j]?.enable; + if (isApiOperationAllowed(resolveEffectiveApiMethods(enable), 'bulk')) continue; + bulkReported.add(target); + issues.push({ + severity: 'warning', + rule: RELATIONSHIP_INLINE_EDIT_NEEDS_BULK, + message: + `inlineEdit on "${obj.name}.${fieldName}" saves ${parent} and its ${obj.name} rows in one ` + + `/api/v1/batch, which needs 'bulk' on every object in it; "${target}" declares ` + + `enable.apiMethods without 'bulk', so that save is refused 405 OBJECT_API_METHOD_NOT_ALLOWED`, + path: `objects[${j}].enable.apiMethods`, + fix: `add 'bulk' to ${target}.enable.apiMethods`, + }); + } + } + // R4 — a line-item-shaped child should usually be master_detail, not lookup. if (type === 'lookup' && isLineItemName(obj.name)) { issues.push({ diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 6d8ee42c8f7..e8ec5368eb6 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -835,7 +835,13 @@ export const CEILINGS = new Map([ // 15349 bytes (15329 priced) -> 15569 (15549 priced) -> 3888 tokens, pinned AT the // measurement, zero headroom. // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(15549 / 4) - ['skills/objectstack-ui/SKILL.md', 3888], + // 3888 -> 3921: Master-Detail Forms item 1 names the save's precondition — a parent or + // child declaring `enable.apiMethods` must list `'bulk'`, or the one `/api/v1/batch` is + // refused 405. Nothing else in this file restates it or was left to cut after the row + // above; same standing ruling (record 6513306068). 15569 bytes (15549 priced) -> 15704 + // (15684 priced) -> 3921 tokens, pinned AT the measurement, zero headroom. + // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(15684 / 4) + ['skills/objectstack-ui/SKILL.md', 3921], // 8333 -> 6193: RE-LOCK at the landed count after the #19715 split (decision // batch #213 item 1, maintainer 「1 2 4 同意」): the worked R1, the report // template and the v17-canonical shapes block moved VERBATIM into @@ -988,7 +994,12 @@ export const CEILINGS = new Map([ // ceil(16925 / 4) = 4232; the ceiling moves +105, pinned AT the measurement. // Raise path the 2026-10-27 ruling 「A:先削重复,余额按实测提高」 (ruling record // 6513306068), quoted verbatim and untranslated in the PR body. - ['skills/objectstack-data/rules/relationships.md', 4232], + // 4232 -> 4229: Inline Editing names the save's `bulk` precondition (+129 bytes), paid by + // restatement cut from the same file: the `subforms` sentence (the objectstack-ui pointer + // now carries it), the related-list example's "write side" comment (the paragraph above + // says it) and "(no UI config)" (the sentence says "purely from how you model"). 16925 -> + // 16916 bytes -> ceil(16916 / 4) = 4229; the row follows the measurement down. + ['skills/objectstack-data/rules/relationships.md', 4229], // NEW FILE (#14296 item 1 = A, condition (b)): the entry's Security & Access // Control block moved here whole. Pinned at its landed count — no headroom, // because a split that arrives with budget is a raise wearing a new path. @@ -1470,7 +1481,10 @@ export const CEILINGS = new Map([ // review's module pointer paid by the custom-Page aside (the ui skill's // rule); the row follows the measurement down, zero headroom. ['skills/objectstack-data/references/examples-objects.md', 1728], - ['skills/objectstack-data/references/lint-rules.md', 970], + // 970 -> 934: one row for `relationship/inline-edit-needs-bulk`, and the closing "target a + // lint-clean model" paragraph cut — it restated the table's rows one by one. 3829 -> 3735 + // bytes -> ceil(3735 / 4) = 934; the row follows the measurement down, zero headroom. + ['skills/objectstack-data/references/lint-rules.md', 934], // 1299 -> 1566 (#26297): the `columns` dataset key and `applyOn: 'create'` // — a column a job or an admin owns after the first load is written on // create and left alone on every `upsert` replay; which modes it touches, diff --git a/skills/objectstack-data/references/lint-rules.md b/skills/objectstack-data/references/lint-rules.md index 3b515acadfc..6dede1c8771 100644 --- a/skills/objectstack-data/references/lint-rules.md +++ b/skills/objectstack-data/references/lint-rules.md @@ -13,6 +13,7 @@ Data-model rules (in addition to naming/label/i18n): | `relationship/master-detail-required` | warning; error under `controlled_by_parent` | a `master_detail` that isn't `required` (under `controlled_by_parent`, the only one may be `required: false`: the optional master) — or, under `controlled_by_parent`, is `readonly`/`system` | | `relationship/delete-behavior` | suggestion | `master_detail` without an explicit `deleteBehavior` | | `relationship/line-items-inline-edit` | suggestion | a `*_line`/`*_item` master_detail child without `inlineEdit` | +| `relationship/inline-edit-needs-bulk` | warning | `inlineEdit` while the parent's or child's `enable.apiMethods` omits `'bulk'` | | `relationship/line-item-should-be-master-detail` | suggestion | a line-item-shaped child using `lookup` instead of `master_detail` | | `relationship/association-inline-edit` | warning | an association (comment/audit/activity) marked `inlineEdit` (clutters the parent form — use a detail-page related list) | | `rollup/missing-summary` | suggestion | a parent of numeric master_detail children with no roll-up `summary` | @@ -46,7 +47,3 @@ These same rules are the **rubric for AI-generated metadata** — a generation i corpus (invoice+lines, project+tasks, blog+comments, expense+lines, account+contacts) offline; each case must clear the pass bar (`--eval-min`, default 75). Deterministic, no API key. - -When generating object metadata, target a lint-clean model: master_detail (with -`required` + `deleteBehavior` + `inlineEdit` for line items), roll-up summaries -on parents, `select` options, and a name/title field per object. diff --git a/skills/objectstack-data/rules/relationships.md b/skills/objectstack-data/rules/relationships.md index 31cb7bf44d5..1946ba804d2 100644 --- a/skills/objectstack-data/rules/relationships.md +++ b/skills/objectstack-data/rules/relationships.md @@ -247,7 +247,8 @@ Declare inline editing **on the relationship**, in the data model — not in a f view. Set `inlineEdit: true` on the child's `master_detail` (or `lookup`) field that points back to the parent. The parent's **standard** create/edit form then renders an editable grid for these children and saves parent + children in **one -atomic transaction**. +atomic transaction**. A parent or child declaring `enable.apiMethods` must list +`'bulk'`, or that save is refused `405 OBJECT_API_METHOD_NOT_ALLOWED`. ```typescript // On the CHILD object's FK field: @@ -275,8 +276,7 @@ the parent. **Leave it off for associations** (comments, attachments, activity, audit): those are also `master_detail` (cascade delete) but should NOT clutter the parent's entry form — surface them as related lists on the detail page. -A form view may still set `subforms` to override the derived columns/order. See the -objectstack-ui skill (Master-Detail Forms) for the rendering side. +The rendering side, `subforms` overrides included: objectstack-ui → Master-Detail Forms. #### Inline-edit form factor (`grid` vs `form`) @@ -297,7 +297,7 @@ inlineEdit: 'form' // read-only list; "Add" / per-row edit opens the FULL fo editable fields, else `grid`. Set the string to override. **Modeling a `'grid'` line item for the full editor.** The grid lights up extra -behaviors purely from how you model the child + parent (no UI config): +behaviors purely from how you model the child + parent: ```typescript // Parent @@ -355,7 +355,7 @@ flags exist to *refine* that: project: { type: 'master_detail', reference: 'project', - inlineEdit: true, // write side: edit inline in the Project form + inlineEdit: true, relatedList: 'primary', // read side: a body table relatedListTitle: 'Tasks', relatedListColumns: ['title', 'status', 'priority', 'due_date'], diff --git a/skills/objectstack-ui/SKILL.md b/skills/objectstack-ui/SKILL.md index 6af68d9fdaf..5639025b606 100644 --- a/skills/objectstack-ui/SKILL.md +++ b/skills/objectstack-ui/SKILL.md @@ -76,7 +76,9 @@ custom page or form config. Prefer, in order: DATA MODEL — set `inlineEdit` on the child's `master_detail` field that references the parent. Every standard New/Edit form for the parent (modal, drawer, full-page) then auto-renders the children and saves parent + children - in one atomic `/api/v1/batch`. **No view metadata needed.** The + in one atomic `/api/v1/batch`. **No view metadata needed.** A parent or child + declaring `enable.apiMethods` must list `'bulk'`, or that save is refused + `405 OBJECT_API_METHOD_NOT_ALLOWED`. The `true` / `'grid'` / `'form'` ladder and what each value picks: **objectstack-data → Relationships → Inline Editing**. From 09c5d366104c879eb029fac3274a5320abfac2d5 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 03:04:24 +0000 Subject: [PATCH 3/6] feat(lint): inline-edit-needs-bulk runs from the authoring registry on all three commands The warning forecasts a 405 at save time, not a style nudge, so it moves out of the os lint-only best-practice sweep into AUTHORING_RULES as an advisory rule: os lint, os validate and os build (and objectstack dev, which runs the registry) all report it, once. It stays a warning and never fails a build. The rule is the exported lintInlineEditBulk with its rule-id constant, and its finding names the object in the where slot. Claude-Session: https://claude.ai/code/session_01ADHkmSMwg7iTEBBE4qY9Y3 Co-authored-by: Claude --- packages/cli/test/data-model-rules.test.ts | 23 +++++- packages/lint/src/authoring-rules.ts | 26 ++++++ packages/lint/src/data-model-rules.ts | 93 +++++++++++++--------- packages/lint/src/index.ts | 2 + 4 files changed, 103 insertions(+), 41 deletions(-) diff --git a/packages/cli/test/data-model-rules.test.ts b/packages/cli/test/data-model-rules.test.ts index 58abdb9768b..b0960499238 100644 --- a/packages/cli/test/data-model-rules.test.ts +++ b/packages/cli/test/data-model-rules.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { authoringRulesFor, lintDataModel, lintUniqueDeclarations, lintUnscopedDeclaredIndexes, lintLegacyOrganizationComposites } from '@objectstack/lint'; +import { authoringRulesFor, lintDataModel, lintInlineEditBulk, lintUniqueDeclarations, lintUnscopedDeclaredIndexes, lintLegacyOrganizationComposites, runAuthoringRules } from '@objectstack/lint'; import { FieldSchema } from '@objectstack/spec/data'; import { lintConfig } from '../src/commands/lint'; @@ -87,11 +87,12 @@ describe('lintDataModel — relationships', () => { }); }); -// R5b — the parent's form saves parent + inline children in ONE cross-object +// The parent's form saves parent + inline children in ONE cross-object // `/api/v1/batch`, which gates every op as `bulk` on the op's own object. A // declared `enable.apiMethods` without `bulk` on either side is warned about, // naming the object to edit and the value to add; an undeclared list is open. -describe('lintDataModel — relationship/inline-edit-needs-bulk', () => { +// A registry rule (`lintInlineEditBulk`), so all three commands report it. +describe('lintInlineEditBulk — relationship/inline-edit-needs-bulk', () => { const RULE = 'relationship/inline-edit-needs-bulk'; const OPEN = ['get', 'list', 'create', 'update', 'delete']; const budget = (enable?: unknown) => ({ name: 'project_budget', ...(enable ? { enable } : {}), fields: { title: { type: 'text' } } }); @@ -103,13 +104,14 @@ describe('lintDataModel — relationship/inline-edit-needs-bulk', () => { amount: { type: 'currency' }, }, }); - const hits = (objects: any[]) => lintDataModel(objects).filter((i) => i.rule === RULE); + const hits = (objects: any[]) => lintInlineEditBulk(objects).filter((i) => i.rule === RULE); it.each([true, 'grid', 'form'])('warns on the parent when inlineEdit is %s and its apiMethods omit bulk', (inlineEdit) => { const [issue, ...rest] = hits([budget({ apiMethods: OPEN }), line(inlineEdit)]); expect(rest).toEqual([]); expect(issue?.severity).toBe('warning'); expect(issue?.path).toBe('objects[0].enable.apiMethods'); + expect(issue?.where).toBe('object "project_budget"'); expect(issue?.fix).toBe("add 'bulk' to project_budget.enable.apiMethods"); expect(issue?.message).toContain('OBJECT_API_METHOD_NOT_ALLOWED'); }); @@ -136,6 +138,19 @@ describe('lintDataModel — relationship/inline-edit-needs-bulk', () => { expect(hits([budget({ apiMethods: OPEN }), line(undefined)])).toEqual([]); expect(hits([budget({ apiMethods: OPEN }), line(false)])).toEqual([]); }); + + it('reaches os lint, os validate and os build through the registry, as a warning, once', () => { + const objects = [budget({ apiMethods: OPEN }), line('grid')]; + for (const command of ['lint', 'validate', 'build'] as const) { + expect(authoringRulesFor(command).map((r) => r.name), command).toContain('lintInlineEditBulk'); + const found = runAuthoringRules(command, { normalized: { objects }, parsed: { objects } }).filter((f) => f.rule === RULE); + expect(found.map((f) => [f.severity, f.path, f.hint]), command).toEqual([ + ['warning', 'objects[0].enable.apiMethods', "add 'bulk' to project_budget.enable.apiMethods"], + ]); + } + // Not a second copy in `os lint`'s best-practice sweep. + expect(lintDataModel(objects).filter((i) => i.rule === RULE)).toEqual([]); + }); }); describe('lintDataModel — roll-ups', () => { diff --git a/packages/lint/src/authoring-rules.ts b/packages/lint/src/authoring-rules.ts index c6b0040569a..55665132f78 100644 --- a/packages/lint/src/authoring-rules.ts +++ b/packages/lint/src/authoring-rules.ts @@ -169,6 +169,7 @@ import { lintUnscopedDeclaredIndexes, lintLegacyOrganizationComposites, lintSummaryRollups, + lintInlineEditBulk, } from './data-model-rules.js'; import type { IObjectQLEngine } from '@objectstack/spec/contracts'; @@ -2479,6 +2480,31 @@ export const AUTHORING_RULES: readonly AuthoringRule[] = [ hint: f.fix ?? '', })), }, + // An inline-edited relationship whose parent or child declares + // `enable.apiMethods` without `bulk` (`relationship/inline-edit-needs-bulk`). + // The parent's form saves the rows in one cross-object `/api/v1/batch`, which + // asks every object in it for `bulk`, so the form fills and then 405s on save. + // Registered rather than left in `lintDataModel`: it forecasts a refusal at run + // time, not a style nudge, so all three commands report it. Advisory: a + // warning that refuses nothing and never fails `os build`. + { + name: 'lintInlineEditBulk', + tier: 'advisory', + input: 'parsed', + commands: ALL, + source: 'packages/lint/src/data-model-rules.ts', + surfaces: CLI_ONLY, + surfaceReason: RUNTIME_OBJECT_ADVISORY_VOLUME, + run: (stack) => + lintInlineEditBulk(Array.isArray(stack.objects) ? (stack.objects as unknown[]) : []).map((f) => ({ + severity: f.severity === 'suggestion' ? ('info' as const) : f.severity, + rule: f.rule, + where: f.where, + path: f.path, + message: f.message, + hint: f.fix ?? '', + })), + }, // ADR-0090 D7 — the security-domain publish linter. Every `error` rule mirrors // a runtime enforcement point (fail-closed OWD default, canonical enum, anchor // binding gate, vocabulary freeze), moving the failure from a runtime deny to diff --git a/packages/lint/src/data-model-rules.ts b/packages/lint/src/data-model-rules.ts index 5252a8593a8..0d6fd144419 100644 --- a/packages/lint/src/data-model-rules.ts +++ b/packages/lint/src/data-model-rules.ts @@ -268,8 +268,62 @@ export const RELATIONSHIP_MASTER_DETAIL_REQUIRED = 'relationship/master-detail-r /** The rule id R3 reports under (`master_detail` without `deleteBehavior`). */ export const RELATIONSHIP_DELETE_BEHAVIOR = 'relationship/delete-behavior'; -/** R5b — an inline-edited relationship whose parent or child withholds `bulk`. */ -const RELATIONSHIP_INLINE_EDIT_NEEDS_BULK = 'relationship/inline-edit-needs-bulk'; +/** The rule id {@link lintInlineEditBulk} reports under. */ +export const RELATIONSHIP_INLINE_EDIT_NEEDS_BULK = 'relationship/inline-edit-needs-bulk'; + +/** + * An inline-edited relationship whose parent or child withholds `bulk`. + * + * The parent's form saves an `inlineEdit` child's rows together with the parent + * in ONE cross-object `/api/v1/batch` (ADR-0035), and that route gates EVERY op + * as `bulk` plus its own write on the op's own object + * (`packages/rest/src/batch-routes.ts`). So a parent or child whose DECLARED + * `enable.apiMethods` omits `bulk` gets a form that renders and fills, then is + * refused 405 `OBJECT_API_METHOD_NOT_ALLOWED` on save. An undeclared + * `apiMethods` is unrestricted, so the spec's own resolver decides, never a + * copy of its table. + * + * A registry rule (`AUTHORING_RULES`), not a `lintDataModel` member: it + * forecasts a refusal at run time rather than nudging a style, so `os lint`, + * `os validate` and `os build` all report it. Advisory: a warning that refuses + * nothing. One finding per object, however many inline children name it. + */ +export function lintInlineEditBulk(objects: any[]): LocatedLintIssue[] { + const issues: LocatedLintIssue[] = []; + if (!Array.isArray(objects)) return issues; + const indexByName = new Map(); + objects.forEach((o, j) => { + if (typeof o?.name === 'string' && !indexByName.has(o.name)) indexByName.set(o.name, j); + }); + const reported = new Set(); + for (const child of objects) { + if (!child?.name) continue; + for (const { name: fieldName, def } of fieldEntries(child.fields)) { + if (!RELATIONSHIP_TYPES.has(def?.type)) continue; + if (def.inlineEdit !== true && def.inlineEdit !== 'grid' && def.inlineEdit !== 'form') continue; + const parent = refOf(def); + if (!parent) continue; + for (const target of [parent, child.name]) { + const j = indexByName.get(target); + if (j === undefined || reported.has(target)) continue; + if (isApiOperationAllowed(resolveEffectiveApiMethods(objects[j]?.enable), 'bulk')) continue; + reported.add(target); + issues.push({ + severity: 'warning', + rule: RELATIONSHIP_INLINE_EDIT_NEEDS_BULK, + where: objectWhere(objects[j]), + message: + `inlineEdit on "${child.name}.${fieldName}" saves ${parent} and its ${child.name} rows in one ` + + `/api/v1/batch, which needs 'bulk' on every object in it; "${target}" declares ` + + `enable.apiMethods without 'bulk', so that save is refused 405 OBJECT_API_METHOD_NOT_ALLOWED`, + path: `objects[${j}].enable.apiMethods`, + fix: `add 'bulk' to ${target}.enable.apiMethods`, + }); + } + } + } + return issues; +} /** * The rule id R13 reports under: a roll-up whose child field the function @@ -934,13 +988,6 @@ export function lintDataModel(objects: any[]): LintIssue[] { } } - // R5b's lookup: object name → its index (the path names the object to edit), - // and the objects it has already reported, so a parent with several inline - // children is reported once. - const indexByName = new Map(); - objects.forEach((o, j) => { if (o?.name && !indexByName.has(o.name)) indexByName.set(o.name, j); }); - const bulkReported = new Set(); - for (let i = 0; i < objects.length; i++) { const obj = objects[i]; if (!obj?.name) continue; @@ -1110,34 +1157,6 @@ export function lintDataModel(objects: any[]): LintIssue[] { } } - // R5b — an inline-edited child is saved with its parent in ONE - // cross-object `/api/v1/batch` (ADR-0035), and that route gates EVERY op - // as `bulk` plus its own write on the op's own object - // (`packages/rest/src/batch-routes.ts`). So a parent or child whose - // DECLARED `enable.apiMethods` omits `bulk` gets a form that renders and - // fills, then is refused 405 `OBJECT_API_METHOD_NOT_ALLOWED` on save. - // Undeclared `apiMethods` is unrestricted, so the spec's own resolver - // decides, never a copy of its table. A warning: it refuses nothing. - if (def.inlineEdit === true || def.inlineEdit === 'grid' || def.inlineEdit === 'form') { - for (const target of [parent, obj.name]) { - const j = indexByName.get(target); - if (j === undefined || bulkReported.has(target)) continue; - const enable = objects[j]?.enable; - if (isApiOperationAllowed(resolveEffectiveApiMethods(enable), 'bulk')) continue; - bulkReported.add(target); - issues.push({ - severity: 'warning', - rule: RELATIONSHIP_INLINE_EDIT_NEEDS_BULK, - message: - `inlineEdit on "${obj.name}.${fieldName}" saves ${parent} and its ${obj.name} rows in one ` + - `/api/v1/batch, which needs 'bulk' on every object in it; "${target}" declares ` + - `enable.apiMethods without 'bulk', so that save is refused 405 OBJECT_API_METHOD_NOT_ALLOWED`, - path: `objects[${j}].enable.apiMethods`, - fix: `add 'bulk' to ${target}.enable.apiMethods`, - }); - } - } - // R4 — a line-item-shaped child should usually be master_detail, not lookup. if (type === 'lookup' && isLineItemName(obj.name)) { issues.push({ diff --git a/packages/lint/src/index.ts b/packages/lint/src/index.ts index adabc3c8e68..f3c7235ed00 100644 --- a/packages/lint/src/index.ts +++ b/packages/lint/src/index.ts @@ -1203,6 +1203,7 @@ export { lintUnscopedDeclaredIndexes, lintLegacyOrganizationComposites, lintSummaryRollups, + lintInlineEditBulk, lintDataModel, UNIQUE_DOUBLE_DECLARATION, UNIQUE_UNSCOPED_DECLARED_INDEX, @@ -1214,6 +1215,7 @@ export { RELATIONSHIP_DELETE_BEHAVIOR, ROLLUP_NON_NUMERIC_AGGREGAND, FIELD_EMBEDDED_SUB_FIELDS, + RELATIONSHIP_INLINE_EDIT_NEEDS_BULK, } from './data-model-rules.js'; export type { LintIssue, LocatedLintIssue, Severity } from './data-model-rules.js'; From 6109acf0b6d21ff5488264abffc000ae82319998 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 03:08:36 +0000 Subject: [PATCH 4/6] docs(changeset): the inline-edit bulk warning is reported by all three commands Claude-Session: https://claude.ai/code/session_01ADHkmSMwg7iTEBBE4qY9Y3 Co-authored-by: Claude --- .changeset/34567-form-layout-inline-edit-bulk.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/34567-form-layout-inline-edit-bulk.md b/.changeset/34567-form-layout-inline-edit-bulk.md index 160a1944c46..1c8be1efdf4 100644 --- a/.changeset/34567-form-layout-inline-edit-bulk.md +++ b/.changeset/34567-form-layout-inline-edit-bulk.md @@ -3,7 +3,7 @@ '@objectstack/lint': patch --- -docs(skills): `objectstack-ui` keeps a long form `simple`, and both skills name the `bulk` an `inlineEdit` save needs; `os lint` warns when it is withheld +docs(skills): `objectstack-ui` keeps a long form `simple`, and both skills name the `bulk` an `inlineEdit` save needs; `os lint`, `os validate` and `os build` warn when it is withheld Clause-②: no Metadata-protocol: none @@ -12,6 +12,6 @@ Metadata-protocol: none The parent's form saves an `inlineEdit` child's rows with the parent in one `/api/v1/batch`, and that route asks every object in it for `bulk`. Master-Detail Forms in `objectstack-ui` and § Inline Editing in `objectstack-data` `rules/relationships.md` now say so: a parent or child that declares `enable.apiMethods` must list `'bulk'`, or the save is refused `405 OBJECT_API_METHOD_NOT_ALLOWED`. An undeclared `apiMethods` allows it. -`os lint` gains the warning `relationship/inline-edit-needs-bulk`. It fires on an `inlineEdit` relationship (`true`, `'grid'` or `'form'`) whose parent or child declares `enable.apiMethods` without `'bulk'`, once per object, at that object's `enable.apiMethods`, and its fix line names the value to add. It refuses nothing. `references/lint-rules.md` lists it. +A new authoring rule, `relationship/inline-edit-needs-bulk` (`lintInlineEditBulk`, exported with its id constant `RELATIONSHIP_INLINE_EDIT_NEEDS_BULK`), warns on an `inlineEdit` relationship (`true`, `'grid'` or `'form'`) whose parent or child declares `enable.apiMethods` without `'bulk'`: once per object, at that object's `enable.apiMethods`, with a fix line naming the value to add. It is registered for all three commands, so `os lint`, `os validate` and `os build` (and `objectstack dev`) report it. It is advisory and never fails a build. `references/lint-rules.md` lists it. The skill files pay for most of this by cutting text stated elsewhere, and the `objectstack-ui/SKILL.md` token ceiling moves by the measured remainder. From 2da6508c15d60e314f3a3611c04ed970665f4f0e Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 03:22:06 +0000 Subject: [PATCH 5/6] docs: the validate and build transcripts print 69 author-time rules Claude-Session: https://claude.ai/code/session_01ADHkmSMwg7iTEBBE4qY9Y3 Co-authored-by: Claude --- content/docs/deployment/cli.mdx | 2 +- content/docs/deployment/validating-metadata.mdx | 2 +- content/docs/getting-started/build-with-claude-code.mdx | 2 +- content/docs/ui/react-pages.mdx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/content/docs/deployment/cli.mdx b/content/docs/deployment/cli.mdx index c005050575d..5a0c9142933 100644 --- a/content/docs/deployment/cli.mdx +++ b/content/docs/deployment/cli.mdx @@ -887,7 +887,7 @@ os compile --json # JSON output for CI pipelines → Normalizing stack definition... → Lowering inline handlers... → Validating protocol compliance... - → Running author-time rules (68)... + → Running author-time rules (69)... → Checking that every required capability has a provider installable in this edition... → Collecting package docs (ADR-0046)... 0 collected → Writing artifact... diff --git a/content/docs/deployment/validating-metadata.mdx b/content/docs/deployment/validating-metadata.mdx index ff349ada78d..d0adea624a1 100644 --- a/content/docs/deployment/validating-metadata.mdx +++ b/content/docs/deployment/validating-metadata.mdx @@ -852,7 +852,7 @@ A clean run walks the registry and reports timing: Config: /path/to/support-desk/objectstack.config.ts Load time: 21ms → Validating against ObjectStack Protocol... - → Running author-time rules (68)... + → Running author-time rules (69)... → Checking that every required capability has a provider installable in this edition... → Checking package docs (ADR-0046)... diff --git a/content/docs/getting-started/build-with-claude-code.mdx b/content/docs/getting-started/build-with-claude-code.mdx index 0afbb85a249..e8fe83b2be9 100644 --- a/content/docs/getting-started/build-with-claude-code.mdx +++ b/content/docs/getting-started/build-with-claude-code.mdx @@ -311,7 +311,7 @@ visible: 'status != "resolved"' ◆ Validate ──────────────────────────────────────── → Validating against ObjectStack Protocol... - → Running author-time rules (68)... + → Running author-time rules (69)... ✗ Author-time rules failed (1 issue) • stack · action 'resolve_ticket' visible: bare reference `status` — a diff --git a/content/docs/ui/react-pages.mdx b/content/docs/ui/react-pages.mdx index a2c91e9cff5..c39a14544a4 100644 --- a/content/docs/ui/react-pages.mdx +++ b/content/docs/ui/react-pages.mdx @@ -404,7 +404,7 @@ objectstack validate ──────────────────────────────────────── → Loading configuration... → Validating against ObjectStack Protocol... - → Running author-time rules (68)... + → Running author-time rules (69)... → Checking that every required capability has a provider installable in this edition... → Checking package docs (ADR-0046)... From ef4b6bc350174e99a16427d1745754bdfa14a548 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 04:21:38 +0000 Subject: [PATCH 6/6] docs(skills): the long-form eval case accepts the fieldGroups collapse route Claude-Session: https://claude.ai/code/session_01ADHkmSMwg7iTEBBE4qY9Y3 Co-authored-by: Claude --- skills/objectstack-ui/evals/views-apps-actions-pages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/objectstack-ui/evals/views-apps-actions-pages.json b/skills/objectstack-ui/evals/views-apps-actions-pages.json index e61cd0545f1..f287b10c568 100644 --- a/skills/objectstack-ui/evals/views-apps-actions-pages.json +++ b/skills/objectstack-ui/evals/views-apps-actions-pages.json @@ -187,7 +187,7 @@ "expected_output": "One form view with `type: 'simple'`: the six sections stacked on one scrolling page, each listing its own `fields`, with `collapsed: true` on the four rarely filled ones (or `collapse: 'collapsed'` on those `fieldGroups` entries of the object). `columns: 3` uses the wide dialog and `modalSize: 'xl'` sizes it. Not tabs: a required field on another tab is flagged only on its tab, and the tab strip overflows on a phone.", "files": [], "assertions": { - "must_contain": ["type: 'simple'", "collapsed: true", "modalSize"], + "must_contain": ["type: 'simple'", "modalSize"], "must_not_contain": ["type: 'tabbed'"] } }