Repository navigation
refactor(state): split openclaw-state-db into focused modules under the line limit - #110666
Conversation
ee91796 to
737c1c9
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 8:33 AM ET / 12:33 UTC. Summary PR surface: Source +117, Other +5. Total +122 across 11 files. Reproducibility: not applicable. as a bug reproduction: this PR claims a behavior-neutral refactor. The relevant high-confidence validation is a real fresh-open and existing-database reopen/upgrade run, which has not been supplied. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Keep one public state-database facade, land the focused modules only after redacted runtime proof shows successful fresh initialization and successful reopen/upgrade of an existing state database, then obtain the state owner’s approval for the compatibility-sensitive move. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this PR claims a behavior-neutral refactor. The relevant high-confidence validation is a real fresh-open and existing-database reopen/upgrade run, which has not been supplied. Is this the best way to solve the issue? Unclear: splitting the oversized module into ownership-focused siblings is a reasonable maintainability direction, but it is not yet proven to be the best safe implementation until fresh and upgrade runtime behavior is demonstrated. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against af2662f25a85. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +117, Other +5. Total +122 across 11 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (2 earlier review cycles)
|
737c1c9 to
0ea42c4
Compare
0ea42c4 to
7fc8009
Compare
|
Merged via squash.
|
What Problem This Solves
src/state/openclaw-state-db.tswas ~1940 lines with a grandfatheredmax-linessuppression - the largest state module and the one every schema-safety change this week had to wade through. Third of the four oversized modules being retired (after #110550, #110664).Why This Change Was Made
Behavior-neutral decomposition: the entry module (
openclaw-state-db.ts, 440 lines) keeps the open/close lifecycle, cache/latch wiring, schema orchestration, and writes, with its exported surface verified unchanged (19/19 names) so no importer moves. Extracted siblings: contracts/constants (32), metadata + schema-version + maintenance validation (120), permissions (54), audit-schema detection/repair (342), legacy data backfills (549), additive columns (229), migration detection/schema repair (153), and the startup-checkpoint database (80). Suppression and baseline entry removed; raw-SQLite modules joined the existing kysely-guardrails lifecycle allowlist group (moved code, same justification).User Impact
None - internal module layout only.
Evidence
node scripts/run-vitest.mjs src/state/openclaw-state-db.test.ts src/state/openclaw-agent-db.test.ts src/state/openclaw-database-verify.test.ts src/state/openclaw-database-preflight.test.ts src/state/openclaw-database-maintenance.test.ts src/commands/doctor-state-sqlite-compact.test.ts(154 tests; two multi-process barrier tests initially starved under a saturated machine and pass reliably solo and on a quiet box - load sensitivity, not regression).git diff --check: green.pnpm check:test-typesclean after rebasing past the transientaudit-extra.async.tsbreakage on main (fix(security): restore fs import dropped by bounded manifest-read change #110585/fix(security): bound skill-file audit read (restore removed fs dependency) #110589).