Bläddra i källkod

docs: the vector-release path is tested upstream, and a defensive config duplicate freezes against future defaults

fszontagh 1 månad sedan
förälder
incheckning
bba15a9e9e
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. 2 2
      CLAUDE.md

+ 2 - 2
CLAUDE.md

@@ -647,9 +647,9 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **DEPLOYED 2026-10-27 AND THE PREDICTION HELD, WITH ONE UNIT ERROR WORTH MORE THAN THE RESULT.** Prod is on `2.21.2 (commit fe9b15b)`, client unchanged at 2.20.0, in a 134 s window (16:08:07-16:10:16 UTC; the stop alone took 53 s writing its shutdown snapshot). `max_memory_mb` was raised to **1536** FIRST, in a `conf.d` drop-in, and the first line on the new build read **`889 MB estimated (57%, pressure=normal), of which vectors 616 MB, 118247 docs, 0 evicted`** - honest, in `normal`, with no warning or error anywhere in the boot.
   **I predicted 919 MB and the answer was 889, because I added DECIMAL MB of vectors to a MEBIBYTE estimate.** 39,387 rows x 16,416 B is 646.6 MB **or** 616.6 MiB, and the server reports the second: 272 + 616 = 888 against 889 observed. The mechanism was right and the units were mixed, which here erred pessimistically - but **a unit mismatch inside a headroom calculation has no preferred direction**, and this one was 30 MB on a figure being compared against a pressure threshold. State MiB or MB whenever a number is going to be divided by a budget.
   **The budget must be chosen against the LIVE estimate, not a quoted one.** The database session recommended 1300 from a `258 MB` line; the live figure was 272, so the real requirement was 919/0.7 = 1313 and 1300 would have landed at **70.7% - inside `soft` pressure**, which is not the "behaviour unchanged, numbers honest" it was offered as. 1536 puts it at 57.9% with 186 MB of growth before soft, against the 138 MB of body growth the old 512 budget allowed, so eviction is marginally EARLIER than before rather than later.
-  **The drop-in carried all TWELVE keys of the `memory` object with only `max_memory_mb` changed, because whether the loader merges drop-ins deeply INSIDE a nested object was unknown.** A one-key drop-in would have been correct under a deep merge and would have reset the eviction thresholds to defaults under a shallow one - the same shape as a key PATCH replacing a whole scope, and as `createCollection` clearing a default TTL when 0 is passed back. Carrying every current value makes the question moot rather than answered, and a pre-flight assertion proved exactly one key differed. The boot log then confirmed `Merging drop-in: .../60-memory.json` and `Config assembled from 3 file(s)`.
+  **THE DROP-IN FIRST CARRIED ALL TWELVE KEYS OF THE `memory` OBJECT AND NOW CARRIES ONE, AND THE CORRECTION INVERTS THE REASON RATHER THAN RELAXING IT.** Twelve was chosen because whether the loader merges drop-ins deeply INSIDE a nested object was unknown: a one-key file is correct under a deep merge and would have reset the eviction thresholds to defaults under a shallow one, which is the shape of a key PATCH replacing a whole scope, and of `createCollection` clearing a default TTL when 0 is passed back. Carrying every current value made the question moot rather than answered, which was the right call while it was open. **The merge is RFC 7396 - objects merge recursively, arrays replace - so twelve was unnecessary, and keeping it would have been actively WRONG for a reason neither of us raised at the time: eleven duplicated values FREEZE against the package's future defaults.** A later release that lowers `eviction_threshold_percent` in `config.json` would be silently overridden by a stale copy in our drop-in, and nothing would report it - the same stale-duplicate failure this file records everywhere else, manufactured by a safety measure. Now one key, swapped after a control PROVED the other eleven were byte-identical to `config.json` so the removal could not change the effective config, with the old file backed up to `/var/backups/` and **never beside it in `conf.d`, which the loader globs**. The boot log confirmed `Merging drop-in: .../60-memory.json` and `Config assembled from 3 file(s)`. **A defensive duplicate is only free while the thing it duplicates never changes.**
   **VERIFICATION, and the one that counts is the SEARCH rather than the counts.** 2.21.2 rewrites the snapshot's vector section, so a count cannot see the failure that matters. A **fixed explicit `query_vector`** (seeded, dim 4096) was run against all five vector collections before and after: **top-5 ids AND scores identical to 8 decimal places in every one**. Counts unchanged on seven collections, a body read back with `_created_by` still `fn:justice-pa/compress` at `_version` 8, a negative control 404, and a deliberate write probe (create collection, insert, read back, delete, control 404) proving writes are accepted - which is the precise thing an emergency-pressure boot would have refused. Swap in use FELL 1147 -> 521 MB.
-  **What is NOT verified, stated because the headline invites the opposite reading: the vector-release-on-eviction path was never exercised.** Prod sits at `0 evicted, pressure=normal`, so nothing has evicted anything and the new behaviour is dormant. It becomes live only under pressure, and its own precondition is a healthy LMDB mirror at zero drift - which prod does currently satisfy (`memory_only: 0`). **The feature was deployed, not tested, and the first eviction episode is the measurement nobody has taken.**
+  **PROD HAS NOT EXERCISED THE VECTOR-RELEASE PATH, AND I WRONGLY WROTE THAT NOBODY HAD: IT IS TESTED UPSTREAM, AND THE DISTINCTION IS "UNMEASURED HERE" RATHER THAN "UNTESTED".** Prod sits at `0 evicted, pressure=normal`, so the behaviour is dormant on this box and its first episode here is still unmeasured. But the database owner exercised it before tagging, against a real LMDB mirror at zero drift: unit coverage (21 checks) asserting the vector share falls by exactly the released vectors, a reload restoring each vector BYTE-EXACT, a delete of an evicted row leaving no vector anywhere, and **an unhealthy mirror keeping vectors resident** - which is the precondition itself under test; plus an e2e on a real server where 300 dim-4096 rows under a 16 MB budget evicted 893 rows, the line went to `of which vectors 0 MB`, and after two snapshots and a restart it read exactly 4 MB with search intact. Reverting each part fails a check. **"Deployed, not tested" was a claim about THEIR work that I had no evidence for and did not ask about before writing** - the measurement I was missing was mine, and the fix was one question. Say "unmeasured in our deployment", which is what was actually true.
   **AND MY PROBE SWALLOWED AN ERROR WHILE TAKING THE BASELINE, WHICH WOULD HAVE POISONED THE COMPARISON.** The first pre-upgrade run reported `novitax:kb_fact_answers` as `top: []` with a null `filter_mode`; that was an error envelope with no `results` key, not an empty result, and the parser turned it into a legitimate-looking empty baseline that the post-upgrade run would have "matched" or "fixed" for reasons unrelated to the upgrade. A retry succeeded immediately. The rewrite distinguishes a missing `results` key from an empty one, records the envelope verbatim and retries three times - **an absent field and an empty field must never render the same in a baseline you intend to diff.**
   **RSS IS DELIBERATELY NOT QUOTED AS THE COST: 1232 MB was a 19-hour-old process and 1595 MB is a fresh boot**, so that difference is the restart. `VmHWM` moving 1,771,136 -> 1,780,676 kB is the only clean statement available and says the boot peak barely changed. Box-wide swap in use FELL, 646 MB to 259 MB.
   **Provenance survives adoption, and it had to be checked rather than assumed:** `justice-pa:facts/01a116ef1b2edf735dd281c3f564` reads back at `_version` 2 with `_created_by` still `fn:justice-pa/compress`, control a neighbouring id that never existed still `not found`. An adoption that took the insert path would have re-created rows at version 1 with a fresh creator - which is exactly the pre-2.20.2 ghost-clobber behaviour, and novitax now depends on `_created_by` as their only after-the-fact attribution channel.