test(ql3): authorize read-only cutover probe boundary

This commit is contained in:
whyour
2026-08-31 01:32:28 +08:00
parent 2215a29afb
commit a76618e176
2 changed files with 49 additions and 0 deletions
+8
View File
@@ -2818,6 +2818,14 @@ function auditSourceImports(root, packagePath, findings) {
) { ) {
continue; continue;
} }
if (
packagePath === 'packages/ql3-local-application' &&
path.relative(packageDirectory, filePath) ===
'src/production-process/cutoverProbeProcess.ts' &&
specifier === '@qinglong/local-sqlite/readiness-inspection'
) {
continue;
}
if ( if (
packagePath === 'packages/ql3-local-application' && packagePath === 'packages/ql3-local-application' &&
path.relative(packageDirectory, filePath) === path.relative(packageDirectory, filePath) ===
@@ -3293,6 +3293,47 @@ test('local application Profile subpaths stay in exact composition owners', (t)
); );
}); });
test('cutover probe receives only the read-only SQLite readiness inspector', (t) => {
const root = fs.mkdtempSync(
path.join(os.tmpdir(), 'ql3-local-cutover-probe-boundary-'),
);
const processDirectory = path.join(
root,
'packages/ql3-local-application/src/production-process',
);
fs.mkdirSync(processDirectory, { recursive: true });
fs.writeFileSync(
path.join(processDirectory, 'cutoverProbeProcess.ts'),
[
"import { inspect } from '@qinglong/local-sqlite/readiness-inspection';",
"import { mutate } from '@qinglong/local-sqlite/runtime';",
].join('\n'),
);
fs.writeFileSync(
path.join(processDirectory, 'neighbor.ts'),
"import { inspect } from '@qinglong/local-sqlite/readiness-inspection';",
);
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
const findings = [];
auditSourceImports(root, 'packages/ql3-local-application', findings);
assert.deepEqual(
findings.map(({ code, file, specifier }) => ({ code, file, specifier })),
[
{
code: 'FORBIDDEN_PACKAGE_SOURCE_IMPORT',
file: 'packages/ql3-local-application/src/production-process/cutoverProbeProcess.ts',
specifier: '@qinglong/local-sqlite/runtime',
},
{
code: 'FORBIDDEN_PACKAGE_SOURCE_IMPORT',
file: 'packages/ql3-local-application/src/production-process/neighbor.ts',
specifier: '@qinglong/local-sqlite/readiness-inspection',
},
],
);
});
test('local process package remains SQLite, ORM and profile neutral', (t) => { test('local process package remains SQLite, ORM and profile neutral', (t) => {
const root = fixture( const root = fixture(
t, t,