Skip to content

Commit 50c82b3

Browse files
authored
fix(scripts): add database-first legacy store guard
Adds a required database-first legacy-store guard and regression coverage for legacy runtime state write patterns. The guard is wired into architecture/preflight/changed checks, narrows the documented guard contract to the implemented filesystem-write scope, and tightens extension migration exemptions to explicit owner APIs. Also includes a small memory-core lint unblocker after current CI flagged an unnecessary non-null assertion. Verification: - pnpm check:database-first-legacy-stores - pnpm lint:scripts - node scripts/run-vitest.mjs test/scripts/check-database-first-legacy-stores.test.ts -- --reporter=verbose - node scripts/run-oxlint.mjs extensions/memory-core/src/memory/manager-embedding-ops.ts - git diff --check - .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main - GitHub CI green for PR head 34dde2c Closes #91628.
1 parent dc46a67 commit 50c82b3

7 files changed

Lines changed: 18270 additions & 17 deletions

File tree

docs/refactor/database-first.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,22 +1406,13 @@ create` validates the written archive by default; `--no-verify` is the
14061406
explicit `dbPath`.
14071407
- `check:database-first-legacy-stores` fails new runtime source that pairs
14081408
legacy store names with write-style filesystem APIs. It also fails runtime
1409-
source that reintroduces transcript bridge contracts such as
1410-
`transcriptLocator`, `sqlite-transcript://...`, `sessionFile`, or
1411-
`storePath`, and scans tests for those bridge-contract names too. It also
1412-
bans `SessionManager.open(...)` and the old static SessionManager facades so
1413-
runtime and tests cannot silently re-create a file-backed session opener or
1414-
file-era session discovery. It also bans the old session JSONL downloader
1415-
hook/class from export UI. It also bans sidecar-shaped plugin-state/task
1416-
SQLite helper names; tests should assert `databasePath` and the shared
1417-
`state/openclaw.sqlite` location instead of pretending those features own
1418-
separate SQLite files. It also bans the old generic memory index SQL table
1419-
names (`meta`, `files`, `chunks`, `chunks_vec`,
1420-
`chunks_fts`, `embedding_cache`) in runtime source so the agent database keeps
1421-
its explicit `memory_index_*` schema. It also bans embedding TEXT schemas and
1422-
embedding JSON-array writes so vectors stay compact SQLite BLOBs. Migration,
1423-
doctor, import, and explicit non-session export code remain allowed. The
1424-
guard now also covers runtime `cache/*.json` stores, generic
1409+
source that reintroduces the retired transcript bridge markers
1410+
`transcriptLocator` or `sqlite-transcript://...`. Migration, doctor, import,
1411+
and explicit non-session export code remain allowed. Broader legacy contract
1412+
names such as `sessionFile`, `storePath`, and old `SessionManager` file-era
1413+
facades still have current owners and need separate migration guard work
1414+
before they can become a required preflight check. The guard now also covers
1415+
runtime `cache/*.json` stores, generic
14251416
`thread-bindings.json` sidecars, cron state/run-log JSON, config health JSON,
14261417
restart and lock sidecars, Voice Wake settings, plugin binding approvals,
14271418
installed plugin index JSON, File Transfer audit JSONL, Memory Wiki activity

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,11 +1453,12 @@
14531453
"canvas:a2ui:bundle": "node scripts/bundle-a2ui.mjs",
14541454
"changed:lanes": "node scripts/changed-lanes.mjs",
14551455
"check": "node scripts/check.mjs",
1456-
"check:architecture": "pnpm check:import-cycles && pnpm check:madge-import-cycles && pnpm check:deprecated-api-usage && pnpm check:deprecated-jsdoc && pnpm db:kysely:check && pnpm lint:kysely",
1456+
"check:architecture": "pnpm check:import-cycles && pnpm check:madge-import-cycles && pnpm check:deprecated-api-usage && pnpm check:deprecated-jsdoc && pnpm db:kysely:check && pnpm lint:kysely && pnpm check:database-first-legacy-stores",
14571457
"check:base-config-schema": "node --import tsx scripts/generate-base-config-schema.ts --check",
14581458
"check:bundled-channel-config-metadata": "node --import tsx scripts/generate-bundled-channel-config-metadata.ts --check",
14591459
"check:changed": "node scripts/check-changed.mjs",
14601460
"check:changelog-attributions": "node scripts/check-changelog-attributions.mjs",
1461+
"check:database-first-legacy-stores": "node scripts/check-database-first-legacy-stores.mjs",
14611462
"check:deprecated-api-usage": "node scripts/check-deprecated-api-usage.mjs",
14621463
"check:deprecated-jsdoc": "node scripts/check-deprecated-jsdoc.mjs",
14631464
"check:docs": "pnpm format:docs:check && pnpm lint:docs && pnpm docs:check-mdx && pnpm docs:check-i18n-glossary && pnpm docs:check-links",

scripts/check-changed.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ export function createChangedCheckPlan(result, options = {}) {
257257
}
258258

259259
if (runAll) {
260+
add("database-first legacy-store guard", ["check:database-first-legacy-stores"]);
260261
add("media download helper guard", ["check:media-download-helpers"]);
261262
add("runtime sidecar loader guard", ["check:runtime-sidecar-loaders"]);
262263
addTypecheck("typecheck all", ["tsgo:all"]);
@@ -322,6 +323,7 @@ export function createChangedCheckPlan(result, options = {}) {
322323
}
323324

324325
if (lanes.core || lanes.extensions) {
326+
add("database-first legacy-store guard", ["check:database-first-legacy-stores"]);
325327
add("media download helper guard", ["check:media-download-helpers"]);
326328
add("runtime sidecar loader guard", ["check:runtime-sidecar-loaders"]);
327329
add("runtime import cycles", ["check:import-cycles"]);

0 commit comments

Comments
 (0)