|
@@ -159,7 +159,14 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
|
|
|
- **Client ABI pin:** the server deb is compiled against `DB_CLIENT_VERSION` (`packaging/Dockerfile.base`). Every 2.x client shares one SONAME, so a deb built against a newer client installs fine and only segfaults on the next restart - keep the pin equal to the deploy target, and ship a DB upgrade and a vectorapi rebuild together.
|
|
- **Client ABI pin:** the server deb is compiled against `DB_CLIENT_VERSION` (`packaging/Dockerfile.base`). Every 2.x client shares one SONAME, so a deb built against a newer client installs fine and only segfaults on the next restart - keep the pin equal to the deploy target, and ship a DB upgrade and a vectorapi rebuild together.
|
|
|
- **The apt repo now indexes EVERY published version, so a rollback is an ordinary apt command.** It used to list only the newest, which made `pkg=<old version>` uninstallable the moment anything newer was published - and that was never retention, only indexing: `dpkg-scanpackages` emits one version per package unless given `-m`, while the pool had kept every `.deb` all along (a publish reported "3 added, 309 unchanged"). Fixed 2026-10-08 in the deb-repo tooling; the trixie index went from 33 stanzas to 1191. **A downgrade needs `--allow-downgrades`** (`apt-get install --allow-downgrades pkg=0.7.1-1 ...`), and downgrade the three app packages TOGETHER or apt resolves a split version set. A plain `apt install pkg` still picks the newest, so ordinary installs are unaffected. The backup step still stages the installed `.deb`s out of `/var/cache/apt/archives/`, which stays the right belt-and-braces for a rollback when the repo itself is unreachable.
|
|
- **The apt repo now indexes EVERY published version, so a rollback is an ordinary apt command.** It used to list only the newest, which made `pkg=<old version>` uninstallable the moment anything newer was published - and that was never retention, only indexing: `dpkg-scanpackages` emits one version per package unless given `-m`, while the pool had kept every `.deb` all along (a publish reported "3 added, 309 unchanged"). Fixed 2026-10-08 in the deb-repo tooling; the trixie index went from 33 stanzas to 1191. **A downgrade needs `--allow-downgrades`** (`apt-get install --allow-downgrades pkg=0.7.1-1 ...`), and downgrade the three app packages TOGETHER or apt resolves a split version set. A plain `apt install pkg` still picks the newest, so ordinary installs are unaffected. The backup step still stages the installed `.deb`s out of `/var/cache/apt/archives/`, which stays the right belt-and-braces for a rollback when the repo itself is unreachable.
|
|
|
- **"The dev host cannot build the C++" was a misdiagnosis - it was a stale `protoc`.** The host builds everything natively; use `scripts/host-build.sh`. The old symptom was real: generated protos wanted `google/protobuf/map_field_inl.h`, a header protobuf 35 removed. But nothing in the database's tree includes that header - an **old protoc emits the include**. The host had libprotobuf 35.1 and gRPC 1.83 from the distro, and a hand-dropped static **protoc 25.2 in `~/.local/bin`** shadowing everything, while the distro's compiler package (`protobuf-35.1`, separate from `protobuf-devel`, which ships no protoc) was never installed. `find_program(PROTOC protoc REQUIRED)` took the 25.2 binary from PATH, generated code for a protobuf 25 runtime and compiled it against 35 headers. With a matching protoc the client and all of vectorapi compile and link natively. `host-build.sh` therefore picks protoc **by version rather than PATH order** and refuses to run on a mismatch, because the failure otherwise surfaces as a missing header deep in generated code rather than as a version complaint.
|
|
- **"The dev host cannot build the C++" was a misdiagnosis - it was a stale `protoc`.** The host builds everything natively; use `scripts/host-build.sh`. The old symptom was real: generated protos wanted `google/protobuf/map_field_inl.h`, a header protobuf 35 removed. But nothing in the database's tree includes that header - an **old protoc emits the include**. The host had libprotobuf 35.1 and gRPC 1.83 from the distro, and a hand-dropped static **protoc 25.2 in `~/.local/bin`** shadowing everything, while the distro's compiler package (`protobuf-35.1`, separate from `protobuf-devel`, which ships no protoc) was never installed. `find_program(PROTOC protoc REQUIRED)` took the 25.2 binary from PATH, generated code for a protobuf 25 runtime and compiled it against 35 headers. With a matching protoc the client and all of vectorapi compile and link natively. `host-build.sh` therefore picks protoc **by version rather than PATH order** and refuses to run on a mismatch, because the failure otherwise surfaces as a missing header deep in generated code rather than as a version complaint.
|
|
|
|
|
+- **ENCRYPTING A VECTOR COLLECTION IS SAFE FOR SEARCH AND FOR BACKUP. MEASURED, not reasoned.** The question arose because `encryptJsonFieldEx` reads "in a whole-document collection every other non-null scalar becomes `$ENCJ$`", walking arrays - which on its face turns a 4096-float vector into 4096 ciphertext strings, and because the body copy and the extracted vector index are separate things. The feared shape was the worst this estate collects: search keeps working off the index while the BODY copy becomes ciphertext, so the damage is invisible until a restore. Measured on a throwaway 2.17.1 instance (never the shared dev database), with a dim-4 collection, three known vectors, `createCollection(existing, encrypted=true)` flipping the flag on populated data:
|
|
|
|
|
+ - **Search is unaffected.** Each row is its own nearest neighbour at 1.0 before the flip, after it, and after the seal restart.
|
|
|
|
|
+ - **The export is BYTE-IDENTICAL**, same `content_sha256`, vectors as plain arrays and `label` in plaintext, because reads DECRYPT TRANSPARENTLY. Encryption is at rest only; nothing above the storage layer sees ciphertext.
|
|
|
|
|
+ - **Re-import retrieves correctly**, which is the load-bearing half a consumer insisted on: every restored row is its own nearest neighbour at 1.000000, and one fixed `query_vector` scores the rows identically to eight decimals in source and restored (`b=0.80000001, a=0.60000002, c=0.00000000` in both).
|
|
|
|
|
+ - **The cost is FILTERS, and it is total for that collection.** `label:eq:row-a` is refused: "cannot filter on a field stored encrypted ... its stored form is ciphertext, so any comparison would be silently wrong". So encrypting a collection trades every filter, sort, index and unique constraint on it. For a consumer that was decisive on three grounds: it removes the retrieval model on one collection, and on another it would silently convert a UNIQUE INDEX underpinning retry idempotency into a duplicate-write hazard.
|
|
|
|
|
+- **`encryption-verify` REPORTS CLEAN WHILE THE PLAINTEXT IS STILL ON DISK.** Measured in the same run: immediately after the online upgrade, `grep -F` found the plaintext label in BOTH `wal/wal-current.log` and the project's `data.mdb`, while verify printed `vecenc:vecs [encrypted] ... plaintext-required 0` and `CLEAN`. The only contrary signal is a separate line, `at-rest migration sealed: NO (restart pending)` - easy to read past. After a restart the plaintext was gone and the line read `sealed: yes`. **So CLEAN means "everything that must be ciphertext is ciphertext in the live store", NOT "no plaintext remains anywhere". Read the `sealed` line, and until it says yes the old copies are still readable.** Same family as the flag that recorded an intention: a check that answers confidently about a narrower question than the one being asked.
|
|
|
- **`encrypted_field` (422) is its own slug, not `validation`.** Database 2.17.0 encrypts any field named `password`, `secret`, `token`, `api_key`, `apiKey` or `credentials` at ANY depth in EVERY collection, and then REFUSES a filter, sort, index, unique constraint, relation or increment on one. It needs its own slug because the remedy is unlike every other validation failure: the request is well formed, the field name is correct, and no correction of the body helps - the caller must stop querying that field, storing a non-sensitive duplicate (a hash, or a boolean "set") or renaming it if it was never a credential. Folding it into `validation` would send them hunting a typo. Note what it REPLACES is worse than itself: before 2.17.0 a top-level field of those names was plaintext and filterable, and a NESTED one compared ciphertext and **silently matched nothing** - so the refusal turns a silently empty result into a visible error. **Our `/documents` filter grammar, `?sort=` and the index route all accept ANY field name with no validation, so a TENANT can trigger this; we cannot.** Our own tests use `password` only as a `ctx.mail` option key, never as a stored field being queried.
|
|
- **`encrypted_field` (422) is its own slug, not `validation`.** Database 2.17.0 encrypts any field named `password`, `secret`, `token`, `api_key`, `apiKey` or `credentials` at ANY depth in EVERY collection, and then REFUSES a filter, sort, index, unique constraint, relation or increment on one. It needs its own slug because the remedy is unlike every other validation failure: the request is well formed, the field name is correct, and no correction of the body helps - the caller must stop querying that field, storing a non-sensitive duplicate (a hash, or a boolean "set") or renaming it if it was never a credential. Folding it into `validation` would send them hunting a typo. Note what it REPLACES is worse than itself: before 2.17.0 a top-level field of those names was plaintext and filterable, and a NESTED one compared ciphertext and **silently matched nothing** - so the refusal turns a silently empty result into a visible error. **Our `/documents` filter grammar, `?sort=` and the index route all accept ANY field name with no validation, so a TENANT can trigger this; we cannot.** Our own tests use `password` only as a `ctx.mail` option key, never as a stored field being queried.
|
|
|
|
|
+ **IT IS DORMANT UNTIL THE CLIENT MOVES TO 2.17.x, AND I TOLD A CONSUMER IT WAS LIVE.** Measured against a 2.17.1 server with our shipped 2.14.0 client: a filter on an encrypted field comes back as slug **`validation`**, not `encrypted_field`, even though the server's message arrives intact. The reason is the client, not our mapping - carrying the server's error reason on READ calls (`find`, `similaritySearch`) is a 2.17.0 client change, so on 2.14.0 the reason is simply absent and `translate()` falls through to `validation`. So the slug shipped in 0.12.0 cannot fire on prod today. It starts working when `DB_CLIENT_VERSION` moves, which is the same dependency as the index-route mapping, and it covers the FILTER path too rather than only indexes.
|
|
|
- **WE CREATE EVERY COLLECTION WITH UNLIMITED VERSION HISTORY, and most of prod's history is therefore our own operational churn.** `createCollection(..., maxVersions = 0, ...)` and 0 means "keep unlimited history", not "keep none" - so every code push to a function has appended a full copy of the script forever. Measured on prod: `justice-pa:vectorapi_functions.hlog` 114 MB (the function REGISTRY, a handful of rows), `default:vectorapi_function_jobs.hlog` 14 MB, `justice-pa:vectorapi_function_runs.hlog` 4.7 MB - about 133 MB of the box's 192 MB of history, roughly 69%, none of it data anyone would ever read. A consumer's 47 MB of `kb_chunks` history is retention of the same kind on a collection that has not changed size in days.
|
|
- **WE CREATE EVERY COLLECTION WITH UNLIMITED VERSION HISTORY, and most of prod's history is therefore our own operational churn.** `createCollection(..., maxVersions = 0, ...)` and 0 means "keep unlimited history", not "keep none" - so every code push to a function has appended a full copy of the script forever. Measured on prod: `justice-pa:vectorapi_functions.hlog` 114 MB (the function REGISTRY, a handful of rows), `default:vectorapi_function_jobs.hlog` 14 MB, `justice-pa:vectorapi_function_runs.hlog` 4.7 MB - about 133 MB of the box's 192 MB of history, roughly 69%, none of it data anyone would ever read. A consumer's 47 MB of `kb_chunks` history is retention of the same kind on a collection that has not changed size in days.
|
|
|
**IT IS A DISK AND GROWTH PROBLEM ONLY. I claimed history bytes dominate the at-rest encryption migration, and measured on prod's own data they do not matter to it at all.** That claim was inherited from the database team's sizing model and amplified by me, and one measurement would have settled it before I asked them for a boot mode and asked a consumer to weigh an escape hatch. Measured with 2.17.1 on a copy of prod's data directory (1.6 GB, 24753 docs, 65 collections, prod's own config, 900 MB cap): **190 seconds total**, of which the ENCRYPTION pass was **13 seconds** (24733 rows scanned, 19 encrypted, 26 history versions) and **compaction was 176 seconds, 167 of them novitax's single 339 MB env**. The seal was under a second.
|
|
**IT IS A DISK AND GROWTH PROBLEM ONLY. I claimed history bytes dominate the at-rest encryption migration, and measured on prod's own data they do not matter to it at all.** That claim was inherited from the database team's sizing model and amplified by me, and one measurement would have settled it before I asked them for a boot mode and asked a consumer to weigh an escape hatch. Measured with 2.17.1 on a copy of prod's data directory (1.6 GB, 24753 docs, 65 collections, prod's own config, 900 MB cap): **190 seconds total**, of which the ENCRYPTION pass was **13 seconds** (24733 rows scanned, 19 encrypted, 26 history versions) and **compaction was 176 seconds, 167 of them novitax's single 339 MB env**. The seal was under a second.
|
|
|
**The structural reason, which is what makes it general rather than a quirk of this dataset: the migration only rewrites history belonging to ENCRYPTED collections.** Our 114 MB `vectorapi_functions.hlog` and the consumer's 47 MB `kb_chunks.hlog` sit on `encrypted=false` collections, so they are scanned and left alone - `encryption-verify` reports `novitax:kb_chunks` with `history 18648, plaintext-required 0`. So the migration's cost tracks **the largest project's `data.mdb`, through compaction**, and almost nothing else. An operator with a huge history and a small env would read the old model and expect the opposite of what happens.
|
|
**The structural reason, which is what makes it general rather than a quirk of this dataset: the migration only rewrites history belonging to ENCRYPTED collections.** Our 114 MB `vectorapi_functions.hlog` and the consumer's 47 MB `kb_chunks.hlog` sit on `encrypted=false` collections, so they are scanned and left alone - `encryption-verify` reports `novitax:kb_chunks` with `history 18648, plaintext-required 0`. So the migration's cost tracks **the largest project's `data.mdb`, through compaction**, and almost nothing else. An operator with a huge history and a small env would read the old model and expect the opposite of what happens.
|