Jelajahi Sumber

docs: correct what 0.16.0 makes stale, and record the audit that found its own list rotten

Four entries this release falsifies, each handled by the rule it earns
rather than uniformly.

REPLACED, because they were statements about current behaviour that a
reader acts on: llms.txt's "_expires_at is not yet RETURNED" (accurate
when written, false once the pin moved - and in an API reference a stale
sentence makes a consumer write code that never looks for the field), and
the Depends artefact list, which now also says the floors are HAND-WRITTEN
and therefore evidence of intent rather than of need.

LABELLED SUPERSEDED, because the claim was right and only the world moved:
the curl CVE "stays UNRESOLVED until 8.23.0 is vendored" keeps its lesson,
which is the useful half - a bounded pass was equally consistent with
"immune" and "not reproduced", and the fix was taken on the advisory's
word rather than argued away on a test that reached the healthy path.

CORRECTED AS AN UNDERSTATEMENT, which is a third thing and was mine: the
2.17.2 -> 2.20.1 entry read as though the upgrade brought "log lines plus
a lower hourly snapshot peak". It is the structural fix for the crash loop
we spent a day on - the snapshot writer now streams instead of holding the
store in memory three times over - so it is the reason to take the window
rather than a side effect of it. Their own limit is recorded beside it:
this prevents phase 1 and so prevents phase 2 being reached, and does not
make phase 2 survivable if something else produces a large WAL.

Two new entries. A long-lived branch's diff against main describes BOTH
directions, so the curl branch appeared to delete 1995 lines and three
releases' work it had never touched; the safe read is the branch's own
commit and the safe apply checks the merge-base first.

And the best-effort audit, recorded for what it got wrong about itself.
All 14 detail-discarding catches are legitimate, but the sweep looked for
a syntactic property ("reports nothing") and had a false-positive rate
near 100%, while the shape that hurts is a premise that expired - which no
grep can see, because the code still reads as correct. The one real
finding had failed nothing: a catch depending on another function to log,
true today with nothing enforcing it, and silent about the thing an
operator needs. This file's own candidate list for that audit named a path
deleted two releases ago, so the list of things to audit rots exactly like
the things on it.
fszontagh 1 bulan lalu
induk
melakukan
7339f5be9e

+ 15 - 6
CLAUDE.md

@@ -69,7 +69,7 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   - **Mine, nearly refusing something cheap:** a consumer asked to raise the function run log's retention from 50, and I almost declined on the grounds that "store size is exactly what took prod down this morning, so today is the wrong day to grow a collection." Every clause of that is TRUE and the sentence contains no measurement. Measured instead: a run row is **~711 bytes** (601 docs / 427,481 bytes on `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.
   - **Theirs, nearly having me divide by zero:** they asked for a history size to divide by their own fact-count delta, and the delta was NEGATIVE because `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:25`, default 50). 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.
+  **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.
 - **THE ONE QUESTION THAT CATCHES THIS WHOLE FAMILY: "WHAT ELSE WOULD PRODUCE THIS EXACT RESULT?"** It is one line, it costs nothing, and on 2026-10-12 three separate instances of the same defect appeared in a single afternoon - two of them mine - every one of which it would have stopped:
   - **A vector-encryption test** read rows written BEFORE the flag was flipped and concluded about writes after it. What else would produce three rows still searching at 1.0? Pre-flip vectors living in the vector sub-db rather than the body. Which is exactly what was happening, and the new-insert path was broken.
   - **A consumer's page probe** returned 200 at 5.4 MiB and they concluded the size limit was per DOCUMENT. What else would produce that? A per-RESPONSE limit anywhere above 5.4 MiB - which is what it is, 100 MB. A test that passes under both hypotheses cannot choose between them.
@@ -87,7 +87,7 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
 - TS: no `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).
 - Commits: conventional prefixes (`feat`/`fix`/`build`/`docs`/`test`). Branch for feature work; `main` is pushed to `ssh://git.smartbotics.ai:10022/fszontagh/smartbotic-vectorapi.git`.
 - **"COMMITTED", "RELEASED" AND "DEPLOYED" ARE THREE DIFFERENT THINGS, AND THIS FILE SAID "FIXED IN X" FOR ALL THREE. THREE SEPARATE ENTRIES WERE WRONG IN EXACTLY THAT GAP.** Found 2026-10-22 when a consumer audited their own recorded gotchas against prod and asked ten questions. The three: the `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**.
-  **Two instruments settle it, and both are 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)` while `0.13.0-1` and `0.15.0-1` declare `>= 2.17.2`, which is the artefact disagreeing with the note.
+  **Two instruments settle it, and both are 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.
@@ -97,6 +97,11 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **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.
+
 - **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.
 
@@ -318,7 +323,9 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **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.
 - **A DATABASE OUTAGE ERASES ITS OWN EVIDENCE FROM THE FUNCTION RUN LOG, because the run log lives in the database.** Observed by a consumer diagnosing the 50-second window: ZERO recorded function runs inside it, not failures. They had to infer the gap from the surrounding minute-cron ticks (16:21:05, then 16:22:46) rather than read it. So when diagnosing a past outage, the run log goes QUIET rather than showing errors, and absence of failures there is not evidence that nothing failed - the same absence-is-not-information trap as a missing `scan_capped`, one layer out.
 - **DATABASE 2.17.2 -> 2.20.1 IS A VERIFIED TWO-WAY DOOR: NOTHING BETWEEN THEM MIGRATES ANYTHING ON DISK, AND 2.17.2 READS A DATA DIRECTORY 2.20.1 HAS RUN ON.** Established by the database owner 2026-10-19 by TEST rather than by reading the diff, which is why it is quotable: 2.17.2 seeded 200 rows with encryption on, 2.20.1 then inserted 100, updated 50 (recording history), deleted 10 and wrote its streaming snapshot, and **2.17.2 booted from that 2.20.1 snapshot** with 0 WAL entries replayed, not read-only, reading 290 rows with the updated and new ones decrypting exactly; `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, boot does the same recovery work, and the only boot-path differences are log lines plus a lower hourly snapshot peak. 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.**
+  **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.
 - **THE DATABASE PACKAGES ARE ON APT HOLD, so an upgrade needs `--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`.
@@ -343,7 +350,7 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **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, prod runs 2.17.2, and the client side of the dependency is already satisfied. This file previously filed both under one "pin move" dependency, which is wrong in opposite directions - one is already done, the other never needed the client at all.
+  **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`.
 - **DONE 2026-10-15: THE OPERATIONAL COLLECTIONS ARE CAPPED, 316 MB OF HISTORY DOWN TO 117 MB.** Run with `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:
 
@@ -416,7 +423,8 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   - **It can legitimately be in the PAST**, which is the whole point: the sweep runs every second, a `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.
   - **The restore rule, which closes the immortal-marker defect:** absent → insert with no TTL; in the PAST → **skip the row**; otherwise `ttlSeconds = ceil((_expires_at - now)/1000)`.
   - Filtering on it (`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.
-  - **IT IS RESERVED AND IS NOW IN OUR STRIP LIST - DONE IN 0.14.0, INDEPENDENTLY OF THE PIN MOVE.** `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". Note `api/llms.txt` says plainly that the field is stripped but **not yet RETURNED** on reads, since the client we ship drops it before we see it - claiming otherwise would have been a documented guarantee nobody could observe.
+  - **IT IS RESERVED AND IS NOW IN OUR STRIP LIST - DONE IN 0.14.0, INDEPENDENTLY OF THE PIN MOVE.** `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.
 - **TTL EXPIRY IS LAZY, SO A BACKUP LEGITIMATELY HOLDS ROWS THE LIVE PROJECT NO LONGER HAS - AND ANY BACKUP-VERSUS-LIVE COMPARISON READS THAT AS DATA LOSS.** Found by a consumer verifying their own backup right after a platform window, which is the worst possible moment to meet it: their tool reported `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.
@@ -433,8 +441,9 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
 - **UPSTREAM PIN REVIEW, 2026-10-09.** Both pins were checked against what this service actually reaches, which is the standing discipline here rather than chasing version numbers.
   - **curl 8.23.0: JUDGED ITEM BY ITEM NOW THAT THE EMBARGO HAS LIFTED, AND THE HIGH IS NOT OUR EXPOSURE.** This entry used to say the bump was "REQUIRED and not optional" with "the HIGH one is unknown"; the details are public since 2026-10-14 and the picture is nearly the opposite of what the severity implied. **CVE-2026-92392 (HIGH) is a use-after-free in HTTP/2 UPLOAD handling** - a malicious server's `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. **So the CVE stays UNRESOLVED for us until 8.23.0 is vendored**, the test is kept as a regression test for the timeout plumbing and 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.
+    **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.
+  - **AND THE WAY IT SHIPPED CARRIES ITS OWN TRAP: A LONG-LIVED BRANCH'S DIFF AGAINST `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.
   - **cpp-httplib v0.60.0/v0.60.1 exist, and NONE of their security fixes are our exposure.** Judged individually: the hostname-verification SAN fix is Mbed TLS and we build against OpenSSL; the 303-redirect body and redirect percent-decoding fixes need redirects, which `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.
 - **cpp-httplib is pinned (`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.
 - **Monaco** is bundled locally (`webui/src/monacoSetup.ts`) so the editor works offline - do not revert to the CDN loader.

+ 1 - 1
packaging/deb/templates/control.server

@@ -2,7 +2,7 @@ Package: smartbotic-vectorapi
 Version: {{VERSION}}
 Architecture: amd64
 Maintainer: Ferenc Szontagh <ferenc.szontagh@smartbotics.ai>
-Description: Smartbotic VectorAPI — REST API for RAG vectors and JSON
+Description: Smartbotic VectorAPI - REST API for RAG vectors and JSON
  General-purpose, client-agnostic REST API in front of smartbotic-database:
  multi-project namespaces, multi-key per-project-grant authorization, OpenAI
  embedding generation for RAG, similarity search, JSON document CRUD, and

+ 1 - 1
packaging/deb/templates/control.webui

@@ -2,7 +2,7 @@ Package: smartbotic-vectorapi-webui
 Version: {{VERSION}}
 Architecture: all
 Maintainer: Ferenc Szontagh <ferenc.szontagh@smartbotics.ai>
-Description: Smartbotic VectorAPI — web administration console
+Description: Smartbotic VectorAPI - web administration console
  React-based admin console for smartbotic-vectorapi: login, project switching,
  dashboard, collections, JSON document editor (Monaco, bundled offline), RAG
  search tester, and project/key administration. Served by smartbotic-vectorapi.