openvibers/openvibe.contracts Commits

ADR-035 amendment: one dialect, async-first, every service. After the costs were laid out the owner confirmed: migrate all services, async-focused and tuned. Services write PostgreSQL SQL only; the data layer has no SQLite adapter. Tests run real PostgreSQL in-process through PGlite, and CI also runs each migrated suite against PostgreSQL 18 + PgBouncer (transaction mode) + Valkey. A verified importer (batched COPY, type mapping, per-table counts and checksums) moves each service's SQLite data once. Per-service steps are restated (schema, async data access, per-process state to Valkey, suites, rehearsal on a production copy, freeze-import-switch, SQLite read-only for the N-1 window). The roadmap's engineering standards (section 4B.7) bind each migration.

OP OpenVibers committed 28 Sept 2026 · d2a89dfec1 · 2 files, +31 −1


Changes

ddiff --git a/docs/adr/ADR-035-postgresql-and-valkey.md b/docs/adr/ADR-035-postgresql-and-valkey.md
iindex 540bd3fc..237832ed 100644
---- a/docs/adr/ADR-035-postgresql-and-valkey.md
++++ b/docs/adr/ADR-035-postgresql-and-valkey.md
@@@ -84,3 +84,33 @@
- flushing Valkey mid-run changes no money or account answer.
- **A point-in-time restore drill** from pgBackRest reproduces a service's database at a chosen time.
- **Truthful readiness:** each migrated service's `/ready` reports `postgresql` and its pool state, and a service not yet migrated reports `sqlite`.
++
++## Amendment 2026-09-28 (same day): one dialect, async-first, every service
++
++The owner confirmed after the costs were laid out: "everything should be async focused and highly optimized/efficient in the first place … migrate all of it". So:
++
++1. **One SQL dialect.** Services write PostgreSQL SQL only. The data layer has no SQLite adapter.
++ - Tests run real PostgreSQL in-process through **PGlite** (PostgreSQL compiled to WASM). What is tested is what runs, and there is no dual-dialect drift.
++ - CI also runs each migrated suite against a real PostgreSQL 18 + PgBouncer (transaction mode) + Valkey container set, which catches what only the pooler forbids.
++ - Item 4's "PostgreSQL and SQLite adapters" becomes "PostgreSQL (`pg`, through PgBouncer) and PGlite (tests, embedded)".
++2. **A one-time import from SQLite.** `openvibe-sdk/db` ships a verified importer from a service's SQLite file into its PostgreSQL schema:
++ - batched `COPY`;
++ - type mapping: 0/1 to boolean, text timestamps to `timestamptz`, JSON text to `jsonb`;
++ - per-table row counts and content checksums.
++
++ Item 6's per-service steps become:
++ 1. the PostgreSQL schema;
++ 2. data access async on the layer;
++ 3. per-process state to Valkey;
++ 4. suites on PGlite and CI PostgreSQL;
++ 5. a rehearsal on a production copy;
++ 6. a short write freeze, the import and the switch;
++ 7. the SQLite file kept read-only for the N-1 window as the rollback, then archived and deleted.
++3. **Every service migrates,** in item 6's order. The roadmap's engineering standards (section 4B.7) bind each one:
++ - async request paths;
++ - bounded pools;
++ - Valkey for shared state;
++ - indexes for every query shape;
++ - keyset pagination;
++ - no N+1 queries;
++ - measured budgets.
ddiff --git a/docs/adr/README.md b/docs/adr/README.md
iindex 7e9f1e5a..d878e9bc 100644
---- a/docs/adr/README.md
++++ b/docs/adr/README.md
@@@ -38,4 +38,4 @@ Platform-wide decisions from the OpenVibe development roadmap (section 10). Each
| [ADR-032](ADR-032-containers.md) | Containers: platform services stay systemd units (one adapter in ovhost, a reserved `runtime` field); tenant code isolation belongs to Stage C | Accepted 2026-09-26 |
| [ADR-033](ADR-033-account-export-and-deletion.md) | Account export and deletion: services push their export parts to Network; deletion after a 30-day grace, each service erases its rows and confirms; money rows kept pseudonymised | Accepted 2026-09-27; implementation in progress |
| [ADR-034](ADR-034-platform-north-star.md) | Platform north star, an open affordable cloud: boundaries now (projects, `ovrn:` resource names, scoped grants, generated contracts, metering), infrastructure when measured; control/data plane and cells; regions, edge nodes, load balancing and a geo API; pulled, gated deploys; four extension levels under one manifest | Proposed 2026-09-28, for the owner's review |
--| [ADR-035](ADR-035-postgresql-and-valkey.md) | PostgreSQL 18 as every service's system of record (database + roles per service, PgBouncer transaction pooling, pgBackRest PITR to B2) and Valkey as the shared non-authoritative store; the SDK data layer; services migrate one at a time, smallest first; supersedes ADR-007's trigger rule | Accepted 2026-09-28 (owner decision) |
++| [ADR-035](ADR-035-postgresql-and-valkey.md) | PostgreSQL 18 as every service's system of record (database + roles per service, PgBouncer transaction pooling, pgBackRest PITR to B2) and Valkey as the shared non-authoritative store; the SDK data layer; services migrate one at a time, smallest first; supersedes ADR-007's trigger rule; amendment: PostgreSQL dialect only (PGlite in tests), a verified SQLite importer, every service async and migrated | Accepted 2026-09-28 (owner decision), amended the same day |