Skip to content

feat(watch): support PostgreSQL watch persistence - #7568

Open
zhanglistar wants to merge 3 commits into
mainfrom
feat/postgres-watch-store
Open

zhanglistar wants to merge 3 commits into
mainfrom
feat/postgres-watch-store

Conversation

@zhanglistar

@zhanglistar zhanglistar commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Deployments can now persist shared Watch metadata and run occupancy in PostgreSQL by selecting storage.watch_store.provider=postgres. Previously, shared Watch persistence required MySQL.

  • Extract the existing transactional Watch operations into a shared SQL store, with PostgreSQL database time, JSON projection, bounded URI indexes, and the existing encrypted credential and checkpoint semantics.
  • Report only driver-confirmed duplicate keys as existing Watches; preserve other database constraint errors. Reuse the same SQL runtime/session implementation as feat(task): support PostgreSQL for durable Task/Work storage #7552, with MySQL compatibility exports sharing the singleton runtime.
  • Add the postgres dependency extra, PostgreSQL 14+ deployment DDL, validated connection/TLS configuration, and bilingual deployment instructions. Tables must be provisioned before startup; changing providers does not migrate existing Watches.
  • Extend database CI with PostgreSQL 14 and require real backend and multiprocess claim coverage for both PostgreSQL and MySQL.

This provider configures Watch persistence independently of Task/Work, Account, path locks, coordination, and vector storage.

Validation

  • Merged upstream main (bd70f20a8), preserving both pgvector and postgres dependency extras.
  • Ruff, git diff --check, and uv lock --check.
  • Documentation theme tests, consistency/API checks, build, and built link/anchor checks.
  • After the upstream merge: 331 passed and 13 expected skips against real PostgreSQL 17.6 and MySQL 8.4 backends, including PostgreSQL contracts, cancellation/pool cleanup, and multiprocess exclusive claims.
  • The remaining eight failures in tests/service/test_resource_service_watch.py match the names and errors previously reproduced on clean baseline 37a744373: stale mocks lack read_file or doc_type.
  • Review-fix validation: 368 broader Watch/Task/Account cases passed; after correcting PyMySQL's CHECK exception expectation, all seven targeted duplicate/constraint/runtime cases passed (three expected File skips). The broader run also had 17 expected skips.
  • An additional 65 API-key and real Redis/MySQL account cases passed, including cancellation and concurrent lifecycle cleanup.
  • The four shared runtime/session files match feat(task): support PostgreSQL for durable Task/Work storage #7552 exactly. That PR is still open; this PR includes the common extraction and can merge independently.
  • PostgreSQL 14 and full checks on remote CI.

Share transactional watch operations with MySQL and add PostgreSQL configuration, deployment schema, and real-backend CI coverage.
Only report duplicate-key violations as existing Watches, and reuse the relational runtime from the Task/Work PostgreSQL implementation while retaining MySQL compatibility exports.
Reconcile shared SQL runtime and container database routing, update Watch test fixtures, and complete resource API documentation so local regressions and docs checks pass.

This branch has not been deployed

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant