Skip to content

Commit bc156e7

Browse files
committed
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 <noreply@anthropic.com>
1 parent 76cb366 commit bc156e7

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/lint': patch
3+
---
4+
5+
fix(lint): the `field/embedded-sub-fields` fix names the field group that inlines the child
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
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.

‎packages/lint/src/data-model-rules.embedded-sub-fields.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,17 @@ describe('field/embedded-sub-fields — one-line verdict, `os explain` carries t
116116
}
117117
});
118118
});
119+
120+
describe('field/embedded-sub-fields — the fix names the field group that inlines the child', () => {
121+
// A parent field group whose `relatedList` names the child places it on the
122+
// parent's form; the FK's `inlineEdit` only picks grid or form (spec
123+
// `EMBEDDED_JSON_TYPED_LIST`). A hint teaching `inlineEdit` as the switch
124+
// leaves the author a child that is only a tab.
125+
it('routes to `fieldGroups[].relatedList` and gives `inlineEdit` only the form factor', () => {
126+
const [issue] = findings(audit({ type: 'repeater', fields: SUB_ROWS }));
127+
expect(issue!.fix).toContain('`master_detail`');
128+
expect(issue!.fix).toContain('`fieldGroups[].relatedList`');
129+
expect(issue!.fix).toContain('`inlineEdit` only picks how rows are edited');
130+
expect(issue!.fix).not.toContain("inlineEdit: 'grid'");
131+
});
132+
});

‎packages/lint/src/data-model-rules.fix-lines.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ describe('[#22161] data-model-rules.ts — one remedy line per fix', () => {
178178

179179
it('field/embedded-sub-fields: one line, whatever the type, the keys or the names', () => {
180180
const fix =
181-
'Make the typed list a child object whose `master_detail` field points back here ' +
182-
"(`inlineEdit: 'grid'` edits it inline), and remove the key.";
181+
'Make the typed list a child object whose `master_detail` field points back here, name it in ' +
182+
'a `fieldGroups[].relatedList` here (`inlineEdit` only picks how rows are edited), and remove the key.';
183183
for (const type of ['repeater', 'composite']) {
184184
const objects = [
185185
{

‎packages/lint/src/data-model-rules.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,8 +1114,8 @@ export function lintDataModel(objects: any[]): LintIssue[] {
11141114
`object-level ${type} is untyped JSON with no sub-fields`,
11151115
path: `${fieldPath}.${declared[0]}`,
11161116
fix:
1117-
'Make the typed list a child object whose `master_detail` field points back here ' +
1118-
"(`inlineEdit: 'grid'` edits it inline), and remove the key.",
1117+
'Make the typed list a child object whose `master_detail` field points back here, name it in ' +
1118+
'a `fieldGroups[].relatedList` here (`inlineEdit` only picks how rows are edited), and remove the key.',
11191119
});
11201120
}
11211121
}

0 commit comments

Comments
 (0)