Repository navigation
fix: avoid SQLite schema warnings for unrelated runtime edits - #1456
Conversation
Keep unchanged table context within its diff hunk and distinguish raw SQL columns from ORM builder calls so runtime properties such as suffix: null do not invent a persisted schema change. Preserve direct DDL detection, genuine SQL/ORM columns, likely-schema uncertainty, approval boundaries, and compatibility-proof requirements. Add raw and production-normalized regressions covering classification, report warnings, readiness, and automation markers. Validated with 155 focused tests, the complete repository check, and a real in-memory SQLite replay showing unchanged schemas for runtime-only edits and changed schemas for positive SQL-column and ALTER TABLE controls.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 2:50 PM ET / 18:50 UTC. ClawSweeper reviewWhat this changesThe PR prevents unrelated runtime edits from triggering SQLite schema warnings by limiting table context to the same diff hunk and distinguishing SQL columns from runtime properties. Merge readiness✅ Ready for maintainer review The fix remains necessary on the pinned main revision. The patch is focused, the supplied real SQLite proof supports its claim, and no actionable correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherClawSweeper classifies incoming OpenClaw PR patches for possible database changes. Those classifications feed stored review reports, contributor warnings, and compatibility-proof requirements. flowchart TD
A[OpenClaw PR patches] --> B[Production file filtering]
B --> C[SQLite change detection]
C --> D[Changed table or same-hunk column]
D --> E[Stored review classification]
E --> F[Warnings and compatibility checks]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep schema warnings tied to concrete changed declarations while retaining conservative handling of incomplete schema patches and existing compatibility-proof gates. Do we have a high-confidence way to reproduce the issue? Yes. On pinned main, unchanged CREATE TABLE context in one hunk combines with suffix: null in another to trigger the SQLite warning; source inspection establishes the path, and the contributor supplies a before/after runtime trace. Is this the best way to solve the issue? Yes. Reusing the existing hunk-local classification pattern and requiring ORM builder calls directly addresses the two false-positive mechanisms without adding configuration or a parallel detector. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f9deb128e547. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Fixes an issue where contributors receive a false SQLite table change warning when a runtime-only edit shares a file with unchanged table setup. The confirmed example changes
refresh()torefresh(true)and a diagnosticsuffixfrom a string tonullin another diff hunk; the database schema does not change.Why This Change Was Made
The producer previously joined the whole patch when looking for unchanged table context and used one case-insensitive pattern for both raw SQL columns and JavaScript properties. This combined unrelated hunks and interpreted
suffix: nullas a SQL declaration.Unchanged SQL/ORM table context now applies only within the changed declaration's hunk. Raw SQL columns remain case-insensitive; ORM properties require supported column-builder calls. Direct changed table DDL, genuine same-hunk columns, and conservative likely-schema uncertainty remain detectable. Approval and compatibility-proof gates are not weakened. Serialization and filename/path-ownership classification are outside this change.
User Impact
Runtime-only changes no longer receive an invented SQLite schema warning. Genuine table changes continue to receive their warning and compatibility-proof requirements. The detector remains a bounded lexical heuristic, not a complete SQL/JavaScript parser.
OpenClaw Bay Impact
Unaffected: no observer API, fields, routes, or controls change.
Documentation Impact
Updated active implementation guidance in
docs/pr-review-comments.mdand added one Unreleased changelog entry. ReviewedAGENTS.md,CONTRIBUTING.md,docs/README.md, and the proposed material-SQLite-change policy; the proposal remains untouched and grants no new enforcement authority.Evidence
Reviewed head:
5f3f045d394bb7309eed889890062ead311f4ab6.The regression suite covers the supplied cross-hunk repro, same-hunk runtime values/type annotations, independently tested hunk locality, lowercase/NULL/NUMERIC SQL columns, ORM builder calls, added/changed/removed declarations, direct DDL, normalized input, and contributor-visible warnings/readiness/automation markers.
The new negative regressions failed before the source fix: 121 passed, 34 failed. The initial fixed run passed all 155 focused tests. A fresh pre-commit Codex review found no actionable P0–P2 findings.
At this head,
pnpm run buildandnode --test test/pr-surface-policy.test.tspassed all 155 focused tests with no failures. The committed branch also passed a fresh isolated Codex review against currentmain, with no actionable P0–P2 findings. Required repository checks remain mandatory before merge.Real Behavior Proof
Claim and surface: the compiled SQLite/data-model producers reject the supplied runtime-only false positive while continuing to classify genuine table changes. Equivalent before/after programs are executed against real in-memory SQLite databases using Node's
DatabaseSync;sqlite_schema,PRAGMA table_info, diagnostic values, and refresh calls provide the observable result.Environment: local macOS, Node 24+, repository-pinned pnpm. All inputs are synthetic; no hosted workflow, production database, or live publication is used for this proof.
Observed result at the reviewed head: the baseline at
da713f68d3fd46a1e6b123da5d709062b412cd1breports a SQLite change for the supplied patch; this head reports neither a SQLite nor a data-model change. Actual SQLite schemas stay identical while diagnostics/refresh behavior change. Three positive controls change actual columns and remain detected: a normal SQL column, a raw SQLNULLcolumn, andALTER TABLE.{ "outcome": "PASS", "head": "5f3f045d394bb7309eed889890062ead311f4ab6", "node": "v24.20.0", "platform": "darwin", "runtimeSchemaUnchanged": true, "baseline": { "sqlite": { "change": true, "files": [ "src/runtime/controller.ts" ] }, "dataModel": { "change": false, "surfaces": [] } }, "candidate": { "sqlite": { "change": false, "files": [] }, "dataModel": { "change": false, "surfaces": [] } }, "positiveControls": [ { "name": "SQL column", "sqliteChange": true, "dataModelChange": true, "columns": [ "revision", "id" ] }, { "name": "SQL NULL column", "sqliteChange": true, "dataModelChange": true, "columns": [ "suffix", "id" ] }, { "name": "ALTER TABLE", "sqliteChange": true, "dataModelChange": true, "columns": [ "id", "revision" ] } ] }Reproduction: run the following from the repository root on the reviewed head. The baseline commit must be available locally.
Limits: this proves the compiled classifier boundary and actual SQLite schema outcomes for these fixtures, not hosted review/publication or database migration safety. The focused regression suite separately verifies report generation, visible warnings, readiness, and compatibility-proof gates. No real-user data or agent transcript is included.