openvibers/openvibe.sdk Commits

openvibe-sdk 0.38.1: a fresh database applies its contract migrations (#34)

OP OpenVibers committed 10 Oct 2026 · tag v0.38. · 0 files, +0 −0

`migrate`: a **fresh database applies its contract migrations at once.**

When a run starts with no row in `ov_migrations` (a new install, a test database, a restore drill into an empty schema), no previous release can be running against it, so the N-1 window (ADR-016/028) has nothing to protect. Before, a fresh database stopped at its first contract for `windowDays`. A held contract holds everything after it, so every migration past that point went untested. Found on 2026-10-10: OpenVibe.Chat's test databases have stopped at 0004 since its 0005 contract, so its 0006 and 0007 never ran in a test. A new expand (Chat's SDK outbox) could not be tested at all.

**Existing databases are unchanged.** A contract waits until its expand has been applied for the window, and holds what follows. That includes an expand and its contract arriving in the same deploy, because the previous release may be running against the expanded schema.

Only three repositories have contract migrations today (Chat, Codes, Tips), so only their test databases change: they now carry the final schema, as production does after the window.

- `src/db/migrate.js`: `fresh = done.size === 0` and contracts are not held on a fresh run; the header explains why.
- `test/db.test.js`: a fresh database applies the contract with the rest. An existing database holds a new contract and the expand after it until the window passes. An expand plus contract in one deploy holds the contract.
- `test/testing-db.test.js`: a snapshot built fresh carries its contract, and a hit is that schema. `src/testing/db.js` comment updated.

0.38.1: version, changelog, STATUS and browser bundle updated. `ov test`: 40 files reached, green.

This commit has no diff to show.