Skip to content

Commit a76618e

Browse files
committed
test(ql3): authorize read-only cutover probe boundary
1 parent 2215a29 commit a76618e

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

scripts/ql3-cluster-dependency-audit.cjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,6 +2818,14 @@ function auditSourceImports(root, packagePath, findings) {
28182818
) {
28192819
continue;
28202820
}
2821+
if (
2822+
packagePath === 'packages/ql3-local-application' &&
2823+
path.relative(packageDirectory, filePath) ===
2824+
'src/production-process/cutoverProbeProcess.ts' &&
2825+
specifier === '@qinglong/local-sqlite/readiness-inspection'
2826+
) {
2827+
continue;
2828+
}
28212829
if (
28222830
packagePath === 'packages/ql3-local-application' &&
28232831
path.relative(packageDirectory, filePath) ===

test/back/ql3ClusterDependencyAudit.test.cjs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,6 +3293,47 @@ test('local application Profile subpaths stay in exact composition owners', (t)
32933293
);
32943294
});
32953295

3296+
test('cutover probe receives only the read-only SQLite readiness inspector', (t) => {
3297+
const root = fs.mkdtempSync(
3298+
path.join(os.tmpdir(), 'ql3-local-cutover-probe-boundary-'),
3299+
);
3300+
const processDirectory = path.join(
3301+
root,
3302+
'packages/ql3-local-application/src/production-process',
3303+
);
3304+
fs.mkdirSync(processDirectory, { recursive: true });
3305+
fs.writeFileSync(
3306+
path.join(processDirectory, 'cutoverProbeProcess.ts'),
3307+
[
3308+
"import { inspect } from '@qinglong/local-sqlite/readiness-inspection';",
3309+
"import { mutate } from '@qinglong/local-sqlite/runtime';",
3310+
].join('\n'),
3311+
);
3312+
fs.writeFileSync(
3313+
path.join(processDirectory, 'neighbor.ts'),
3314+
"import { inspect } from '@qinglong/local-sqlite/readiness-inspection';",
3315+
);
3316+
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
3317+
3318+
const findings = [];
3319+
auditSourceImports(root, 'packages/ql3-local-application', findings);
3320+
assert.deepEqual(
3321+
findings.map(({ code, file, specifier }) => ({ code, file, specifier })),
3322+
[
3323+
{
3324+
code: 'FORBIDDEN_PACKAGE_SOURCE_IMPORT',
3325+
file: 'packages/ql3-local-application/src/production-process/cutoverProbeProcess.ts',
3326+
specifier: '@qinglong/local-sqlite/runtime',
3327+
},
3328+
{
3329+
code: 'FORBIDDEN_PACKAGE_SOURCE_IMPORT',
3330+
file: 'packages/ql3-local-application/src/production-process/neighbor.ts',
3331+
specifier: '@qinglong/local-sqlite/readiness-inspection',
3332+
},
3333+
],
3334+
);
3335+
});
3336+
32963337
test('local process package remains SQLite, ORM and profile neutral', (t) => {
32973338
const root = fixture(
32983339
t,

0 commit comments

Comments
 (0)