C++20 REST API fronting smartbotic-database (gRPC) for n8n + other clients. Stores RAG vectors + JSON, organized into projects with multi-key per-project-grant auth. React admin UI. Ships as Debian .debs.
# Backend + web UI (Release)
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_WEBUI=ON -S .
cmake --build build -j"$(nproc)"
# Tests (GoogleTest). Integration tests need a running smartbotic-database on localhost:9004;
# they GTEST_SKIP() cleanly if it's unreachable. BUILD_WEBUI=OFF to skip the npm build during test cycles.
cmake -B build -G Ninja -DBUILD_TESTS=ON -DBUILD_WEBUI=OFF -S . && cmake --build build -j"$(nproc)"
ctest --test-dir build --output-on-failure
# Run locally (use the repo's api/ for /openapi.json,/llms.txt,/docs and the built UI)
SMARTBOTIC_VECTORAPI_KEY=dev ./build/src/smartbotic-vectorapi \
--config config/config.json --share-dir "$PWD/api" --webui-dir "$PWD/build/webui/dist"
# Native host build: clang, the whole repo including the runner, ~100 s, and the
# compile_commands.json that clangd reads. Development only - it links the
# host's protobuf/gRPC, not the versions the .deb is built against.
scripts/host-build.sh --client # --client also rebuilds libsmartbotic-db-client into the prefix
scripts/host-build.sh --test # + ctest, SERIALLY (see the ApiFixture note below)
# Web UI only
cd webui && npm install && npm run build # → webui/dist ; `npm run dev` for the :3000 proxy dev server
# Local backend for UI work, or when you want Debian's exact toolchain
# packaging/devstack: DB + API from the release .debs in a Debian 13 container.
docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svapi-devstack
src/ - the server. vectorapi_core static lib + main.cpp. Namespace svapi. Flat headers, quoted includes.
db_gateway (qualify(project,coll) + DbGateway over smartbotic::database::Client), settings_store (global settings and per-project embedding overrides, hot-reload, one subscribe stream for both), project_settings (ProjectEmbeddingSettings + the pure resolveEmbedding()), outbound_http (User-Agent + TLS defaults for every external call), key_store (API keys, hot-reload, bootstrap admin key), collection_registry (per-project metadata), embeddings (OpenAI), auth (sessions, bearer/cookie), server (ApiServer + auth helpers), handlers/* (one file per route group)./api/* (401); each handler authorizes via requireKey → requireAdmin / requireProjectAccess (403). Keys are referenced by a stable id (not the secret).
AND TO THE ORIGIN ALLOW-LIST, FROM 0.15.0 - IT SKIPPED IT ENTIRELY BEFORE, AND THE REASON IS THE SHAPE THIS FILE KEEPS RECORDING: THE CHECK LIVED IN A FUNCTION THE ROUTE DOES NOT CALL. requireCapability consults the allow-list; the listing authorizes through requireProjectAccess plus the scope filter and therefore never reached it. Measured by a consumer 2026-10-16 with their own publishable key: the listing answered 200 with the full inventory (names, document counts, sizes, kind) from Origin: https://evil.example.com, while a document read with that same Origin answered 403. A publishable key ships in the browser, so "any origin holding the key" is effectively anyone - and it sat directly against the reason the scope refusal is 403 rather than 404, where we deliberately stop a scoped key discovering which collections exist outside its scope while this route handed over the whole list.
Now one requireAllowedOrigin() is called by both, so they cannot drift. An ABSENT Origin is refused when a list is set (originAllowed("") is false for a non-empty list), and that was left IDENTICAL on purpose rather than softened for the listing: the defect was the listing behaving differently from its siblings, and a second, gentler rule would have replaced one inconsistency with another. The consequence is worth telling consumers plainly - a key meant for server-side use must carry no allow-list, since a non-browser client sends no Origin and can never satisfy one. That was already true of document reads, so it is not a new constraint; a test now pins both routes to the same answer for an absent Origin, which is the evidence for saying so.
THE COLLECTIONS LISTING ANSWERS TO THE SCOPE RULES AS WELL AS THE PROJECT GRANT (2026-10-13). It used to check only requireProjectAccess, which never consults the rules, so a key granted exactly ONE collection could read every collection's name, document count and size in its project. The tell was internal inconsistency rather than a report: the index-values route next door authorizes through requireCapability, which does consult them. Three decisions in the fix are load-bearing:KeyScope::reachesCollection), deliberately weaker than findRule(name, KeyOp::List). A key that may read one document there already knows the collection exists, so hiding the name buys nothing and costs the thing the listing was added for - a consumer had to hardcode four collection names into a backup script, and a collection added later was silently missed. What the listing must not do is enumerate collections the key cannot touch AT ALL. A read-only rule therefore still shows the name, which keeps AScopedKeyMayListCollectionsButNotCreateThem true.requireCapabilityCore per collection, because that function also CHARGES THE RATE LIMITER. One listing of fifty collections would have spent fifty of the key's tokens and could rate-limit a caller for a single request. The limit is charged once, for the one request it is, and a test pins that a two-per-minute key affords one listing of several collections. The "one implementation" rule is still honoured - reachesCollection calls the same collMatches; what is not reused is the throwing-and-charging wrapper, which is wrong for a filter./fn rather than 403; and the response carries scope_filtered, which is true for EVERY scoped key whether or not anything was withheld. "Something was hidden" would leak one bit about the existence of a collection outside the caller's scope; "your view is partial" leaks nothing a holder cannot derive from their own key. It exists because an empty list would otherwise be indistinguishable from an empty project, which is this file's most repeated trap.
CONSEQUENCE WORTH KNOWING BEFORE YOU PROBE ANYTHING: an unauthenticated request to a NONEXISTENT /api/* path answers 401, not 404, because the pre-routing filter runs before routing and never consults the route table. So a 401 cannot distinguish "the route exists and I lack a key" from "there is no such route" - and reading one as "the service is alive" is a check that answers confidently about a different question. Measured during the 0.12.0 deploy: /api/v1/healthz gave 401 unauthenticated and 404 with a valid admin key, because the health route is /healthz and is NOT under /api/. Probe liveness at /healthz, and when a path matters, send a key so the 404 can reach you.webui/ - React 19 + Vite + TS (strict, erasableSyntaxOnly) + Tailwind + Monaco. npx tsc --noEmit is NOT the build check - it passed on a malformed import that npm run build (tsc -b && vite build) rejected, because the project build uses different settings. Verify a UI change with npm run build.
Functions settings tab exists and is ADMIN-ONLY, matching its route (requireAdmin, not requireProjectManage): it bounds what one project may take from a runner every other project shares. It carries the per-kind wall caps and network_egress, both of which were previously reachable only by curl - and a control nobody can see is a control nobody knows exists, which mattered most for egress, where an operator could not tell whether a project's functions had outbound access. Egress renders THREE states, because network_egress is the effective value and network_egress_set says whether it was chosen or inherited: "allow (inherited)" is a different statement from "allow, set here". An empty wall-cap field means NO project cap, which is not a cap of zero, so it is held as a string to keep an empty input and a zero distinguishable all the way to the request.search, rather than annotating it. search ignores the field - it is a case-insensitive substring over the whole document, id and keys included - and the three inputs read as field/op/value, which asserts a scope it does not have. A control that cannot affect the result must not look like it can. The hint points at regex for a field-scoped substring, and contains gets its own hint because array membership is equally easy to misread as a substring.SaveButton IS a <button type="submit">, so it belongs inside a <form onSubmit> and must not be wrapped in another button. The toast store's push takes (msg, kind) positionally, not an options object. pages/Functions.tsx holds fn/tab in the URL (a draft is ?new=1 and carries no source, so it is deliberately not shareable); components/ScopeRules.tsx is the rules/ops editor shared by key scopes and function policies, with allowEmpty for the latter because an empty function policy is legal. require_human_token is hidden for function policies: it is a captcha header check in requireCapability, and a function is authorized through requireCapabilityCore, which never sees an HTTP request - offering it would store a field that silently does nothing. Cookie-session auth (credentials:'include'). Pages read currentProject/admin from useAuthStore; all calls go through src/api/client.ts. Documents keeps collection, the filter triple (field/op/value) and open in the URL, so relation links are ordinary links and any filtered view is shareable; changing collection closes an open editor (it belongs to the collection being left). pages/Settings.tsx is a tab shell over pages/settings/* (Embeddings, Cache & performance, Access & security, Web UI are admin-only; the per-project embeddings tab is not, so /settings is not admin-gated in App.tsx). Shared controls live in components/form.tsx.runner/ - the function runner service, a second binary (smartbotic-vectorapi-runner). Four layers split by what they must link, which is also what decides where each can be tested: runner_core (QuickJS engine + pool, no database), runner_protocol (/run, /validate, /health as JSON in / JSON out, no transport and no database - which is why its 30 tests run on the dev host), runner_net (libcurl + the IMAP/MIME parsers + the mail budget + the error map; links neither vectorapi_core nor the database client, so its ~200 tests run on the dev host too), runner_host (the ctx.* surface; links vectorapi_core AND runner_net). src/main.cpp is the only part that links the world and the only part the dev host cannot build. The QuickJS execution core (runner_core). Builds as its own top-level project (cmake -S runner -B build-runner), which is the one part of this repo that compiles on the Void dev host, since it links neither vectorapi_core nor the database client. BUILD_RUNNER=ON wires it into the root build; it is OFF by default because it vendors QuickJS from GitHub at configure time and an ordinary build must not start depending on a network fetch.api/ - openapi.json (3.1), llms.txt (llmstxt.org), docs/ (Redoc page). Served at /openapi.json, /llms.txt, /docs. Shipped in the server .deb. Keep these in sync when changing routes.packaging/ - build.sh (--local + Docker trixie), deb/create-debs.sh, control templates, systemd unit, maintainer scripts. docs/superpowers/ - design spec (esp. Addendum A) + the 3 implementation plans.nlohmann/json, spdlog, cpp-httplib (FetchContent, OpenSSL on). Handlers throw svapi::ApiError; a global exception handler maps to {error:{code,message}} + HTTP status (errors.hpp: 400/401/403/404/422/503/500).field:op:value (op ∈ eq/ne/gt/gte/lt/lte/in/contains/exists/regex/search). Used by /documents (?filter=, repeatable) and vector /search (filters body array) - both parse with parseFilter() and are evaluated by the DB, so semantics never diverge. contains is array membership. A SILENCE IN api/llms.txt PROPAGATES AS CONFIDENTLY AS A WRONG SENTENCE, and it is harder to find because you cannot grep for an absence. Recorded 2026-10-13 after the second instance in one week of an undocumented behaviour reaching a consumer's DESIGN rather than their code. The specimen: quoting a filter value appeared ZERO times in this file. The rule is one line (parseFilter runs json::parse and falls back to a literal string) and entirely learnable, and because nobody wrote it down a consumer was about to ship a query builder that worked on every version string they currently hold and would have returned nothing silently the day a customer released a two-component version. They found it by MEASURING, not by reading - which is the only way an absence can be found. So when fixing a documented behaviour, also ask what a caller would have to discover by experiment; the method that works is to list what WE only learned by measuring, because that is exactly what a reader cannot learn at all.
This documentation's own wrong sentence about search PROPAGATED into two consumers' notes - one copied "use search for substrings" from here into their CLAUDE.md and had not called it yet, the other followed it and shipped a live bug where a keyword fallback matched a chat id and a category instead of the field it named. A wrong sentence in a doc is a defect with a blast radius, not a tidiness problem, and it travels to places that never read the code. search IGNORES THE FIELD NAME: it is a case-insensitive substring over the WHOLE document - the id, the keys, and every string and number in it - so name:search:foo matches a document with "foo" anywhere, not in name. Measured on prod with controls: nosuchfield:search:webber returns rows while nosuchfield:eq:webber returns none, and departmentKey:search:szamla returns rows while departmentKey:eq:szamla returns none. A consumer's control is stronger than either of mine and worth reusing: status:search:webber returns rows where status only ever holds draft or approved - that proves the operator read a value out of a DIFFERENT field, where a nonexistent-field control only proves it tolerates an unknown name. They also confirmed regex passes both controls, so it genuinely is the field-scoped replacement. They re-verified rather than taking our correction, on the principle that if the upstream source of an error is also the source of its correction, the correction needs its own evidence. The field is syntactically required and semantically discarded, which this note previously described as "the substring op" in a field:op:value sentence - implying a scope it never had. For a field-scoped substring use regex on that field. This matters because a search filter written as a scoping or tenancy boundary admits rows the author believed it excluded, which is the same failure as a dropped filter and in the same direction. Vector search intersects the DB's filter result with the similarity ranking (scores stay identical to an unfiltered query), scanning at most 10000 candidates.embedding_model pin → project override → global default; endpoint + API key are the project override when set, else global. Resolved by the pure resolveEmbedding() (project_settings.hpp) - unit-test precedence there, not through the handlers.applyOutboundDefaults() (outbound_http.hpp): User-Agent: smartbotic-vectorapi/<version> and nothing else, TLS verification on, redirects off. Never let cpp-httplib's default UA reach a provider.unknown_option refusal would break them: a test asserting their outgoing body with expect.objectContaining({...}) tolerated extra keys by construction, so it could only ever fail in the direction that was already safe - add a stray key and the test stays green while production starts refusing every search with 422. They tightened it to an exact match. The lesson for asking consumers about a breaking change: the question is not only "do you send an extra key" but "would your tests notice if you started".src/filters.cpp:33-38 for each, and in the same breath recommended field:exists:true as a guard against nulls in a range filter. I had not checked it. It is wrong - a field holding an explicit null EXISTS, so exists excludes only the absent case, which was never the problem. They put it in a spec and called it "strictly better" than the pair-of-bounds form they had actually tested.
Both halves of that are the same mechanism and worth naming separately. Mine: I was pleased with a clean one-operator answer and did not notice I had stopped citing. Theirs, in their words: they had measured four behaviours precisely so as not to record a guarantee nobody had made, then took a fifth on trust because it was the answer they wanted - so "thanks are a signal to re-read, not to proceed." The practical rule for this file and for any reply to a consumer: if a claim has no file, line or measurement behind it, say so in the same sentence. An unqualified sentence sitting between two cited ones is the most dangerous shape a wrong claim can take.offset, page, cursor, sort, fields, after, skip", and a consumer had to gate their deploy approval on asking whether it was a SHARED query-string validator, because they send offset and sort to the DOCUMENTS listing where both are load-bearing. The rule is "refuse what you cannot honour": the documents route IMPLEMENTS both, so accepting them is correct, while the values route's underlying client call takes (collection, field, limit, ascending) and has no offset at all, so accepting them was the defect. Stated that way the scope is DERIVABLE; stated as seven names it reads like a generic set and invites exactly the question it got.
Worth pairing with the verification lesson, because answering it needed both: reading opts.offset = parseUInt(...) proves the parameter is CONSUMED, and disjoint page1/page2 proves it is HONOURED. Different claims, and this whole week turned on the gap between them.ok with nobody mailed; a comment-only edit "proving" a deploy skip, when the bundler had stripped the comment so there was genuinely nothing to push; a row count that cannot see a truncated document; and a 200 for an input the handler discarded. In every one the passing observation was real and the inference from it was unsupported, and no amount of care in reading the result would have helped, because the result is the same either way. A control with a DIFFERING input is the one test such a failure cannot survive - which is also why the falsifiability pairing exists in the query-param tests, and why the prune was verified by reading a document body back rather than by watching a count fall.justice-pa:vectorapi_function_runs, small because capping it turned versioning off), only 2 of their 18 functions are minute-crons, so a full day of retention costs 2-3 MB against a 607 MB store. Wrong by about 100x, in the direction of refusing a consumer a cheap thing they had a real need for.facts_versions is not monotonic - a retirement removes that fact's row from the sum - so writes in a period are delta + the versions of everything retired in it. Clean arithmetic over an unchecked quantity, which would have produced a confident wrong number rather than an error.
The tell is grammatical and worth learning: the sentence reasons from a true general fact straight to a magnitude, with no step in between where anything was counted. "Store size caused the outage" to "therefore this collection is too expensive" skips the only question that mattered, which was how big a row is. More scepticism does not help, because every premise survives scrutiny; the missing thing is an act of measurement, not a doubt. Pair it with the existing rule - ask what else would produce a result you HAVE, and ask whether you have one at all before reasoning from it.
The same pair also produced the day's cleanest instance of a correct observation with the cause one layer over. They reported GET /functions/<id>/logs capping at 50 however high limit is set, which is exactly true. limit is HONOURED and clamped to the retained count (function_run_log.cpp:110), because rows beyond it were trimmed on write and do not exist to return - so this is NOT the accepted-and-ignored family (#72/#74) and there is nothing to fix in the handler, which already names runs_kept in its refusal text. The remedies are entirely disjoint: "honour my limit" has no fix, "raise retention" is one config line plus a restart (runs_kept is a BOOT config, src/config.hpp, default raised from 50 to 500 in 0.16.0 - per FUNCTION, since trimOldest filters on function_id, so at ~711 bytes a row the old default cost ~640 KB across one project's 18 functions and the new one costs ~6 MB against a 607 MB store). A report of a symptom is not a report of a cause, and filing it as the latter sends the next reader to the wrong file.db_client version check proposed to detect whether a filtered search ran on the uncapped server path. What else would return "2.14.0"? A 2.14 client against a 2.13 server, where the capped emulation runs.
The common form is an observation that is TRUE and a claim drawn from it that is strictly WIDER than the observation could discriminate. More scepticism is no defence, because in each case the observation really was made and really was correct - what fails is the inference, and nothing in a passing result flags it. The companion rule, from the same afternoon: a measurement has to COVER the claim, not merely sit next to it. Stating what the measurement covered before using it is the habit; asking what else would produce it is the check.db_client from /api/v1/version. That field would have been returned every time, correctly, and it reports the CLIENT library version - so a client at 2.14 against a server at 2.13, where the filtered call is refused and the capped emulation runs, reads 2.14.0 throughout. The answer was dependable and about something else. Their own documentation already carried the line "db_client is the RUNTIME library version", written by them, three paragraphs above the proposal. The defence is to verify when asked to confirm: they asked me to confirm the mapping was version-deterministic and it was checking rather than agreeing that found it./search to refuse an unknown option was meant to turn a silently wrong answer into a visible failure. A consumer then checked and found their recall_memory catches EVERY search error and falls back to keyword matching - so the new 422 would have silently degraded their search instead, with nothing logged anywhere. The defect would have moved rather than been fixed: from our silence to theirs. They now rethrow unknown_option specifically, and a deliberately misspelled option fails four of their tests. So when tightening a contract, "would your tests notice if you started?" has to be paired with "does your error handling swallow it?" - a caller with a broad catch converts a loud contract violation into a quiet capability loss, which is strictly worse than the original bug because it looks like a working system. Note what the defect becomes rather than merely where it goes: a dropped filter stops being a dropped filter and becomes a silently different retrieval strategy - still 200, still wrong, and now one layer further from the cause. In a RAG path that is a wrong answer delivered confidently, which is the single failure a knowledge base cannot afford.
THE SIBLING QUESTION, AND IT INVERTS THE USUAL ASSUMPTION: ASK WHETHER A HANG IS WORSE THAN A FAILURE FOR THAT CALLER, BECAUSE SOMETIMES IT IS. Measured on the only public WRITE path on prod, toloajto's offer submission, and stated by its owner 2026-10-15. Their quotes INSERT is best-effort - try/catch, no retry, no fetch timeout - so a FAILED insert is swallowed with a console warning and is genuinely harmless, because the MiniCRM/n8n push that actually DELIVERS the offer still runs. But that insert is awaited SEQUENTIALLY BEFORE the delivery push, so a HUNG insert blocks the delivery for the full stall with no timeout to cut it short: the button spins, and if the customer closes the tab mid-hang the CRM push never runs and the offer is lost outright. So for that caller our cheapest failure is an error and our most expensive one is latency - the opposite of the usual reading, where an error is the bad outcome and a slow success is tolerable.
THE QUESTION TO ASK A CONSUMER IS NOT "DO YOU RETRY ON STATUS" BUT "DOES ANYTHING ABOVE THE CALL SITE CONVERT A THROW INTO A DEFAULT". novitax-6c's framing, 2026-10-16, when asked whether the /invoke 422 would reach them. Their retry set is keyed on STATUS (RETRYABLE = new Set([429, 502, 503, 504]), 3 attempts at 500 ms) and never on the error code, which is the design that makes a widening slug set safe - but they pointed out the half a retry question misses, from their own live code: their public portal answers an identical 202 whether the mail went out or not, so the loud failure exists and something ABOVE it flattens the signal. A status-keyed retry is only safe while nothing wraps a broad catch around the call. toloajto is the clean instance of that same shape being the RIGHT design rather than a bug: postValidate() is if (!res.ok) return null;, so every non-2xx including a 422 degrades to the local client-side price - deliberate, because server-authoritative pricing is an optional hardening layer with an intended fallback. So one shape is a defect in one codebase and a feature in another, only the owner can tell you which, and neither answer is visible from our side of the call.
Two consequences worth carrying. When pricing ANY window or slow path, "what does your error handling do" is only half the question; the other half is "what does your code do while waiting, and what is downstream of the await". And a caller with no client-side timeout does not experience a slow dependency as slowness - it experiences it as an abandoned transaction, which is silent, unlogged on both sides, and indistinguishable from a customer who simply changed their mind. Note our own /rag/ mount sets proxy_read_timeout 180s, so the ceiling on that spin is ours, not theirs. CLOSED ON THEIR SIDE THE SAME DAY, and the lesson is KEPT because the shape recurs rather than because the instance is open: told that the 180 s ceiling was ours and not theirs, they added an 8 s AbortSignal.timeout to both offer-flow inserts and the copy-link insert, so a stall now lands in the harmless path a failure already had - the design still goes out through the CRM push, the quote simply is not persisted to rag, and the link falls back to a self-contained URL. A three-minute freeze became an 8 s fail-fast. Worth noting WHAT unlocked it: they had the timeout problem in their own code and could not see the number, because the ceiling lived in our nginx config. A latency budget split across two owners is invisible to both of them, so saying out loud which side holds the ceiling is cheap and is the thing that made the fix obvious.(?<![\p{L}\p{N}_]) word boundaries, written because JavaScript's \b is ASCII-only and matched inside áfaszázalék - but both were JS regexes applied to local text before masking and never reach our store, so they are unaffected. A sweep answering "yes, we use lookaround" would have been accurate and would have sent them looking for a problem they do not have, while a sweep that only counted constructs could equally have missed a single store-bound pattern among them. The partition that matters is by DESTINATION, not by syntax. The same shape applies to us: a lookaround in a webui regex and one in a ?filter= value have nothing in common but their spelling.( is correctly emitted as \(, whose ( reads to a naive scan as an unescaped group opener; a typed \1 is correctly emitted as \\1, whose second backslash reads as a backreference. Both outputs are RIGHT and a plain-text scan reports both as faults, so the test sends you hunting for a bug in a generator that was already correct. Strip escaped pairs first. Worth keeping because it is the mirror of the usual trap in this file: not a check that cannot fail, but a check that fails on correct behaviour - equally expensive, and more convincing while it is wrong.
Their generator test is also the shape to copy over "I read it and it looks fine": assert the PROPERTY over adversarial inputs (every lookaround spelling, a backreference, (a+)+$, \p{L}, an emoji) that the output contains no lookaround, no backreference and no capture group at all, so there is nothing a backreference could refer to - then mutation-check it, which they did: emitting a lookahead fails 5 tests, a capturing group 3, dropping an escape 3..clangd, .clang-format) and read build-host/compile_commands.json, so they cover src/, tests/ and runner/ including runner/src/main.cpp. The tidy set is narrow on purpose (bugprone/cert/clang-analyzer/misc/performance): the broad modernize/readability families bury real findings under thousands of style notes. .clang-format describes the style the code already uses rather than imposing one, so it is close to a no-op; LambdaBodyIndentation: OuterScope is the setting that matters, since every route handler is a lambda whose body is indented from the statement. Even so the codebase is hand-laid-out and not formatter-clean, so format new or changed code only (git clang-format), never whole files.any, no TS enum, no constructor parameter-property shorthand (tsconfig erasableSyntaxOnly). Iterating parsed JSON: bind to a named var first (range-for over nlohmann::json::parse(...)[...] dangles).feat/fix/build/docs/test). Branch for feature work; main is pushed to ssh://git.smartbotics.ai:10022/fszontagh/smartbotic-vectorapi.git.vector/_vector guard was recorded as waiting on the curl 8.23.0 release when it had actually shipped in 0.13.0 and was live; "2.17.2 is NOT released and is not in apt" survived ten days past 2.17.2 becoming prod's server; and DB_CLIENT_VERSION was described as 2.14.0 in several places when it moved to 2.17.2 in the 0.13.0 bump commit itself.
THE BEST INSTRUMENT NOW IS THE DEB ITSELF, AND IT ONLY STARTED WORKING IN 0.16.0. /api/v1/version reports a commit field, and every release deb before 0.16.0 answered unknown there while the local build answered the sha - because build.sh computed the commit and passed --build-arg BUILD_GIT_COMMIT, Dockerfile.build never declared the ARG so Docker dropped it, and .dockerignore excludes .git so CMake's probe failed inside the container. Accepted and ignored, in the build system rather than on a route, and nobody noticed because the two paths disagreed silently.
So the complete answer to "is that fix in this release" is two commands and needs no trust at all: read the commit the artefact reports (strings -a the binary, or /api/v1/version from a running copy), then git merge-base --is-ancestor <fix> <that commit>. Worked 2026-10-22: the 0.16.0-1 server deb reports 2061c25, and 01967f8 - the PATCH exists() fix - is an ancestor of it, so the fix is provably in that artefact rather than in somebody's recollection of what was in the tree at build time. Note the deb's commit also tells you what the artefact is MISSING: HEAD was two commits further on, and the diff was documentation only, which is how you know a rebuild buys nothing.
Two further instruments, both cheaper than the prose they replace. Map the fix's commit against the DEPLOYED version's bump commit - git merge-base --is-ancestor <fix> <bump> answers "is this live" without trusting any release plan. And read the package's own Depends rather than a sentence about a pin: 0.12.0-1 declares libsmartbotic-db-client (>= 2.14.0), 0.13.0-1 and 0.15.0-1 declare >= 2.17.2, and 0.16.0-1 declares >= 2.20.0, which is the artefact disagreeing with the note. Note the floors are HAND-WRITTEN, so they are evidence of what we INTENDED rather than of what the binary needs - create-debs.sh never runs dpkg-shlibdeps (see the Depends gotcha). That is exactly why a pin move has to move them in the same commit: left behind, the artefact would agree with a stale note and both would be wrong together.
THE PART NEITHER SIDE CAN FIX ALONE, AND IT IS THE REASON TO WELCOME THIS KIND OF AUDIT: TWO OF THE THREE WERE WRONG HERE FIRST, AND THAT IS HOW THEY REACHED THE CONSUMER'S FILE. Their copy was downstream of ours, so reading either file against itself could never have caught them - the error and its corroboration had the same source, which is the trap this file already records as "if the upstream source of an error is also the source of its correction, the correction needs its own evidence". A stale entry is not free: it teaches a workaround for something that no longer exists, and it propagates to places that never read the code. The consumer's own discipline is worth copying - five entries changed and none deleted, because a retired warning keeps its text: the failure SHAPE usually outlives the bug, which is this file's keep-and-label rule arrived at independently.
And a correction can invite the very error it fixes, so write the warning beside it. They had measured index-values refusing offset and returning truncated, whose obvious reading is "vectorapi refuses unhonoured params now". That generalisation is FALSE on 0.13.0: it is one bespoke check on one route, and the export still ignoring ?filter= is the disproof sitting right beside it. Correcting the first entry without that caveat would have replaced one wrong note with another.
A STRONGER CONTROL FOR distinct_values, FROM THE SAME CONSUMER, AND IT BEATS THE ONE I USED. GET .../collections/{c}/indexes reports distinct_values per indexed field from the index's own metadata with NO 1000 cap (the values route caps and sets truncated). I verified exactness with departmentKey at 10 against exactly 10 enumerated - agreement BELOW the cap, which is the weak form. Theirs: kb_fact_answers.intent reports 13092 against a document count of 13092, where intent is a unique business key, so one-per-row is what it MUST report and the agreement is at 13k rather than under the cap. Neither proves exactness for an arbitrary field, and that limit is worth stating when quoting the number. Note the route needs an index to exist - a collection with none answers {"composite_unique":[],"indexes":[]}, which is why a caller can reasonably conclude no route can total a high-cardinality field.
That exact count then found a real data defect one layer out, which is the argument for exposing counts at all: comparing their two fact collections gave 13093 against 13092, and the one-row gap is a fact with a question vector and no answer vector - live and retrievable by its question, invisible to any search over answers. Invisible until there was an exact count to compare.rt=0.756 urt=0.755, 95-byte body. Four candidates then fell to measurement rather than argument - dimension_mismatch by BYTE COUNT, since that envelope is 82-85 bytes for any plausible vector length against the 95 observed; schema_violation because the collection reports has_schema: false; relation_violation because the only active relation has a different child; and the 2.17.x encrypted-collection vector freeze because that collection is encrypted: no. And the timing was the half the consumer could not see: the route's order is authorize, then embed, then insert, so the only pre-provider 422 fires in microseconds and 755 ms excludes it - which places the refusal AFTER a successful embedding, a different defect from the one anybody would have assumed. What remained was a database-side refusal carrying a 51-character message, and nothing retained it: no journal entry for a 4xx on our side, nothing at warning level from the database across twenty minutes.
So the cost of not logging the slug is not the eliminations - it is an unknown that cannot be closed later. Logging the code for every 4xx and 5xx would have made that one line. The structured error already exists and already passes through one place. Raised with the owner rather than shipped unilaterally.
AND THE SHARPER LESSON CAME BACK FROM THEIR SIDE: A DELIBERATELY TOLERATED FAILURE NEEDS A RE-CHECK TRIGGER, EXACTLY AS A HEADROOM MEASUREMENT DOES - BECAUSE ITS JUSTIFICATION CAN EXPIRE SILENTLY AND THE TOLERANCE WILL OUTLIVE IT. Our own access log showed their mirror path hitting the missing row three times over two days, taking a 404 each time and never repairing it. That 404 was tolerated ON PURPOSE and for a good reason: facts predating the answer collection had no answer row until a backfill reached them, and failing a withdrawal over that would have made the feature unusable on 1635 facts. The premise expired the day the backfill finished, and nothing noticed - from that moment a 404 there meant a hole rather than a legacy state. Three chances to catch a real defect, silence every time. They kept the tolerance, because failing the withdrawal is still the worse trade, and made it REPORT at all three call sites with a test. The shape to carry: when tolerating a failure, write down what makes it safe and what would end that - this file already demands a re-measurement trigger for a dated number, and a tolerated error is the same claim wearing different clothes. Audit candidates here are every best-effort path: the error-handler dispatch that never throws, the registry's retry-then-health-check, the secret store's deliberately kept guard. Each is currently right for a stated reason; the question is whether anything would tell us when a reason stops holding.
Their verification is also the model, and it nearly fooled them in our direction: counts reconciled at 13093/13093 and the id answered 200 in both collections, and a PARAPHRASE query still did not surface the row in the top five - which reads exactly like the unsearchable-junk-row failure. Querying with the exact text put it at 1.000000, its own nearest neighbour, so the ranking was ordinary all along. Their words: they would have reported success off the count. A count cannot see a vector stored in the wrong field or the wrong form; only retrieval by similarity can.AUDITED EVERY BEST-EFFORT PATH FOR AN EXPIRED PREMISE (0.16.0). THE RESULT IS THAT NONE OF THEM SWALLOWS SILENTLY - AND THE AUDIT IS WORTH RECORDING FOR WHAT IT GOT WRONG ABOUT ITSELF, NOT FOR THAT RESULT. All 14 catches in src/ and runner/src/ that discard the exception detail turned out to be legitimate: a documented fallback (parseFilter's json::parse to a literal string, triggerBodyFields, decodeOrRaw, decodeMailboxName), a DECLINE rather than a guess (all three timezone.cpp arms return nullopt rather than inventing UTC parts), or a conversion into a reported failure (files, export, guarded, job_worker, the runner's own handler).
But the sweep I wrote to find them looked for the WRONG SHAPE, and that is the lesson. I grepped for "a catch that reports nothing", which is a syntactic property, and got a false-positive rate near 100% - it flagged arms that throw an ApiError two lines down. The shape that actually hurts is a catch whose PREMISE has expired, which no grep can see, because the code is unchanged and still reads as correct. The one real finding had reported nothing wrong and failed nothing: FunctionEventWatcher::refresh() said "Already logged" and kept the previous watch plan. That premise was TRUE of buildPlan - it warns and rethrows on both its throwing paths - but it was held in another function with nothing enforcing it, so a third throwing path added there would have turned this into a silent swallow while the comment went on asserting otherwise.
The fix is not to repeat the cause but to log the CONSEQUENCE, which is also the part the other function cannot know. "Could not read the registry" never says the thing an operator needs: that a function deployed since the last good refresh is NOT BEING WATCHED. And because the old plan keeps working, every event for every existing function still arrives, so nothing else looks wrong - the failure is invisible in exactly the way the .catch(() => []) into in-code defaults was. It now counts consecutive failures and says what they cost.
So the generalisable rule, which is the one to apply next time rather than the grep: a tolerated failure needs the same thing a dated measurement needs - not a note saying it is fine, but a statement of WHAT MAKES IT FINE and WHAT WOULD END THAT. Where the premise lives in another function, either enforce it or stop depending on it. And note this file's own candidate list for that audit had an expired entry of its own: it named "the registry's retry-then-health-check" as a path to check, and that code was DELETED when client 2.13.0 made the distinction honest. The list of things to audit rots exactly like the things on it.
THE DEVSTACK CONTAINER IS HOW YOU MEASURE A BEHAVIOUR PROD'S SERVER CANNOT YET PRODUCE, AND 0.16.0 IS THE FIRST TIME THAT WAS USED FOR IT. packaging/devstack installs the real .debs plus any database version from the deb repo, so pointing it at smartbotic-database 2.20.1 let the invalid_pattern mapping be measured END TO END while prod still ran 2.17.2 and therefore could not emit the reason at all. Measured through the shipped deb: ?filter=note:regex:(?<=a)b answered 422 invalid_pattern with details.field and a message naming RE2, carried no Retry-After (the verdict is permanent), and the CONTROL - a valid RE2 pattern on the same route - answered 200 with the right row. A unit test on the mapping could not have told a selective refusal from a blanket one.
The same container also gave the Retry-After pairing a LIVE form, which is stronger than the unit pairing because both arms come out of one binary: no_runner answered 503 with NO header (an operator must act) while db_unavailable, produced by killing the database, answered 503 with Retry-After: 5. Same status, same service, same release, and the header appears only where waiting is the remedy.
Three of my own checks in that session could not discriminate, and all three LOOKED like measurements - which is the part worth keeping, because the container is slim and that is what makes it a trap. pkill is NOT INSTALLED in the devstack image, so docker exec ... pkill -f smartbotic-data failed with 127; I had redirected stderr to /dev/null, so a command that never ran looked like one that worked, and the subsequent 200 read as a result when the database had never died. kill is not installed either. The database was still at pid 14 throughout. And the check I reached for to confirm the port was down - curl against 9004 - returns 000 whether the server is alive or dead, because that port speaks gRPC and not HTTP, so it reported "confirmed down" about a process that was running. The only check that discriminated was [ -d /proc/<pid> ], and the shell BUILTIN sh -c 'kill -9 14' was the only way to send the signal. Verify the CONDITION before interpreting the response, never redirect the error away from a command whose success you are about to assume, and do not probe a non-HTTP port with an HTTP client.
MAINTAINING THIS FILE: REWRITE when a claim was WRONG; KEEP AND LABEL when a claim was RIGHT and the world moved. The two look similar and the failure modes are opposite. An appended correction under a wrong claim leaves both sentences reading as true and invites the reader to pick - the stale-comment failure with a timestamp attached, and this file is read under pressure by someone who will take the first assertion that fits. So a measured refutation REPLACES the claim, says it was wrong, and says what the measurement was: the note that history bytes dominate the at-rest migration was mine, it was false, and it reads as false now rather than as a dated opinion beside a newer one. Conversely the superseded filtered-scan cap stays, LABELLED superseded, because the claim was accurate and only the mechanism retired - and the failure shape it describes is still worth recognising. The rule came from a consumer drawing the distinction after watching me do both in one afternoon without naming it.
ESTABLISH WHO OWNS A LAYER BEFORE REPORTING A FINDING TO IT. encryption-verify, the CLI, the migration, encryption at rest and storage are the DATABASE's; this repo owns the HTTP surface, the function runtime, the export and its digest. A consumer sent us a sound suggestion about the verify tool's verdict wording and told us it was our call - it was not, and had we received it politely they would have waited on a change we cannot make. A finding filed one layer too high is sympathetically received by someone who cannot act on it, which is worse than a rejection because it looks like progress. Route it, and say plainly that you are routing it.
principal.hpp). requireCapabilityCore() answers project/scope/rate-limit questions for any caller; the ApiKey overload adds the things only an HTTP request has (Origin allow-list, captcha), because those are meaningless for a cron or event run. One implementation, so function access and HTTP access cannot drift.mergeForCodePush() (function_record.hpp, pure) takes policy and enabled from the stored row and never reads the ones in the payload - not unioned, not used as a fallback. A first registration inherits the project default. Identity is function_id from the script's on block and path carries no meaning, so a rename keeps the row and its policy.builtinDefaultFunctionPolicy() grants nothing: unreviewed code reaches no collection until an admin says so. Widening it is a security-posture change, and a test asserts the current floor.functions/descriptor.hpp, pure): a script author's typo is data. Unknown keys are ignored so a script written for a later server still loads. 404 and 405 stay distinct, so a 405 can carry its Allow: union./api/v1/projects/{p}/functions* (project-manage; policy is admin-only) and served to the world at /fn/{project}/*, which is unauthenticated - the project segment is therefore hostile input: charset-restricted (no :, the qualify() separator), confirmed against listProjects() before anything qualifies a collection, and a .. segment is refused anywhere (httplib percent-decodes before the handler sees the path, and .. can be captured by a :name param). Disabled and invalid functions are absent from the descriptor list, so they 404 rather than 403, and function error text never reaches the caller - it goes to the run log, with the run_id in the response./fn IS UNAUTHENTICATED AND UNTHROTTLED, AND THE SECOND HALF SURPRISES PEOPLE WHO READ THE FIRST. Verified in code 2026-10-13, prompted by a consumer asking how to send a verification e-mail: function_dispatch.cpp never touches rateLimiter(), and the policy's rate_limit_per_min is enforced only inside requireCapabilityCore - that is, on the function's DATA access through ctx.collections. ctx.mail and ctx.fetch are outside the policy entirely (a function with rules: [] can still send mail, which is recorded above as a deliberate decision). So a published function that sends mail or makes an outbound call is reachable by anyone who learns the URL, with no per-function ceiling: an e-mail bomb aimed at any address, on the tenant's SMTP quota and sender reputation, or a paid API burned.
The unauthenticated part is a design decision and still right - a published HTTP function is published. The unthrottled part was not a decision, it was a gap, and the field that looked like it covered it did not. I believed it did when I started answering.
CLOSED IN 0.15.0 IN THE ARTEFACT AND STILL OPEN IN PRODUCTION AS OF 2026-10-22 - THIS ENTRY SAID "CLOSED" AND PROD RUNS 0.13.0. Measured from the public internet with no credential: POST https://qdrant-1.../rag/fn/novitax/aliz/kb-search with body {} and no Authorization answered 200 in 0.106 s, with the control - the same shape against a function id that does not exist - answering 404, so it is a real function running rather than a catch-all. Read from the source at the 0.13.0 revision rather than from these notes, src/handlers/function_dispatch.cpp there contains zero references to rateLimiter and no key gate; the throttle landed in 696b431. By the two-command instrument: 696b431 IS an ancestor of the built 0.16.0 deb and is NOT in prod's 0.13.0.
So this is the committed/released/deployed confusion this file warns about, committed BY this file, about a security control. "Closed in 0.15.0" reads as the third and was only ever the first - and 0.15.0 was never published, so the control has not existed in production on any day since the gap was found. Three live functions behind a voice agent are reachable at a URL in a VAPI config, with ctx.mail and ctx.fetch outside the policy, and the only thing bounding abuse today is that nobody has tried. Tracked as SV-19, which also carries the separate question of adding /fn/ to the customer-facing host's whitelist - correctly answered "after the deploy, not before", since adding it today would duplicate an anonymous unthrottled surface onto the one hostname we kept narrow.
The generalisable repair is to write the ARTEFACT the fix is in, never the version it "shipped" in, because the second is a claim about the world and the first is checkable with git merge-base --is-ancestor. The lesson below is kept because the shape recurs.** rate_limit_per_min is now charged on /fn as well as on data access, and a function can require a key with auth: 'key' in its on block. Five decisions in that fix are load-bearing:
auth defaults to public and an unrecognised VALUE is REFUSED, while an unknown KEY in the on block stays ignored. Both are deliberate and they pull in opposite directions: an unknown key is a script written for a newer server and must still load, whereas auth: 'kye' falling back to public would publish a function whose author believed it was gated. A typo must never widen access. Note the honest limitation: an older server ignores the key entirely, so a gated function deployed backwards is silently public - the one place forward-compatibility cuts against safety.auth: 'key' provides and an anonymous request does not have.
And a test-writing trap met while proving it, worth more than the feature: the first throttle test set incoming.policy on the record it pushed and the limit silently did not apply, because mergeForCodePush takes the policy from the STORED row and never reads the one in the push - the "a code push can never widen access" invariant, working exactly as written. The test therefore "disproved" a throttle that worked. A first registration inherits the projectDefault argument, so that is where a test's policy has to go. The same test was also flaky on the real clock, because the limiter buckets by now / 60 and two requests straddling a minute boundary land in different windows; it now freezes the clock, since a test that fails once an hour teaches people to re-run rather than to read.THE RATE LIMIT IS PER KEY, IN A FIXED WINDOW, AND A REFUSAL COSTS NOTHING - NONE OF WHICH A CONSUMER CAN LEARN BY READING. Asked by novitax 2026-10-22 while chasing 429s, and every part of the answer had to come out of rate_limiter.cpp because none of it was written down anywhere a caller can see.
allow(p.id, ...)), not the project and not the source IP. So two callers share a bucket only if they present the same key - which is the question that was actually being asked, because a reviewer refreshing and a batch script are the same project and different keys. A rate_limit_per_min of 0 means UNLIMITED, not "no requests", so moving batch work onto an unlimited key needs no change on our side.now / 60), not sliding. A burst spends the whole allowance at once and then every remaining call in that wall-clock minute is refused, rather than draining smoothly - measured in their log as seven 200s and then four 429s inside one second, and 36 refusals in one minute. It also means a burst straddling a boundary can land 2x the limit in a rolling 60 s.allow() increments only on the admitting path. So a client retrying a 429 is not digging its own counter deeper, which is the opposite of what a caller reasonably assumes and is the half of the answer that changes their tuning. Measured cost of a refusal: urt=0.001, i.e. refused before any database work.A write is validated on a runner before storage, so the engine that validates is the engine that executes; with no healthy runner the write is refused 503 rather than stored unchecked.
RunnerPool retry is three-way, not two. Never connected → retry (nothing ran). Answered, whatever the answer → never retry (the runner did its job). Delivered then unanswered (read timeout, non-200, unparseable body) → do not retry, mark unhealthy: the handler may be running right now, and a retry would run a side-effecting function twice. validate() retries everything, because compiling has no side effects. Also: RunnerPool::Options::readTimeoutSec must exceed the runner's max_wall_time_ms, or our read times out before the runner can report its own timeout and the caller gets a misleading 503 instead of a 504.
ctx.collections(...) is a direct gateway call, never loopback HTTP, and ctx.fetch pins the connection to the single address the guard approved (set_hostname_addr_map) rather than re-resolving - re-resolving IS the rebinding window. One resolution, one classification.
Triggers: http (a route), cron (a schedule, with an IANA tz validated against the host tz database at PUSH time - an unknown zone is refused, never silently UTC), db (an INSERT/UPDATE/DELETE on a watched collection) job (reached only by being enqueued, which is where slow work belongs) and error (0.15.0+, runs when ANOTHER function fails). The scheduler and the event watcher live in vectorapi, because there must be exactly one of each; N runners each firing every cron is the obvious bug.
THE error TRIGGER'S LOOP GUARD IS CATEGORICAL, NOT A DEPTH BUDGET, AND THAT IS THE ONE DECISION TO UNDERSTAND BEFORE TOUCHING IT. selectErrorHandlers() (functions/error_hook.hpp, pure) returns NOTHING when the failed function is itself an error handler - not itself, and not a different handler. A depth limit would be wrong here in a way it is not wrong for db triggers: chaining db events is legitimate and only runaway chaining is not, whereas there is no legitimate reason to report the failure of a failure reporter. The shape being prevented is a handler that tries to e-mail an alert, fails because egress is denied, and triggers itself forever on the tenant's own queue - and two handlers both watching * would ping-pong indefinitely under any budget above zero. The cost is real and must be stated to anyone relying on it: an error handler's own failures are visible ONLY in the run log, so "the alerts stopped" is a run-log question.
Three more decisions worth keeping. Handlers are ENQUEUED rather than run inline, so a failing request never waits on the handler reporting it and a slow handler cannot hold the socket of a request that already went wrong - which also means delivery is at-least-once and a handler must be idempotent. watch is matched exactly with no globbing beyond a bare *, because a prefix match would quietly start catching functions added later, and a handler widening its own scope is the opposite of what an operator wants. And dispatch hangs off the same point as the run-log append (dispatchErrorHandlers, one implementation called from both producers) rather than being inlined at each site, because this file already records what happened when unknownKeys() was called in one handler while six siblings stayed broken - a new producer of failed runs should call it rather than grow a third copy. It is best-effort and never throws: a function that failed AND could not enqueue its handler must still report its own failure.
Note the invoke route can invoke a function of ANY trigger type, so the failed type is read from the stored row rather than assumed, and an unparseable descriptor defaults to Error, which SUPPRESSES dispatch - failing closed costs a missed alert on a function that is invalid anyway, while failing open risks a loop.
A blocking host call cannot be interrupted, so host timeouts ARE the enforcement. The wall budget is enforced by a QuickJS interrupt handler that fires between bytecode ops; while an embedding or ctx.fetch request is in flight the engine never regains control, so the deadline is noticed only once the call returns. Bounding a host call therefore means handing the HTTP client timeouts that already fit the remaining budget - which is what resolveEmbedBudget() (functions/embed_budget.hpp, pure) does. It exists because a 10 s-budget run took 14314 ms: the READ timeout was clamped to the budget and the CONNECT timeout was not, and the two are additive, so a connect stall burned the full embedding_connect_timeout_sec outside the budget. Connect gets at most HALF the available time (a reachable provider connects in well under a second, and a large connect allowance only starves the read phase). Below a 2 s budget the 1 s floor on each phase dominates and the worst case is 2 s - bounded, and stated rather than glossed over.
Embedding timeouts are per-project and NARROWING ONLY, resolved by the same resolveEmbedding() that picks the endpoint, so a project's override applies identically to a function and to an HTTP vector route. The effective value is min(project, global): these govern a shared provider connection and a pooled runtime waiting on it, so an override that could RAISE them would let one tenant hold both longer than the operator allowed. A stored value above the global is kept rather than refused - it becomes effective if the global is later lowered. A zero override is "unset", never "no timeout", because 0 means no timeout to the HTTP client and that is precisely the unbounded call the split prevents.
THE FUNCTION SURFACE NEEDED THE SAME FIX, AND NEEDED IT MORE. .search()/.store() build their payload in host_prelude.js from an EXPLICIT key list, so an unrecognised option is discarded in the prelude before the host can ever see it - the host cannot refuse what never arrives, so a host-side check is no protection at all there. That is precisely how embedTimeoutMs came to be honoured host-side and never sent by the prelude while a consumer was told a bound was in force. onlyKnownKeys() (renamed from mailOnlyKeys, since the job is not mail's) now refuses by name in the prelude, and expectRefused() asserts the host was never reached rather than only that something threw. A consumer's call sites were ALL on this surface and none on the HTTP route, so fixing only the route would have left the real callers exposed while looking finished.
THAT FIX WAS APPLIED TO ONE HANDLER AND NOT TO THE CLASS, AND A SIBLING WAS LEFT BROKEN (CLOSED 2026-10-13, and the lesson is kept because the shape recurs). Audited 2026-10-13: unknownKeys() is called in exactly ONE place service-wide, handlers/vectors.cpp:121, on the search BODY. Six handler files read query parameters and none of them refuse an unknown one (indexes, files, collections, documents, export, functions). The live consequence a consumer measured: GET .../indexes/{field}/values?offset=1000 answers 200 with the first page, because the handler reads only limit and order and the client has no offset parameter to honour. A caller paginating that route loops forever believing it is progressing - see task #72.
The general form, which a consumer put better than I did: a fix applied in the handler where the lesson was LEARNED, rather than to the CLASS of handler, is how one correction leaves its siblings broken - and the silent-wrong-answer family is the one where nobody notices the sibling, because every sibling answers 200. When a defect of this kind is fixed, grep for the shape rather than patching the instance.
CLOSED: requireHonourableParams() (query_params.hpp) now covers all seven listing routes and indexes.cpp was converted to it, so there is one idiom rather than two. Three things in that fix are worth keeping rather than rediscovering:
/documents takes sort+desc=true, index-values takes order=desc, /collections searches with q while /documents filters with filter, and the export takes vector_format where format is the obvious guess. So the likeliest author of a plausible-but-ignored parameter is a caller who learned it on a SIBLING route of this same API - and details.instead names the local spelling. The costly one is the export: ?format=base64 was ignored, silently producing the ARRAY export at roughly three times the bytes, which looks like it worked.details.unsupported KEPT its flat-array shape from 0.13.0 and the replacements arrived as a separate details.instead map. Turning each entry into an object would have been tidier and would have broken anyone already parsing the field one release after it shipped - the same additive-not-reshaped discipline as the FailureDetail& overloads.?status=failed only after its 404, so the answer depended on whether the function existed; the export's check had to be split out of parseExportQuery to get above the registry lookup, since the refusal needs no metadata. A request-level fault that no amount of creating the resource fixes should not hide behind the resource.
And the audit found a SECOND instance of the absent-flag defect, in the same family as the missing truncated: the files listing was DISCARDING has_more and total_count, which the client already returns. A full page and the last page were byte-identical, so a caller could not tell whether to ask for the next one - and unlike index-values, the information was in hand and thrown away rather than unavailable. Now emitted unconditionally as has_more/total. Note its newest-first sort is applied WITHIN a page, after paging, so it is not a stable global order to page through; the route refuses sort rather than implying one.
Two of my own mistakes in doing it, both caught by assertions rather than by review. A scripted edit on an anchor that appears in several near-identical function handlers silently landed in the wrong one - the trap this file already records for the network_egress edit - and was only visible because the next attempt asserted the shape it expected before moving anything. And the falsifiability-pairing test (NoListingRouteRefusesAnIncidentalParameter, which proves the refusal is SELECTIVE rather than blanket) first failed because it leaned on a collection another test created, so it passed or failed on ctest ordering. It was then deliberately falsified by adding _ to a candidate list and confirming it goes red - because a test asserting "this is NOT refused" is exactly the kind that can quietly stop testing anything.But the query string CANNOT take the body's blanket treatment, and that is why this needs design rather than a copy-paste. Every key in a JSON body is deliberate, so refusing all unknowns is safe. A query string legitimately collects things nobody meant as options - a cache-buster, a proxy's addition, a UI's _=<timestamp> - so a blanket 422 would break callers for params that were never asking for behaviour. The defensible line is to refuse the params a caller plausibly sends EXPECTING AN EFFECT and that we do not implement (offset, page, cursor, sort, fields), and to keep ignoring genuinely incidental ones. Refusing offset is the point; refusing _=1760000000 is a regression.
/search body is REFUSED (422 unknown_option), not ignored (functions/known_keys.hpp, pure). It was ignored until 0.10.3, and measured on prod that produced silently wrong answers rather than errors: topK: 3 returned the DEFAULT five rows, minScore: 0.99 returned rows where the correct spelling returns none, and filter: in the singular returned the rows the caller meant to EXCLUDE - a dropped filter is frequently a tenancy boundary in the caller's mind, which is what makes this a defect and not an ergonomic wish. Every unrecognised key is named at once, and the accepted set is listed, because the usual cause is a plausible spelling of a real option. Matching is exact and case-sensitive on purpose: accepting Top_K would give the service two spellings for one option, which is how the next drift starts. ctx.fetch, ctx.mail and ctx.jobs already behaved this way; this brought the HTTP surface in line.POST /functions/{id}/invoke TAKES AN ENVELOPE, AND A BARE PAYLOAD USED TO BE SILENTLY DISCARDED WITH A 200. FIXED IN 0.14.0; the lesson is kept because the shape recurs. Reported by a consumer 2026-10-15 and confirmed in code: manualTrigger() read exactly method, path, params, query, headers and body, and every other key was ignored, leaving t["body"] null. So POST .../invoke with {"day":"2026-10-12"} ran the function with an EMPTY ctx.body and answered 200. {json: ...} and a JSON string did the same. The correct envelope is {"body": {...}}.
Now refused 422 unknown_option by requireInvokeEnvelope() (functions/invoke_envelope.hpp, pure), which names every unknown key at once and lists the accepted set. Four things in the fix are worth not rediscovering:
requireRunner, following the one ordering rule here - authorize, then the request, then the resource. Behind the lookup it would answer 404 to anyone whose function was absent or misnamed; behind the runner check it would answer 503 on every deployment without a runner, which is the default, since installing the runner does not enable functions. An integration test pins it by invoking a function id that does NOT exist and demanding 422, with the pairing that a CORRECT envelope on that same path answers 404 or 503 instead - so the test proves the ordering rather than only the refusal.body.value(...) on a non-object throws type_error, so a posted JSON string was never the clean 200 the original report assumed.params as a string falls back to an empty object, as it always has. The defect is keys nobody reads, not retyping a field, and a test pins that as a decision rather than an oversight.manualTrigger was EXTRACTED to the pure header to make the pairing testable at all. It sat in an anonymous namespace in a file that links the database client, so "a correct {"body":{...}} still reaches ctx.body" could not be asserted anywhere - and without that half, the refusal tests would pass just as well against a route that refused EVERYTHING, which is a worse defect than the one being fixed. Deliberately falsified by adding day to kInvokeEnvelopeKeys: two refusal tests go red while the pairing stays green.
The cost is a false pass, which is worse than a failure. Their re-run "looked like it had processed the day I asked for", and the function had quietly processed its DEFAULT day; it surfaced only because a second request for a DIFFERENT day returned the same day in its result. A control that returns 200 for an input it discarded cannot be distinguished from one that worked, which is exactly the shape unknownKeys() exists to prevent on the vector /search body. This is a JSON BODY, so the blanket rule applies and is safe - the query-string caveat about incidental parameters does not reach here, since every key in a posted body is deliberate. Fix is to run the existing unknownKeys() over the invoke envelope and 422 with the accepted set named, which is the same idiom and the same error shape. Their suggestion is worth taking too: echo which input the run actually used, so the answer carries its own evidence.embedTimeoutMs on .search()/.store() is validated, not coerced. A non-integer or non-positive value is 422, and exceeding it is 504 embedding_timeout (distinct from the run simply running out of budget, because the remedies differ). It went unnoticed for a release while being silently accepted and ignored, which is exactly why an unsupported option must be refused rather than dropped.functions/wall_budget.hpp): an HTTP one (~2 s, which RunnerPool::readTimeoutSec must exceed) and a JOB one, which is exempt because a queue-claimed run holds no socket. RunService::run takes the kind as a PARAMETER, never inferred from the descriptor, and defaults to Http - the narrow budget - so a caller that forgets is slow rather than dangerous. Precedence: min(descriptor timeoutMs or default, project max or kind ceiling, hard ceiling), resolved by the pure resolveWallBudget(). The project cap is per kind ({http, job} on PUT /projects/{p}/settings/functions): one number could not express "10 s for routes, 60 s for jobs", so capping a project's routes also cut its cron work and the only safe setting was no cap. FunctionView carries BOTH and RunService::run selects, because lookup() does not know how a run was triggered. The engine's JsLimits::wall_time_ms is raised to the highest ceiling at construction, or the clamp inside JsRuntime::run would kill every job at the HTTP value.ctx.fetch included, so without a lane N slow jobs leave one runtime for every interactive route and the second overlapping HTTP run blocks until the read timeout fires - a 503 from a healthy runner. Worst-case memory is (pool + job_pool) x memory_limit_bytes, so the two lanes ADD.fn:<project>/<id>:<depth> via the actor parameter, and Event::actor carries it back - so provenance costs nothing and lives in the audit trail, NOT in a field inside user documents (which would travel into every export forever). A chain is refused past events.max_depth generations and logged at error.
A CONSUMER NOW DEPENDS ON THAT STAMP AS A SECURITY ATTRIBUTION CHANNEL, WHICH IS NOT WHAT IT WAS BUILT FOR: _created_by MUST KEEP NAMING THE WRITING FUNCTION AND MUST NOT BE COLLAPSED TO THE PROJECT. Flagged by novitax 2026-10-22, deliberately, as a dependency rather than left to be discovered by breaking it. Assessing whether the unauthenticated /fn exposure (SV-19) had been used, they could tell a chat-mediated write from a direct anonymous one ONLY because _created_by reads fn:novitax/aliz-chat rather than fn:novitax: a direct call to the request-taking function would read fn:novitax/aliz-take-request and be distinguishable. All 29 rows named the chat function, which is what established that nothing had exploited it. Granularity we added for a loop guard turned out to be the only after-the-fact attribution available for an authentication gap, so a refactor that kept the project and dropped the function id would look lossless and would silently remove it. Their discipline is worth copying too: they turned the finding into a one-command check and proved its control fires (an empty expected-writer set flags all 29 rows and exits 1), because "probably unused" written in a document decays into an assumption while a script does not.singleFlight (default true for cron) skips a tick while the previous run is still going, which bounds stacking but is not exactly-once.jobs.enabled is OFF by default in the runner, so a runner upgrade never starts draining a queue in a deployment whose server has no scheduler. On a host that wants cron it MUST be turned on, or the scheduler enqueues work nothing ever runs - the most confusing possible way for cron to look broken.file_store.hpp), so everything customer-specific - a logo, a signature image - is tenant DATA rather than something bundled into a function's source. PROJECT ISOLATION IS OURS, NOT THE DATABASE'S: the database namespaces files by Client::Config::project, this service runs ONE client configured for default (collections are qualified per call instead), and the file API has no per-call project argument - so every project's files share one database namespace and are separated only by the related_id we stamp and filter on. Every lookup must therefore filter on BOTH project and name, and nothing outside file_store.cpp may address a file by its database id. A bug there is a cross-tenant leak, not a mis-sorted list._files pseudo-collection, so requireCapabilityCore is the one implementation and file access cannot drift from collection access. The leading underscore makes it unshadowable - collection-create rejects _-prefixed names. ctx.files is read only: writing a tenant's asset is a management act and the HTTP route requires project-manage for it.max_file_bytes (global settings, default 2 MiB) bounds what can be STORED; kCtxFileMaxBytes (1 MiB) bounds what one function run may LOAD. A file stored when the limit was generous must not be able to pull megabytes into a 64 MiB JS heap on every run afterwards. The database imposes a cap of its own (storage.files.max_file_size_mb, default 500), which is far above either.FileStore::put deletes the previous ones itself, uploading FIRST so a failure leaves the old file intact. Reads take the NEWEST record, because an interrupted put can leave two and a read that picked arbitrarily would serve stale bytes some of the time.vectorapi_keys, field key), the global OpenAI credential (vectorapi_settings) and every project secret including mail passwords (<project>:vectorapi_secrets) are readable by anyone with access to the database's data directory or to any backup of it - including the pre-upgrade tarballs under /var/backups/ on prod. On every version we have ever run.
The mechanism we believed in does not exist. Each store creates its collection with createCollection(..., encrypted=true, ...), and nothing in the database's write path reads that flag - CollectionOptions::encrypted is stored, reported by getCollectionInfo and never acted on. The database's actual mechanism is pattern matching on sensitive FIELD PATHS (*.password, *.api_key, ...), which requires a dot before the name, so our top-level value and key never matched - and key is not in the pattern list at any nesting.
Measured here, not taken on report: a project secret written through our own HTTP route was found in plaintext in wal/wal-current.log and in the project's env/data.mdb. AStoredSecretIsCurrentlyPLAINTEXTatRest does exactly that, and asserts the DEFECT so the suite stays honest and green while being self-correcting: when the database ships encryption at rest, that test fails and says to flip it.
AND I HAD A TEST ASSERTING THE OPPOSITE. It read getCollectionInfo()->encrypted and presented a flag as evidence about bytes, which is the same proxy-not-the-thing failure this file is full of warnings about. It is now named EachCredentialStoreSetsTheEncryptedFLAG_whichProtectsNothing and says so. A flag that records an intention is not a measurement of the outcome - if a security property matters, assert the property: write a canary and look for it on disk.
Until the database ships encryption at rest, the only reliable protection is encrypting CLIENT-SIDE before the value is stored.
THE COMING FIX IS SAFE FOR US, and the reason is worth keeping because it is not obvious: NOTHING queries a credential collection by value. The database asked before releasing, because full-value encryption uses a random IV, so a FILTER on an encrypted field never matches and an INDEX on one indexes ciphertext. Audited: KeyStore::lookup() scans an IN-MEMORY snapshot (k.key == key) loaded by a find() carrying only a limit, so authentication is a full read compared in process - it never asks the database to match a key. Settings and project secrets are addressed by DOCUMENT ID throughout (the secret's NAME is its id). The global settings document is told apart from the per-project ones by p.project.empty(), evaluated in our process after a full read, which LOOKS like a value query and is not. opts.filters is set in exactly three places service-wide - vector_search.cpp, function_run_log.cpp (function_id) and host_context.cpp (ctx.collections) - none of them a credential collection, and no index is declared on any of the three.
The adjacent hazard that WOULD break: vectorapi_function_runs is filtered by function_id. It, the job queue, the function registry and the collection registry are all deliberately encrypted=false, and user collections are always created encrypted=false (handlers/collections.cpp:74) so a user's index is never over ciphertext. If anyone ever flips the flag on those, that filter stops matching silently.
THE FLAG WAS ASKED FOR AND NEVER APPLIED, AND THIS NOTE USED TO CLAIM THE OPPOSITE. It said our startup calls createCollection(..., encrypted=true, ...) "unconditionally", so the three stores would "repair themselves on the next restart". Both halves were false. Every call site was guarded by if (!getCollectionInfo(...).has_value()), so the create was skipped for a collection that ALREADY EXISTED - which is exactly the case that needed it, because the collection had been created implicitly by an earlier write, with the default flag of false. Measured on the dev database: vectorapi_keys and vectorapi_settings report encrypted: no while the code reads as though it had asked for true, and only <project>:vectorapi_secrets (a later store, whose collection our code did create) reports yes. A guard that skips the repair in precisely the broken case is worse than no guard, and the suite could not see it because the flag test deliberately points each store at a FRESH collection name - correct for testing the creating path, and the reason it was blind to this one.
THAT UNCONDITIONAL CALL COSTS A SECOND WINDOW ON 2.17.x, AND IT MUST BE PLANNED RATHER THAN DISCOVERED. Under 2.17.x, re-issuing createCollection(existing, encrypted=true) performs the ONLINE encryption upgrade when it changes anything - and a collection reaching encryption through the bare-alias option merge still has its OWN flag unset, so our call does change something: it moves the flag where it belongs. That requests a RESEAL at the next boot, and the reseal compacts every project, which is the 167-second term measured above. Seen for real: the dev box's restart onto 2.17.1 took ~3.5 minutes instead of ~15 seconds, caused by our own bootstraps having flipped those flags under 2.17.0. It is a ONE-OFF, not a standing tax: the reseal is requested only when createCollection actually CHANGES the options, so once the flag is set every later startup does nothing and asks for nothing. The cost is one compacting restart per collection that gains its flag. Upstream is also considering requesting the reseal only when the upgrade actually REWROTE something - our keys and settings were already ciphertext through the alias, so their flag change wrote no plaintext anywhere and arguably need not cost a compaction at all - but that is NOT in 2.17.1, so plan step 3 as written.
So the prod sequence has THREE steps and two compactions, not one: upgrade the database (first-boot migration, 190 s measured), start vectorapi so the bootstraps move the flags, then restart the database inside the SAME window so the reseal happens while everyone is expecting an outage. Skip that last step and a routine restart weeks later silently takes three minutes with no visible cause - the same shape as the /etc mode 0751 trap below, and the reason "under 10 minutes" is the right thing to ask consumers to approve for that window rather than three.
Today's release is unaffected: prod runs 2.14.0, where the upgrade branch does not exist and the re-call is a plain no-op. The cost arrives only with 2.17.x.
So KeyStore::bootstrap and SettingsStore::bootstrap now call createCollection UNCONDITIONALLY, which puts the flag on the collection we actually read and write. Read the correction two paragraphs down before relying on the reasoning that motivated it. Re-issuing it against an existing collection switches encryption ON (never off), encrypting the stored rows and their history; against an older server it is a no-op, so it is safe on every version we support. Verified safe before shipping, not reasoned about: MemoryStore::createCollection's existing-collection path only acts on a vectorDimension > 0 and on defaultTtlSeconds, and we pass 0 for every option but the flag, while upgradeEncryptionOptions only ever flips false to true and appends sensitive fields. BootstrapAsksForEncryptionOnAnAlreadyEXISTINGCollection pins it with a CONTROL collection that is never bootstrapped, so the assertion cannot pass for an unrelated reason, and it asserts the pre-existing row survives the re-call.
ProjectSecretStore::ensure deliberately KEEPS its guard, and the difference is the call path rather than the intent: it runs on every secret READ (the runner builds ctx.env through it) and CreateCollection is REFUSED by a read-only database, so making it unconditional would turn every function run into a 503 during read-only recovery - trading a live outage for a hardening step that collection does not need.
What database 2.17.0 actually does, confirmed from their source and then independently by them: collection-level encrypted=true encrypts EVERY non-null value in the collection whatever the field is called (isEncryptedPath returns true for any non-empty path when the rule is whole-document). Strings become $ENC$..., and numbers, bools, objects and arrays become $ENCJ$... and read back with their original type. The built-in sensitive-name patterns match a WHOLE path segment, so openai_api_key does NOT match api_key - which is why the collection flag, not the field name, is the only thing that was ever going to protect us. Grep a data file with grep -F: a bare $ENC$ pattern is a regex anchor and matches nothing. AND grep -F ALONE IS STILL NOT ENOUGH - ON THESE FILES IT RETURNS 0 FOR EVERYTHING, INCLUDING THINGS THAT ARE CERTAINLY THERE, SO IT IS A CHECK THAT CANNOT FAIL. Measured 2026-10-19 on a snapshot and a WAL segment: grep -c -F novitax returned 0 on a WAL that strings -a | grep -c -F novitax shows 5957 times. The files carry custom framing (CALWAL01, CALSNAP1 magic) with embedded NULs, so grep will not surface text past them.
THE REASON I GAVE FOR THAT WAS WRONG, AND THE CORRECTION CHANGES WHAT AN ABSENCE IS WORTH. This note used to add "and they are NOT compressed - gzip still halves them", inferring from gzip shrinking the file that nothing had compressed it. The database owner corrected it 2026-10-22: the snapshot writer compresses with LZ4 whenever compression is on, which is the DEFAULT, and gzip shrinking an LZ4 file further is entirely expected rather than evidence of anything. My practical conclusion survived - strings -a really does surface plaintext - but for a different reason: LZ4 output is mostly literal runs, so plaintext survives in FRAGMENTS.
So on a compressed SNAPSHOT the check is asymmetric, and only one direction counts: A HIT IS REAL EVIDENCE, A MISS IS NOT. A 28-character document id or a long API key can be split across a match reference, so strings never shows it whole and an absence means "not present in the literal runs" rather than "not present". The WAL is not written through that path, so a controlled absence there is still worth something.
That weakens scripts/audit-backup-credentials.sh in the direction I had least expected, and the entry is corrected rather than defended: its EXPOSED verdicts rest on hits and are sound, but any clean verdict over a SNAPSHOT is weaker than this file claimed - it bounds what is findable in the literal runs, not what is there. The positive control still matters (without it the check cannot report at all), it simply does not upgrade a snapshot miss into an absence. Read a clean snapshot result as "nothing surfaced", never as "nothing is there", and prefer the WAL and the LMDB data files when an absence has to carry weight. Use strings -a, and ALWAYS run a POSITIVE CONTROL first: grep for a collection or project name you know is in the file, and do not believe a zero until a known-present string returns non-zero. Without that control the audit reads as a clean bill of health while being incapable of reporting anything, which is the most dangerous possible result for a credential check - and I filed exactly that conclusion before the control caught it. scripts/audit-backup-credentials.sh does this properly and is falsified four ways; the fourth is the one worth copying, because it runs against a REAL pre-2.17 backup whose plaintext status was measured independently (2 genuine key-shaped tokens, $ENC$=0) and correctly says EXPOSED, while the post-2.17.2 copy says REVIEW with ciphertext markers. The same code giving different answers on data that genuinely differs is what makes it a measurement; a synthetic leak proves only that the regex compiles.
THE THREE SHAPES IN ONE SENTENCE, WHICH IS THE COMPRESSED FORM OF HALF THIS FILE: A CHECK THAT CANNOT FAIL LOOKS LIKE A PASS, A CHECK THAT FAILS ON CORRECT BEHAVIOUR LOOKS LIKE A BUG, AND A CONTROL THAT FAILS SAFE LOOKS LIKE DILIGENCE - AND ONLY THE THIRD IS FLATTERING, WHICH IS EXACTLY WHY IT SURVIVES REVIEW. A consumer's formulation, 2026-10-19. The practical consequence is that the second shape gets fixed fast because it is annoying, the first gets caught eventually because someone eventually doubts a clean result, and the third can sit indefinitely, because every time anyone looks at it the output reads as careful work.
A CONTROL THAT FAILS SAFE STILL DESTROYS THE CHECK, AND IT DOES IT WHILE LOOKING LIKE DILIGENCE. This file already records checks that cannot fail and checks that fail on correct behaviour. This is the pair of the second with a reassuring face. The first version of that audit script used strings -a file | grep -q: grep -q exits on the first match, SIGPIPEs strings, and under set -o pipefail the pipeline goes non-zero - so the control reported FAILURE on every file it had just successfully matched, and the script printed "CANNOT DETERMINE, no absence below means anything" for all three real files. That is the SAFE direction, it never claimed anything false, and it was still worthless: the correct reading of its output was "these files are unreadable", which they are not. It survived the synthetic tests because they were small enough that nothing differed. So fail-safe is the right default and it is not the same as working (a consumer's framing, after the same guard found two bugs in their own script - including one where a traceback above a success line in a deploy log read as a success). Never strings ... | grep -q here; use grep -c and compare, which consumes all its input.
And the field-name/value distinction cuts both ways depending on which error you can afford. Our snapshot has 40 hits for secret and zero exposure, because the word appears in ordinary tenant content - so a NAME appearing is not an exposure and the test must be anchored at a token start with a length floor (sk- turns up mid-blob in ciphertext by chance). A consumer auditing a bundle for client strings has the mirror problem: a client whose name is a common token would match every build, and a check that always fires is one somebody disables, so their length floor goes on the derived patterns instead. Same underlying fact, opposite failure, different remedy - which is why PRESENT, REVIEW and EXPOSED are three separate verdicts here rather than one boolean.
I PREDICTED THOSE TWO COLLECTIONS WOULD SURVIVE THE MIGRATION UNENCRYPTED, AND THEY DID NOT. The prediction was written down before the upgrade, which is the only reason it could be checked rather than quietly reinterpreted afterwards. Measured after 2.17.0: default:vectorapi_keys and default:vectorapi_settings are both [encrypted] with plaintext-required 0, and the boot log shows their rows and history versions being encrypted. The cause is an accident of history. The encrypted=true our code asked for landed on the BARE-name collections (vectorapi_keys, not default:vectorapi_keys), almost certainly through the pre-2.4.5 client bug where createCollection sent the unqualified name and the options went to a phantom collection - and 2.17.0 MERGES a collection's options with those of its bare alias, because migration files use bare names, so the qualified collections inherited the flag. The exposure was real and the guard was real; the rescue came from somewhere I had not looked, so my conclusion was wrong in the direction of alarm. The fix remains right for a reason that does not depend on the accident - encryption no longer rests on an alias merge surviving a future cleanup - but it is HARDENING, not the rescue its commit message claims.
getCollectionInfo / info IS NOT THE ENFORCED RULE, and that is how the wrong prediction happened. info default:vectorapi_settings still reports encrypted: no on 2.17.0 while that collection's data IS encrypted, because it reports the collection's OWN options rather than the merged rule in force. So the flag can be wrong in BOTH directions: false while encryption is active, and (before 2.17.0) true while nothing was encrypted at all. Treat encryption-verify's [encrypted] marker as authoritative and the flag as a hint; the database is fixing info in 2.17.1. This is the lesson this file keeps relearning, with a new edge: a field recording an intention is not a measurement of the outcome, and when it disagrees with the bytes it can disagree in the REASSURING direction as easily as the alarming one.
encryption-verify BLOCKS WRITES SERVER-WIDE before 2.17.1, so never run it against a shared database. It audits history through the same routine the migration uses to rewrite it, and that routine holds the GLOBAL history mutex for the whole scan, so every write recording a history version - update, patch, upsert of an existing row, delete, in ANY collection - waits for it. Measured at ~10 minutes on the live box, during which a consumer saw a collection wedged with Deadline Exceeded. Use a scratch server until 2.17.1.
A tenant can now reach encrypted_field through the INDEX route, and we answer 503 for it. After 2.17.0 the name patterns match at top level in every collection, user collections included, so a tenant declaring an index on a field named token or password is refused with INVALID_ARGUMENT / encrypted_field. But CreateIndexResult carries no reason: the client turns a non-OK status into success = false with only the message text (client.cpp in Impl::createUniqueIndex), discarding the trailer detail, so indexDeclineError falls through to 503 db_error - "retry as-is" for something no retry can fix. The mirror image of the FailedPrecondition bug: that told a caller a read-only database was its own mistake, this tells a caller its own permanent mistake is our outage. It cannot be fixed on our side, because the only distinguishing signal is the message text and matching on that is forbidden here. Fixed in database 2.17.0 as FailureDetail& OVERLOADS, and my proposed fix was rejected for a good reason worth keeping: adding fields to CreateIndexResult would change its SIZE under soname 2, which is the case that crashed a consumer in 2.7.1. A struct a client returns by value is ABI, so the additive shape is an overload, never a new member - and I argued it was safe by citing their comment that the struct was standalone, which was about not disturbing IndexDefinition's shape rather than a licence to grow this one. Use createUniqueIndex(coll, field, FailureDetail&), createCompositeUniqueIndex(coll, fields, FailureDetail&) and createIndex(coll, field, rowsIndexed, FailureDetail&), map reason == "encrypted_field" to our 422, and keep the duplicate-values path keyed on duplicateExamples; an in-band refusal arrives as code Unknown. For the setAdd/setRemove overloads failure.code == Ok means the call worked and the member simply was or was not there. The same "non-OK status becomes a success flag, detail discarded" shape is worth grepping for elsewhere.<project>:vectorapi_secrets, encrypted and deliberately NOT in the collection registry - so the documents API and ctx.collections both 404 it, and even a policy granting every collection cannot read it. Writes are admin-only; no GET ever returns a value. A SVAPI_FN_<project>__<NAME> host variable WINS over a stored secret of the same name, which is the break-glass a stolen API credential cannot shadow.ProjectWallMax wraps a SettingsStore with reloadAll() plus startWatch(), so a changed cap reaches the next run immediately. It used to be a hand-rolled cache on a project_budget_ttl_sec TTL, which made clearing a cap look broken for up to 15 s and produced a false bug report. reloadAll(), never bootstrap() - bootstrap WRITES, seeding the settings document, and a runner must never author configuration it only reads.runtime ceilings are boot-time only, unlike every hot-reloading setting in the server: QuickJS fixes a runtime's memory limit at creation, so changing one live would mean draining and recreating the whole pool. Editing them means restarting the runner - cheap, because vectorapi answers 503 for that moment and stores nothing unvalidated. By contrast function_egress_blocked_cidrs / function_egress_allow_private DO hot-reload, because they are read per run.ctx.env comes from the runner's environment, scoped per project: SVAPI_FN_<project>__<NAME> in /etc/smartbotic-vectorapi/runner.env reaches that project's functions as ctx.env.<NAME>. The project is part of the variable name because one runner serves every project; nothing outside the SVAPI_FN_ prefix is ever exposed, so the runner's own token and database address stay invisible to functions. Matched exactly and case-sensitively; the split is at the first __, so a project whose name contains __ cannot carry secrets.isLoopbackBind() answers "not loopback" for anything it cannot parse, so an unrecognised address produces the refusal. The comparison is constant-time, /health is authenticated too, and both sides prefer SVAPI_RUNNER_TOKEN in the .env over the conffile.network_egress belongs to the /settings/functions PUT, which is requireAdmin - NOT the /settings/embeddings PUT, which is requireProjectManage. It shipped in the wrong one in 0.10.1: a scripted edit replaced the first match of a line both handlers share, so an admin-only control was silently ignored on its documented route AND writable on a non-admin one, which would have let a project-manage key re-enable egress an admin had denied. The suite did not catch it because no test exercised the route at all; prod acceptance did, by noticing that a deny PUT answered "allow" and that an invalid value answered 200 instead of 422. Five integration tests now pin it, including that the embeddings route cannot touch it and that clearing an embedding override does not drop it. Two lessons: a settings key is not done until a test drives its ROUTE, and when patching one of several near-identical handlers, assert WHICH one the edit landed in.network_egress on PUT /projects/{p}/settings/functions (admin only, stored as function_network_egress) gates ctx.fetch AND ctx.mail through one requireNetworkEgress(), checked before the SSRF classifier and before any resolution - a denied project must not emit a DNS query either, since a lookup is an observable side effect and a channel of its own. Gating one surface and not the other would let an operator believe a tenant was offline while the other stayed open, and mail is the one carrying credentials. It is NOT a _network pseudo-collection scope rule: a scope rule answers "may this principal touch that data of ours", which is why _files is one, whereas reaching a third party the tenant already has credentials for is a capability rather than an access decision - and a pseudo-collection would put it in range of a * rule, exactly the widening that had to be fixed once already. The default is ALLOW (kFunctionNetworkEgressDefault, pinned by a test): ctx.fetch shipped ungated, so a default of deny would break every deployed function that fetches the moment the setting appeared, which is an outage caused by ADDING a control. The control that was missing is the ability to revoke. Note the runner needs its own test seam (HostContextConfig::networkEgress) rather than riding on egressPolicy, because that one means "there is no database to read" and a test setting it would skip the gate while appearing to exercise it.ctx.fetch egress goes through the SSRF guard (functions/net_guard.hpp): fail closed on anything unparseable, and classify every address a name resolves to, not the first. A settings blocklist is UNIONED with the built-in defaults by SsrfPolicy::fromSettings(), never substituted for them - an operator adding one CIDR must not silently reopen loopback, RFC1918 and the metadata endpoint. function_egress_allow_private is the explicit opt-out and relaxes only privateBlockedCidrs(); 169.254.0.0/16, link-local, multicast, reserved space and the IPv6 spellings of an IPv4 destination (NAT64, 6to4, ::/96) stay blocked whatever it is set to. Note the opt-out does expose loopback, where our own API listens.ctx.mail, IMAP + SMTP)ctx.fetch is cpp-httplib with its own guard, its own pinning and its own outbound defaults, and two HTTP clients with two sets of defaults is exactly how the two drift. Re-enabling it also brings redirects back, which then need CURLOPT_REDIR_PROTOCOLS_STR set separately and FOLLOWLOCATION off.runner_net is a separate target for testability, not tidiness. runner_host links vectorapi_core and the database client, so putting the IMAP and MIME code there would make the largest and most defect-prone part of the feature the one part only the Docker path can compile. The division at the boundary is strict: runner_host converts JS values to a plain request struct and back, and does nothing else - no curl call, no IMAP knowledge, no timeout arithmetic above that line.curl-8_22_0 (SVAPI_CURL_TAG, SVAPI_VENDOR_CURL=ON; OFF links the system one and is what the dev loop uses, because vendoring costs minutes). The pin comment carries the obligations, and they are real: CVE tracking is ours now, a statically linked curl is invisible to apt, and a fix means a rebuild and a republish of both binaries rather than an unattended upgrade. Judge an advisory against what this service reaches - exactly imaps/imap/smtps/smtp - the same discipline the httplib pin uses. PROXY is compiled out rather than disabled per handle, because curl reads *_proxy from the environment where httplib does not and runner.env is a file an operator edits; a stray proxy variable would silently reroute a destination the SSRF guard had already approved. NETRC is out so credentials can only come from project secrets. Cookies/ALTSVC/HSTS are out because each is persistent cross-request state, which a multi-tenant pool must not accumulate. A build from a git tag reports its version as 8.22.0-DEV.CURLOPT_CUSTOMREQUEST with BODY.PEEK[], NEVER curl's ;UID= URL form. Measured against a live server elsewhere: the URL form always sets \Seen. Undoing it afterwards with a UID STORE -FLAGS is worse than the disease - it removes a flag it may not have set, so a message the user had already read comes back unread, and a timeout between the fetch and the undo leaves the message read anyway, which is the exact outcome peek exists to prevent. A test asserts no STORE, +FLAGS or -FLAGS ever reaches the wire.) AND the tagged completion line; untagged response lines are what reach the write callback. Measured by byte count, which is the only way to see it: a fetch whose fake response was a 30-byte untagged line plus a 50-byte literal plus )\r\n plus the tagged OK delivered exactly 80 bytes. An earlier version of this note claimed the tagged line DOES arrive, and that was wrong - it came from a substring check for " OK " that matched * OK [UIDVALIDITY 1], an untagged line. The consequence is real: a successful fetch's raw buffer legitimately parses as NeedMore, because the framing it was told to expect was never sent, so the binding restores the framing and re-parses rather than treating that as a short read. Restoring framing is safe only because it cannot satisfy an unsent {n}, so a genuinely truncated literal still reports NeedMore. Never resolve this with a terminator search. Separately: a BODY.PEEK[...] fetch comes back labelled BODY[...] without the .PEEK, so a parser looking for the string it sent finds nothing.{n} LARGER than the body it sends corrupts silently, and only its CONTENT gives it away. curl counts the response's own framing toward the announced count and reports success: measured against 8.22.0, an announce of 50 for a 40-byte body yielded CURLE_OK and a 50-byte literal ending )<CRLF>A003 OK, which ctx.mail then returned as a 200 whose header and text both carried those ten octets. It cannot be caught structurally - curl strips the real framing in the healthy case too, so a padded response and a correct one are byte-for-byte the same SHAPE (untagged line, literal header, exactly n bytes, nothing after). literalEndsWithFraming() (net/imap_fetch.cpp, pure) therefore matches the tail, and parseCurlFetch refuses a body that ends in framing. The tag it matches is CURL'S, not ours: customRequestFor strips the tag from every command, so curl re-tags on the wire (measured: A001, A002, ... sequential) and our own ImapTagger value never reaches the server at all. Malformed, not NeedMore - a truncated transfer is transient and worth retrying, while a server that miscounts its own literal will miscount it again, so this is mail_protocol_error 502 and NOT retryable. An earlier note here described this defect as the DIRECT parse returning Ok; measured, the direct parse returns NeedMore and the corruption arrives through the framed re-parse, so a fix aimed at the direct path would have aimed at nothing.UID FETCH naming more than one uid delivers ZERO bytes to the write callback (7,9 and 7:9 both; a single 7 delivers normally). So a read is one command per uid, all on the one session and the one LOGIN. Measured; it is why the obvious batching optimisation does not work.Ok with no messages. The caller skips it. Nothing a returned message carries ever comes from the raw buffer, which is what makes the "tagged completion line returned as the e-mail body" bug structurally impossible here rather than merely absent... The renderer additionally emits a leading period as =2E in quoted-printable, so the protection holds either way.SEARCH CHARSET UTF-8 with the term as an octet-counted literal, which is a multi-step exchange the one-shot transport does not drive. Sending the raw bytes is worse than failing: the server matches nothing and zero results is indistinguishable from "there is no such mail". That shipped elsewhere and produced silently wrong answers against Hungarian mail. The refusal names the field and says to filter on an ASCII-safe criterion and match the accented text after fetching. Mailbox NAMES are unaffected and still go out as modified UTF-7.CURLcode 8 (WEIRD_SERVER_REPLY) with CURLINFO_RESPONSE_CODE 550. So a reply code the server actually sent wins over curl's generic transport complaint for the generic codes; otherwise a bad recipient was reported as a protocol fault. Codes that already carry more meaning than a reply code, such as a denied login, keep their own answer. A 4xx reply is transient (mail_server_busy, 503), a 5xx is the caller's problem (mail_rejected, 422 - a 550 is overwhelmingly a bad recipient or a rejected sender, and blaming the server sends them looking in the wrong place).sideEffecting is the caller saying whether the operation changes anything at the far end, for the same reason the run kind is a parameter to RunService::run. A failure is retryable only when nothing can have happened: DNS and connect failures are, a mailbox read that times out is, and a send is never retryable past the point delivery was possible, because a duplicate cannot be recalled. A rejected login is not retryable either - repeating it is how an account gets locked or an IP blocked, which is far more expensive than the failure being retried. A timeout is 504, not 503, because 503's whole meaning is "retry as-is".totalMs. An embedding call is one request/response, so bounding connect and read bounds it. A mailbox read is several round trips on one connection, and a read timeout bounds each quiet period and not their sum - a server answering every command just inside the read timeout holds a pooled runtime far past the run's budget without ever tripping it. resolveMailBudget() (net/mail_budget.hpp, pure) otherwise mirrors resolveEmbedBudget(), connect capped at half.mailGlobalInit() is called once from the runner's main before any worker starts, and FAILS CLOSED. curl_global_init is not thread-safe and a lazy first-use from two pool threads is a real race. It also checks CURL_VERSION_THREADSAFE and refuses to start without it, in the same spirit as the runner refusing to start with no token on a non-loopback bind. CURLOPT_NOSIGNAL on every handle, or curl uses SIGALRM for resolution timeouts, which is unsafe off the main thread and can longjmp out of a worker - and a single-threaded test never shows it.CURLSH, no cross-tenant reuse. A handle carries connection state and credentials. A fresh handle per command would mean a TCP connect, a TLS handshake and a LOGIN for every command, which is both slow and what gets an account throttled; a test asserts one LOGIN serves three commands.mailboxes decoded 6 folders in 263 ms; read with a smallerThanBytes criterion returned 3 of 9 matches in 312 ms; criteria: {unseen:true} worked; and the non-ASCII SEARCH refusal fired in production as mail_bad_argument 422 naming the field, which is the single most important safety behaviour here because the alternative shipped elsewhere as silently empty results. Credentials came from project secrets via passwordSecret, never from source. A function whose policy grants nothing (rules: []) can still use ctx.mail, which confirms the deliberate decision that an outbound surface is gated by network_egress and the SSRF guard rather than by scope rules.subject/from/from_address/to/cc/date/message_id beside the raw header (putDecodedHeaderFields, over the pure functions/unfoldHeaders + the RFC 2047 decoder this service already owns). Built because the raw header is folded and every consumer would get it wrong - see the next bullet. header is ALWAYS still returned raw: a decoded field is a convenience and must never become the only way to see what arrived. An undecodable value passes through as it came rather than raising, matching what the mailbox-name decoder does and for the same reason. Decoded from the HEADER rather than from IMAP's ENVELOPE deliberately: ENVELOPE would make the value depend on the provider's parsing, and we would own neither the bug nor the fix.header is RAW and FOLDED, and the naive regex truncates it SILENTLY. Measured through the deployed runner: a long accented subject arrived as Subject:<CRLF> =?UTF-8?B?...?=<CRLF> =?UTF-8?B?...?= - nothing on the Subject: line at all, the value split across two continuation lines as two encoded words. /Subject:.*=\?UTF-8\?/ is then false (. cannot cross the CRLF) while /^Subject:\s*(.*)$/m matches but captures only the FIRST encoded word, so one check fails loudly and the other lies. Both of my probe's checks were wrong, in opposite directions. Consumers must unfold before parsing and decode every encoded word, which api/llms.txt now says. Candidate improvement: expose a decoded subject on each message so no consumer has to get this right - deliberately NOT built, since it is a new surface.ctx.mail.send CANNOT WORK on the DigitalOcean prod droplet: outbound 25, 465 and 587 are blocked by the provider (2525 is NOT - an earlier version of this note said it was, which was wrong: 2525 merely had nothing listening at the time, and I folded it into the block without the second host that would have told the two apart), confirmed as the host's policy rather than the mail server's by smtp.gmail.com:587 and smtp.sendgrid.net:587 being blocked too. CONFIRMED ON A SECOND DROPLET BY A CONSUMER, 2026-10-13, which is what promotes this from "our box" to "the provider": 25, 465 and 587 blocked to both gmail and sendgrid, api.openai.com:443 open as a control, and smtp.sendgrid.net:2525 OPEN. Two consequences they drew that I had not stated. The alternative everyone reaches for does not work: nodemailer in your own service on the same host hits the identical wall, because the constraint is the port and not this API - so "do the send myself" is not a workaround, and they were one answer away from writing exactly that task. And since a provider WAS measured open on 2525, a customer mail host without 2525 does not make SMTP impossible - it makes it a question of which relay. Their own stated conclusion ("SMTP is impossible from this host in either form") was contradicted by their own control, which is worth remembering: a measurement can refute the conclusion drawn in the same message, and the person who took it is the least likely to notice. IMAP 993 and 143 are open. A send therefore fails as mail_timeout 504 after ~7 s with retryable: false - which is the right answer and worth noting: a send is never retryable even when the timeout proves nothing could have been delivered, because the guarantee has to hold without knowing. The ~7 s is also live confirmation that connect is capped at HALF the run budget (15 s descriptor timeout). Sending from prod WORKS over port 2525 with STARTTLS, verified end to end through the deployed runner: send accepted in ~1.3 s, then found by UID SEARCH and fetched back, with the message arriving \\Recent and NOT \\Seen - which is BODY.PEEK proven in production against a genuinely new message, the strongest form of that test. A send over 587 still fails as mail_timeout 504 with retryable: false.noreply@smartbotics.ai IDENTITY CANNOT SEND FROM PROD, AND THERE IS NO WORKING PRECEDENT FOR SENDING AS OURSELVES AT ALL. Measured on prod 2026-10-13: the credentials in /data/dev/.env under SMTP_*_NOREPLY point at mail.nethely.hu, which answers on NO reachable port - 25, 465 and 587 blocked by the provider, and 2525 closed. Read that last line against mail.onmail.hu:2525 being OPEN from the same host in the same run: DigitalOcean does not block 2525, so a closed 2525 means nethely does not offer it. That pair is the only way to tell "the host blocks it" from "nobody is listening" - the distinction I got wrong once before, when I called 2525 blocked on a single host that merely had nothing listening.
And I MANUFACTURED the precedent that sent a consumer looking. I described a peer session's daily-report work as "justice-pa" - justice-pa is a PROJECT on prod, the session is personal-assistant-d9 - and then cited it to another consumer as an established practice. Their user acted on the name, asked them to collect credentials and a working function from a session that does not exist, and the work itself is inert by its author's own statement: no credentials, nothing ever sent. So a sketch became a solved precedent because I renamed it and repeated it. A precedent needs its author's name attached and a check that it ever RAN - "they do this" and "they have code that would do this" are different claims, and only one of them is evidence.smartbotics.ai sender, whose single instruction is "enter the code from this message", is a phishing e-mail as far as a careful recipient is concerned - and the more careful they are, the less likely they complete the flow. A control that quietly lowers completion on a verification path is a product cost, not an administrative one. If it is taken, the customer has to be told to expect it before the link goes out and the message itself has to say plainly who sent it and why.
The precedent I cited did not transfer, and that is the generalisable part. I pointed at justice-pa sending as noreply@smartbotics.ai as settled practice. Their recipients were not being asked to APPROVE the customer's own content, so the trust bar was lower - the consumer spotted the difference, not me. A precedent carries its context: reusing one means checking that what made it safe still holds, not that the mechanism is the same. The mechanism was identical and the trust requirement was not.status, headers or body is read as a response ENVELOPE, and an envelope may contain nothing else. A diagnostic object with a field called status therefore fails the run with invalid_return - and if that object was built in a catch, it HIDES the error it was meant to report. Cost me a debugging round on prod.mail.onmail.hu, IMAP 993 implicit TLS and SMTP 587 STARTTLS, credentials in /data/dev/.env). Everything below was measured against that server, not a fixture, and every fake-server claim in this section survived it: LIST and modified-UTF-7 decoding, EXAMINE reporting PERMANENTFLAGS () read-only, UID SEARCH including UNSEEN, a peek fetch of a genuinely UNSEEN message leaving it unseen (the weak version of this test uses an already-seen message and proves nothing), the direct parse of a good fetch returning NeedMore while the framed re-parse returns Ok, no tagged line in the buffer, and a multi-uid UID FETCH delivering zero bytes. A full send-and-read-back round trip confirmed an accented Hungarian subject surviving as two =?UTF-8?B? encoded words and decoding back exactly, quoted-printable chosen for the accented text, a lone . body line arriving intact and not double-stuffed, an RFC 2231 attachment filename, and BODYSTRUCTURE part numbering of 1.1 for the text inside a multipart/alternative inside a multipart/mixed with the attachment at 2. Note EXAMINE alone prevents a flag change, so that test confirms the read path is safe but does NOT isolate BODY.PEEK's own contribution.runner/tests/fake_mail_server.hpp): in-process TCP listeners on ephemeral ports. Ephemeral because a fixed port collides - twice during development a test reached a stale server from an earlier run and "passed" against the wrong process. They mask credentials before recording a transcript, and the SMTP one answers a bare AUTH PLAIN with a 334 challenge, not 235: answering 235 made an earlier harness report a working login for a client that had sent no credentials. It also un-stuffs the leading period during DATA, as a real receiver does, or a correct client looks like it double-stuffed.{n} are NOT a fixed shape. Measured against a real mail provider: when a fetch sets flags, the provider volunteers the new FLAGS in the SAME untagged line as the body, so the items before the literal vary in number and order. Anchoring on the first { after FETCH is safe; counting fields or assuming a prefix length is not. Our parser walks name/value pairs over a parsed s-expression, so order is already irrelevant and unrecognised items land in unknownItems rather than breaking the parse - three tests pin that instead of assuming it.mime_words tests arrived with a real person's name and a real work address in nine places, because the cases were ported verbatim and the accented display name is the entire point of the RFC 2047 cases. The substitute must therefore stay ACCENTED - a plain-ASCII placeholder would quietly stop testing what the case exists for. When replacing one, recompute any pre-encoded =?UTF-8?Q?...?= literal rather than hand-editing it, and let the decode assertion verify the new encoding: a one-byte corruption of the encoded word must fail that case, which is how you know it checks the encoding and not your arithmetic.src/functions/mime_words.* is adapted from an existing internal implementation, is owned elsewhere, and changes flow one way INTO this repo. If a decoding bug turns up here, report it rather than fixing only this copy.config.json is minimal: log_level, http.{bind_address,port}, database.address. Everything else lives in the DB and hot-reloads (subscribe + atomic snapshot swap).default project, no leading underscore - see gotcha): vectorapi_keys, vectorapi_settings. The settings collection holds the global doc (current) and one project_<name> doc per project carrying that project's embedding overrides (empty field = inherit; the body repeats project because the DB strips id). Per-project registry: <project>:vectorapi_collections. The vectorapi_ prefix is reserved (collection-create rejects _ and vectorapi_).projects:["*"], admin:true) and logs it once; SMARTBOTIC_VECTORAPI_KEY seeds it, OPENAI_API_KEY seeds embeddings._-prefixed collections misroute when project-qualified. Writes land in MemoryStore (mirror skips _-names) but reads of default:_foo route to LMDB → null. → service collections use no leading underscore (vectorapi_*). Suspected DB bug.dropCollection left the collection's indexes declared, before database 2.12.2. The documents and the metadata went; the declared indexes, unique ones included, stayed. A collection later created under the same name inherited a constraint nobody declared - a legitimate write refused as a duplicate, measured directly: a recycled name on 2.12.0 answered unique constraint violated on recyc#sku. Collection-create and collection-delete therefore undeclare indexes explicitly, which is idempotent on 2.12.2 and the correct behaviour against anything older. The create-time repair must be gated on "is anything still attached to this name", NOT on getCollectionInfo (anythingAttachedTo() in handlers/collections.cpp): a poisoned name has no collection, so a presence check skips the repair in exactly the case that needs it. 2.12.2 also made dropIndex work on an absent collection, which is what lets an already-poisoned name be repaired at all - on 2.12.1 nothing could clear one.svapitest_apiproj), so ctest must run serially - -j makes them delete each other's state - and the fixture has to purge the previous run itself. It drops each of the project's indexes before its collection, because neither dropProject nor dropCollection does (see the two caveats here). None of this shows up in packaging/devstack, whose database is new every time; it only appears once the suite runs against a persistent one, which the native host build now does.dropProject does not physically purge collection data. A recycled project name is otherwise blocked by stale collections/registry → the project-delete handler drops the registry + collections first, and collection-create drops invisible orphans (after the registry "exists" check).id from a document body, not the database client. This note used to say the client did it, and that is measured as false on client 2.12.1: inserting {"id":"body-id-value"} with an explicit document id stores the body field verbatim and it reads back alongside the real _id metadata. The stripping is ours, in documentBody() (documents_util.hpp), which erases id and then calls stripDbMetadata() to drop the six reserved keys. Keep doing it: the database stores a reserved key as an ordinary user field while every read overwrites it with the real metadata, so a body carrying _version would put an invisible shadow copy on disk that no read ever shows and no filter can reach. Our layer is what keeps stored documents clean (the database is fixing this server-side in 2.13.0, for every other client). API keys store their stable id as key_id in the body (exposed as id externally) - that predates this and the stored rows are not worth migrating, but it was never forced by the client.protobuf-compiler-grpc + libgrpc++-dev + libprotobuf-dev are installed - find_package(gRPC CONFIG) (used transitively by smartbotic-db-clientConfig.cmake) fails on a gRPCTargets.cmake referencing missing plugin files. The Docker base installs them.memory.peak 1092 MiB, process VmHWM 1212 MiB, ending CLEAN / sealed: yes. Under a 900 MiB cap it was OOM-KILLED during compaction. Prod WAS 1973 MB with NO SWAP when this was measured; it now has a 4 GB /swapfile (added 2026-10-19, see the crash-loop note below), and the running database holds ~757 MB RSS which is freed when it restarts. The margin was real but not generous, and it ran out.
The same run on 2.17.1 OOM-kills identically, so this is NOT a version regression - it is the DATA. Friday's copy held 24733 rows and peaked at 364 MiB anonymous; today's held 33321 rows, 35% more, and peaks near 1.1 GB. A migration memory figure is therefore a measurement of one corpus on one day, exactly like a search baseline, and the earlier comfortable number would have been carried straight into a window had the second run not been made. An OOM is RECOVERABLE - the migration re-runs at the next boot and skips completed work - so the failure mode is a longer outage rather than lost credentials, which is worth telling consumers when asking for the window.memory.stat every second against the log (22.5k docs, a 626 MB and a 262 MB env):| phase | anon max | page cache max | |---|---|---| | boot + row pass | 456 MB (load spike, then ~375) | 218 MB | | seal snapshot (5 s) | 774 MB | 259 MB | | compaction (3m10s) | 373 MB, FLAT | 263 MB |
The snapshot serialises the whole in-memory store into one buffer, compresses into a second, writes, then verifies by reading back and fully decompressing - so the peak is roughly working set + one serialised copy of the store, about +400 MB there. Compaction never raised anonymous memory at all, even on a 626 MB env, because mdb_env_copy2 streams the mmapped env with small buffers; its cost is reclaimable page cache. Two consequences that inverted our planning: a large ENV does not threaten memory (so dropping a big collection would not have helped), and the thing that CAN kill the boot is identical work on every attempt, so under a cap it cannot fit it loops at the same point rather than retrying into eventual success. Progress is not persisted per project either.
Our own 1092 MiB figure was a cgroup peak and therefore INCLUDED page cache; only the anonymous part has to fit. Quoting it as the memory requirement overstates it - the same measure-the-wrong-quantity error as reading VmHWM and forgetting the LMDB mmap is file-backed.
SUPERSEDED BY GROWTH, 2026-10-19 - the measurement below was ACCURATE when taken and the claim it supports is now FALSE. Read the crash-loop note that follows before using any number here. The headroom was real on 2026-10-12 and the store outgrew it; the mechanism this paragraph describes is still correct, which is exactly why it stopped fitting.
MEASURED ON PROD, 2026-10-12: its own hourly snapshot peaks at 1051 MiB RSS against a 743 MiB steady state (+307 MB), and it survived that EVERY HOUR with vectorapi still running. Sampled at 1 Hz across the 13:30 UTC snapshot: 761 MB steady, 950 at 13:30:19, 1034 at 13:30:20, 1051 at 13:30:23, with "Created snapshot at sequence 206689" logged at 13:30:25. Box is 1973 MB, other services ~264 MB (journald 110, qdrant 82, dockerd 54, nginx 18), so peak plus others is ~1315 MB and the margin is ~658 MB with vectorapi stopped and the old process's memory already freed. So the seal snapshot fits, and the strongest part of that evidence is not the arithmetic - it is that the same code path on the same store already runs hourly and survives. It also fully explains the container OOM at a 900 MiB cap: the cgroup counted anon plus page cache, and ~724 MiB of steady-state total plus a ~307 MB snapshot spike simply exceeds 900.
The safest pre-flight number is the running server's own periodic snapshot - but it is a MEASUREMENT WITH A SHELF LIFE, not a property of the deployment, and nothing announces its expiry. snapshot_interval_sec is 3600 on prod, so it performs this exact serialise-compress-verify hourly and survives it; sampling its RSS across one ("Created snapshot at sequence ...") gives the peak the first boot has to reproduce, on the same store, same code and same config. A number from the thing itself beats any number from a container.
AND IT EXPIRED, AND THE EXPIRY WAS INVISIBLE FOR THREE DAYS. PROD'S DATABASE SPENT 2026-10-17 AND 2026-10-18 BEING OOM-KILLED ONCE AN HOUR, RECOVERING EACH TIME, UNTIL THE MORNING OF THE 19TH WHEN IT COULD NO LONGER BOOT AT ALL. The sequence is worth knowing in full because every step made the next one worse:
oom-kill results run hourly from 2026-10-17 00:37, 48 of them across Oct 17-18 - exactly 24 a day, at :37/:38.anon-rss:1513544kB.
IT WAS TWO DISTINCT FAILURES WITH DIFFERENT CAUSES, AND COLLAPSING THEM POINTS THE FIX AT THE WRONG PLACE. THE DISCRIMINATOR IS WHETHER THE BOOT REACHED Notified systemd: READY.shouldSnapshot() does fire immediately when the WAL is over max_wal_size_mb (100), and it fired on the recovery boot: service READY 11:39:16, "Created snapshot at sequence 406829" at 11:39:21, five seconds later and at the sequence recovery ended on, so no writes had intervened. But it runs AFTER READY, and phase 2 never got there. Note the snapshots directory does NOT discriminate here and must not be used to: its mtime sat at Oct 16 14:35 through all 120 cycles, which is equally consistent with "no snapshot attempted" and with "the writer builds its buffers in memory and died before writing". Execution progress discriminates; on-disk absence does not.
The consequence for a fix: streaming the snapshot writer prevents phase 1 and therefore prevents the WAL ever reaching the size that causes phase 2 - but it does not make phase 2 survivable. An operator who meets a 139 MB WAL after some unrelated crash is back in the unsurvivable case. Prevention and survivability are different guarantees and it is worth saying which one is on offer.
Last snapshot before the gap: Oct 16 14:35, sequence 337213. Next: Oct 19 11:39, sequence 406829, after the fix. ~69 hours with none.
FIXED BY ADDING SWAP, which is a floor under the symptom and not a cure. 4 GB /swapfile plus an /etc/fstab line so it survives a reboot (/etc/fstab is owned by no package - dpkg -S first, per the conffile trap above; backed up to /etc/fstab.bak-20261019). The fstab line alone is not enough: findmnt --verify --fstab warns "your fstab has been modified, but systemd still uses the old version", so a systemctl daemon-reload is needed for systemd to generate the swapfile.swap unit - verified afterwards as loaded, active and RequiredBy=swap.target. Same shape as the /etc mode 0751 trap: correct today and only visible as broken after a reboot. Verify the entry with swapon -a, which is idempotent and reports "already active", NEVER with swapoff - paging 847 MB back into a 1973 MB box would re-kill the thing you just rescued. Boot then peaked at ~1514 MB RSS and 818 MB of swap, settling at 847 MB in use, so the anonymous demand is well ABOVE the 1973 MB box rather than marginally over it. The snapshot peak still scales with the store, and swapping a 400 MB serialise is slow; the structural fix is the database's.
THE KILL POINT IS A LOWER BOUND ON THE REQUIREMENT, NEVER THE REQUIREMENT. Without swap the process died at 1.51 GB anon, and it is tempting to size against that. The kernel STOPPED it there - it never revealed its own peak. Only once swap gave it room did the real figure appear, and it was ~2.3 GB of anonymous demand. Sizing against an OOM kill point under-provisions by however much the process still had left to allocate, which is unknowable from the kill.
WHY NOBODY SAW IT, AND THIS IS THE GENERALISABLE PART: A CRASH THAT RESTARTS CLEANLY IS A SILENT CRASH. systemd brought it back each hour, so the observable was a ~40 s outage once an hour inside consumers' retry budgets - and the database logs it only as status=9/KILL, with no line saying a snapshot FAILED. Worse, the run log lives in the database, so during each kill it goes QUIET rather than recording failures: the absence-is-not-information trap this file already records, now in its most expensive form. A consumer reported it only on the day it became permanent. So "the service is up" and "the service has not been failing" are different claims, and NRestarts is the cheap way to tell them apart - 183 here, which was visible all along and which nobody read. Check it when closing any window, next to apt-mark showhold; it is the same class of signal as the ii/hi column this file has now been read past twice.
RUNNING PROD ON SWAP COSTS NOTHING MEASURABLE IN THE STEADY STATE - BUT READ THE REFUTATION BELOW BEFORE USING THAT AS "IT IS FINE": MEASURED 2026-10-22, IT COSTS A MULTI-SECOND STALL ONCE AN HOUR, AND A STEADY-STATE SAMPLE CANNOT SEE THAT BY CONSTRUCTION. The numbers in this paragraph all still reproduce; the conclusion drawn from them was wider than they could support, and the periodic cost is in the snapshot-stall entry further down. The obvious worry after the fix is that a database holding 866 MB in swap now serves every read through paging. Measured after recovery: vmstat shows si=0, so=0 - no page-in or page-out activity at all, so the swapped pages are the init-time peak sitting cold, not working set being thrashed. A pure DB read through our API (/documents?limit=5, no embedding in the path) answers in 3-10 ms. The one slow number, an 8.17 s vector search, was NOT swap: the same query_text repeated answered in 0.267 s and 0.242 s, which is the provider caching identical text exactly as recorded above, so the 8 s was the cold provider round trip in its known bad tail. The pure DB read is the control that makes this conclusive - it removes the provider from the path entirely, and at 3 ms it cannot be hiding a paging cost. Without it, a fast repeat would have been equally consistent with "swap is fine" and "the provider cached it while swap is still slow".
No data was lost, and the arithmetic is the proof rather than the doc counts. The last good snapshot ended at sequence 337213; recovery logged "Replayed 69616 WAL entries from sequence 337213" and "Persistence manager started, WAL sequence: 406829", and 337213 + 69616 = 406829 exactly - the WAL began precisely where the snapshot ended, with no gap and no overlap, across the whole ~69-hour snapshot drought. "Recovery complete (TrivialSuccess): 65030 docs in 73 collections", and a document body read back intact from all four live tenants. A COUNT would not have shown this: counts match under several wrong outcomes, whereas the sequence identity can only hold if every write in the gap was replayed.
GREPPING AN OOM LINE FOR A SERVICE NAME MISREADS IT, AND THE MISREADING IS THE FLATTERING ONE FOR WHOEVER IS GREPPING. cpuset= NAMES THE CGROUP THAT TRIGGERED THE ALLOCATION; task= AND task_memcg= NAME THE VICTIM. Five kernel lines on 2026-10-19 read cpuset=smartbotic-vectorapi.service ... task_memcg=/system.slice/smartbotic-database.service, task=smartbotic-data, so a grep for our own service name matched them and they look exactly like vectorapi being OOM-killed. It never was: ours asked for memory, that request tripped the GLOBAL OOM killer, and the kernel chose the database as the victim because it was the largest. NRestarts=0 on all three of our units is the control, against 183 on the database from the same command. Under global memory pressure the process that triggers a kill and the process that dies are routinely different, which also means a service can be a repeated CAUSE of another service's death while its own logs stay perfectly clean - worth knowing before taking "my service shows nothing wrong" as exculpatory. Read task=.
vectorapi itself came through untouched, up since 2026-10-15 15:56 (the supervised restart after the client library moved) and the runner since 2026-10-13, and it answered 1664 requests with 503 during the permanent phase - correctly classified, naming the real condition, which is the error-slug work doing its job under the one condition nobody arranges deliberately.
The pre-flight rule that follows: a headroom measurement needs a RE-MEASUREMENT TRIGGER, not just a date. "The snapshot survives hourly" was true, dated, and silently became false through ordinary growth - no deploy, no config change, nothing to review. Tie it to a quantity that moves: snapshot file size against free memory, or doc count against the figure the headroom was measured at. A dated measurement with no trigger is a claim that will be believed long after it stops being true, which is precisely the failure this file's maintenance rule exists to prevent - and here the stale claim was MINE, in this file, and it read as reassuring right up to the outage.
RE-MEASURED 2026-10-22, AND THE TRIGGER THIS FILE ASKED FOR HAS FIRED: PROD IS NOW SURVIVING ITS HOURLY SNAPSHOT ONLY BECAUSE OF THE SWAPFILE, AND THE MARGIN ABOVE THE BOX IS GONE RATHER THAN THIN. The entry above demanded a re-measurement trigger tied to a quantity that moves instead of a date. Here is that quantity, moved:| | 2026-10-19 (the outage) | 2026-10-22 |
|---|---|---|
| documents | 65,030 at recovery | 94,805 |
| serialised snapshot | ~370-399 MB | 685 MB |
| process VmHWM | ~1514 MB at the kill point | 1794 MB |
| cgroup memory.peak | - | 1860 MB |
| swap in use by the database | 847 MB | 863 MB |
Box is 1973 MB and other services take ~264 MB, so the peak now EXCEEDS what the box could give it: the process holds 871 MB resident plus 863 MB paged out, i.e. ~1.73 GB of anonymous demand, and without the 4 GB swapfile it would be dead every hour. Doc count grew 42% in three days (the step came 19th to 20th, +21,035 in one day - a consumer backfill - while the last four hours moved the snapshot only 88 KB, so this is step-change growth, not a smooth ramp, which is the harder kind to leave a margin for).
The healthy signals are genuinely healthy and must not be read as "fine", because they are the output of the swapfile doing its job: snapshots complete hourly in ~9 s, 14 of them that day, the WAL directory is EMPTY - which is the exact inverse of the Oct 17-19 state where nothing completed so nothing truncated - zero OOM kills since Oct 20, NRestarts=0, and si=0 so=0, so the swapped pages are the cold boot transient rather than working set being thrashed. Everything works. It works with no headroom.
So the 2.20.1 window moved from "the structural fix for a solved outage" to "the thing standing between us and the same outage at the next step-change", and the distinction this file already draws decides what it buys: streaming the snapshot writer removes the hourly peak and therefore prevents phase 1 and the WAL growth that made phase 2 unsurvivable - but boot still holds the whole dataset in memory, which 2.20.1 does NOT fix, and the dataset is now 42% larger than the one that could not boot on 2026-10-19. The swapfile is what covers that today. Quote both halves when asking for the window.
THE HOURLY SNAPSHOT STALLS THE DATABASE FOR SECONDS AND FAILS REAL TENANT SEARCHES. 79% OF EVERY gRPC DEADLINE FAILURE COINCIDES WITH ONE, AGAINST A BASE RATE OF 3.7%. Measured 2026-10-22, and it is the memory state above showing up as latency rather than as a crash - which is why it was invisible. Every Deadline Exceeded vectorapi logged since Oct 20, excluding the cluster around the database's own restart, timed against every snapshot completion:
getCollectionInfo 30, similaritySearch 5, getMemoryStats 5, insert 3The control is what makes it an association rather than a pattern found by looking for one: reshuffling the same 43 stalls to uniformly random times across the same span, 200 times, gives mean 1.4 hits and a MAXIMUM of 7. Observed 34. Clustering is cheap to find once you have a hypothesis, and this is the cheap check that says whether it is there.
A WINDOW ANCHORED ON ONE SIDE OF A PERIODIC EVENT SYSTEMATICALLY MISSES THE EVENTS JUST INSIDE THE OTHER SIDE, and it nearly cost half the result. My first pass measured each stall from the nearest PRECEDING snapshot and reported 56%. Nine stalls came out at +3639s, +3644s, +3651s and read as the uncorrelated remainder. Snapshots drift ~45 s later each hour because the timer restarts after each completion, so a stall 3639 s after one snapshot is a few seconds BEFORE the next one finished - during it. Measuring to the nearest snapshot in either direction moved 56% to 79%.
The impact is real traffic, not only our own metadata reads. 5 similaritySearch and 3 insert failures are a tenant's. Cross-checked in the access log: one tenant's kb_facts/search took 503s at rt=60.062, 21.063, 19.177, 17.810 and 14.391 on 21 Oct, and the 01:13:07 cluster sits +4 s after a snapshot completion.
NOBODY REPORTED IT BECAUSE EVERY AFFECTED CALLER TOLERATES IT - the tolerated-failure trap this file already demands a re-check trigger for, now costing an hourly outage nobody can see. Ours log a warning and carry on (function scheduler could not list projects, function event watcher could not list projects, function job reclaim failed, could not enqueue cron job), and two of the 22 Oct stalls had no HTTP request in that minute at all, so they were purely internal. The tenant retries. Nothing alerts on a warning written by a path that is designed not to fail loudly, so the signal sat in the journal for days.
This is not ours to fix in code: it is exactly what 2.20.1's streaming snapshot writer removes, which means the window buys a measurable present fix rather than only insurance against the next step-change. Tracked as SV-18.
It also REFUTES this file's own claim that running prod on swap "costs nothing measurable here". That entry stands as a steady-state measurement - si=0 so=0, a 3-10 ms document read, and those still reproduce - but the conclusion drawn from it was too wide. The cost is seconds long and once an hour, so a steady-state sample cannot see it by construction, and the sample was taken on the reassuring side of the very thing it was meant to rule out. The discriminating measurement is one that spans the periodic event, not one taken between them.
KeyStore/SettingsStore bootstraps DO perform the online upgrade after the migration, and the log says so - but with 0 rows and 0 history versions rewritten, because the collections are already ciphertext through the bare-alias merge. encryption-verify then reports sealed: yes, CLEAN, exit 0. So the window is TWO steps and ONE compaction (upgrade, then start vectorapi), with verify as the branch: plain CLEAN means done, CLEAN (UNSEALED: ...) means take the reseal inside the window. On 2.17.1 that same flag move requested a reseal that compacted every project, which is where the obsolete three-step plan came from.
Note the upstream log line still says "old plaintext copies are removed at the next restart" even when it rewrote NOTHING, which contradicts verify's sealed: yes and would have an operator restart for no reason. Trust verify.libsmartbotic-db-client.so.2 under a server binary compiled against 2.14.0 headers - and the documented failure mode is that it installs fine and segfaults later. Verified before deploying rather than hoped: a Debian 13 container holding the real smartbotic-vectorapi 0.12.0-1 deb plus libsmartbotic-db-client 2.17.2-1, against a 2.17.2 server, answered 21 of 21 calls correctly - including POST /indexes with unique, which exercises CreateIndexResult, the by-value struct whose SIZE is the thing that would break, and a 409 duplicate refusal, which proves duplicateExamples crossed the boundary intact. /api/v1/version reported db_client: 2.17.2 so the new library really was loaded. Repeat this whenever DB_CLIENT_VERSION and the deployed client diverge; it takes minutes and the alternative is a restart days later.toloajto:kitchen_presets on every page load and got 403, 63 times on 14 Oct, 70 on the 15th, 6 on the 16th. What I measured was sound: the 403 is real, every other collection on the same page load answers 200 from the same origin with the same key (so not the key, not the Origin allow-list), kitchen_presets is absent from the admin listing of all eight collections, and the key IS granted read/list on catalog_kitchen_modules. What I then asserted, having never looked at their client, is that kitchen_presets was a typo for catalog_kitchen_modules - and it was not. The owner traced it: the two collections are genuinely unrelated, kitchen_presets feeds a kitchen TEMPLATE shape (layout, wallDims, plinthColor) while catalog_kitchen_modules is a module catalogue of a different shape that their client never reads at all, so the rename I recommended would have loaded module documents and used them as layout templates. The real cause is that the read sat in a SHARED startup catalogue load, so it fired on the public wardrobe site although kitchen is dev-gated; the fix was to gate the fetch, and the collection was simply never provisioned.
The similar name is what made the wrong hypothesis attractive, and "what else would produce this exact result?" has an obvious second answer: a collection nobody ever created. Both produce an identical 403, because the refusal names neither the collection nor the op - see the next bullet. So this is the family trap again, committed in the same afternoon as a long note about committing it, and committed in its most deceptive shape: four cited observations and one uncited inference, which reads with the credibility of its neighbours. The rule already written here applies verbatim - if a claim has no file, line or measurement behind it, say so in the same sentence - and the specific discipline for diagnosing someone else's caller is that their client's INTENT is not derivable from our logs, however suggestive the names are. Ask them.
THEN I GOT THE SAME COLLECTION WRONG A SECOND TIME, IN THE MESSAGE WHERE I RECORDED GETTING IT WRONG THE FIRST TIME - AND THE SECOND ERROR HAS ITS OWN SHAPE WORTH NAMING: A REQUIREMENT INFERRED FROM TRAFFIC MEASURED AFTER THE FIX THAT SUPPRESSED THAT TRAFFIC. Filing the follow-up, I wrote that the public key "appears not to need" kitchen_presets because the templates feed an admin tool. The owner corrected it: the templates feed BOTH - their startup catalogue load reads them with the PUBLIC key and renders them as the customer-facing template gallery, and the admin CRUD is the other consumer. The only reason prod showed admin-shaped access alone is that they had gated the public read behind ?dev=1 hours earlier, that same morning, as the fix. So I measured the state the mitigation produced and read it as the design. The cost would have been the identical 403 on kitchen launch day, which is the failure we had just spent the morning diagnosing, reproduced at the next launch because the wrong line had hardened into the task.
The tell is a question worth asking whenever a requirement is read off observed traffic: WHAT CHANGED RECENTLY THAT WOULD REMOVE THIS TRAFFIC? A measurement taken after a mitigation describes the mitigated system, and "nobody calls this" is not evidence that nobody needs it - most sharply when the thing that stopped the calls is a change you were told about in the same conversation. Note what did NOT save me either time: both inferences were about a consumer's own code, both were avoidable by asking, and the first correction's lesson ("a caller's intent is not derivable from our logs") was already written down when I made the second. Writing the rule is not the same as applying it, and the gap between them is one message.
IT HID FOR THREE DAYS BECAUSE A .catch(() => []) TURNED IT INTO THE IN-CODE DEFAULTS, so no user ever saw anything wrong and only our log knew. That is the THIRD independent instance in one day of the same mechanism, which is why it is recorded as a rule rather than an anecdote: novitax-6c's portal answering an identical 202 whether mail went out or not, toloajto's postValidate() returning null on any non-2xx, and this swallow-into-defaults. A silent fetch failure is invisible to users and visible in our logs, which makes a log sweep worth doing on someone else's behalf - and it is the strongest argument for the error message in the next bullet, since the one party who CAN see these has only the status code to go on./ answers 404 BY DESIGN. Added 2026-10-15.
qdrant-1.shop.static.shopcall.ai/rag/ - the ORIGINAL mount, unchanged and still the full surface including the admin web UI. proxy_pass carries a TRAILING SLASH here, which strips the /rag prefix before vectorapi sees it.global-api-01.smartbotics.ai - the CUSTOMER-FACING name, at the ROOT, with its own Let's Encrypt cert (expires 2027-01-13, --redirect so 80 answers 301). proxy_pass has NO trailing slash, so the path reaches vectorapi unchanged. The two mounts are deliberately different and must never be copied onto each other.
It is a WHITELIST, not a deny-list on /, and that is the load-bearing choice: /api/ and /healthz are proxied, everything else returns 404. vectorapi serves its ADMIN WEB UI at /, which does not belong on a hostname handed to customers - and with a deny-list, a route added by a later release would be exposed the moment the package upgraded, with nobody noticing. The cost is that a genuinely public new route must be added here deliberately, which is the point. The shared proxy settings (180 s read timeout for the server-side embedding, 10 MB body) live in /etc/nginx/snippets/vectorapi-proxy.conf and are included by every location, so the two cannot drift.
/docs, /openapi.json and /llms.txt WERE whitelisted here for about five hours on 2026-10-15, and were then removed by the owner's decision: the API is the only thing this hostname serves. The reason is worth keeping because it is not secrecy - nothing there was callable without a key. The docs page renders the COMPLETE operation list, admin key management, project deletion, the read-only lock and the server-wide stats included, so it published a catalogue of what to come back and try. A customer needs the one URL they were given plus minimal docs for the part they actually use. All three stay reachable on the OLD name under /rag/, which is where we read them. /healthz stays because it was verified to return {"status":"ok"} and nothing else, so an outside monitor needs no credential. The 404 discloses nothing further either: server_tokens is already off globally, so it answers Server: nginx with no version.
AND THE REFUSAL ITSELF IS TOO QUIET: requireCapabilityCore ANSWERS 403 "scope does not permit this operation" WITH NO COLLECTION, NO OP AND NO HINT OF WHAT THE KEY CAN REACH (src/server.cpp:57). A misspelled name, an ungranted one and a never-provisioned one are byte-identical in that answer. Confirmed by the consumer it happened to: it sent them to re-verify their KEY rather than the string, which is the wrong half of the system. Keep the 403 - do NOT answer 404 for absent and 403 for ungranted, because that pair lets a scoped key probe which collections exist in its project outside its scope, the leak closed deliberately above. FIXED IN 0.15.0 (scope_refusal.hpp, pure): the message now names the collection and the op asked and echoes the collections this key IS granted, which discloses nothing a holder cannot read off their own key - the same reasoning that makes scope_filtered safe to send unconditionally. details carries collection, operation and granted. The STATUS deliberately did not move, and an integration test asserts 403 rather than 404 for exactly that reason. Three things in the fix are worth keeping. The message says outright that this same refusal is returned whether the collection is outside the key's scope or does not exist, because the status cannot distinguish them and the holder is the only party who can - that sentence is the one that would have saved the three days. The granted list is NOT filtered to rules mentioning the requested collection: the caller's problem is usually that they are asking about the wrong name, and a list filtered by that same wrong name would be empty exactly when it is most needed. And a key with NO rules says so in words rather than rendering an empty list, which reads like a failure to render. The boundary is unit-tested rather than inferred: one test asserts the refusal names no collection the key does not hold, and another asserts it is byte-identical for two names the key equally lacks once the caller's own input is normalised out - so a later change that passed collection EXISTENCE into the message would have to delete that assertion deliberately rather than by accident. It was deliberately kept out of 0.14.0 while that payload was already cleared by two consumers; 0.15.0 supersedes 0.14.0 unpublished, so they are being re-asked for the combined payload anyway.
THE ORIGIN ALLOW-LIST LIVES AT scope.origins, NOT AT THE TOP LEVEL OF THE KEY - AND READING THE WRONG ONE MADE ME RULE OUT THE CORRECT DIAGNOSIS. 2026-10-20, diagnosing toloajto 403s: my probe printed key["origins"], got None for all four keys, and I reported that no key carried an allow-list. It is at key["scope"]["origins"], and both toloajto keys carry six origins. The hypothesis I had just discarded was the right one. A field read from the wrong nesting level answers confidently and wrongly, and it looks exactly like a measurement - which is the same failure as reading a flag instead of the bytes, one layer in.
THE CORS PREFLIGHT SUCCEEDS WHILE THE REAL REQUEST IS REFUSED, SO "CORS IS FINE" ANSWERS THE WRONG QUESTION. The access log pairs each 403 with a 204: OPTIONS answers 204 regardless of the allow-list, then the GET is refused 403. A developer reads the successful preflight as proof the origin is accepted. Measured: 1124 preflight 204s against 1470 403s from one origin, and not a single 200, on any day since 2026-10-08.
AND THE CLIENT HID IT COMPLETELY FOR TWELVE DAYS, WHICH IS THE THIRD TIME THIS EXACT MECHANISM HAS APPEARED HERE. The owner reported it as "it worked from morning to now", and the log says that origin has never once succeeded. Their catalogue load swallows a failed fetch into the in-code defaults (.catch(() => [])), so the site renders and looks right while serving built-in data rather than live data. The 403 is correct behaviour throughout; what is invisible is that the app silently stopped reading the database. So "it works" from a consumer and "it returns 200" from the log are different claims, and when they disagree the log is the one that is about the system. The discriminating check is free and was already in the data: the SAME path, grouped by Referer, shows 403 for every origin absent from the list and 200 for every origin present - a differing input with a differing output, which is the one test this family cannot survive.
Updating a key's origins REPLACES the whole scope (PATCH /api/v1/keys/{id}, parseScope builds a fresh KeyScope), so a patch carrying only origins does not merge - it would redefine the scope, and it fails closed on scope.rules must be a non-empty array rather than silently granting nothing. Read the current scope, add the origin, send it whole, and then VERIFY by diffing the read-back against a saved copy: rule count and rule contents identical, rate_limit_per_min and expires_at unchanged, exactly one origin added and none removed. A config change that could silently narrow a key's rules needs that diff, not a 200.
A KEYED 404 IS THE CONTROL THAT PROVES THE BLOCK IS NGINX'S OWN. /docs answers 404 WITH a valid admin key as well as without one. Without that control a 404 on this host is equally consistent with "the route is gone" and "the request was not authorized" - and those are different stories, one of which would come back the moment a customer sent a key.
REMOVING A ROUTE DOES NOT CLOSE A PAGE THAT IS ALREADY OPEN, AND THE HALF-DEAD RESULT READS LIKE A SERVER FAULT. Measured in a browser immediately after the reload: the HTML and rapidoc-min.js came from the browser's DISK CACHE so the title still rendered, while openapi.json went to the network and 404'd - leaving a page that looked alive and listed nothing. A cache-busting query string answered nginx's own 404, which is the real state. So verify a withdrawal with a URL the cache has never seen, and expect anyone who had the page open to meet a BROKEN docs page rather than an absent one.
THE ERROR PAGES ARE BRANDED NOW, AND ONE SETTING DECIDES WHETHER THAT IS COSMETIC OR BREAKING. /etc/nginx/snippets/branded-errors.conf maps 403/404/500/502/503/504 to static pages under /var/www/smartbotics-errors/_brand/, styled from the design tokens read off smartbotics.ai (--gradient-primary, --foreground, --radius), bilingual EN/HU, with a dark-mode variant. proxy_intercept_errors is OFF, which is the default, and MUST STAY OFF: it is the single setting that would replace vectorapi's own {"error":{"code":...}} JSON with HTML and silently break every client that parses our errors. Verified after the change that an unauthenticated /api/v1/version still answers the JSON envelope, because the branding is only meant to cover the errors NGINX ITSELF raises. Everything the page needs is on local disk, so the 502 page still renders when the upstream it is reporting on is down - an error page that fetched its own assets through the proxy would be blank in exactly the case it exists for. The pages are internal (unreachable as paths); only the logo is not, since the browser must fetch it.
AN ERROR PAGE'S RELATIVE URL RESOLVES AGAINST THE REQUESTED PATH, NOT AGAINST THE ERROR PAGE'S OWN PATH, AND EVERY TEXT-BASED CHECK PASSES WHILE IT IS BROKEN. The pages first carried src="logo.png", which is correct relative to /_brand/404.html and is never what the browser resolves: nginx's internal redirect leaves the URL as the REQUEST, so the logo was fetched from /logo.png, or /some/deep/logo.png, and 404'd every time. curl said status=404 type=text/html and the body contained the brand name twice, so it looked finished. It was a screenshot that found it - the broken-image icon - which is the one check that could. A local preview had also passed, because the file happened to sit beside the HTML there, so the preview was testing a layout the server can never reproduce. Absolute /_brand/logo.png fixes it, and the test that proves it is a DEEP path, not the one the page was first opened at.
EVERY nginx-RAISED ERROR ON THE BOX IS BRANDED NOW, AND THE CATCH-ALL IS OURS RATHER THAN DEBIAN'S. The snippet is included by all four server blocks: both hostnames, the port-80 redirect and the catch-all. The bare IP and any unknown hostname answer a branded page carrying the landing text, with status 404 rather than 200, because nothing is published there and a 200 would tell every monitor and crawler otherwise. Verified afterwards that qdrant still answers its own JSON on :6334 and the whole /rag/ surface is untouched, which is the part that mattered: that hostname fronts a service that is not ours.
NEVER EDIT A dpkg CONFFILE TO DO IT. /etc/nginx/sites-available/default belongs to nginx-common, and a modified conffile makes every later nginx upgrade stop and ask about a three-way merge - a cosmetic change turning into an interactive prompt in the middle of an unattended upgrade. I edited it, the owner caught it, and it was restored byte-for-byte (dpkg --verify nginx-common prints nothing, which is the check). The catch-all now lives in /etc/nginx/sites-available/smartbotics-catchall, which no package owns, and the packaged default is left as shipped and simply not symlinked into sites-enabled; /var/www/html/index.nginx-debian.html is the same story, still on disk and never served. dpkg -S <file> before touching anything under /etc - and note the failure is invisible at the time, since the edit works perfectly until an upgrade months later.
MOVING A CONSUMER TO THE NEW NAME: THE BASE IS THE ROOT, AND THE OLD VALUE INVITES THE ONE WRONG GUESS. https://global-api-01.smartbotics.ai with NO /rag and no trailing slash; https://global-api-01.smartbotics.ai/rag/... is a 404, measured. Everything else carries over and was verified rather than asserted when a consumer asked before their go-live: both names proxy to the same 127.0.0.1:8080, and GET /api/v1/projects/toloajto/collections returns 200 on both with byte-for-byte identical bodies. CORS preflight is identical (204, same Access-Control-Allow-*). proxy_read_timeout 180s and client_max_body_size 10m match, the new host taking them from the shared snippet so the two cannot drift.
Keys and origin allow-lists need NO re-provisioning, and the reason is the part worth stating: a key and its allow-list live in the DATABASE, not in the hostname, and the allow-list is checked against the Origin header the BROWSER sends, which is the consumer's PAGE origin and does not change when they point at a different API host. A consumer will reasonably assume otherwise and ask whether their keys must be re-issued.
The one way this switch bites: a wrong base returns HTML, not JSON. Outside /api/ the new host answers nginx's own branded 404 page, so a base string that still contains /rag gives the caller text/html and a JSON parse failure rather than our {"error":{...}} envelope. On the old host everything under /rag/ reaches vectorapi, so a bad path there still returns JSON. The failure therefore does not name its own cause, and it lands at CONFIG time - which is why the advice to a consumer is to test one real write against the new base before flipping prod, and never to flip it the day before a go-live.
THE ACCESS LOG NOW CARRIES TIMING, AND IT IS combined PLUS THREE APPENDED FIELDS RATHER THAN A NEW SHAPE. Done 2026-10-16 (task #84), after a consumer's latency question turned out to be unanswerable retrospectively: the built-in combined format records no time at all, so "was it slow yesterday" had no evidence in either direction. /etc/nginx/conf.d/log-format-timing.conf defines log_format timing as combined plus host=$host rt=$request_time urt=$upstream_response_time, and the two API server blocks set access_log ... timing. Appended, never reshaped, so anything parsing the combined prefix keeps working - the same additive discipline as details.unsupported.
host= is the field that is easy to leave out and then need: prod serves two hostnames with different surfaces, so without it a line cannot be attributed to either. And the GAP between rt and urt is usually the answer, because it is the part a consumer cannot see from their own side: a slow client or a large body rather than a slow backend. urt is - when nothing was proxied, which is correct rather than zero.
AND THE ACCESS LOG IS NOT ROTATED - IT RUNS BACK TO 2025-11-24, SO ANY "BY HOUR" AGGREGATE OVER IT IS ELEVEN MONTHS BUCKETED BY HOUR-OF-DAY. Met 2026-10-22: asked how a consumer's 429s were distributed, I grouped by the hour field and produced a clean, plausible histogram peaking at 09:00 with 305 refusals. It was every 09:00 since November. Scoped to the actual day the answer was 44. The artefact is convincing precisely because the shape looks like a working day. Scope the date first (grep 22/Oct), and check head -1 for the log's real start before quoting any total as "today".
Two more traps in the same file, both of which produced wrong numbers before anything caught them. grep " 503 " matches the BODY-SIZE field as well as the status, so it counts 200 503 lines as failures - it reported 1685 where awk '$9==503' reports 1. And a request count is not a concurrency measurement: 126 requests in a minute is what explained a timeout here, while the same count spread evenly would have explained nothing, so read the per-second clustering rather than the per-minute total.It went in conf.d and in the SITE files, never in nginx.conf, which is an nginx-common CONFFILE - dpkg -S first, per the trap above. conf.d is included at line 60 and sites-enabled at 61, so a format defined there is visible to the site files. A second access_log at the http level would have DOUBLE-logged every request rather than replacing the default, which is why it is set per server block.
The qdrant site file has three identical server_name lines, so the edit was placed by LINE NUMBER and then asserted by printing the surrounding lines - the scripted-edit-landed-in-the-wrong-handler trap, in config form.
And a reload does NOT re-format existing keepalive connections, which looks exactly like a config that did not take. Measured: immediately after the reload, requests from an external node client with persistent connections were still logged in the OLD format while fresh requests carried the new fields, because old workers keep serving established connections. The cut-over was visible at a single second and resolved in about five. So verify a log-format change on a NEW connection, and do not read a few old-format lines after a reload as failure.
Two traps met while doing it. The half-written config was a BYTE COPY of the qdrant one with a single server_name changed, so it still carried full duplicate qdrant-1 blocks on 443 and 80 and pointed at qdrant's port 6333 and qdrant's certificate - enabling that would have put conflicting server blocks on the live site and served a cert that covers neither name. And the first request after systemctl reload nginx hit the old worker set and answered 404, which read exactly like a broken location block; every path passed on a retry seconds later. Do not diagnose an nginx location from a request issued in the same breath as the reload.
| project | during the backfill | after it finished | ratio | |---|---|---|---| | novitax | 4.707 s | 0.553 s | 8.5x | | justice-pa | 0.223 s | 0.035 s | 6.4x | | toloajto | 0.174 s | 0.031 s | 5.6x | | creditforte | 0.076 s | 0.008 s | 9.5x |
The UNIFORMITY is the finding, and it refutes the per-collection reading. justice-pa and creditforte share no collection with novitax, and the 2.17.2 history lock is per-collection, so contention there cannot explain it. nproc is 1. cpp-httplib's default pool is max(8u, hardware_concurrency - 1), so vectorapi runs 8 request threads on one core (max 32) - concurrency without parallelism, where 8 busy threads each take about 8x longer. The measured 5.6-9.5x lands on that number, which is why this is corroboration rather than a coincidence.
So "can one tenant's load block the server" has a two-part answer worth giving precisely: it DEGRADES everyone proportionally and it did not BLOCK anyone. Every other tenant stayed under 250 ms, which no caller would notice. The blocking regime is further out and is reached through the thread pool rather than the core: once 8 (then 32) concurrent requests are queued, new connections wait, and the ceiling becomes nginx's proxy_read_timeout 180s on our side rather than anything the database reports. The thing to measure before promising a tenant a throughput is therefore CONCURRENCY, not request rate - 6 writes a second cost nothing on its own, and 6 concurrent slow requests cost everyone a factor of 8.
Note what this also means for any latency number in this file: a p50 taken while the box is quiet is not a property of the service, and the single core makes every measurement here sensitive to what else is running. The provider round trip dominates a vector search, so search latency hides this; a pure DB read at 8-35 ms does not.
handlers/collections.cpp enriches every row inside the loop with count(qc) plus getCollectionInfo(qc), so N collections cost 2N sequential calls - 22 of them for novitax's 11 collections, for what a caller reasonably reads as a cheap inventory call.| call | time, idle box | |---|---| | collections listing (11 collections) | 0.428 / 0.409 / 0.492 s | | control: one document listing, no fan-out | 0.002 s |
The control is what makes this a measurement rather than "that route feels slow" - it removes the per-collection fan-out and nothing else, and the gap is three orders of magnitude. NO CONSUMER CALLS THIS ROUTE, AND I ASSERTED THAT ONE DID. The cost above is measured and real; the impact claim was mine and was false. I wrote that a consumer was paying it on every queue page load and that it explained their 503. They grepped their own src/, scripts/ and functions/ and found zero call sites - their client only ever reads documents and index values. Confirmed from our side rather than taken on report: every collections-listing request that day falls inside one three-minute window, which was the consumer probing collection sizes BY HAND while diagnosing. So the 503 I built the story on was their own diagnostic call, and the route costs nobody anything in production.
The measurement covered the ROUTE's cost and I used it to claim a CONSUMER's behaviour, which it could not reach. A consumer's call sites are not derivable from our access log - the exact lesson this file already records from the kitchen_presets diagnosis, committed again the same way inside a week. Writing the rule down is not applying it.
And the cost was not the embarrassment, it was that a tidy explanation closed the question. Having attributed the 503 to "their burst plus our expensive route" I stopped looking, and the real cause - the hourly snapshot stalling the database, below - went on being invisible. It was in the journal the whole time. A wrong cause that FITS is more expensive than no cause at all, because no cause keeps someone looking.
It is the same shape as the rate-limiter decision one layer down, and worth noticing that we got it right there and not here: that route deliberately charges the limiter ONCE because "one request is one request", and then fans out 22 round trips for the same single request. Tracked as SV-16; no fix shipped, because making the stats opt-in changes the response shape and caching them makes an exact document_count stale, and this file already records an exact count finding a real data defect (13093 against 13092).
localhost, not 0.0.0.0 (storage.bind_address), which is why it is only reachable from vectorapi on the same box - correct, and worth knowing before wondering why a port-mapped copy refuses connections.policy-rc.d DOES NOT HOLD THE DATABASE PACKAGE. It blocks invoke-rc.d, and that postinst calls systemctl DIRECTLY. Measured the hard way on 2026-10-12: a policy-rc.d returning 101 was in place, the pinned install ran at 18:21:12, and the service restarted anyway - the 2.17.2 first-boot migration ran to completion before the install command had even returned. A hold point three consumers had been promised simply did not exist, and that cost TWO separate things, not one. One consumer lost the chance to say "wait, a call is live" that they had explicitly been offered. And because the install itself triggered the migration, the outage happened at 18:21 rather than in the 18:30 slot all three had approved - it ran NINE MINUTES EARLY, outside the approved window, which is a governance failure distinct from the missing check. A consumer put that second point in the record; my own account had blurred it into the first, which understated it.
The error was verifying the mechanism's PURPOSE instead of its EFFECT. policy-rc.d genuinely is the standard Debian way to prevent a maintainer script starting a service; it is just not effective against a script that bypasses invoke-rc.d. Checking that it is the right tool is not the same as checking that it works here, and one systemctl show -p ActiveEnterTimestamp before the install - or one grep systemctl over the postinst - would have shown it. A control nobody has seen fire is not a control. If a window needs a pause, REHEARSE THE PAUSE, not just the migration: install on a scratch box and confirm the service did NOT start. The consumer's framing is the one to keep - they asked for a pause and then treated it as load-bearing without either of us testing that it pauses.
To actually hold a start for this package: systemctl mask the unit for the duration, confirmed upstream - a masked unit REFUSES the start and the postinst's || true absorbs the failure, so the install completes with nothing running. Then unmask and start deliberately. Upstream is also moving the postinst to deb-systemd-invoke so policy-rc.d will work too, but that is ROADMAP, not shipped. Whichever route, PROVE it by reading ActiveEnterTimestamp before and after the install rather than assuming the hold took.scan_capped, one layer out.encryption-verify said CLEAN over 350 ciphertext values and 60 history versions. The whole server diff is 16 files and adds no boot migration, no marker-gated rewrite, no WAL op, no snapshot format version, no index key format and no schema version. 2.18.0 is query-time only (an index declines non-number, non-string range bounds); 2.19.0 maps _expires_at onto the expiresAt the server always stored; 2.20.0 is the RE2 engine; 2.20.1's snapshot is the same v4 format. The one new file, snapshots/snapshot.in-progress, is ignored by 2.17.2, which lists only snapshot-*.dat and snapshot-*.tmp.
So "detectable before it runs", "what is its memory peak" and "does it re-run after an OOM" are all MOOT for this upgrade - there is nothing to run, and boot does the same recovery work.
BUT "a lower hourly snapshot peak" UNDERSTATES WHAT 2.20.1 IS, AND THIS NOTE SAID EXACTLY THAT: 2.20.1 IS THE STRUCTURAL FIX FOR THE CRASH LOOP WE SPENT A DAY ON, SO IT IS THE REASON TO TAKE THE WINDOW RATHER THAN A SIDE EFFECT OF IT. From their own changelog, marked [server]: a snapshot used to hold the whole store in memory three times over - the serialised body, a compressed copy beside it, and a copy of each collection's documents - and the writer now streams to disk a chunk at a time, so a snapshot adds a few tens of MB whatever the store's size. That is precisely the path that was OOM-killed hourly on prod from 2026-10-17, that never truncated the WAL, and whose 139 MB WAL then made recovery itself unsurvivable. The 4 GB swapfile is a floor under the symptom; this removes the cause. The file format is unchanged in both directions, which is what keeps the door two-way.
Their own statement of what it does NOT fix is the part to carry into the window, because it is the distinction this file already drew between prevention and survivability: 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. So the upgrade prevents phase 1 and therefore prevents phase 2 ever being reached, and does not make phase 2 survivable if something else produces it. Worth contrasting with 2.17.x, where the first-boot at-rest migration rewrote rows and history, could not be skipped, peaked over a gigabyte and OOM-killed under a 900 MiB cap. Two upgrades of the same product, one requiring a carefully sized window and one requiring none - which is why the question has to be asked per upgrade rather than inherited from the last one.
THE ONE CAVEAT ON GOING BACK, AND IT IS MEASURED AS INAPPLICABLE TO PROD RATHER THAN ASSUMED: a regex pattern STORED while on 2.20.x - a view where or a policy row predicate - using RE2-only syntax such as (?i) is not valid std::regex, so after a rollback 2.17.2 fails it CLOSED and silently, and such a view reads empty. A pattern in a request only affects that request. Verified on prod rather than taken on "no reason to store one": ViewManager: loaded 0 views from _views at boot, security disabled and zero principals with a policy on all six projects, and createView and the policy API appear NOWHERE in src/ or runner/src/ - so our layer cannot create either, and the hazard cannot arrive through us. A tenant reaching it would need the CLI directly.--allow-change-held-packages or it FAILS. apt-mark showhold lists smartbotic-database and libsmartbotic-db-client; our three app packages are not held, which is why an ordinary vectorapi release needs nothing special. A pinned install without the flag dies with E: Held packages were changed and -y was used without --allow-change-held-packages - caught here by a --dry-run a few hours before a window, which is the only reason it was not discovered mid-outage. Prefer the FLAG over apt-mark unhold plus a re-hold: the hold is per PACKAGE rather than per version, so it survives the upgrade and keeps protecting the new version automatically, whereas the unhold route leaves the database freely upgradable if the re-hold is ever forgotten - a protection silently switched off is worse than an install that refuses.
AND THAT IS EXACTLY WHAT HAPPENED. THE HOLD WAS GONE, MEASURED 2026-10-15: apt-mark showhold printed NOTHING and dpkg -l showed ii rather than hi for all three. So the 2.17.2 window took the unhold route, the re-hold was forgotten, and the protection this paragraph calls load-bearing was off for three days with nothing to show it. smartbotic-database 2.18.0-1 was sitting in apt at that moment, so a routine apt-get upgrade TYPED BY A HUMAN would have upgraded the database, the client and the CLI, and the database postinst calls systemctl DIRECTLY - so it would have restarted prod and run whatever 2.18.0's first boot does, unannounced, on a box holding four tenants' data. Re-held all three (the CLI too, since it is version-matched to the client), and verified the control actually fires rather than trusting the command's output: apt-get -s upgrade now reports them under "The following packages have been kept back" with ZERO Inst lines. A deliberate upgrade still works with --allow-change-held-packages.
Two things worth taking from it. The note PREDICTED this failure in writing and the prediction still came true, because a written warning is not a control - check apt-mark showhold as part of closing any window that touched a held package, since the evidence is one command and the failure is invisible until the day it costs an outage. And it was found by accident, while verifying something unrelated: the ii/hi column appeared in a listing I had pulled to check a version. That is the second time this exact column has carried the answer while being read past.
SCOPE THAT EXPOSURE HONESTLY, THOUGH: unattended-upgrades WOULD NOT HAVE DONE IT. It is installed, enabled, active and running daily on prod, but its Origins-Pattern allows only origin=Debian with label=Debian or Debian-Security. Our own repo is o=Smartbotics,l=Smartbotics, and a --dry-run --debug says so in as many words: "Marking not allowed ... o=Smartbotics ... with -32768 pin", then "adjusting candidate to version libsmartbotic-db-client=2.17.2-1". So nothing of OURS - database, client, CLI or the three app packages - is ever auto-upgraded, and the unheld window was exposure to a human typing apt upgrade during routine maintenance, not to a nightly job. That is still worth the hold, because routine maintenance is exactly when someone types it, but it is a smaller claim than "it could have gone at any moment" and the smaller claim is the true one.
The generalisation came from a consumer who ran the same check and got the OPPOSITE answer, correctly: the question is not "is my hold still set" but "what actually protects the versions I depend on". On their box, no hold is wanted - unattended-upgrades covering Debian means their Node 20 pin is unreachable anyway, since the archive cannot move nodejs off 20.x within Debian 13, and adding a hold there would only block security fixes. Their real gap was the mirror image of ours: a backports package (o=Debian Backports) matched by no pattern, so the package that rots fastest is the one nothing refreshes. Two boxes, same check, opposite correct answers - which is why the rule is to measure the policy rather than copy the remedy. A pin added in the wrong place costs security updates.
CHECK THE SERVER'S VERSION WITH smartbotic-db-cli server-info, NEVER with db_client FROM /api/v1/version. A consumer pushed back on a claim of mine that rested on the latter, correctly: db_client is the version of the client library the BUILD LINKS, and a lock's scope is a SERVER property, so that field cannot establish it - the same trap this file already records from the other direction, where a 2.14 client against a 2.13 server reads 2.14.0 while the capped path runs. Verified properly: server-info reports server: 2.17.2 (commit 0cd2285) and the server's own view of the client. The general form is that a claim about the server needs a server-side measurement, and a version string is the weakest kind of evidence available for it - prefer the measured behaviour when you have it.
The signal was in plain sight and I walked past it. dpkg -l prints hi rather than ii for a held package, and that appeared in the very first prod inventory of the day; I read the versions out of that output and ignored the status column. Always --dry-run a pinned install before a window and read what it says it will do: this one also confirmed 2 upgraded, 1 newly installed (smartbotic-db-cli, which is how encryption-verify arrives on prod), 0 removed and nothing held back.smartbotic-db-cli WAS AN ABI EVENT FOR VECTORAPI, BECAUSE THE CLI WAS VERSION-LOCKED TO THE SHARED CLIENT LIBRARY. FIXED UPSTREAM IN 2.18.1-2; TRUE OF 2.18.1-1 AND EARLIER, WHICH IS WHAT WE HIT. Measured 2026-10-15: smartbotic-db-cli 2.18.1-1 Depends libsmartbotic-db-client (>= 2.18.1-1), and apt refuses to install the CLI alone ("Reached two conflicting decisions"). So taking an admin-tool-only, client-side-only fix moves libsmartbotic-db-client.so.2 under the running server, which is compiled against whatever DB_CLIENT_VERSION the deb was built with - and every 2.x client shares one SONAME, so it installs cleanly and segfaults on the NEXT RESTART, days later, with nothing pointing at the change. Run the container ABI test first (the real server deb plus the new client in a Debian 13 container against the target server; it cleared 2.17.2 at 21 of 21 calls and takes minutes). Reported upstream, since an operator tool and a long-running service have no reason to share a version - static linking or an ABI-floor dependency would both fix it. They chose the ABI floor over static linking, and the reasoning is worth keeping: a statically linked CLI stops exercising the shared library on every host, which is exactly where you want that coverage. From 2.18.1-2 the library ships a Debian SYMBOLS file (each exported symbol tagged with the version that first shipped it, floor 2.8.0) and the CLI's Depends is computed by dpkg-shlibdeps from the symbols it actually uses - which came out as >= 2.17.0, not its own version. Verified by them in a clean container: the CLI installs against library 2.17.2 and the library stays put, while library 2.16.0 makes dpkg refuse the CLI. We hit this an hour too early and took the library to 2.18.1 under vectorapi; handled by restarting vectorapi immediately under supervision rather than leaving a latent segfault - clean, no symbol errors, 8 real API calls across 4 projects all 200 - so prod is on a VERIFIED combination rather than an untested one, which is why it was not downgraded afterwards. Their build now also FAILS if a release loses a public symbol, which is a control that fires rather than a convention someone is meant to notice.smartbotic-database/client debs must be built against the system's current Abseil; a stale build crash-loops on libabsl_*.so.<old>. Rebuild the DB if it won't start.--rebuild-base is required when DB_CLIENT_VERSION moves. The client version is baked into the Docker BASE image, so bumping the variable alone leaves the release build compiling against the old headers - it fails on the new entry points, or worse, silently links the old ones. Note devstack/run-tests.sh installs the client debs explicitly, so the TEST path can be on a newer client than the RELEASE path: a green suite is not evidence about the packages.systemctl start on an already-running unit is a no-op. A package postinst starts the service, so any config written AFTER apt needs a restart, not a start - otherwise the process keeps the config that existed at install time and the file on disk disagrees with the running state. Compare the file mtime against systemctl show -p ActiveEnterTimestamp when a setting appears not to apply.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.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 .debs out of /var/cache/apt/archives/, which stays the right belt-and-braces for a rollback when the repo itself is unreachable.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.encrypted=true ON A COLLECTION THAT STILL RECEIVES VECTORS. On database 2.17.0 and 2.17.1 as released, an encrypted collection REFUSES every new insert carrying a vector, failing with Invalid JSON: type must be number, but is string - the handler encrypts the whole body, _vector included, before the store extracts the vector. So an encrypted RAG collection is FROZEN for new embeddings. Not silent loss, since the write is refused, but broken. Fixed as 2.17.2 (_vector is never encrypted, everything else still is). That sentence used to read "2.17.2 is NOT released and is not in apt", which is long stale: 2.17.2 was released, is in apt and has been PROD's server since 2026-10-12 - so the vector-insert freeze is fixed on the deployed server, not only on their main. What remains true regardless, and is usually the decisive cost, is the FILTER consequence in the paragraphs below.
MY OWN MEASUREMENT MISSED THIS, AND THE WAY IT MISSED IT IS THE POINT. I tested a populated collection flipped to encrypted=true and verified: every row still its own nearest neighbour at 1.0 before, after and across the seal restart; the export BYTE-IDENTICAL with the same content_sha256; and a re-import retrieving correctly at 1.000000 with a fixed query_vector scoring identically to eight decimals. All of that is true and still holds - vectors stored BEFORE the flip live in the vector sub-db rather than the body, so they are untouched. What I never did was insert a NEW row after the flip, and my re-import went into a fresh collection which our own route creates encrypted=false, so it could not have caught it either. I then wrote "safe for search and for backup", which was broader than what I had measured. Same shape as everything else in this file: a check that answers a narrower question than the one being asked, committed by the person who had spent the day pointing that out to others. When testing whether a state change is safe, test WRITES INTO the new state, not only reads of what was there before it.
What this does NOT affect: our three credential collections are not vector collections, so encrypting them is unaffected; and handlers/collections.cpp creates every user collection encrypted=false, so a tenant cannot reach this unless someone deliberately flips one.
The cost that remains true either way, and is usually decisive: FILTERS. A filter on an encrypted field is refused outright ("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 without needing the write freeze: 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.
MOVING THE CLIENT PIN WIDENS THE OBSERVABLE SLUG SET ON EVERY READ ROUTE, AND IN ONE CASE IT FIXES A RETRY-FOREVER BUG. translate() branches on NINE server reasons - delete_restricted, document_too_large, duplicate_id, encrypted_field, memory_pressure, message_too_large, missing_parent, outcome_unknown, read_only - and forwarding the reason on READ calls (find, a filtered search) is a 2.17.0 CLIENT change, so on anything older every one of those collapses on a read into whatever the bare code maps to. The important instance: ResourceExhausted with no reason falls through to 429 rate_limited, which says WAIT AND RETRY. A document grown too large to read back (repeated patches, measured) is exactly that case, and no amount of waiting fixes it. With the reason it becomes 422 message_too_large, which is permanent and honest. So the pin move does not merely add encrypted_field: it corrects a read failure that is currently reported as retryable when nothing can ever succeed.
Tell consumers the GENERAL form before the pin moves, not the one slug. A consumer with an exhaustive code map plus a default branch starts meeting codes it has never seen, and the dangerous default is not "unknown error" but "retry" - a caller that retries its default would begin retrying a permanent verdict. The consumer who raised this is inert by construction (their retryable set is keyed on STATUS, not on code, which is the design that makes a widening slug set safe), and that is the right question to ask each consumer: not "do you handle this slug" but "what does your default branch do, and is your retry decision keyed on status or on code". Filing this as "additive, becomes live" understates it in the asymmetric direction - the same understatement I made about filter_mode, where being wrong cost an opportunity rather than a retry loop.
IT WAS DORMANT UNDER THE 2.14.0 CLIENT AND IT IS LIVE ON PROD NOW - THE CLAIM BELOW WAS RIGHT WHEN MEASURED AND THE WORLD MOVED, SO READ THE CORRECTION FIRST. Measured on prod 2026-10-22, vectorapi 0.13.0 against server 2.17.2: ?filter=password:eq:x answers encrypted_field with details.field, and so do token and api_key, while the control nosuchfield:eq:x answers 200 - so the refusal is selective and genuinely firing rather than a blanket failure. The reason it works is that DB_CLIENT_VERSION ALREADY MOVED, and this file said otherwise in several places. The pin went 2.14.0 -> 2.17.2 in commit 9534794, which IS the 0.13.0 version bump (2026-10-13), confirmed independently by the built debs: 0.12.0-1 declares Depends: libsmartbotic-db-client (>= 2.14.0) and 0.13.0-1 and 0.15.0-1 declare >= 2.17.2. So "we ship 2.14.0" is true of 0.12.0 and FALSE of everything prod has run since 2026-10-13. Anywhere this file still says we ship 2.14.0, or that a read-path slug is dormant until the pin moves, is stale for the same reason.
Two consequences, and the second is the one that was costing us. message_too_large on a READ should likewise be live now, because the same mechanism carries it - apiErrorFor(Client::Error) extracts errorDetail(e) and passes d->reason, and encrypted_field arriving proves the reason does reach translate() on a read path (that is an inference from the proven mechanism, not a separate measurement - triggering it needs a document too large to read back). And invalid_pattern is blocked on the SERVER, not on the client: it is a 2.20.0 server reason, and the client side of the dependency was already satisfied. This file previously filed both under one "pin move" dependency, which is wrong in opposite directions - one was already done, the other never needed the client at all. MAPPED IN 0.16.0 and it ships AHEAD of the server that produces it, which is sound precisely because the dependency is the server: the branch is dormant until prod reaches 2.20.x and correct the moment it does, so there is nothing to come back and switch on. The pin itself moved again in 0.16.0, 2.17.2 -> 2.20.0, so anywhere this file says we ship 2.17.2 is stale from that release - the same way "we ship 2.14.0" went stale at 0.13.0, which is the second time this exact sentence has had to be written and the argument for reading the deb's Depends instead of any sentence.
What the original measurement said, kept because the mechanism is still the thing to understand: against a 2.17.1 server with a 2.14.0 client, a filter on an encrypted field came back as slug validation, not encrypted_field, even though the server's message arrived intact. The cause was 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 was simply absent and translate() fell through to validation.smartbotic-db-cli configure <coll> [--versioning on|off] [--max-versions N] (client 2.18.1), after a full data+config backup copied OFF the box and verified there. Measured, each collection in turn:| collection | before | after | time | setting |
|---|---|---|---|---|
| justice-pa:vectorapi_function_runs | 8.45 MiB | 8.32 MiB | 694 ms | versioning off, cap 1 |
| default:vectorapi_function_jobs | 24.69 MiB | 12.44 MiB | 1840 ms | versioning off, cap 1 |
| mailtest:vectorapi_functions | 0.08 MiB | 0.04 MiB | 3 ms | cap 5 |
| toloajto:vectorapi_functions | 0.05 MiB | 0.05 MiB | 2 ms | cap 5 |
| justice-pa:vectorapi_functions | 197.56 MiB | 8.85 MiB | 3389 ms | cap 5, versioning left ON |
Under 6 seconds of lock in total, each confined to its own collection; document counts unchanged everywhere; the job queue was verified still enqueueing afterwards. The registry keeps versioning ON with a cap, so restore-after-delete still works for a function definition - that is the whole reason it is treated differently from the queue.
A CAP RECLAIMS IN PROPORTION TO HOW MANY OLD VERSIONS EXIST, AND THE SPREAD IS TWO ORDERS OF MAGNITUDE. Same command, same box, same minute: the run log gave back 1.5% because a run row is written once and never updated, while the registry gave back 95.5% because 18 rows had each accumulated roughly a thousand full copies of their script. File size alone does not predict it - the run log and the registry both looked like "a few MB of history" at the start of the week.
THE REAL FIX WAS THE CONSUMER'S, AND IT IS AT THE RIGHT LAYER. The registry grew because their deploy script PUT all 18 functions every time, so a one-line change to a shared library wrote 18 whole rows, script included - about 2.9 MB per deploy. They changed it to read GET /functions once and skip any function whose stored content_hash already equals the sha256 of the bytes it would send. So the prune was the treatment and their change is the cure; without it the 188 MiB would have been partly re-spent by the next deploy. content_hash is exactly the right field for that comparison: it is the hash of the source WE stored, so a match is our statement that we hold their bytes - strictly better evidence than the 200 their own PUT returned, which only says the write was accepted.
Their verification note is worth keeping too: their first test of the skip used a COMMENT-only edit, got "0 pushed" and briefly read it as broken. esbuild strips comments, so the bundle was byte-identical and there was genuinely nothing to push. A skip that works and a skip that is broken produce identical output when the input is identical, so the only informative test is one where the two must differ.
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.
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.
Memory: plan with ANONYMOUS memory, not RSS, and expect RSS to look alarming. Same run: anon 364 MiB, page cache 295 MiB, cgroup memory.peak pinned at the 900 MiB cap, and the process's VmHWM 1122 MiB - above the cgroup limit - with oom_kill 0. That is not a contradiction: the LMDB mmap is file-backed, so resident mapped pages count toward the process high-water mark while the cgroup treats them as reclaimable cache and evicts rather than killing. "It needed 1.1 GB" and "it needed 364 MB" are both readable off one run and only the second is the planning number. Anyone watching RSS cross 1 GB on a 2 GB box mid-credential-migration will reach for the kill switch; the page-cache explanation is not something they will derive at that moment.
PRUNING NO LONGER TAKES A GLOBAL LOCK ON 2.17.2, AND THE NOTE THAT SAID IT DID WAS THE BASIS OF AN APPROVAL ROUND I SHOULD NOT HAVE RUN. This paragraph used to read "it takes a GLOBAL lock ... essentially every operation that resolves a collection waits, in every collection". That was accurate for 2.17.1 and is wrong for 2.17.2, which is what prod runs (confirmed from their code 2026-10-15). In 2.17.2 the prune runs AFTER createCollection releases the store lock and holds only THAT COLLECTION's history-file lock. During it, history-recording writes to the SAME collection wait (update, patch, upsert of an existing id, delete), and because a waiting writer holds that collection's lock, reads of that collection can wait behind it. Other collections are unaffected. Memory is one counter per document id.
So the blast radius of pruning our own operational collections is our own function machinery, NOT the tenants' data: the shared default:vectorapi_function_jobs queue is the one with cross-project reach, since every project's cron and job writes record history there. I asked four consumer sessions to approve a "global stall" that 2.17.2 does not have, which is the cost of carrying a version-specific claim without re-checking it against the version actually deployed. A note naming the version it was measured on still has to be re-read when the deployment moves past that version.
versioningEnabled=false NEEDS NO WINDOW AT ALL. It is one small write to _collection_meta, touches no history and takes no history lock - so stopping the GROWTH and reclaiming the BYTES are two separate operations with completely different risk, and only the second wants a quiet moment.
THE CALL ITSELF CARRIES A TRAP THAT HAS NOTHING TO DO WITH VERSIONS: createCollection(name, defaultTtlSeconds, encrypted, maxVersions, vectorDimension) APPLIES defaultTtlSeconds WHENEVER IT DIFFERS, AND 0 IS A REAL VALUE meaning "no default expiry". So pruning a collection that HAS a default TTL by passing 0 silently CLEARS the expiry for every later insert. Read the current value first (getCollectionInfo(...)->defaultTtlSeconds) and pass it back. encrypted=false never downgrades and vectorDimension=0 is ignored, so those two are safe to pass. Note smartbotic-db-cli info does NOT print the TTL at all, so the CLI cannot answer this question and its silence is not a zero. For OUR collections it happens to be moot - every createCollection call in src/ passes 0 for that argument, so the stored value is already 0 - but that is a fact about our code, not about the API.
And it cannot be done BEFORE the encryption migration. There is no mode that boots 2.17.1 without migrating - it runs before the listener opens - so "prune first to shorten the migration" is unreachable. Just as well: the prune path had no test against an unmigrated store (and this note used to add "its test asserts only counts, not that surviving versions decrypt", which is out of date: as of 2.17.1 the e2e test prunes 12 versions to a cap of 3 and reads the newest version's CONTENT back through getVersionHistory, plus the live document unchanged, and the unit test asserts exactly the newest 3 per document remain, oldest first and readable, with a second prune to the same cap changing nothing), so the escape hatch would have exercised new code against old on-disk format in a configuration nobody upgrades into. The consumer who would have gained most from it was the one who decomposed the question correctly - "can it be deferred" is the easy half, "is the prune path safe against an unmigrated store" is the half that bites - and said they would rather have the long window. Worth remembering as a pattern: when an optimisation needs a state that only the optimisation produces, the question is never whether you can get into that state.
"DISABLE VERSIONING" AND maxVersions = 0 ARE OPPOSITES, AND OUR OWN PLAN HAD THEM THE WRONG WAY ROUND. maxVersions = 0 means keep unlimited history - it is the setting that CREATED these files. The off switch is configureCollection(coll, {versioningEnabled = false}) (client 2.4.5+, settable on an EXISTING collection, and reversible because history already written stays readable). client.hpp:547 states the distinction outright. Our written plan said "disable versioning by setting maxVersions=0 on the queue and the run log", which would have re-applied the defect while believing it was the fix, and it survived unchallenged until a consumer attached a CONDITION to their approval that forced the mechanism to be checked. The approval that costs something is the one that finds a defect; an approval that only says yes tells you nothing you did not already believe.
It also follows that disabling versioning RECLAIMS NOTHING. It stops new versions; the bytes already written stay. Stopping the growth and recovering the space are two operations, and only the second needs a quiet moment. There is no supported way to discard a collection's history outright while keeping the collection: the floor is maxVersions = 1, which keeps the newest version of every document id ever written, deleted rows included, since history outlives a delete so the row can be restored. dropCollection does remove the history file and is not an option for a live queue. A "discard history" operation is upstream ROADMAP.
THE HISTORY QUESTION TO ASK OF ANY COLLECTION IS WHAT ITS WRITES TRACK, NOT HOW BIG IT IS TODAY. A consumer found the sharp version of this in their own code after reading per-collection numbers we sent them: touchFacts patched last_retrieved_at on EVERY recalled fact on EVERY recall, so one search returning 8 hits wrote 8 full copies of documents whose CONTENT had not changed - while the only reader, a ranking function, asks nothing finer than "inside 30 days? inside 180 days?". They were paying a version per hit for precision nothing reads. Their fix is the shape worth copying: skip the write when the stored timestamp is already inside the last day, which bounds it at one version per field per day and leaves the ranking unchanged BY CONSTRUCTION rather than by judgement, since at 30-day granularity this morning and this second are the same input.
The dangerous class is history that grows with READ traffic, because it has no natural ceiling and looks harmless in exactly the period before anyone uses the feature - theirs measured 266 KiB with only 16 of 122 rows ever touched, purely because the customer had barely used the assistant since cutover. Three shapes, needing different answers: read-driven (unbounded, fix the write), content-driven like their calls at ~13 KiB per call for transcript-then-analysis patches (bounded by real volume, fine), and human-driven like their settings/main at version 172 (bounded by how often a person changes a setting, fine).
Audited OURS against that: we are clean, and the audit is the point rather than the result. function_registry.cpp writes only in put (a code push), setPolicy and setEnabled - nothing stamps the row on a read or a run. So the 195 MiB over 18 rows is genuinely push-driven: put upserts the WHOLE row including the script source at ~199 KiB, so ~1000 pushes accounts for it exactly. And default:vectorapi_keys.hlog measures 0.0 MB, which is the measurement that rules out a per-request last_used_at stamp on the key store - the one place this pathology would have grown with every API call we serve.
What disabling versioning costs, confirmed from their code rather than assumed, because the plan is to turn it OFF for the queue and the run log and keep a small N (5-10) on the registry: version history and restoreVersion/restoreToDate stop working for new writes, and a DELETED row can no longer be restored, because restore-after-delete reads the pre-delete state from history. That is why the REGISTRY keeps versions - an accidentally deleted function is exactly the row worth recovering - while a claimed-and-deleted queue row has no reader. It does NOT touch the WAL, replication, the event stream (actor included) or _version, which still increments; none of them read history, and recovery is snapshots plus WAL.Retry-After IS KEYED ON THE CAUSE, AND ITS ABSENCE ON MOST 503s IS THE INFORMATION - WHICH IS WHY IT CANNOT BE SET AT THE HANDLER THAT MAPS THE STATUS. 0.15.0+. ApiError::retryAfterSec is a 5th constructor parameter filled at the RAISE site, because that is the only place that knows whether a duration is the remedy; retryAfterSeconds() (errors.cpp, pure) prefers that hint, then gives a 429 the limiter's own window, then returns 0. The values are measured rather than round: kRetryAfterDbUnreachableSec = 5 (the OOM crash loop recovered in 13-15 s a cycle), kRetryAfterReadOnlySec = 30 (recovery, not a blip), kRetryAfterRateLimitedSec = 60. The temptation is to stamp every 503, and that is the defect rather than the feature: most of this service's 503s are db_error "insert failed" - a write that did not apply - or no_runner, which needs an operator. No duration makes either succeed, so a number there invents a remedy a caller would honour. So the tests that matter are the PAIRING ones (AnOrdinary503SaysNOTHING, NoRunnerConfiguredSaysNOTHING), deliberately falsified by making the mapping blanket for Unavailable: exactly those two go red and the four positive ones stay green, which is the only way to know the four are testing selectivity rather than presence. Note /fn sets its own headers directly and CANNOT route through this (a function's error text must never reach an unauthenticated caller), so it shares the CONSTANTS instead - and its two runner_unavailable 503s differ on purpose: configured-and-silent carries 5, not-configured-at-all carries nothing. api/openapi.json had described that route as simply "carries Retry-After", which was a documented guarantee half of it does not meet.
The reason this is worth a note at all is that NEITHER consumer honours the header today - one keys its retries on status alone, the other does not retry - so the numbers are for future callers and were chosen with the asymmetry stated: too LONG is far more expensive than too short, because a caller honouring 60 s on a transient blip converts a fast error into a stalled transaction, and on the one live public write path recorded here that is an abandoned customer order. The honest framing for a consumer is "read presence as a positive signal and absence as 'a timer is not the fix', never as 'the server forgot, so I will pick a number'".FailedPrecondition means three different things and must be branched on FailureDetail.reason: missing_parent and delete_restricted are 422, read_only is 503, and an absent or unrecognised reason is 500, never a guessed 422. Mapping the bare code to 422 told a caller that a read-only database was its own validation mistake, so it would fix its payload and retry forever instead of waiting. Use the FailureDetail& overloads wherever a call offers one - the reason-less Failure form cannot tell these apart.ErrorCode::Aborted (client 2.12.0) carrying currentVersion, and maps to 409 version_conflict. It used to arrive as Unknown and fold into 503 "retry as-is", which is the opposite of the required instruction: re-read first. Never match on the message text for this.patch with a field set to null REMOVES the field (RFC 7396 merge), it does not store null. Use update for an explicit null.relations_enforced is readable since client 2.11.4 via tryGetRelationsEnforced(), which DECLINES to answer on a failed read rather than defaulting (getRelationsEnforced() is the fail-to-enforced variant, for code deciding whether it may rely on enforcement). The collection GET surfaces it, omitting the field when undetermined - absence never means disabled, so the web UI renders three states, not two.A GHOST DOCUMENT - READS FIND IT, EVERY WRITE 404s - AND THE OBVIOUS SUSPECT IN OUR CODE COULD NOT HAVE CAUSED IT. Reported by a consumer 2026-10-22 on prod toloajto:catalog_hardware, one document created 2026-07-01 at _version 2, last written 2026-09-28: it LISTS, GET answers 200 with the full body, and PATCH (even {}), PUT and DELETE all answer 404 not_found. Other collections' documents write fine with the same admin key, and a freshly POSTed document in the SAME collection writes fine, so it is one row rather than a collection or a key.
Their diagnosis was that Client::exists returns false while get succeeds, because PATCH probes exists first. That is refuted by their own evidence, and the refutation is readable off three handlers: PATCH probes exists(); PUT uses get() - the very call they report SUCCEEDING - and on finding the row goes to updateIfVersion; DELETE calls remove() and touches exists() nowhere at all. All three answered 404, so exists() cannot be the common cause, and changing it would have fixed nothing - it would only have relocated PATCH's 404 from the probe to the patch() call. The correct statement is that READS find the row (get, find) and WRITES cannot (update, patch, remove), which is a storage question and therefore the DATABASE's layer, not ours. Routed there rather than received politely.
Why the symptom was unreadable, and it is our fault: all three write paths answer a BYTE-IDENTICAL 404 not_found "no such document", and so does a genuinely absent document. Measured locally on all three routes against an id that never existed - the responses are indistinguishable from the ghost's. So the one observation a consumer can make cannot discriminate "the row is gone", "this path cannot see it" or "the write was refused", and the probe became the suspect purely because it is the only one of the three that is VISIBLE in our source. A plausible mechanism is the MemoryStore/LMDB split this file already records from the other direction (_-prefixed collections: writes land in MemoryStore while reads route to LMDB), which would put this row in the mirror and not in the authoritative store - but that is a HYPOTHESIS with no measurement behind it, it concerns another team's internals, and it is theirs to confirm.
WHAT WE FIXED IS A DIFFERENT, REAL DEFECT THE REPORT EXPOSED, AND IT IS A DELETION: the exists() probe is GONE from PATCH. Client::exists conflates "no such document" with "the call failed", exactly as CollectionRegistry::get records - and that cost a consumer a 6-minute ingest of an 8 GB mailbox when a transport blip became "no such collection". A 404 is unretryable BY DESIGN for a careful client, so a transient failure on that probe was PERMANENT for the caller. Removing it is free, and that was measured before deleting rather than argued: with no probe, PATCH of an absent document still answers 404 not_found because patch() reports it through its own Failure (code Ok on a 0 return means "did not apply"), while a transport failure arrives as Unavailable and now correctly answers 503; the control, a document that exists, still patches to 200. So the probe bought nothing for correctness, cost a round trip, and could only ever turn a 503 into a 404.
The test that pins it says what it does NOT cover, because it would otherwise read as proof of the deletion: it passes identically with the probe in place, since the probe gave the same two answers, and nothing in the fixture can see a round-trip count or inject a transport failure. What it pins is the FACT the deletion rests on - that patch() reports absence itself - so if that ever broke, the test goes red and the deletion stands revealed as unsafe.
The CLASS was swept rather than the instance, and two of the three remaining exists() sites are the same shape while one is NOT. settings_store.cpp (removeProject) and project_secret_store.cpp (remove) both do if (!exists) return false; and their callers map false to 404, so a transport failure is an unretryable 404 there too - admin-only, and fixing them needs a CONTRACT change rather than a deletion, since bool cannot say "the call failed". The third reads alarmingly and is fine: settings_store.cpp bootstrap does if (seeded || !exists(...)) upsert(s.toJson(), ...), which looks like a transport blip re-seeding global settings over a live configuration - it is not, because s holds what get() read two lines above, so the worst case is writing the current settings back, and a FAILED get throws and fails startup closed. Worth recording so nobody raises it twice.
Client::get returns nullopt for BOTH "absent" and "transport failed" - it throws only for PERMISSION_DENIED - so a registry lookup cannot tell them apart from the return value. Unhandled, that reaches a caller as 404 "no such collection" for a collection that exists, and a 404 is unretryable BY DESIGN for a careful client, because adding it to a retry set would retry every genuine absence. A consumer lost a 6-minute ingest of an 8 GB mailbox to exactly this. CollectionRegistry::get therefore retries once (a transient failure usually succeeds, and logs a warning saying so) and then asks healthCheck() before reporting absence, throwing 503 when the database is unreachable. Reported upstream too: the client should distinguish, the way it already does for a permission denial.
A REPRODUCIBLE vector-search baseline needs an explicit query_vector. Pinning query_text is NOT enough. query_text is embedded server-side through the external provider on every call - there is no query-embedding cache (emb.embed(cfg.model, text) in handlers/vectors.cpp), so the same text can yield a different vector on a different day and every score and row count moves with it. Measured by a consumer across one deploy over a byte-identical collection (12447 rows unchanged): an unfiltered top score went 0.7221 to 0.7175 and a filtered count 424 to 426, while five consecutive calls agreed to six decimals - so it is drift in text→vector, not per-call noise. The isolating test: a fixed explicit query_vector returned bit-identical results three times, which proves the RANKING is deterministic given a vector. So nothing in a release has to change for such a baseline to move, and it is therefore not evidence about the release either way. Corollary worth stating because it bit us: scan_capped is query-dependent too and so is also a measurement, not a property of the collection - it is set only when the walk hit the cap while still short of top_k, so a query that fills top_k reports false where a query that falls short reports true. Read all three of the useful assertions (scan_capped/scanned/the nested error envelope) as "this query, this filter", never as facts about the data.
A LAUNCH ANNOUNCEMENT TELLS YOU WHAT IS SHIPPING, NOT WHAT IS NEXT - AND I PUT A CONSUMER'S INFERENCE ABOUT THEIR OWN ROADMAP INTO A PRIORITY DECISION WITHOUT ASKING WHETHER IT WAS A FACT. 2026-10-22. Told that a tenant's /fn exposure was safe only because their voice agent was unlaunched, I asked how near the launch was; they answered "likelier to be near than far" and that the safe window "may be shorter than the deploy window", and I raised the deploy's priority on it and told my owner the two were racing. Retracted by them within the hour, from their user: the customer is getting the review portal ONLY and the agents are NOT IMPLEMENTED - not unwired, not awaiting configuration, not built. The race did not exist.
Their own diagnosis of it is the rule worth keeping: "they are publishing the portal" is evidence about the portal and SILENT about everything else in the product, and the gap got filled by an assumption that things ship in the order one happens to learn about them. It is the same family as reading a requirement off traffic - both substitute an observation for a statement of intent that only the owner holds - and in both cases there was a person who could simply have been asked.
What it cost, which is the part that generalises: an unverified roadmap claim can move a RELEASE PRIORITY, which is more expensive than moving a diagnosis. A wrong diagnosis is corrected by the next measurement; a wrong priority reorders real work and is quoted onward by whoever heard it. So a claim about someone else's schedule needs the same treatment as a claim about their code: ask whether it is a fact or an inference, and say which when passing it on.
The replacement fact is the model for what to accept instead: the portal bundle contains no reference to /fn, kb-search or take-request, and its agent component is a banner with no endpoint behind it. That is a statement about CODE, verifiable by a future reader, where "no tool points at it" is a statement about a CONFIGURATION that can change without touching the repo. Prefer the premise that cannot decay silently, even when both are true today.
AND THE SHAPE THE RETRACTION DID NOT TOUCH: A PREMISE THAT MAKES AN EXPOSURE SAFE CAN LIVE ENTIRELY IN A CONSUMER'S ROADMAP, WHERE NOTHING IN OUR SYSTEM CAN OBSERVE IT EXPIRING. THAT IS THE EXPIRED-PREMISE FAILURE WITH NO AVAILABLE TRIGGER AT ALL. 2026-10-22, on the unauthenticated /fn gap (SV-19). The reason a tenant's request-taking function was tolerable unauthenticated is that it is test-phase: its own first line reads "stores only, sends nothing", its body writes one row to a single hardcoded collection and returns, and no human actions those rows because the production path does not exist yet. All true, all verifiable, and none of it is a fact about our service. It stops being true the moment they point a tool at it, which is a decision on their side that nothing on ours would see - and they volunteered that their voice launch is "likelier to be near than far" while our own gate sits behind a database window with no date.
So the remedy is not a measurement with a re-check trigger, which is what this file normally prescribes - there is no quantity of ours to watch. The remedy is to convert the race into a precondition the consumer holds: do not point a tool at it until the gate exists. That survives the function being re-enabled later by someone who does not know why it was disabled, which a state change does not. When the thing keeping you safe is someone else's plan, ask them to make it a prerequisite rather than trying to monitor it.
AN UNAUTHENTICATED WRITE IS NOT IN THE SAME RISK CLASS AS AN UNAUTHENTICATED READ, BECAUSE THE PAYLOAD OUTLIVES THE PREMISE. novitax's formulation, 2026-10-22, correcting me after I had walked a /fn exposure back too far and filed an unauthenticated write as "roughly the same as the unauthenticated read next to it". The distinction:
So its damage accrues while the exposure is still considered harmless and LANDS when the thing that made it harmless ends. That is a third category between "quota" and "direct harm", and the practical consequence is that stopping the accumulation and preventing the launch-into-it are two separate jobs: a precondition on the consumer's side stops anyone launching without a gate, and disabling the endpoint stops the pile growing meanwhile. Neither substitutes for the other. It also decides what a pre-launch check must be: not "audit what accumulated" but "start from a known set". The collection was test-only with no production data, so beginning launch day from an emptied or reviewed collection REMOVES the question, where auditing three weeks of arrivals only answers it - and a check whose failure does not block the launch is this file's third shape, the one that reads as diligence.
/fn risk for me, correctly - a function writing an arbitrary phone number into a collection a human actions is categorically worse than a free search burning budget, and I had those the wrong way round. I took the ranking and then escalated it to "staff ringing a stranger", which requires the human-actioning end to exist, and it did not. Their statement was about what the function is FOR; I read it as what the function currently DOES.
The tell is tense. "Writes a callback request a human actions" describes a design; "today an anonymous caller can append a row to a test collection" describes the system. I had the right destination and the wrong tense, and because the correction came from the consumer I did not re-examine it the way I would have re-examined my own hypothesis. A correction is evidence for exactly what it says, and deferring to its author is not a reason to extend it - which is this file's "thanks are a signal to re-read, not to proceed" with the roles reversed.
Worth pairing with what it cost: I told my own owner the decision could not wait a weekend. The decision IS time-sensitive, for the roadmap reason above, and the present harm was roughly a storage nuisance. Overstating urgency spends the credibility you need the next time something genuinely cannot wait.query_text is 0.5-1.0 s at the median and the tail reaches at least 8.17 s, so a 6 s client timeout is not generously set - it is set INSIDE our distribution, and nothing on either side of the call says so. This is the split-latency-budget trap again (their timeout is their number, our tail is ours, and neither side can see the other), with the sharper form that two different faults produced one symptom: the hourly snapshot stall and this boundary, plus a third explanation they had written up that morning. When a consumer reports an intermittent degradation, the question is not which cause it is but how many causes it has.
The fix is the one already recommended here on independent grounds - embed ONCE and pass an explicit query_vector to every collection - which halves the draws from the tail, moves the cold call off the boundary, and is separately the only reproducible baseline.query_vector stays the only reproducible baseline.query_text is 0.49-0.95 s, essentially all of it the provider round trip; the SAME text repeated is 0.022 s, because the provider caches it. That cache is useless to a workload of unique queries such as a voice assistant, which is therefore permanently on the 0.5-1.0 s path. Eight samples in one window is a MEDIAN, not a tail: a 12-15 s text search was observed earlier the same day and did not reproduce, so the bad tail is real and unexplained rather than bounded at 0.95 s. Quote these as medians and say so.
RE-MEASURED 2026-10-19 BY A CONSUMER AND BY US, AND THE DISTRIBUTION IS WHAT MATTERS RATHER THAN EITHER FIGURE: THE MEDIAN IMPROVED BY AN ORDER OF MAGNITUDE AND THE TAIL DID NOT GO AWAY. Twelve never-before-seen strings against novitax:kb_facts: min 0.48 s, median 0.75 s, max 4.46 s, with 1 of 12 over 2 s. In the same hour a cold query_text of ours took 8.17 s, so the tail reaches at least that. Both observations are correct and neither alone describes the endpoint.
The consumer had first measured FOUR fresh strings, got 0.57-1.33 s, and written that the 12-15 s figure was retired and two searches now fit inside a phone call's budget. Their own re-measurement overturned it. Four samples describe a median and say nothing about a tail, and a caller does not experience the median - they experience the call they are on. That is the same shape as reading a server version off db_client: a true observation supporting a claim strictly wider than it can discriminate.
The design consequence, which is the useful part: TWO SEQUENTIAL query_text SEARCHES ARE TWO INDEPENDENT DRAWS FROM THAT TAIL. Reading two collections that way doubles the chance of meeting it, so the right shape is to embed ONCE and pass the same explicit query_vector to both - not because a single search is slow, since usually it is not, but because it halves the draws and lets one embedTimeoutMs bound one call instead of two. That also restores the explicit-query_vector recommendation on the independent ground already recorded here, that it is the only reproducible baseline.
AND A FAST REPEAT CANNOT ATTRIBUTE A SLOW CALL - ONLY REMOVING THE PROVIDER FROM THE PATH CAN. When the 8.17 s search was followed by the same text answering in 0.267 s and 0.242 s, that was equally consistent with "the provider cached it and we are fine" and with "the provider cached it while our store is slow under swap". The measurement that decides it is a pure DB read with no embedding in the path, which answered in 3-10 ms. Keep that control to hand whenever attributing latency across the provider boundary; without it the reassuring reading and the alarming one produce identical numbers.query_vector search returned in 3.4 s against 12-15 s for the same filter and top_k via query_text. There is no query-embedding cache, so every repeated search pays the provider again.topK 500 took 51 ms indexed against 187 ms for the same search unfiltered - the filter makes it CHEAPER, because only matching rows are scored. Our emulation took 3.21 s for that shape on prod.
scan_capped is emitted EXPLICITLY as false on this path, never omitted, and scanned is 0 because no walk happened - which here is literally true rather than a sentinel. A consumer maps an absent scan_capped to "this server cannot report truncation, so completeness is unknown" and shows that to an operator; on this path that is both false and PERMANENT, and a warning that always fires is one people learn to skip. Absence is also already spoken for by the 0.8.3 agreement, where a missing field means "old server" and nothing else.filters_applied response field, not a version check we have to get right. A pre-2.14.0 server would silently answer UNFILTERED, so the client throws FailedPrecondition / filters_unsupported instead - which is the only reason the new path can be tried optimistically. The refusal is LATCHED per process, so a deployment on an older database pays one refused round trip rather than one per search; one-way on purpose, since the emulation is correct and merely capped, and it clears on the restart a database upgrade involves anyway.filter_mode is on the response now, and a function's .search() carries it too. "server", "walk" or "none", from the single filterModeName() so the HTTP route and the runner cannot spell it differently. On the function surface the return stays an ARRAY and the flags ride as NON-ENUMERABLE properties, so indexing, length, iteration, spread and JSON.stringify are byte-identical to before and a script written earlier is unaffected - tests assert each of those, and that the flags do NOT appear in JSON.stringify. The prelude also tolerates a host answering the old bare-array shape, so the two halves deploy in either order. The console warning STAYS: it is what an author reading a run log sees, and the structured flag is for the function's logic and for any model downstream of it - a consumer's own bug was exactly that their assistant was never told a search had degraded and said "nothing in memory" with confidence.VectorSearchResult::serverFiltered records which path answered, because scanCapped == false means two different things: false BY CONSTRUCTION here (a sweep of a filtered set is sound) versus "complete this time" on the walk (it is not). A caller cannot infer it from /api/v1/version, which reports the CLIENT library version while the path depends on the SERVER - a 2.14 client against a 2.13 server reads as the new path while running the old capped one. Whether to expose it to callers is still open.Depends floor had to move to >= 2.14.0, and that is load-bearing. Verified rather than assumed, with nm on both shipped .so files: the 5-argument symbol exists only in 2.14.0, while 2.13.1 carries just the 4-argument form. Since every 2.x client shares one SONAME, leaving the old >= 2.12.0 floor would have let apt install this binary against a client that cannot resolve the call - the failure that "installs fine and only breaks on the next restart".collection_schema is introduced in 2.16.0, and capability names gate features from 2.15.0 onward, so serverSupports(Capability::kCollectionSchema) answers correctly; a 2.16.0 client calling the schema methods against an older server gets FailedPrecondition / server_unsupported. filtered_similarity is NOT gated that way because it predates the capability API and a 2.14.0 server reports no capabilities at all while fully supporting filters. The rule: a capability name is sound for a feature introduced in 2.15.0 or later, and unsound for anything older.
Design as the database team specified it, for when we implement: a JSON Schema SUBSET with draft 2020-12 meanings (type incl. ["string","null"] for nullable, required, additionalProperties, lengths, ranges, enum, const, pattern as RE2, format, items, nested properties), and anything outside it REFUSED at set time with invalid_schema so a schema can never look stricter than what is enforced. _vector is NOT part of the validated body - dimension stays the collection's vector_dimension. A violation is INVALID_ARGUMENT / schema_violation whose fields carry the violating PATHS (addr.zip, tags[2]) and whose message names the rule and size, with values deliberately not echoed. getCollectionSchema() is a separate call (a read grant suffices) so no public struct changes size. A schema may be set, replaced or removed at any time in enforce mode (every existing row validated FIRST, refused with counts and up to 10 example ids if any violate) or audit mode (applied regardless, violations counted and let through) - and it is armed under the collection's write lock BEFORE the scan, so no write slips past. Validated on insert/update/upsert/patch (on the MERGED result)/increment/batch/set ops/restoreVersion; NOT on WAL replay or replication apply, which replay already-accepted writes. suggestCollectionSchema() generates one from the data, which suits a button in the editor.GetServerInfo, serverInfo(), serverSupports(name) and Client::Capability constants, and from it the client and server release independently (2.15.0 is the last lockstep release; the server no longer pins libsmartbotic-db-client (= VERSION)). Nothing in it changes our 2.14.0 alignment. The trap, flagged by the database team: serverSupports(Capability::kFilteredSimilarity) is FALSE against a 2.14.0 server, which has no GetServerInfo but fully supports filters. Capability names gate only features introduced in 2.15.0 or later, so a capability check there would silently drop us onto the emulation against the very server we just deployed. Keep what is built: call the filtered overload, and fall back only on FailedPrecondition with reason filters_unsupported. Adopting 2.15.0 would also make serverInfo() a cheaper answer than a filter_mode response field, because it finally exposes the SERVER version - which is the thing that decides support, and the gap that made version inference unsound. Note it costs one cached GetServerInfo per client per 60 s.minScore 0.0 DROPS rows whose cosine is negative, so "fewer matches than topK returns all of them" means all that score at or above minScore - pass a negative minScore to see genuinely every match. And from 2.14.0 rows with EQUAL scores are ordered by id, lower first, including when a tie straddles the cut; that applies to the unfiltered search too and was previously unspecified, so it is observable only on duplicate vectors.similaritySearch, so a filtered search fetches the filter's ids with find() and then re-runs the WHOLE similarity search with a growing limit, intersecting in our process. Measured on prod with an explicit query_vector (no embedding in the path), on 12447 rows at dim 4096: unfiltered top_k 500 is 0.26 s, filtered top_k 500 is 3.21 s having issued three searches (2000, 8000, 10000), and a filter matching nothing is 0.05 s. Time tracks rows fetched almost linearly, ~0.3 ms per candidate - neither the vector arithmetic nor the 1 MB response is the cost. firstScanDepth()/nextScanDepth() (vector_search.hpp, pure, 8 tests) therefore go straight to the cap when the filter matches fewer rows than topK (the early exit can never fire, so every step before the cap is certain waste) and otherwise widen by the hit rate the previous pass actually measured. scan * 4 stays the FLOOR, so a mis-estimate can only skip steps and never shrink one - progress stays guaranteed and nothing can get slower. The RESULT is unchanged in every case: each pass is a prefix of the same ranking, so the first topK matches within it are the same rows whatever depth the walk stopped at. The real fix is a server-side filtered similarity search, requested and designed for database 2.14.0; this emulation must keep working regardless, as the path for any older server.kVectorFilterScanCap (10000) deep into the ranking, so on a larger collection a filter whose matches lie deeper is silently short - measured at 455 returned of 553 true matches on 12448 rows. VectorSearchResult::scanCapped is set ONLY when the walk hit the cap while still short of topK and the ranking was not exhausted, so a filter that merely matches fewer rows than top_k is correctly reported as complete rather than crying wolf. The HTTP route adds scan_capped/scanned; ctx...search() keeps its ARRAY return and warns in the run console instead.db_errors.hpp, client 2.11.4). Client::Error::code() on the throwing calls and the Failure& overloads on update/patch/remove feed one translate(): AlreadyExists → 409 duplicate_values, or duplicate_id when reason says so (database 2.12.1: a taken document id and a taken unique field value are the same code but different remedies), FailedPrecondition → 422 relation_violation, NotFound → 404, Unavailable/DeadlineExceeded/Unknown → 503, everything else → 500. ErrorCode::Ok on a call that returned false means "did not apply", not an error - map it to 404, or a plain missing document becomes a 500 with an empty message.nlohmann::json STORES invalid UTF-8 and throws only when you serialise it. A binary /fn request body therefore reached the run request intact and blew up at dump() with type_error.316, which surfaced as a 500 with nothing pointing at the body while the function never ran. triggerBodyFields() (functions/trigger_body.hpp, pure) now offers unserialisable bytes as base64 under their OWN keys - body stays null, bodyBase64 carries them, bodyEncoding is "base64" - because base64 placed in body would hand an unprepared function a plausible-looking string that is not what was sent, and silent corruption is worse than a visible null. bodyEncoding is absent for a text body, so an existing function's trigger shape is unchanged. isValidUtf8() (utf8_text.hpp) must agree with nlohmann's own decoder, not with a reading of RFC 3629 - a sequence it accepted and nlohmann rejected would only move the 500 - so it refuses overlongs, the surrogate range and anything past U+10FFFF, and the tests cross-check it against a real dump() over every single byte and all 65536 two-byte sequences rather than trusting either side alone.vector/_vector hole, a consumer verified their pipeline could not hit it - one definition, one call site, the embedding route, no vector field - and then corrected my reassurance: their original junk row came from a MANUAL PROBE, a query body posted to the documents route by hand during an investigation. So the gap sits on debugging activity, not on deployed code, and it is WORSE there: a hand-written write is read back by id, the row is present, and the operator concludes success. One character between vector and _vector, a 201, and a row findable by nothing, forever. The question to ask a consumer about this class of defect is not what their code sends but what their operators type while debugging - and hand-writing a document into a vector collection is something people do precisely when something is already wrong. Their mitigation until the guard reaches prod is the right one and applies to us: read back a manual vector write BY SEARCH, never by id.vector_missing accepted a body carrying either _vector OR vector, while the documents route stores the body verbatim and a search reads _vector. So a row written with vector got a 201 and was then findable by NO search - the unsearchable junk row the guard was written for, admitted by the guard. Measured with two rows inserted under the two spellings from the same vector: only the underscored one came back. Now refused, with a message that also says to REWRITE any row already stored that way, because a caller who hit this has unfindable rows behind them and silently fixing only their next write would leave those while looking solved. Found by a consumer asking which field a RESTORE should write - the question exposed it, not a test.vector_b64 back into the documents route used to answer "a document must carry _vector" - accurate, and read by someone restoring a 294 MB file at 3am as "my backup has no vectors", which is indistinguishable from real data loss and will be believed. A consumer named that misreading after doing the restore. The message now names the export's own field, states that the backup is FINE, and says to expand the base64 - and a test asserts the ORDINARY missing-vector case does NOT mention a backup, so the reassurance cannot be given where it would be a lie. The general rule: when an error can be read as "your data is gone", say explicitly that it is not.vector_format=base64 emits vector_b64; POST .../documents wants _vector as a number array and POST .../vectors wants vector as a number array. So the one path a backup exists for does not round-trip without expanding the base64 first, and the 422 a caller gets names what is MISSING rather than the good vector sitting in the field the exporter wrote. Documented in api/llms.txt; whether to accept a base64 write form is open.## Unreleased in their CHANGELOG.md - it simply does not reach apt until the next Tuesday. Out of cycle only for a security fix, data loss or corruption, a regression of the latest release, or when their owner approves one. There is deliberately no staging branch or testing suite.
To use something before its Tuesday, build it ourselves from their main and test it in a throwaway Debian 13 container (./packaging/build.sh with NO --sync, then install the .debs into the container) - the same shape as the 2.17.2 staging run. Nothing is published, so prod cannot pick it up by accident, which is the property that makes this safe rather than merely possible.
Note this cuts BOTH ways and the second direction is the useful one: their local container now moves on release day only, with ONE restart warning per week instead of one per change. A cadence that batches the notices is easier to plan a window around than a stream of individual ones._expires_at IS READABLE FROM CLIENT 2.19.0, AND IT IS A CLIENT FEATURE - IT WORKS AGAINST OUR 2.17.2 SERVER. The server had always sent Document.expires_at (absolute ms since epoch); the CLIENT was dropping it. So the fix to the TTL gap below needs only a DB_CLIENT_VERSION move, not a database upgrade, and the ABI move is additions-only (one constant, soname 2, symbols file unchanged).
get, find and exportCollection attach _expires_at when a document HAS an expiry, and omit it otherwise. Absent means "no expiry", never zero.restrict relation can hold a row past its TTL, and a copy taken while the server is stopped keeps expired rows until a server opens it. That is exactly the "121 hours past its deadline" row a consumer met.ttlSeconds = ceil((_expires_at - now)/1000).lt, exists) needs a 2.19.0 SERVER (capability document_expires_at), so it is NOT available on prod today - reading it is, filtering is not. A row with no expiry is ABSENT for those filters rather than 0, so an upper bound cannot sweep up permanent rows.dbMetadataFields() (documents_util.hpp) listed six names and _expires_at was not among them, so a caller posting {"_expires_at": ...} to POST .../documents had it stored as an ordinary user field - precisely the shadow-copy trap that list exists to prevent, where every read overwrites the stored value and no filter can reach it. A 2.19.0 client strips it on write on both sides, but it was added early and deliberately, because the cost to a caller is nil (they could never read their own value back) and doing it before the pin moves means no row is ever written carrying one - a row written the old way keeps its invisible copy forever afterwards. Paired with a test that an underscore field nothing reserves (_internal_id) is still STORED, so the strip can never quietly become "discard anything starting with an underscore". SUPERSEDED IN 0.16.0, and the claim was ACCURATE when written: the pin moved to 2.20.0, so the field IS returned now. api/llms.txt used to say plainly that the field was stripped but not yet RETURNED on reads, since the client we shipped dropped it before we saw it - which was the right thing to write, because claiming otherwise would have been a documented guarantee nobody could observe. That sentence has been REPLACED rather than labelled, which is the one place this file's own keep-and-label rule does not transfer: a lessons file keeps a superseded claim because the failure shape outlives it, while an API REFERENCE that still says "not yet returned" makes a consumer write code that never looks for the field. The rule differs by document, not by the claim.
Measured on the pin move rather than assumed, with the control that makes it a measurement: a row stored with ?ttl_seconds=3600 reads back carrying _expires_at, a row stored with no TTL carries NO such key, the export carries it on the first and not the second, and the value minus the clock came to 3593816 ms against the 3600 s asked - so absence genuinely means "no expiry" and a caller must test for the KEY rather than for a zero. The filter half still needs a 2.19.0+ SERVER, which prod reaches in the same window.reminders_sent: 1 NOT in the live project, which reads exactly like we lost a row during the maintenance. We had not. The row was an idempotency marker with a 48-hour TTL that expired 2026-10-10, was still physically present in a backup taken 121 hours past its deadline, and had been reaped by the time they verified an hour later. So the same row is present or absent depending on when the reaper happened to run, not on whether anything was lost.
There is NO supported way to read a document's REMAINING TTL - audited in client.hpp: ttlSeconds appears on insert/upsert, patchWithTtl and setFileTtl, all WRITE paths, and CollectionInfo::defaultTtlSeconds is the COLLECTION's default rather than a row's expiry. So inferring from row age against a table of known TTLs is currently the only method, which is sound but needs the caller to know every TTL they ever set. Requested upstream.
THE SHARP EDGE IS ON RESTORE, AND IT IS OURS TOO: A RESTORED ROW CARRIES NO TTL, SO PUTTING AN EXPIRED ROW BACK MAKES IT IMMORTAL. For their idempotency markers that meant a restore would permanently suppress the work the marker guards. Our own export has the same shape - nothing in it carries a TTL, because nothing can read one - so a restore through POST .../documents resurrects expired rows as permanent ones, and the more faithful the restore looks (every id back in place) the more complete the damage. Their fix is the right pattern for anyone restoring from our export: leave expired rows OUT, and say so in the output (0 row(s) put back, 1341 already present, 1 expired left out) rather than silently.
IF ONLY ONE SENTENCE OF THIS IS EVER DOCUMENTED, MAKE IT THIS: THE DIFF IS WHAT HIDES IT. The consumer's framing, and it is better than mine. The operator at risk is not the one who reads the docs - it is the one whose restore LOOKS perfect. Every id back, every count matching, the verifier green, and a set of permanent markers quietly suppressing the work they were meant to guard for 48 hours. Their own run reported 1341 already present and would have said nothing at all about the single row that mattered. So every reassuring signal a careful operator would check is intact while the damage is done, which is the same shape as a digest that matched while the ordering was wrong.
AND THE SAME TRAP HAS A SECOND FACE, WHICH BIT THE SAME CONSUMER AGAIN WITHIN THE HOUR: AN AT-MOST-ONCE MARKER WITH A TTL IS A GUARD FOR THE SCHEDULE, NEVER EVIDENCE OF WHAT HAPPENED. Their daily report used a 48-hour marker for "have we already sent today's mail", which is correct for a cron and wrong the moment a HUMAN can re-run an older day: after two days there is no record the mail ever went out, so a manual re-run sends it again - in their case to a list that had since grown beyond the original recipients. Four days were stored and mailed and only the two most recent still had a marker. If a person can re-run the thing later, the fact has to live somewhere permanent; the marker only answers "is the schedule allowed to fire now". Note it is the mirror of the restore bug one layer up: once relying on a row that has quietly expired, once resurrecting one that should have.query_vector must score a row identically in the restored and original collections (they measured a delta of 0.00e+00). Only retrieval BY SIMILARITY exercises what a vector is for - which is the same lesson as a digest that matched while the ordering was wrong.documentBody() in handlers/documents.cpp is used by POST, PUT and PATCH: it unwraps {"data":{...}}, strips id (the document's identity, from the body on POST and from the URL on PUT/PATCH), and rejects data alongside any other top-level key with 422 ambiguous_body. Before 0.3.3 only POST unwrapped, so a {"data":...} PUT stored the wrapper as a literal field and a data-plus-siblings POST dropped the siblings silently. A literal top-level data field is still writable as {"data":{"data":...}}.SVAPI_QUICKJS_TAG, runner/CMakeLists.txt). QuickJS bytecode carries no version stamp, so a silent upgrade makes a cached blob misread rather than fail. quickjs-ng, not Bellard's tree: the module/promise/stack entry points the core needs (JS_GetModuleNamespace, JS_PromiseState, JS_SetMaxStackSize, JS_IsJobPending) are public API there. JsBytecode is an in-process cache only - never persist it without a QuickJS build fingerprint.JSRuntime, not the JSContext. A fresh context per run is therefore not enough to isolate tenants: a run that times out mid-microtask leaves its jobs queued, and they would execute inside the next tenant's run. The core flushes them with the deadline forced into the past and marks the runtime poisoned() if anything survives; the pool destroys a poisoned runtime instead of leasing it out. An OOM poisons it too./etc/smartbotic-vectorapi must stay mode 0751, not 0750. The runner runs as its own user and needs +x to traverse the directory to runner.json; it still cannot list it, and the server's 0640 files stay unreadable to it. Both server.postinst and runner.postinst set it, and a server upgrade resetting it to 0750 breaks the runner on its next restart - a failure that surfaces weeks later with no obvious cause.imapUidFetch is viable for BOTH overloads - {7, 9} is either the set 7,9 or the single range 7:9, and {uid} is either one uid or the range uid:0 - so the two readings are DIFFERENT COMMANDS. clang silently picks one, GCC refuses the call, and the whole mail surface therefore compiled cleanly on the host for days and then failed the first release build it ever saw. Call such an overload set with an explicit vector type. The lesson is bigger than the call: scripts/host-build.sh passing is not evidence that the .deb will build, so a feature is not finished until the Docker path has compiled it.Depends lists are HAND-MAINTAINED - create-debs.sh copies each control.* template verbatim and never runs dpkg-shlibdeps, so a new shared-library dependency does not appear by itself; it surfaces as a service that refuses to start on a customer box. The mail surface added two to control.runner, both confirmed with ldd against the built binary rather than guessed: ca-certificates, because the vendored curl detects the CA bundle at CONFIGURE time and bakes the path in, and with TLS verification always on a missing bundle makes every mail connection fail as mail_tls_untrusted (which reads as a broken mail server, not a missing package); and libidn2-0, because the vendored curl keeps IDN support. IDN is deliberately not compiled out - mail hostnames are usually ASCII, but breaking an internationalised one to save a dependency is the wrong trade.
THAT TRADE WAS DECLARED AND NEVER ACTUALLY MADE, FOR THREE RELEASES, AND THE Depends LINE IS WHAT MADE IT LOOK DELIVERED. Measured 2026-10-22 while verifying the 0.16.0 packages: the base image never installed libidn2-dev, so curl's configure logged Package 'libidn2' ... not found and reported Features: AsynchDNS IPv6 Largefile SSL threadsafe UnixSockets - no IDN - while objdump -p on the shipped runner showed no libidn2 among its NEEDED libraries at all. So an internationalised mail hostname would have failed with nothing explaining why, and the only artefact anyone would have checked said the opposite. libidn2-dev is now in Dockerfile.base and curl reports IDN; verify it after any base rebuild from curl's own -- Features: line.
This is the hand-written-Depends failure in its most flattering direction, and it is worth more than the bug. A declared dependency the binary does NOT have is harmless at install time - one extra package - which is exactly why nothing ever complained, and why it survived every release. A Depends list is a statement of what we BELIEVE the binary needs; only objdump -p or dpkg-shlibdeps says what it needs. The same list read in the opposite direction - a dependency the binary needs and we forgot - is the one that surfaces as a service refusing to start on a customer box, and nothing distinguishes the two by reading the file. Two more instances of the same shape were found in the same half hour: libz.so.1 is a real NEEDED library and appears in no Depends (harmless, since zlib is effectively always present, but it means the note calling zlib "deliberately absent" describes our curl flags rather than the binary), and libfmt.so.10 likewise arrives only transitively through libspdlog1.15.
And two of my OWN checks on this binary were worthless in ways worth recording, because both looked like measurements. strings | grep for the protocol names returns curl's full protocol NAME TABLE whether or not a protocol is compiled in, so it listed https, pop3 and sftp and could not have told the difference - a check that cannot discriminate. The discriminating one is curl's own configure line, -- Protocols: imap imaps smtp smtps. And I first ran ldd on the extracted binary on the Void dev host, which resolved against Void's libraries rather than Debian's; the tell was that it reported BOTH libfmt.so.10 and libfmt.so.12. Run it inside the Debian container, or read objdump -p, which needs no loader at all. zlib, zstd and brotli are deliberately absent: they are HTTP content encodings, HTTP is compiled out of the vendored curl, and leaving them enabled made them real package dependencies for capabilities the code cannot reach.config.json ships with no functions.runners endpoints, and the server disables the function routes when the list is empty (answering 503). An operator has to add the endpoint by hand, and set the same SVAPI_RUNNER_TOKEN in both vectorapi.env and runner.env.RST_STREAM with HTTP_1_1_REQUIRED or REFUSED_STREAM frees a struct Curl_easy still in use, proven convertible to RCE under exact conditions. We cannot reach it, for two independent reasons read off our own build rather than from prose: CURL_DISABLE_HTTP ON and USE_NGHTTP2 OFF (runner/CMakeLists.txt). There is no HTTP in this curl at all, let alone HTTP/2. Of the other twenty-one, every one is rated Low and twenty are unreachable here, each ruled out by a specific setting or a missing call rather than by assumption: cookies, ALTSVC and HSTS are CURL_DISABLE_* (5 CVEs); CURL_DISABLE_PROXY (1); CURL_USE_GSSAPI OFF plus CURL_DISABLE_NTLM kill the three Negotiate ones; FTP, TFTP, POP3 and WEBSOCKETS are in the disable loop (3); OpenSSL rather than wolfSSL or GnuTLS (2); no libssh2 or libssh, so SSH known_hosts and the SFTP/SCP redirect are out (2); BUILD_CURL_EXE OFF, so the two flaws in the command-line TOOL cannot ship in a library-only build; and curl_mime_*, CURLOPT_INTERFACE, CURLOPT_SSLCERT and CURLINFO_EFFECTIVE_URL appear NOWHERE in runner/src (4) - we build MIME ourselves in net/mime_build.cpp.
THE ONE THAT DOES REACH US IS A LOW, AND IT MATTERS MORE TO US THAN THE HIGH - WHICH IS THE WHOLE POINT OF JUDGING AGAINST WHAT THE SERVICE REACHES RATHER THAN AGAINST THE SEVERITY COLUMN. CVE-2026-92387 NAMES FTP, IMAP, POP3 AND SMTP - the "ping-pong" protocols - and is an unreachable-exit-condition loop: a server that keeps feeding data at the client's read speed while permanently omitting the final control-response line BYPASSES CURLOPT_TIMEOUT_MS. That option is exactly how MailBudget::totalMs is enforced (net/mail_session.cpp:110), so the one ceiling built against a slow mail server is the one the flaw defeats - and because a blocking host call cannot be interrupted, the QuickJS wall budget cannot rescue the run either, so an unbounded mail call holds its lease on a runtime the whole pool shares.
I TRIED TO SETTLE IT BY MEASUREMENT AND THE MEASUREMENT DID NOT COVER THE CLAIM. MailStall.AServerThatNeverCompletesACommandIsStillBounded (runner/tests/mail_session_test.cpp) drives a fake IMAP server that dribbles untagged lines forever and never sends the tagged completion. It passes - bounded at 1500 ms - but it fails with CURL'S OWN message, "Operation timed out after 1500 milliseconds with 1500 bytes received", so CURLOPT_TIMEOUT_MS is what caught it, i.e. the healthy path, not the flawed loop. The advisory's precondition needs a server feeding at the client's read speed ("an extremely high network speed or an unusually slow client") and a 20 ms dribble over loopback is neither. A bounded pass is therefore equally consistent with "not exposed" and "not reproduced", and the green tick cannot tell them apart - the same shape as everything else in this file, committed while writing the test that was meant to catch it. CLOSED IN 0.16.0: 8.23.0 IS VENDORED. The test is kept as a regression test for the timeout plumbing, labelled with what it does not cover, and the tell to watch for in any future repro is a failure attributed to our own progressDecision deadline INSTEAD of curl's timeout. The lesson is kept rather than retired, and it is the useful half: a bounded pass was equally consistent with "immune" and "not reproduced", the green tick could not tell them apart, and the fix was therefore taken on the advisory's word rather than argued away on the strength of a test that reached the healthy path. Note also how the bump finally shipped - NOT in its own window, which is what this entry used to insist on. It rode a release that was already tying itself to a database window for an unrelated pin move, because three windows for three small changes is worse than one window for all of them, and the urgency that justified a dedicated slot evaporated once the HIGH was known to be compiled out twice over.
Net decision (2026-10-16): the bump is still worth taking and it is NOT an emergency, so it does not ride along in a release that consumers have cleared on the strength of two unrelated defect fixes. The urgency that justified its own window came from an unknown HIGH; the HIGH is now known and compiled out twice over. Two of the originally disclosed ones were already ruled out on the same grounds: CVE-2026-6253 (credentials leaked from a first proxy to a second) needs PROXY, and CVE-2026-80230 (public-key pinning unenforced when peer verification is off) needs verification off and pinned keys, which we never do. Since we VENDOR curl, a fix means rebuilding and republishing both binaries - apt cannot see a statically linked curl - so this is ours to do.main DESCRIBES BOTH DIRECTIONS, SO git diff main..branch READS AS A LIST OF DELETIONS THAT THE BRANCH NEVER MADE. The curl-8.23.0 branch predated 0.14.0, so its diff against main showed error_hook, fn_gate, scope_refusal, test_api_integration and 1995 lines being REMOVED - none of which the branch touched; they were simply added to main afterwards. Merging it would have reverted three releases' work while looking like a one-line pin bump, and the commit it carried was four files. The safe read is the branch's OWN commit (git show <sha> -- <paths>), and the safe apply is to check that main has not touched those paths since the merge-base (git diff $(git merge-base main branch)..main -- <paths>, which must be empty) and then take them alone. Same family as everything else here: the diff was correct and the inference from it would have been strictly wider than it could support.applyOutboundDefaults() disables; the WebSocket subprotocol and ping fixes need WebSockets, which we do not use; the SSE stale-event-id fix needs SSE, likewise. v0.60.1 is Windows certificate handling and an MSVC compile error. So the 0.59.0 pin stays deliberately, for the same reason it was not moved for the regex stack-overflow fix. Worth upgrading for hygiene when something else forces a rebuild, not before.cmake/Dependencies.cmake) and the pin carries its reasoning. Currently v0.59.0. Check for an upgrade periodically: it serves the public HTTP surface AND every outbound call, upstream ships security fixes most releases, and we were 17 releases behind before anyone looked. When evaluating one, judge each fix against what this service actually reaches rather than the changelog's severity - CPPHTTPLIB_REQUEST_URI_MAX_LENGTH (8192, enforced before routing) means a long-path attack answers 414 before routing and never reaches the regex matcher, so the headline regex stack-overflow fix was never our exposure (verified against a running server, after first proving which process held the port - an earlier run of this test hit an unrelated service listening on the port I had picked), while the request-PARSING fixes (chunked transfer-coding matching, Content-Length truncation, chunk-size control characters) are. Deliberately NOT on the newest release when its fixes are for backends or features we do not use.webui/src/monacoSetup.ts) so the editor works offline - do not revert to the CDN loader.Type=notify; the binary must be built with libsystemd (it is, when libsystemd-dev is present) or change to Type=exec.VERSION and api/openapi.json's info.version must agree, and packaging/build.sh now refuses to build unless they do (scripts/check-version-sync.sh, run at the top level so it covers the local, Docker and publish paths alike). They drifted once: 0.10.0 was published with the docs claiming 0.9.2, and since openapi.json ships in the server package and is served at /openapi.json, the stale value was live. Correcting it cost a whole release, because a published version number is never reused for different content - which is why 0.10.0 exists but must never be deployed. A release step that relies on remembering is a release step that gets skipped, so it is a check rather than a checklist line.
./packaging/build.sh # Debian-13 .debs → dist/debian13/ (3 packages: server, webui, runner)
./packaging/build.sh --no-runner # skip the runner package
./packaging/build.sh --repo --suite trixie --sync # + publish to repository.smartbotics.ai (outward-facing!)
Publishing uploads to the live apt repo - only with explicit confirmation. The deb-repo tooling is /data/dev/smartbotics/smartbotics-deb-repo/scripts/ (override with DEB_REPO_DIR).
Release packages always come from the Docker path. The dev host (zeus) runs Void Linux, so --local there compiles, runs the tests and leaves a runnable binary in build/src/ but refuses to build .debs (and refuses --install/--repo/--sync) - a Void-linked package would not install on Debian 13. --local still packages normally on a Debian-family host.