Skip to content

Commit 94439cd

Browse files
committed
test(lint): pin the view-container object refusal through the rule table
Claude-Session: https://claude.ai/code/session_01QcAS3qiYYZNezaxZxaUdMV Co-authored-by: Claude <noreply@anthropic.com>
1 parent 27c6400 commit 94439cd

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎packages/lint/src/validate-object-references.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
OBJECT_REFERENCE_UNKNOWN,
77
OBJECT_REFERENCE_UNREGISTERED_PLATFORM,
88
} from './validate-object-references.js';
9+
import { runAuthoringRules, splitBySeverity } from './authoring-rules.js';
910

1011
/** Minimal stack with one own object, mirroring the HotCRM shape. */
1112
const baseStack = () => ({
@@ -763,3 +764,28 @@ describe('[#20216] validateObjectReferences — view container `object`', () =>
763764
expect(validateObjectReferences(appStack([unbound]))).toEqual([]);
764765
});
765766
});
767+
768+
/**
769+
* [#20216] The same finding through the ONE rule table all three commands run
770+
* (`runAuthoringRules`), at the gating tier — so `os validate`, `os build` and
771+
* `os lint` exit 1 on it exactly as they do on the sibling relationship-target
772+
* leg, rather than the rule merely existing.
773+
*/
774+
describe('[#20216] a dangling view container `object` gates every CLI command', () => {
775+
const stack = (object: string) => ({
776+
manifest: { id: 'com.example.my_app', namespace: 'my_app' },
777+
objects: [{ name: 'my_app_order_line', fields: { name: { type: 'text' } } }],
778+
views: [{ name: 'order_line', object, list: { type: 'grid', columns: [{ field: 'name' }] } }],
779+
});
780+
const hits = (command: 'validate' | 'build' | 'lint', object: string) =>
781+
splitBySeverity(runAuthoringRules(command, { normalized: stack(object) as never }))
782+
.errors.filter((f) => f.rule === OBJECT_REFERENCE_UNKNOWN)
783+
.map((f) => f.path);
784+
785+
for (const command of ['validate', 'build', 'lint'] as const) {
786+
it(`\`${command}\` refuses the un-prefixed binding and passes the prefixed one`, () => {
787+
expect(hits(command, 'order_line')).toEqual(['views[0].object']);
788+
expect(hits(command, 'my_app_order_line')).toEqual([]);
789+
});
790+
}
791+
});

0 commit comments

Comments
 (0)