Skip to content

docs(database): record contracts for a future backend - #138463

Merged
steipete merged 1 commit into
mainfrom
codex/pgprep2-contracts
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/pgprep2-contracts

Conversation

@steipete

@steipete steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The schema reference describes current SQLite ownership and migration rules, but does not collect the behavioral contracts a future database backend must preserve. Merely changing Kysely's dialect would miss synchronous commit boundaries, exact stored bytes, writer fences and engine-owned search behavior.

Why This Change Was Made

Document the existing contracts and remaining PostgreSQL preparation work in the canonical database reference. The initial future scope is one Gateway using remote persistence; distributed Gateway coordination remains a separate design decision. SQLite remains the only supported backend.

The guidance covers domain operations, exact connection ownership, planning before synchronous writes, durable-write-before-publication, store identity and quarantine, canonical serialization, scalar decoding, retries and external effects. It identifies SQLite-owned search, maintenance and attachment behavior, and cites current Kysely, node-postgres and PostgreSQL contracts.

User Impact

Maintainers have a concrete reference for future adapter work. No runtime, schema, configuration, dependency or operator setup changes are made.

Evidence

Read the current store/accessor/transaction owners and installed Kysely contract, and verified the cited upstream documentation. pnpm docs:list, the exact-file formatter, the required changed-file checks and fresh independent P0–P2 review pass. English source only; no generated translations or release changelog were edited.

Documentation delta: +71 lines. No production or test code changes.

@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS maintainer Maintainer-authored PR labels Sep 4, 2026
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR remains at a1c16046d9b111943e47e8f36c4d73f3e2bfd2e2, with green required CI and completed native preparation. The original review completed but comment publication hit a GitHub rate limit; its recovery handoff has not produced a completed review comment. A later scheduled proposal also completed without publishing a verdict. Please refresh the normal published review so the native merge gate can evaluate it.

@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 2:15 PM ET / 18:15 UTC.

ClawSweeper review

What this changes

The PR adds a reference section describing the storage, transaction, and data contracts a future non-SQLite database backend would need to preserve, without changing runtime behavior.

Merge readiness

⛔ Blocked before merge - 1 item remains

No introduced correctness or security defect was found. This active, maintainer-labeled documentation PR should remain open for normal maintainer handling; external documentation links could not be independently fetched because DNS is unavailable in this review environment.

Priority: P3
Reviewed head: a1c16046d9b111943e47e8f36c4d73f3e2bfd2e2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused documentation update whose in-tree technical assertions match the reviewed storage boundaries.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required because this PR only changes files under docs/.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required because this PR only changes files under docs/.
Evidence reviewed 6 items Introduced scope: The verified parent-relative PR diff adds only the future-backend guidance to the established database reference; it introduces no runtime, configuration, schema, or dependency-file change.
Current Kysely boundary: Current main intentionally exposes a compile-only Kysely facade whose driver throws on execution, while the synchronous helper compiles and executes queries against node:sqlite; this supports the documented distinction.
Current transaction boundary: Current main rejects Promise-returning SQLite write callbacks and commits the synchronous operation before post-commit publication; the new guidance reflects that owner boundary.
Findings None None.
Security None None.

How this fits together

OpenClaw’s database reference documents the SQLite stores beneath Gateway and agent operations. A future backend would receive domain operations from store owners and must preserve durable-write and publication ordering.

flowchart LR
  A[Gateway and agent operations] --> B[Owning store]
  B --> C[Database connection]
  C --> D[Durable state]
  C --> E[Post-commit effects]
  F[Future backend adapter] --> B
Loading

Before merge

  • Resolve merge risk (P1) - The linked Kysely, node-postgres, and PostgreSQL pages could not be independently re-read because DNS resolution is unavailable; this is a reviewer-environment limitation, not missing contributor proof.
Agent review details

Security

None.

PR surface

Docs +71. Total +71 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 71 0 +71
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 71 0 +71

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep this guidance in the canonical database reference and retain SQLite as the only supported runtime backend until a separately accepted adapter, migration, and multi-Gateway design exists.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep this guidance in the canonical database reference and retain SQLite as the only supported runtime backend until a separately accepted adapter, migration, and multi-Gateway design exists.

Do we have a high-confidence way to reproduce the issue?

Not applicable: the PR changes documentation only and introduces no runtime behavior to reproduce.

Is this the best way to solve the issue?

Yes. The established database reference is the appropriate home, and the OpenClaw-specific statements align with current store, transaction, and plugin-state boundaries; external linked pages remain unverified locally due DNS failure.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a33604ea1eca.

Labels

Label changes:

  • add P3: This is a small documentation-only clarification for future storage work and does not alter current users’ runtime behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is a small documentation-only clarification for future storage work and does not alter current users’ runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

  • Introduced scope: The verified parent-relative PR diff adds only the future-backend guidance to the established database reference; it introduces no runtime, configuration, schema, or dependency-file change. Public docs: docs/reference/database-schemas.md. (docs/reference/database-schemas.md:278, a1c16046d9b1)
  • Current Kysely boundary: Current main intentionally exposes a compile-only Kysely facade whose driver throws on execution, while the synchronous helper compiles and executes queries against node:sqlite; this supports the documented distinction. (src/infra/kysely-sync.ts:47, a33604ea1eca)
  • Current transaction boundary: Current main rejects Promise-returning SQLite write callbacks and commits the synchronous operation before post-commit publication; the new guidance reflects that owner boundary. (src/infra/sqlite-transaction.ts:34, a33604ea1eca)
  • Plugin-state API: The public plugin-state contract exposes asynchronous Promise-returning operations to plugin runtimes, matching the documentation’s description of the existing async facade. (src/plugin-state/plugin-state-store.types.ts:10, a33604ea1eca)
  • Reference placement and history: The page is already routed under Reference, and recent merged work by Peter Steinberger has maintained this database-contract page; this is routing context rather than an attribution claim for the new text. Public docs: docs/docs.json. (docs/docs.json:2125, 10afd71a79e6)
  • External-contract inspection limitation: The added section explicitly relies on Kysely, node-postgres, and PostgreSQL documentation, but their pages could not be retrieved because DNS resolution failed; the in-tree OpenClaw-specific claims were inspected directly.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

ClawSweeper’s remaining pre-merge item was a DNS limitation in its reviewer environment. The four linked upstream pages were independently fetched and read on September 4, 2026:

  • Kysely data types: TypeScript declarations do not convert returned values; the driver determines runtime types.
  • node-postgres transactions: all statements in a transaction use one acquired client, which is released afterward.
  • PostgreSQL isolation: Read Committed is the default, and successive statements may observe different committed snapshots. Stronger isolation can require whole-transaction retries.
  • PostgreSQL JSON types: jsonb does not preserve whitespace, object-key order, or duplicate keys.

These sources support the added guidance. The reviewer’s network limitation is resolved by this independent verification; no document change is needed.

@steipete
steipete merged commit 1cbac47 into main Sep 4, 2026
59 checks passed
@steipete
steipete deleted the codex/pgprep2-contracts branch September 4, 2026 19:51
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant