Repository navigation
fix(database): preserve shared-state PostgreSQL schema constraints - #170059
Conversation
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves shared-state PostgreSQL constraints, separates lazy feature fragments, and exports detailed diagnostics only on request. Example: Generate PostgreSQL DDL for background images belonging to profile 'profile-demo'.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR repairs concrete PostgreSQL schema-generation losses, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCanonical SQLite schemas and feature declarations feed SQLite initialization and PostgreSQL generation, which produces SQL fragments, dependency metadata, and catalog diagnostics. flowchart TD
A[Canonical SQLite schemas] --> B[Feature declarations]
B --> C[SQLite feature initialization]
A --> D[PostgreSQL generator]
B --> D
D --> E[SQL fragments and manifest]
E --> F[PostgreSQL catalog comparison]
Technical reviewBest possible solution: Land the constraint-preserving generator while keeping shared-state runtime activation and ACP column promotion in their separately scoped work. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the missing feature declarations and permissive omission path; this review ran no target code. Is this the best way to solve the issue? Sharing declarations with existing SQLite owners and refusing unexplained PostgreSQL omissions addresses the generator boundary without activating an unfinished runtime backend. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bd79df0936c0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 12, 2026, 3:53 PM ET / 19:53 UTC (Revision 3). |
…penclaw#170059) Preserve shared-state PostgreSQL CHECKs, indexes, and foreign keys; declare feature fragments through the existing schema owner; and validate catalog equivalence in CI. SQLite first-use statements and schema version remain unchanged. PostgreSQL conformance passed. Inherited and unrelated Node test failures are retained under the documented maintainer exception. Refs openclaw#169254, openclaw#169933, openclaw#169952.
* fix(database): preserve agent PostgreSQL schema contracts Generate owner-scoped agent runtime DDL with faithful relational indexes and checks, ten canonical non-search triggers, and explicit pending search capabilities. Verify the agent catalog and paired SQLite/PostgreSQL behavior in conformance. Keep runtime enablement and schema versions unchanged. Related: #169254, #170059, #170266 * fix(ci): exclude generated PostgreSQL from SQLite ratchet The generated PostgreSQL schema uses JSON function and operator names shared with SQLite. Keep the canonical PostgreSQL artifacts outside the SQLite debt inventory while retaining checks on SQLite source.
…71350) * fix(database): preserve agent PostgreSQL schema contracts Generate owner-scoped agent runtime DDL with faithful relational indexes and checks, ten canonical non-search triggers, and explicit pending search capabilities. Verify the agent catalog and paired SQLite/PostgreSQL behavior in conformance. Keep runtime enablement and schema versions unchanged. Related: openclaw#169254, openclaw#170059, openclaw#170266 * fix(ci): exclude generated PostgreSQL from SQLite ratchet The generated PostgreSQL schema uses JSON function and operator names shared with SQLite. Keep the canonical PostgreSQL artifacts outside the SQLite debt inventory while retaining checks on SQLite source.
What Problem This Solves
Shared-state PostgreSQL generation succeeded while dropping 30 CHECKs, two ACP expression indexes, and the background-image foreign key, and eagerly created privacy-sensitive feature tables.
User Impact
The generated shared-state schema now retains all CHECKs and foreign keys and exposes named feature fragments with dependencies. The detailed JSON diagnostics remain in memory and are exported only with explicit
--out; the repository tracks SQL, the manifest, and the Markdown summary. SQLite remains the default; its statement bytes, first-use timing, and schema version 21 are unchanged. This prepares the shared-state PostgreSQL open path without enabling it.Why This Change Was Made
One declaration owner supplies both SQLite ensures and PostgreSQL generation. All 41 named fragments declare their dependencies; 28 first-use and 13 version-additive fragments remain distinct. The background-image fragment depends on profiles and retains its cascading foreign key. The existing ensure wrapper is separated from the pure declarations to keep database/runtime imports out of the generator.
Unsupported shared-state constructs fail with their exact source and reason. The two ACP indexes are explicitly pending the v22 promoted-column follow-up (PR4b), rather than represented by a lossy JSON expression translation. Ten pure NUL subpredicates are enforced intrinsically by PostgreSQL text; every surrounding CHECK remains present. PostgreSQL 16+ is required for IS JSON. Future engine schema versions and migrations move in lockstep, with JSON remaining canonical.
Evidence
60302ba0df2d063171c3f864540db9adc7f663ed7e7c57d6bacc11e5423e6ed4); no early table creation, version change, or repeat-ensure DDL.pnpm db:postgres:check: 14 generator tests passed; generated shared-state artifacts and workboard artifact current. Generator rerun: Vitest 29.67s (test body 25.88s; wrapper 56.61s). Explicit--outJSON export and verification also passed.git diff --checkpassed. The isolated PostgreSQL cluster was stopped and removed.fabe85a1b8e0c5f70e78603bd7310af2351520f1: 134 tables, 1,386 columns, 293 CHECKs, 297 indexes, 32 FKs; zero unexplained differences. Existing suites: 379 tests passed, 38 skipped, across 31 passed and 4 skipped files (three shards, 183.65s; complete job 4m38s). The path filter selected the job automatically through the existing exact-head CI dispatch; the PR remained draft.Related: #169254, #169933, #169952.
Follow-up: added the existing feature-schema ensure module to the PR wrapper inventory after the requested inventory check exposed the missing path. The focused inventory test passed after correction (34.93s suite; 58.55s wrapper).
The follow-up independently passed Codex review with no actionable P0–P2 findings. The PR is ready; its broad CI result and landing attribution are recorded below.
Landing CI attribution
Exact head
fabe85a1b8e0c5f70e78603bd7310af2351520f1, CI run 38291976017, attempt 1. PostgreSQL conformance, security, lint, types, builds, docs, and inventory checks passed. The run has 38 failed Node jobs and one Node job cancelled at its one-hour deadline; the aggregate CI gate is red.Nine failed jobs contain unchanged test files also failing in scheduled main run 38292584060. The other failures are in untouched runtime-config, transcript/session, plugin-schema, or workspace fixtures. Causal inspection found no PostgreSQL-generation path involved: runtime-config failures originate at the unchanged config snapshot owner; plugin-schema assertions concern separate plugin databases; transcript normalization, session-key cold reads, and workspace manifest refresh are unchanged owners. The Codex timeout cascade starts at the same unprepared-runtime-config boundary and reaches the one-hour job deadline. No PR-caused product regression was found. These failures are retained under the explicitly authorized inherited/unrelated-failure admin exception, not reported as green. No fix push or test rerun was made.
Failed-job attribution
checks-node-changed-extensions-bundle-21checks-node-changed-extensions-bundle-3checks-node-changed-extensions-bundle-26checks-node-changed-extensions-bundle-32checks-node-changed-extensions-bundle-25checks-node-changed-extensions-bundle-20checks-node-changed-extensions-bundle-7checks-node-changed-extensions-bundle-27checks-node-changed-extensions-bundle-10checks-node-changed-extensions-bundle-24checks-node-changed-extensions-bundle-22checks-node-changed-compact-large-21checks-node-changed-extensions-bundle-8checks-node-changed-extensions-bundle-9checks-node-changed-extensions-bundle-23checks-node-changed-extensions-bundle-1checks-node-changed-extensions-bundle-17checks-node-changed-extensions-bundle-2checks-node-changed-extensions-bundle-12checks-node-changed-extensions-bundle-15checks-node-changed-compact-large-3checks-node-changed-extensions-bundle-13checks-node-changed-compact-small-23checks-node-changed-extensions-bundle-14checks-node-changed-compact-small-1checks-node-changed-compact-small-10checks-node-changed-extensions-bundle-6checks-node-changed-compact-large-1checks-node-changed-compact-large-13checks-node-changed-extensions-bundle-11checks-node-changed-compact-small-11checks-node-changed-10checks-node-changed-extensions-bundle-5checks-node-changed-18checks-node-changed-2checks-node-changed-compact-small-28checks-node-changed-extensions-config-117checks-node-changed-compact-large-10checks-node-changed-compact-small-3Native landing note: the native review and prepare sequence passed without a push. Admin merge admission refused duplicate same-name GitHub Actions gates from the earlier conformance dispatch and the ready-PR workflow, although the selected gate and exact head match. The required security clearance was independently revalidated through the native security owner. The operator-authorized head-pinned REST squash fallback is used after the native landing exceeds ten minutes.