Skip to content

Commit c0a67bb

Browse files
committed
test(lint): the readonly/system master builder cases now pin the parse's refusal and the rule's report on the literal
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B2EeooonSXrANpkpgUSfFZ
1 parent e9259ee commit c0a67bb

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎packages/lint/src/data-model-rules.master-detail-required.test.ts‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,23 @@ describe('R2 over objects built by ObjectSchema.create()', () => {
161161
fields: { order: field },
162162
});
163163

164+
// [#25092] The builder no longer lets these two through: the parse it ends in
165+
// refuses a one master marked `readonly` / `system` (spec shape
166+
// `master-not-writable`). This rule still reports the same field on the
167+
// object as the builder would have emitted it (`required` forced to `true`),
168+
// which is what `os lint` reads from a stack that never went through it.
164169
it.each([
165170
['readonly', { readonly: true }],
166171
['system', { system: true }],
167-
])('a %s master reference passes the builder (forced required) and is refused here', (flag, extra) => {
168-
const detail = build({ ...Field.masterDetail('work_order', { label: 'Work Order' }), ...extra });
169-
const issues = r2([{ name: 'work_order', sharingModel: 'private', fields: {} }, detail]);
172+
])('a %s master reference is refused by the builder itself, and reported here on the literal', (flag, extra) => {
173+
const field = { ...Field.masterDetail('work_order', { label: 'Work Order' }), ...extra };
174+
expect(() => build(field)).toThrow(/with its one required `master_detail`, `order`, marked/);
175+
const literal = {
176+
name: 'work_order_item',
177+
sharingModel: 'controlled_by_parent',
178+
fields: { order: { ...field, required: true } },
179+
};
180+
const issues = r2([{ name: 'work_order', sharingModel: 'private', fields: {} }, literal]);
170181
expect(issues).toHaveLength(1);
171182
expect(issues[0]).toMatchObject({ severity: 'error', path: `objects[1].fields.order.${flag}` });
172183
});

0 commit comments

Comments
 (0)