Sfoglia il codice sorgente

docs: 2.21.0 + 0.18.0 on prod, and report mode cannot price the step it exists to price

A 97 s window, and the first in three where the package took its own full
pre-upgrade backup rather than being skipped - the disk work paid for itself.
disk_only=report went into a conf.d drop-in, never into the dpkg conffile.

The consistency report: 7217 disk-only, 0 memory-only, 784 ms. But every
per-collection action is the flat 'reported' with no would-adopt/would-skip
field, while upstream's own staging distinguished 25 adopted from 75 skipped -
so a dry run that reports what IS rather than what WOULD HAPPEN answers a
different question, and adopt stays untaken. Raised before 2.21.1 ships.

0.18.0's three fixes verified live with their controls, including the
falsification of the ordering test.
fszontagh 1 mese fa
parent
commit
967d795c07
1 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 10 0
      CLAUDE.md

+ 10 - 0
CLAUDE.md

@@ -591,6 +591,16 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **THE SAME WINDOW ALSO SHOWS THE SNAPSHOT-COMPLETENESS BUG LOGGING ITSELF, AT WARNING, WITH COUNTS - AND POINTING AT THE WRONG CAUSE.** `Snapshot: 9 evicted documents in collection 'justice-pa:vectorapi_secrets' could not be loaded from WAL - they will be missing from the snapshot. Likely a pre-v1.7.3 snapshot already lost them.` and the same for 64 in `justice-pa:calls`. The consequence clause is exactly right and the trailing hint is false - it was the WAL rotation, not an ancient snapshot - so anyone who met that line would have filed it as history and stopped looking. **A warning that fires correctly and misdirects is worse than one nobody reads**, and this is the single message that could have surfaced the whole backup gap a year earlier. Raised with them for rewording.
   Scale worth carrying into the 2.21.0 adopt step: that boot's memory check reads `52584 docs, 33000 evicted`. Eviction on prod is not marginal, which is why 7219 rows ended up stranded.
 
+- **PROD IS ON DATABASE 2.21.0 AND VECTORAPI 0.18.0, AND THIS WAS THE FIRST WINDOW IN THREE WHERE THE PACKAGE TOOK ITS OWN FULL PRE-UPGRADE BACKUP INSTEAD OF BEING SKIPPED.** 2026-10-22 18:30-18:32, a 97 s window, 66 s of which was the preinst copying the data directory - affordable because the disk went 84% to 49% earlier the same evening. `server-info` reads `2.21.0 (commit 43b586c)`, client 2.20.0, vectorapi reports `commit b98b160`, NRestarts 0 on all three, every tenant reading. **Holds re-applied and read back from `dpkg-query` as `hold ok installed`, NOT from the kept-back control, which cannot fire while nothing of ours is newer in apt and would have reported success for the wrong reason.**
+  **`storage.consistency.disk_only = report` was written into `/etc/smartbotic-database/conf.d/50-consistency.json` BEFORE the boot, never into `config.json`, which `dpkg -S` confirms the package owns** - the conffile trap this file already records. `dpkg --verify smartbotic-database` prints nothing afterwards, which is the check.
+  **THE CONSISTENCY REPORT: `compared: 71, disk_only: 7217, memory_only: 0, milliseconds: 784`**, 39 collections listed, the job queue alone 3388 (47% of everything), `novitax:kb_chunks` 1964, `novitax:sources` 1397. Split by owner because the halves mean different things: 16 of our service collections hold 3619 rows, 23 tenant collections hold 3598.
+  **AND REPORT MODE CANNOT PRICE THE STEP IT EXISTS TO PRICE, WHICH IS WHY `adopt` IS STILL UNTAKEN.** Each per-collection entry carries exactly `{collection, disk_only:{action, failed, ids}}`, and every `action` is the flat `"reported"` - there is no field saying whether that collection WOULD adopt or would be skipped. Upstream's own staging distinguished 25 adopted from 75 skipped (adoption needs the collection in memory for its options), so the information exists at adopt time and a report-mode run does not expose it. So going report-first bought the id lists and not the one number it was taken for: how much of the 7217 would become resident on a 1973 MB box already holding swap. **A dry-run mode that reports what IS rather than what WOULD HAPPEN is a control that reads as diligence and answers a different question** - the third shape this file names, met in a new place. Raised upstream before 2.21.1 ships, with the cheap fix: in report mode set `action` to `would_adopt`/`would_skip` with a reason, or add a per-collection `collection_in_memory` boolean.
+- **0.18.0: THREE DEFECTS, ALL FOUND BY VERIFYING A RELEASE AFTER DEPLOYING IT RATHER THAN BEFORE.** None was reported by a consumer, and every one came out of checking 0.17.0 on prod.
+  - **A REQUEST-LEVEL REFUSAL NOW PRECEDES THE RESOURCE'S 404, AND THE FIX KEPT ONE IMPLEMENTATION OF EACH STEP.** `scoped()` is split into `authorized()` (key + capability) and `requireCollection()` (the registry lookup and its 404), with `scoped()` composing them, so the other six call sites are untouched and the one route that needs them apart does not grow a second copy of the logic. Verified live with the full triple: the refused parameter on an absent collection answers **422**, the same route WITHOUT the parameter still answers **404** (so it is not blanket refusal), and unauthenticated plus the bad parameter still answers **401** (so the request check did not move in front of authentication). **Deliberately falsified: putting the old ordering back fails the new test while the pre-existing refusal test stays green**, which is how one knows the new test isolates the ordering and nothing else.
+  - **A 201 FROM `POST /keys` NOW MEANS THE KEY WILL AUTHENTICATE.** `KeyStore::visible(id)` answers whether an id is in the snapshot `reload()` loads with `find()` - the one `lookup()` scans - and `create()`/`update()` throw 503 rather than returning a credential the read path cannot confirm. The asymmetry is the whole point: a 503 is retryable and true, while a 201 carrying a dead secret is silent, permanent, and indistinguishable from success. Verified end to end on prod: create 201, the new secret authenticates 200, DELETE 200, the revoked secret 401. Prod's own audit reports `memory_only: 0`, so the condition is absent here - which is why it was worth adding before it ever is present.
+  - **THE LAST TWO `exists()` PROBES ARE GONE, AND THE CONTRACT CHANGE THE TASK ASSUMED WAS NECESSARY WAS NOT.** The task said `bool` cannot express "the call failed" so a signature change was required. It is not: the function THROWS for a transport failure and keeps `bool` for the genuine present/absent answer, exactly as `CollectionRegistry` already does. `remove()`'s `Failure&` form distinguishes them - code `Ok` with a false return means "did not apply". **Worth generalising: before accepting that a return type must change, check whether the exceptional case is actually exceptional.**
+  **Two instrument failures from the same evening, both caught by controls rather than by review.** A test I wrote against an invented fixture (`StoreFixture`, `db()`, `coll()`) that this project does not have - the file uses `SVAPI_REQUIRE_DB(db)` and bare `TEST()`; and extending the error mapping into a narrow test target needed a `Client::errorDetail` stub, whose first version omitted `noexcept` and failed to compile against the declaration. Neither reached a commit, both cost a build cycle, and the lesson is the cheap one: read the file's own idiom before adding to it.
+
 ## Deploy / publish
 
 **`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.