From bc156e73996c44f371ccb100c99db291befea100 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 04:45:11 +0000 Subject: [PATCH] fix(lint): field/embedded-sub-fields fix names the field group that inlines the child The fix line taught `inlineEdit: 'grid'` as what inlines a child; a parent field group's `relatedList` places it, and `inlineEdit` only picks the form factor. Pins the hint in the shared harness and updates the exact-text pin. Claude-Session: https://claude.ai/code/session_01FEkQ5kDGa1ViantgrfH797 Co-authored-by: Claude --- .changeset/36281-embedded-sub-fields-hint.md | 10 ++++++++++ .../data-model-rules.embedded-sub-fields.test.ts | 14 ++++++++++++++ .../lint/src/data-model-rules.fix-lines.test.ts | 4 ++-- packages/lint/src/data-model-rules.ts | 4 ++-- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .changeset/36281-embedded-sub-fields-hint.md diff --git a/.changeset/36281-embedded-sub-fields-hint.md b/.changeset/36281-embedded-sub-fields-hint.md new file mode 100644 index 00000000000..878a482d7c8 --- /dev/null +++ b/.changeset/36281-embedded-sub-fields-hint.md @@ -0,0 +1,10 @@ +--- +'@objectstack/lint': patch +--- + +fix(lint): the `field/embedded-sub-fields` fix names the field group that inlines the child + +Clause-②: no +Metadata-protocol: none + +The rule's fix line told the author to make the typed list a child object and that `inlineEdit: 'grid'` edits it inline. A child is inlined in its parent's form only when a field group of the parent names it in `relatedList`; the FK's `inlineEdit` picks grid or form, nothing more. An author who followed the old line got a child shown as a tab, with no lines on the parent's form. The fix now reads: make the typed list a child object whose `master_detail` field points back here, name it in a `fieldGroups[].relatedList` here (`inlineEdit` only picks how rows are edited), and remove the key. When the rule fires, its id, severity and path are unchanged. diff --git a/packages/lint/src/data-model-rules.embedded-sub-fields.test.ts b/packages/lint/src/data-model-rules.embedded-sub-fields.test.ts index a747d649427..be4b877b8d8 100644 --- a/packages/lint/src/data-model-rules.embedded-sub-fields.test.ts +++ b/packages/lint/src/data-model-rules.embedded-sub-fields.test.ts @@ -116,3 +116,17 @@ describe('field/embedded-sub-fields — one-line verdict, `os explain` carries t } }); }); + +describe('field/embedded-sub-fields — the fix names the field group that inlines the child', () => { + // A parent field group whose `relatedList` names the child places it on the + // parent's form; the FK's `inlineEdit` only picks grid or form (spec + // `EMBEDDED_JSON_TYPED_LIST`). A hint teaching `inlineEdit` as the switch + // leaves the author a child that is only a tab. + it('routes to `fieldGroups[].relatedList` and gives `inlineEdit` only the form factor', () => { + const [issue] = findings(audit({ type: 'repeater', fields: SUB_ROWS })); + expect(issue!.fix).toContain('`master_detail`'); + expect(issue!.fix).toContain('`fieldGroups[].relatedList`'); + expect(issue!.fix).toContain('`inlineEdit` only picks how rows are edited'); + expect(issue!.fix).not.toContain("inlineEdit: 'grid'"); + }); +}); diff --git a/packages/lint/src/data-model-rules.fix-lines.test.ts b/packages/lint/src/data-model-rules.fix-lines.test.ts index 9742ade9000..fc115f51d4a 100644 --- a/packages/lint/src/data-model-rules.fix-lines.test.ts +++ b/packages/lint/src/data-model-rules.fix-lines.test.ts @@ -178,8 +178,8 @@ describe('[#22161] data-model-rules.ts — one remedy line per fix', () => { it('field/embedded-sub-fields: one line, whatever the type, the keys or the names', () => { const fix = - 'Make the typed list a child object whose `master_detail` field points back here ' + - "(`inlineEdit: 'grid'` edits it inline), and remove the key."; + 'Make the typed list a child object whose `master_detail` field points back here, name it in ' + + 'a `fieldGroups[].relatedList` here (`inlineEdit` only picks how rows are edited), and remove the key.'; for (const type of ['repeater', 'composite']) { const objects = [ { diff --git a/packages/lint/src/data-model-rules.ts b/packages/lint/src/data-model-rules.ts index b6d9fe6cbec..f16e42de7f9 100644 --- a/packages/lint/src/data-model-rules.ts +++ b/packages/lint/src/data-model-rules.ts @@ -1114,8 +1114,8 @@ export function lintDataModel(objects: any[]): LintIssue[] { `object-level ${type} is untyped JSON with no sub-fields`, path: `${fieldPath}.${declared[0]}`, fix: - 'Make the typed list a child object whose `master_detail` field points back here ' + - "(`inlineEdit: 'grid'` edits it inline), and remove the key.", + 'Make the typed list a child object whose `master_detail` field points back here, name it in ' + + 'a `fieldGroups[].relatedList` here (`inlineEdit` only picks how rows are edited), and remove the key.', }); } }