# Changelog Releases are cut weekly on **Tuesday** (see "Release policy" in `CLAUDE.md`). Every change merged to `main` adds a line under **Unreleased** in the same commit; cutting a release renames that heading to the version and date. Categories: Added, Changed (behaviour a consumer can observe), Fixed, Packaging. Mark every line **[server]**, **[client]** or **[both]**: a server-side change reaches every consumer when the server restarts, a client-side one only when they rebuild against the new library. Per-release detail (design, measurements, revert evidence) stays in `CLAUDE.md`; consumer-facing usage is in `docs/integration-guide.md`. ## Unreleased ## 2.21.7 - 2026-11-20 (bug fix, server only) ### Fixed - **[server]** WAL replay reports sequence numbers missing from a file (`N sequence number(s) in this file's range have no record, at M place(s)`, WARN). A file can be perfectly framed and still lack records: the 2.21.5 race dropped 63 whole records from a production file, and every reader reported a complete read. - **[server]** Upload metadata that cannot be right is refused with `INVALID_ARGUMENT`: a project that is not a valid project name (reason `invalid_project`), or a MIME type without a `/` (reason `invalid_mime_type`). Before, it was stored as given; two records held a file path as their project and could never be addressed. - **[server]** An `update` that removes fields the stored document had is logged (`update of / removed N field(s) ...`, WARN, at most once a minute per collection, system collections excepted). An update replaces the whole document, so a call meant as a `patch` silently wiped fields. ### Added - **[server]** `storage.consistency.memory_newer`: `report` (default) | `write`. For rows the boot version audit finds NEWER in memory than on disk, `write` copies memory's version to disk at boot. The default leaves them, and reads show the older disk copy until the next write to the row. Opt-in per instance, because it makes a write nobody has reviewed the one every read returns. ## 2.21.6 - 2026-11-20 (bug fix, server only) ### Fixed - **[server]** ⚠ A damaged WAL record no longer costs the rest of its file. Replay stopped at the first record it could not read: one damaged record (the 2.21.5 flush race) made a production replay skip 160,261 intact records behind it. The reader now resynchronises. From a record that does not frame, checksum or parse, it scans forward to the next offset holding a valid record (plausible length, op type, a sequence above the last good one, then the checksum and a full parse), continues from there, and counts what it skipped (`... N skipped past, B bytes` in the per-file line). - **[server]** The WAL's open scan (which finds the highest sequence number) had the same fail-stop. Damage in the current file made it stop early, and new writes then reused sequence numbers already on disk. It now uses the same resynchronising reader. - **[server]** After a crash mid-write, the next process appended after the half-written record, leaving a damaged record in the middle of the file. Opening the WAL now cuts such a torn tail (bytes after the last valid record that no resync can parse) before appending (`WAL: cut a torn tail of N byte(s)`, WARN). ## 2.21.5 - 2026-11-20 (bug fix, server only) ### Fixed - **[server]** ⚠ The WAL file could be corrupted by a race: `sync()` (the WAL sync thread, every 100 ms, and the flush before a relation cascade) flushed the file stream without the write lock, while writes to the same stream held it. A record could lose or gain a byte. Replay then stopped at that record and skipped every intact record behind it in the file. This is the cause of the 2.21.4 production replay that applied 193,776 of 354,089 entries: one damaged record, 160,261 intact ones never applied. Now the flush holds the lock. The fsync runs outside it, on a descriptor opened under it. - **[server]** ⚠ The 2.21.4 boot version audit reloaded from LMDB every row whose `_version` or `_updated_at` differed, on the premise that LMDB is always the newer side. It is not: a store with old mirror failures (before 2.21.0 they were not recorded) has rows where memory holds a write LMDB missed, and 2.21.4 replaced that newer copy with LMDB's older one. Found by staging 2.21.4 on a real backup: 4 of 5 sampled rows were newer in memory. The audit now reloads a row only when LMDB's copy is newer (later `_updated_at`, then higher `_version`). Rows newer in memory are left alone and reported (`... are NEWER than LMDB's copy, left in memory`). Both versions are logged for the first five rows of each kind. ## 2.21.4 - 2026-11-20 (bug fix, server only) ### Fixed - **[server]** ⚠ Snapshots stopped completing for good once eviction had moved a row of a system collection (`_collection_meta`, `_views`, ...) out of memory. System collections are not mirrored to LMDB, so the snapshot could read such a row back only from the WAL; after one snapshot truncated the WAL, every later one failed ("evicted document '_collection_meta/...' could not be read for the snapshot"), the WAL was never truncated again and recovery grew with it (15 days, 276 MB, on one production instance). Before 2.21.0 the same row was instead written to the snapshot as absent, so the next boot lost that collection's config. System collections are no longer evicted (they hold small metadata). A server already in this state recovers at the restart into this version: the rows come back from the last good snapshot and stay resident, and the first snapshot completes. - **[server]** WAL replay now extends systemd's start timeout every 20,000 entries, and again before the post-replay LMDB re-mirror; recovery logs `WAL replay: N entries applied`. Before, a replay longer than 10 minutes was killed and restarted from the beginning, a loop that never booted. - **[server]** A snapshot could be killed by anything that listed snapshots while it was being written: the listing removed every `snapshot-*.tmp`, including the one in progress ("Failed to reopen snapshot tmp for fsync"). `GetStats` and the retention pass list snapshots. Orphaned `.tmp` files (left only by a killed process; a failed write removes its own) are now removed once, during recovery. This is probably also the 2.21.1 "verification failed after write" pair that was put down to two concurrent snapshots. - **[server]** ⚠ After an incomplete WAL replay, memory kept older versions of rows LMDB had newer copies of, and nothing noticed. Reads (served from LMDB) were right. But a `patch` or `increment` merged into memory's old body and wrote it over LMDB's newer row, silently reverting every field changed since. `updateIfVersion` compared against memory's older version. History and the next snapshot took the old version, which made it permanent. Found on a production boot that applied 193,776 of the 354,089 entries above its snapshot (cause under investigation). New boot step "memory/disk version audit": every resident row of a mirrored collection whose `_version` or `_updated_at` differs from LMDB's is reloaded from LMDB (no history, WAL or event). It runs only while the mirror is healthy with no drift, and after the re-mirror pass and the mirror-pending replay have written to LMDB every row for which memory is authoritative. Logged per collection (WARN), with a summary. - **[server]** WAL replay reports each file: entries applied, already in the snapshot, unreadable (checksum), the sequence range read, and bytes read against the file size. WARN when a file's header is unreadable, an entry fails its checksum, or the file ends early. Before, all three were skipped without a trace. - **[docs]** The 2.21.3 guide said the server's `malloc_trim` returns released vector memory to the system. The packaged server uses jemalloc, so memory goes back through jemalloc's background purge, which the systemd unit's `MALLOC_CONF` turns on. Without it, an idle process keeps the pages (measured: 32 MB of 194 MB returned, against all of it with the setting). ## 2.21.3 - 2026-11-03 (bug fix, server + client) ### Added - **[both]** `served_from_memory` on `FindResponse` and `SimilaritySearchResponse`, capability `served_from_memory`: true when MemoryStore answered instead of LMDB (mirror unhealthy or drifted, or a `_` system collection). Client: `Client::SearchPath` filled by new overloads `similaritySearch(..., filters, SearchPath&)` and `findWithMetrics(..., SearchPath&)`. No existing struct changes size. Before this a degraded vector search looked exactly like a healthy one. ### Fixed - **[server]** Every vector was held twice: in MemoryStore (616 MiB on one production instance) and, for search, in LMDB's pages. Search, get and export already read LMDB, so the memory copy only competed with the page cache; on a 2 GB host the first search on a large collection took 1.4-5.1 s while process memory went to swap. The eviction loop now drops a vector from memory once LMDB holds a byte-identical copy (mirror healthy, zero drift, no write in flight); a write reads it back first; the degraded search reads released vectors from LMDB, so it loses none. The memory line adds `(R more in LMDB only)`. **Observable:** the estimate falls by the vector share within seconds of boot; nothing a client reads changes. **Latency:** a write to a row whose vector was released does one extra LMDB read (`dimension x 4` bytes); a degraded search reads every released vector from LMDB. - **[server]** Every boot logged eight "v2.0 deprecation: storage.memory. is deprecated and will be removed in v2.1" warnings for `max_memory_mb` and the eviction keys. They were never removed and no removal is planned: they set the memory budget, eviction and the pressure levels (emergency refuses writes). The warning is gone. ## 2.21.2 - 2026-10-27 (bug fix, server only) ### Fixed - **[server]** The memory budget did not cover stored vectors. A vector loaded at boot (snapshot or WAL) was never added to the memory estimate, and eviction removed only a document's body, so a vector stayed in memory for the life of the process and was written into every snapshot after it. One production instance reported `237 MB estimated (46%)` with about 615 MiB of vectors resident beside it. Vectors are now counted wherever they enter memory, eviction releases a document's vector with its body (while the LMDB mirror is healthy), a reload brings it back from LMDB, and the snapshot reads released vectors back from LMDB. - **[server]** The snapshot's vector section and the write handlers' WAL vector entries read the in-memory vector map with no lock; both now copy under the collection lock. ### Changed - **[server]** The memory line reports the vector share: `Memory check: N MB estimated (P%, pressure=...), of which vectors V MB, ...`. - **[server]** ⚠ At the first boot on this version the memory estimate rises by every resident vector (`dimension x 4 + 32` bytes each). A vector-heavy instance whose `max_memory_mb` was sized from the old figure can boot into `hard` or `emergency` pressure. At `emergency`, writes answer `RESOURCE_EXHAUSTED` until eviction has released enough vectors. Raise `max_memory_mb` before upgrading to keep memory use as it is, or keep it and let eviction release vectors (lower resident memory, a burst of refused writes after the boot). Released vectors cost an LMDB read when their document is reloaded. Server only; the client stays 2.20.0. ## 2.21.1 - 2026-10-22 (bug fix, server only) ### Fixed - **[server]** ⚠ Every boot that replayed the WAL recorded each replayed update and delete in version history AGAIN (it had been recorded when first written), and did so for collections with versioning OFF too, because replay runs before the collection settings are loaded. One production boot that replayed 14,998 entries (after a stop that was killed mid-snapshot) wrote 1.9 GB of history into two versioning-off collections. Replay now records no history. - **[server]** `max_versions` was enforced only when it was lowered, so a capped collection's history file grew without bound (a comment claimed the snapshot loop pruned it; nothing did). After each snapshot, a capped file that has grown past 16 MB and twice its size at its last prune is now pruned to the cap. The first snapshot after the upgrade prunes every capped file over 16 MB once, which reclaims history like the 1.9 GB above. - **[server]** Eviction removed a document from memory a moment before recording its stub, so for that moment it was in neither place: a snapshot that had listed it could write it as deleted. The stub is now recorded first. - **[server]** Two snapshots could run at once (the final snapshot at shutdown and the periodic one); within the same second they shared a file name, and one failed or renamed the other's half-written file. Snapshots now run one at a time. ### Changed - **[server]** The boot key audit no longer logs one line per adopted row; the summary says how many were adopted (loaded unchanged) and how many are not adoptable because their collection exists only on disk. In `report` mode each collection says what `adopt` would do, and `consistency-report.json` carries `collection_in_memory` per collection, so the step can be sized before it is taken. ## 2.21.0 - 2026-10-22 (out of cycle, owner-approved; server only) ### Fixed - **[server]** ⚠ A snapshot silently left out every document that stayed evicted across a WAL rotation: it read an evicted document back only from the WAL, and the previous snapshot had deleted that WAL file, so the document was written as absent with a WARN. The next boot came up without it while LMDB kept it (7,219 rows on one production instance, found by the 2.20.2 key audit): readable, invisible to writes, and missing from any backup of `snapshots/` plus `wal/`. The snapshot now reads an evicted document from LMDB, and a document it still cannot read fails the snapshot (the WAL is kept) instead of being dropped. - **[server]** A row whose copy to LMDB failed was repaired at the next boot only if its WAL entry still existed; a snapshot in between made the divergence permanent. Failed copies are now recorded durably (`mirror-pending.log` in the data directory) and repaired from memory at the next boot. ### Added - **[server]** `storage.consistency`: what the boot key audit does about rows memory and disk disagree on. `disk_only`: `adopt` (default: load into memory; reads already see them) / `report` / `remove`. `memory_only`: `report` (default) / `write` / `remove`. Complete id lists in `consistency-report.json` in the data directory every boot. ### Observable - **[server]** With the default `disk_only: adopt`, the first boot on this version loads every disk-only row into memory (on the instance above, 7,219 rows): memory use rises by their size until eviction trims it, and boot takes longer by the time to read them. Set `disk_only: report` first to see the list before anything acts. The key audit logs at WARN (it was ERROR), and ERROR only when a repair failed. ## 2.20.2 - 2026-10-22 (bug fix, server only) ### Fixed - **[server]** ⚠ A row that LMDB held and MemoryStore did not could be read and never written: patch, update and delete answered not-found, and an insert or upsert of its id was ACCEPTED and overwrote it at version 1. Found on a production instance. MemoryStore is rebuilt from snapshot + WAL, never from LMDB, so no restart repaired it. A write that misses memory now checks LMDB and, if the row is there, loads it and applies the write to it (WARN per row). An insert of its id is `AlreadyExists`. Only while LMDB is what reads are served from (mirror healthy, no drift). - **[server]** `upsert` reported `inserted=true` for a row that existed but was not in memory (evicted since 2.12.1, or the case above), and skipped keeping the stored ciphertext of unchanged sensitive fields (a spurious history diff). An evicted row's `_created_by` was NOT affected (the store keeps the original); a disk-only row's was, because the upsert re-created it. `_created_by` keeps its meaning (the creator) on every version; 2.20.2 removes an exception, it does not redefine the field. The exception belongs to a ROW, not a date: a disk-only row that an insert or upsert re-created before 2.20.2 names that writer, and still will after the upgrade (nothing repairs it retroactively), so an audit across the upgrade compares like with like everywhere else. ### Added - **[server]** Boot step "memory/disk key audit": per collection, the ids LMDB holds that MemoryStore does not and the reverse, logged as ERROR with counts and up to 10 ids each; read-only, changes nothing. Walks keys, never values: about 120 ms and a few MB per 100,000 rows (memory scales with the largest collection, not the store). ### Observable - **[server]** An insert of an id that is on disk but was not in memory now fails `AlreadyExists` instead of silently overwriting. Each insert of a new id costs one LMDB existence check (microseconds). No format, marker or migration change: 2.20.1 runs on a data directory 2.20.2 has used. ## 2.20.1 - 2026-10-19 (bug fix, server only) ### Fixed - **[server]** ⚠ A snapshot held the whole store in memory twice more: the serialised body, a compressed copy beside it, and a copy of each collection's documents. A store that outgrew its host was OOM-killed at every snapshot, the WAL was never truncated, and recovery grew with it until the server could no longer boot. The writer now streams to disk a chunk at a time; a snapshot adds a few tens of MB to memory whatever the store's size. The file format is unchanged (older servers read the new files and the reverse). This removes the cause, not the failure mode: boot still holds the whole dataset in memory, so a large WAL left by anything else (a crash, a long stop, a full disk) can still keep a small host from booting (ROADMAP 5e). ### Added - **[server]** A snapshot that never finished (the process was killed while writing it) is reported at the next boot as an ERROR, with the WAL size and the age of the newest snapshot; a WARN whenever the WAL reaches twice the size that triggers a snapshot; and an INFO line at recovery naming the WAL size and the newest snapshot. Boot logs each step after the backfill. ## 2.20.0 - 2026-10-16 (out of cycle: security) ### Fixed - **[server]** REGEX filters ran on `std::regex`, which backtracks: a caller-supplied pattern such as `(a+)+$` could tie up a server thread for minutes against one long value (any key holder with a read grant). They now run on RE2, in time linear in the value, compiled once per query instead of once per row. Capability `re2_regex_filters`. - **[server]** A REGEX pattern that does not compile was answered as "no match"; find, count, similaritySearch and createView now refuse it with INVALID_ARGUMENT, reason `invalid_pattern` (reading the reason on a read call needs a 2.17.0+ client). - **[server]** Character classes over non-ASCII letters matched bytes: `[áÁ]` now matches one character, so `sz[áÁ]mfejt` matches and `[öÖ]` no longer matches unrelated accented text. `(?i)` works as a case-insensitive flag. ### Changed - **[server]** ⚠ Patterns with backreferences or lookaround are refused (`invalid_pattern`): RE2 has neither. A view stored with such a pattern matches nothing; recreate it. - **[client]** `Client::Capability::kRe2RegexFilters`. - Releases follow a weekly Tuesday cadence; hotfixes only for security, data loss and regressions of the latest release. (process, no code change) ## 2.19.0 - 2026-10-15 ### Added - `_expires_at` (absolute ms) on get/find/export when a document has an expiry; filterable on a 2.19.0 server (`document_expires_at`); reserved in write bodies (stripped by server and client). ## 2.18.1 - 2026-10-15 (client only) ### Added - `smartbotic-db-cli configure [--versioning on|off] [--max-versions N]`; `info` prints `default_ttl_seconds`. ### Packaging - 2.18.1-2: the library ships a Debian symbols file; the CLI's `Depends` is computed by `dpkg-shlibdeps` (needs library >= 2.17.0) instead of pinning the library to its own version. ## 2.18.0 - 2026-10-13 ### Changed - Range filters (GT/GTE/LT/LTE) match only number-to-number or string-to-string (`typed_range_filters`); null, booleans and type mismatches never match. ## 2.17.2 - 2026-10-12 ### Fixed - Inserts carrying a vector into an encrypted collection were refused (`_vector` is never encrypted now). - A reseal is requested only when an online encryption upgrade rewrote plaintext, and compacts only that project. - History locks are per collection; the `maxVersions` prune runs outside the global lock. - `encryption-verify` prints `CLEAN (UNSEALED: ...)` while a reseal is pending; a missing `key_file` is named in the startup error. ## 2.17.1 - 2026-10-12 ### Fixed - `encryption-verify` stalled history-recording writes server-wide. - The migration's memory scaled with the largest history file (now streamed). - Compaction could leave an env without `data.mdb` if killed mid-swap. - `info` reported the collection's own encryption options, not the enforced rule. - `project:_name` collections are refused (writes to them were unreadable). - Lowering `maxVersions` on an existing collection prunes its history. ## 2.17.0 - 2026-10-12 ### Fixed - Encryption at rest: the `encrypted` flag and `sensitive_fields` did nothing, top-level sensitive names were plaintext, patch and migration ops never encrypted. One-time boot migration with a seal; `encryption-verify`. ### Changed - Comparisons over encrypted values are refused (`encrypted_field`). ## 2.16.0 - 2026-10-09 ### Added - Optional per-collection JSON Schema (enforce/audit), read back, suggested from existing rows. ## 2.15.0 - 2026-10-09 ### Added - `GetServerInfo` and capability names; client and server release independently. ### Packaging - The server no longer depends on the client library; `--only client|server`. ## 2.14.0 - 2026-10-09 ### Added - Filtered `similaritySearch` (pre-filter, exact). ### Fixed - Vector search now applies the access policy's row predicate and masks. ## 2.13.1 - 2026-10-08 ### Fixed - A row could grow past the send limit through patches (write-time size guard). - Timed-out non-idempotent writes were retried; `connect()` did not check reachability. ## 2.13.0 - 2026-10-08 ### Added - Vector read-back (`WithVector`), `exportCollection`. ### Fixed - A document and its vector were two LMDB commits; read-metadata names in write bodies were stored. ## 2.12.0 - 2.12.4 - 2026-10-07 - 2.12.0: refusal detail (`sbdb-error-detail-bin`), `patchIfVersion`, `increment`, composite unique constraints, `removeManyAs`, event actor. - 2.12.1: evicted documents were invisible to writes; duplicate id as AlreadyExists. - 2.12.2: dropping a collection or project left its declarations (and documents). - 2.12.3: file store size limit, project drop and streaming download. - 2.12.4: a failed read looked like "nothing there"; reads now throw. Earlier releases: see the per-version entries in `CLAUDE.md`.