From 014c5a3c4509410a17c27b4eb36aadcf922bcf67 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 03:11:05 +0000 Subject: [PATCH 1/2] docs(skills): line items in the parent's form are a parent field group naming the child The data and ui skills taught that `inlineEdit: true` on the child's master_detail field puts the child grid in the parent's form. A parent field group naming the child (`fieldGroups[].relatedList`) does that; `inlineEdit` only picks how the rows are edited. Three texts, two eval cases corrected, one eval case added, changeset. Claude-Session: https://claude.ai/code/session_01FEkQ5kDGa1ViantgrfH797 Co-authored-by: Claude --- .changeset/36224-inline-edit-form-group.md | 10 ++++ .../evals/objects-fields-relationships.json | 18 ++++++- .../objectstack-data/rules/relationships.md | 52 ++++++++----------- skills/objectstack-ui/SKILL.md | 10 ++-- .../evals/views-apps-actions-pages.json | 4 +- skills/objectstack-ui/rules/list-views.md | 23 ++++---- 6 files changed, 68 insertions(+), 49 deletions(-) create mode 100644 .changeset/36224-inline-edit-form-group.md diff --git a/.changeset/36224-inline-edit-form-group.md b/.changeset/36224-inline-edit-form-group.md new file mode 100644 index 00000000000..ed04b297ec9 --- /dev/null +++ b/.changeset/36224-inline-edit-form-group.md @@ -0,0 +1,10 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): entering line items in the parent's form is taught as a parent field group naming the child, not `inlineEdit` alone + +Clause-②: no +Metadata-protocol: none + +objectstack-data's `rules/relationships.md` (Inline Editing), objectstack-ui's `rules/list-views.md` (Master-Detail Forms) and the objectstack-ui `SKILL.md` trap list taught that `inlineEdit: true` on the child's `master_detail` field puts the child grid into the parent's form. They now teach the rule the platform applies: the parent's form enters a child's rows where a field group of the parent names that child (`fieldGroups: [{ key: 'lines', label: 'Lines', relatedList: 'invoice_line' }]`), `inlineEdit` only picks how those rows are edited, and without the group the child is a tab and the form has no lines. Text only; each file's old wording is cut to pay for the new. Two eval cases that expected the old answer are corrected and objectstack-data gains one case for form entry of quote lines. diff --git a/skills/objectstack-data/evals/objects-fields-relationships.json b/skills/objectstack-data/evals/objects-fields-relationships.json index a55fa9ec0b9..1bdad089ea2 100644 --- a/skills/objectstack-data/evals/objects-fields-relationships.json +++ b/skills/objectstack-data/evals/objects-fields-relationships.json @@ -24,13 +24,12 @@ { "id": 2, "prompt": "Model invoices with line items, and let invoices be tagged with many tags where each tagging records who added it and when. A rep who owns a line item but can only read the invoice may still correct that line.", - "expected_output": "Line items: `invoice_line` with a `master_detail` field to `invoice`, `required: true`, `deleteBehavior: 'cascade'` (or `'restrict'` — `set_null` is refused on master_detail), `inlineEdit` on that relationship, and a `summary` roll-up field on the parent. Tagging carries attributes, so it is a junction object (`invoice_tag`) with two `lookup` fields plus `added_by` / `added_at` — not a `multiple: true` lookup (an array of ids) and not a `many_to_many` type, which does not exist. The line object is `sharingModel: 'controlled_by_parent'` with `sharing: { controlledByParent: { ownerMayEdit: true } }` (by-id update only; every other write still needs master edit). `added_by` is `type: 'user'` — never a `lookup` to a `user` object, which does not exist.", + "expected_output": "Line items: `invoice_line` with a `master_detail` field to `invoice`, `required: true`, `deleteBehavior: 'cascade'` (or `'restrict'` — `set_null` is refused on master_detail), and a `summary` roll-up field on the parent. Tagging carries attributes, so it is a junction object (`invoice_tag`) with two `lookup` fields plus `added_by` / `added_at` — not a `multiple: true` lookup (an array of ids) and not a `many_to_many` type, which does not exist. The line object is `sharingModel: 'controlled_by_parent'` with `sharing: { controlledByParent: { ownerMayEdit: true } }` (by-id update only; every other write still needs master edit). `added_by` is `type: 'user'` — never a `lookup` to a `user` object, which does not exist.", "files": [], "assertions": { "must_contain": [ "master_detail", "deleteBehavior", - "inlineEdit", "summary", "lookup", "ownerMayEdit", @@ -432,6 +431,21 @@ "event: 'afterInsert'" ] } + }, + { + "id": 25, + "prompt": "`quote_line` 通过 `master_detail` 字段 `quote` 归属 `quote`。新建报价单时要在表单里直接录明细,和报价单一起保存。该怎么声明?", + "expected_output": "On the PARENT `quote` object, a field group that names the child: `fieldGroups: [..., { key: 'lines', label: '明细', relatedList: 'quote_line' }]` (such a group holds no fields). The standard create/edit form of `quote` then enters the lines at that group and saves quote + lines in one atomic transaction, and the record page draws the same table there. Without the group nothing changes: `quote_line` is a tab and the form has no lines, whatever `inlineEdit` on `quote_line.quote` says; `inlineEdit` only picks how the rows are edited (`'grid'` / `'form'`, `true` or absent picks by the child's shape). No custom page and no form view is needed. If either object declares `enable.apiMethods`, it must list `'bulk'`.", + "files": [], + "assertions": { + "must_contain": [ + "fieldGroups", + "relatedList: 'quote_line'" + ], + "must_not_contain": [ + "definePage" + ] + } } ] } diff --git a/skills/objectstack-data/rules/relationships.md b/skills/objectstack-data/rules/relationships.md index 3109d864bb7..33a23d7b5ed 100644 --- a/skills/objectstack-data/rules/relationships.md +++ b/skills/objectstack-data/rules/relationships.md @@ -247,44 +247,38 @@ which clients are meant to see, acknowledged — a note: ## Inline Editing (Master-Detail Entry) -Declare inline editing **on the relationship**, in the data model — not in a form -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**. A parent or child declaring `enable.apiMethods` must list +The parent's **standard** create/edit form enters a child's rows where **a +field group of the parent names that child** (`relatedList`): the group draws +the child's table at its place in the record's details and in the parent's +entry form (below the form's fields when its sections name no field group), +and parent + children save in **one atomic transaction**. Without the group +nothing changes: the child is a tab and the form has no lines, whatever +`inlineEdit` says. 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: -export default ObjectSchema.create({ - name: 'invoice_line', - sharingModel: 'controlled_by_parent', - fields: { - invoice: { - type: 'master_detail', - reference: 'invoice', - inlineEdit: true, // ← edited inline within the Invoice form - inlineTitle: 'Line Items', // optional grid title - // inlineColumns / inlineAmountField — optional overrides; columns are - // otherwise derived from this object's fields. - }, - quantity: { type: 'number' }, - amount: { type: 'currency' }, - }, -}); +// PARENT `invoice`: the group places the lines and holds no fields +fieldGroups: [{ key: 'lines', label: 'Line Items', relatedList: 'invoice_line' }], + +// CHILD `invoice_line`: its master_detail FK, declaring no `relatedList` +invoice: { + type: 'master_detail', + reference: 'invoice', + inlineTitle: 'Line Items', // optional grid title + // inlineColumns / inlineAmountField — optional overrides; columns are + // otherwise derived from this object's fields. +}, ``` -**Set `inlineEdit` only for true line-item / composition children** (invoice -lines, order items, expense lines) — the things a user enters *together with* -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. +Name only true line-item / composition children (invoice lines, order items, +expense lines); leave associations (comments, attachments, activity, audit) as +tabs. The rendering side, `subforms` overrides included: objectstack-ui → Master-Detail Forms. #### Inline-edit form factor (`grid` vs `form`) -`inlineEdit` also picks how the children are entered: +`inlineEdit` only picks how a placed child's rows are entered: ```typescript inlineEdit: true // auto — pick grid/form from the child's shape (default) @@ -300,7 +294,7 @@ editable fields, else `grid`. Set the string to override. behaviors purely from how you model the child + parent: ```typescript -// Parent +// Parent (a field group names invoice_line, as above) Invoice = { fields: { tax_rate: Field.number({ label: 'Tax Rate (%)' }), // → live Subtotal/Tax/Total stack diff --git a/skills/objectstack-ui/SKILL.md b/skills/objectstack-ui/SKILL.md index 8adaee562c5..81893819f59 100644 --- a/skills/objectstack-ui/SKILL.md +++ b/skills/objectstack-ui/SKILL.md @@ -45,10 +45,12 @@ Two more: [List Views](#list-views), [Actions](#actions). with `columns` and `modalSize`. `tabbed` flags a required field only on its own tab and overflows on a phone ([Form Views](./rules/list-views.md#form-views)). -2. **A record entered with its line items is `inlineEdit` on the child's - `master_detail` field**, before any custom page, and its grid needs no "Add - line" button. A parent or child declaring `enable.apiMethods` must list - `'bulk'`, or the save is refused `405` +2. **A record entered with its line items is a parent field group naming the + child** (`fieldGroups: [{ key: 'lines', label: 'Lines', relatedList: + 'invoice_line' }]`), before any custom page; without it nothing changes: + the child is a tab and the form has no lines, whatever `inlineEdit` says. + Its grid needs no "Add line" button. A parent or child declaring + `enable.apiMethods` must list `'bulk'`, or the save is refused `405` ([Master-Detail Forms](./rules/list-views.md#master-detail-forms-parent--child-line-items)). 3. **A persisted chart binds a declared dataset.** A widget or report names a `defineDataset` and selects its `dimensions` / `values` by name; an object diff --git a/skills/objectstack-ui/evals/views-apps-actions-pages.json b/skills/objectstack-ui/evals/views-apps-actions-pages.json index 39213deaca5..d178b54b9a2 100644 --- a/skills/objectstack-ui/evals/views-apps-actions-pages.json +++ b/skills/objectstack-ui/evals/views-apps-actions-pages.json @@ -54,10 +54,10 @@ { "id": 6, "prompt": "Invoice entry as a stepped form — header, then line items, then review — saving the invoice and its lines together.", - "expected_output": "A stepped form over ONE object is `formViews` with `type: 'wizard'` and `sections`, not a screen flow (nothing branches). Line items come from the DATA MODEL: `inlineEdit` on the child's `master_detail` field, which renders the editable grid and saves parent + children in one atomic `/api/v1/batch`; `subforms` only to override derived columns. No custom page, and no 'Add line' button (the ghost row exists).", + "expected_output": "A stepped form over ONE object is `formViews` with `type: 'wizard'` and `sections`, not a screen flow (nothing branches). Line items come from the DATA MODEL: a field group of `invoice` naming the `master_detail` child (`fieldGroups: [{ key: 'lines', label: 'Lines', relatedList: 'invoice_line' }]`), which draws the editable grid in the form and saves parent + children in one atomic `/api/v1/batch`; without the group the form has no lines, whatever `inlineEdit` says. `subforms` only to override derived columns. No custom page, and no 'Add line' button (the ghost row exists).", "files": [], "assertions": { - "must_contain": ["type: 'wizard'", "inlineEdit", "formViews", "master_detail"], + "must_contain": ["type: 'wizard'", "relatedList", "formViews", "master_detail"], "must_not_contain": ["type: 'screen'"] } }, diff --git a/skills/objectstack-ui/rules/list-views.md b/skills/objectstack-ui/rules/list-views.md index ff5e666d98d..2978b1c7c03 100644 --- a/skills/objectstack-ui/rules/list-views.md +++ b/skills/objectstack-ui/rules/list-views.md @@ -367,19 +367,19 @@ To let users enter a record **together with its child line items** (invoice + lines, project + tasks) and save them **atomically**, you almost never need a custom page or form config. Prefer, in order: -1. **Relationship `inlineEdit` (default, zero UI config).** Declare it in the - 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.** A parent or child +1. **A parent field group naming the child (zero view config).** In the DATA + MODEL, the parent declares `fieldGroups: [{ key: 'lines', label: 'Lines', + relatedList: 'invoice_line' }]`. Its standard New/Edit forms (modal, + drawer, full-page) then draw the children there and save parent + children + in one atomic `/api/v1/batch`. Without the group nothing changes: the child + is a tab and the form has no lines. 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: + `405 OBJECT_API_METHOD_NOT_ALLOWED`. `inlineEdit` only picks how rows are + edited, the `true` / `'grid'` / `'form'` ladder: **objectstack-data → Relationships → Inline Editing**. 2. **Form view `subforms` (override / tuning).** Add to a form view only when you - need to override the derived columns/order, or expose a child the - relationship didn't mark inline: + need to override the derived columns/order, or inline a child no group names: ```typescript form: { @@ -395,9 +395,8 @@ 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. -**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 +**Line-item grid behaviors (`grid` mode).** Every behaviour of the editable +grid is derived from the DATA MODEL — computed columns, catalog typeahead auto-fill, persisted drag-reorder, and the live Subtotal → Tax → Total stack: **objectstack-data → Relationships → Inline Editing**. Three things are authored on this side: a trailing **ghost** row always exists, so never add an From c8770a8ff8b13ec8a2516beaf245e4abc0ddf4ee Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 03:11:52 +0000 Subject: [PATCH 2/2] docs(skills): drop an emphasis so the ratcheted total is unchanged Claude-Session: https://claude.ai/code/session_01FEkQ5kDGa1ViantgrfH797 Co-authored-by: Claude --- skills/objectstack-data/rules/relationships.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/objectstack-data/rules/relationships.md b/skills/objectstack-data/rules/relationships.md index 33a23d7b5ed..7b360ad28e2 100644 --- a/skills/objectstack-data/rules/relationships.md +++ b/skills/objectstack-data/rules/relationships.md @@ -247,7 +247,7 @@ which clients are meant to see, acknowledged — a note: ## Inline Editing (Master-Detail Entry) -The parent's **standard** create/edit form enters a child's rows where **a +The parent's standard create/edit form enters a child's rows where **a field group of the parent names that child** (`relatedList`): the group draws the child's table at its place in the record's details and in the parent's entry form (below the form's fields when its sections name no field group),