mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 12:26:38 -06:00
fix(scripts): tighten legacy migration guard
This commit is contained in:
@@ -169,8 +169,7 @@ function isAllowedLegacyOwnerPath(relativePath) {
|
||||
allowedRuntimeMigrationPaths.some((allowed) => relativePath.startsWith(allowed)) ||
|
||||
/^extensions\/[^/]+\/(?:doctor-contract-api|legacy-state-migrations-api)\.ts$/u.test(
|
||||
relativePath,
|
||||
) ||
|
||||
/^extensions\/[^/]+\/.*migrations?(?:[./-][^/]*)?\.ts$/u.test(relativePath)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8431,6 +8431,18 @@ describe("check-database-first-legacy-stores", () => {
|
||||
expect(violations).toEqual([]);
|
||||
});
|
||||
|
||||
it("flags extension runtime writes under migration-like directories", () => {
|
||||
const violations = collectDatabaseFirstLegacyStoreViolations(
|
||||
`
|
||||
import { promises as fs } from "node:fs";
|
||||
await fs.writeFile("sessions.json", "{}\\n", "utf8");
|
||||
`,
|
||||
"extensions/example/src/migrations/runtime.ts",
|
||||
);
|
||||
|
||||
expect(violations).toEqual([{ kind: "legacy store filesystem write", line: 3 }]);
|
||||
});
|
||||
|
||||
it("allows exact QA fixture owners to materialize legacy files", () => {
|
||||
const violations = collectDatabaseFirstLegacyStoreViolations(
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user