fix(sdk): enforce runtime dependency boundary
This commit is contained in:
@@ -187,6 +187,36 @@ test('scanner rejects sdk contracts importing a framework platform path', async
|
||||
assert.match(scan(root)[0].message, /sdk.*platform/);
|
||||
});
|
||||
|
||||
test('scanner rejects every sdk runtime dependency on framework implementation layers', async () => {
|
||||
const layers = [
|
||||
'core',
|
||||
'platform',
|
||||
'net',
|
||||
'config',
|
||||
'native',
|
||||
'protocol',
|
||||
'application',
|
||||
'domain',
|
||||
'presentation',
|
||||
'ui',
|
||||
'compat',
|
||||
];
|
||||
|
||||
for (const layer of layers) {
|
||||
const root = await createFixtureRoot();
|
||||
await writeFixture(root, `framework/${layer}/internal.ts`, 'export const value = true\n');
|
||||
await writeFixture(
|
||||
root,
|
||||
'framework/sdk/runtime/bad.ts',
|
||||
`import { value } from '../../${layer}/internal.ts'; void value\n`,
|
||||
);
|
||||
|
||||
const violations = scan(root);
|
||||
assert.equal(violations.length, 1, layer);
|
||||
assert.match(violations[0].message, /sdk.*framework implementation/, layer);
|
||||
}
|
||||
});
|
||||
|
||||
test('scanner rejects game imports of framework net internals', async () => {
|
||||
const root = await createFixtureRoot();
|
||||
await writeFixture(root, 'games/a/assets/game/bad.ts', "import '../../../framework/net/net-client.ts'\n");
|
||||
|
||||
Reference in New Issue
Block a user