ソースを参照

docs: a constant failure message cannot name a phase, and reads lost the database's classification

fszontagh 3 週間 前
親
コミット
3dbbe24470
1 ファイル変更、13 行追加、0 行削除
  1. 13 0
      CLAUDE.md

+ 13 - 0
CLAUDE.md

@@ -714,3 +714,16 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
 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 `.deb`s (and refuses `--install`/`--repo`/`--sync`) - a Void-linked package would not install on Debian 13. `--local` still packages normally on a Debian-family host.
+
+- **A FAILURE MESSAGE THAT IS CONSTANT ACROSS TWO PHASES CANNOT ANSWER "WHICH PHASE", AND THE ANSWER HAD TO BE RECOVERED FROM THE GAP BETWEEN TWO JOURNAL TIMESTAMPS.** 2026-11-03, the evening after 0.18.1 shipped the connect cap. A consumer asked the one question the cap's whole design turns on - is connect or READ the phase expiring - and said plainly that our log was the only instrument that could falsify their inference. It could not. `src/embeddings.cpp` threw the identical `embedding_unreachable` "could not reach embedding endpoint" for both, because cpp-httplib returns an EMPTY `Result` for a connect failure and a read timeout alike and nothing read `res.error()`; and the operator warning one layer up prints `connect<=2s read<=4s`, which are the windows we ALLOWED rather than the ones that elapsed. All 15 lines in their hour were byte-identical.
+  **What discriminated was arithmetic on the timestamps of the lines, not any field in them.** A fully failing call leaves TWO warn lines, one per rung, so the gap between them is the second rung's duration: **3.004, 3.072, 3.024, 3.016 s** against a second-rung read window of 3 s and a connect cap of 2 s. Connect expiring would have been ~2 s in every one. Read, to within 70 ms, confirmed from our side by a different instrument than the one we were asked to read. **The message now carries httplib's error kind and the elapsed ms; the SLUG deliberately does not split**, because `embedding_unreachable` is a code a consumer branches on and two codes would be a breaking change for a distinction only an operator needs.
+  **THE TEST PAIR CAUGHT A DEFECT IN ITSELF, WHICH IS THE PART TO COPY.** Each arm asserts the ABSENCE of the other's wording, so neither can pass against a message that names one phase unconditionally. That is what exposed the "refused connection" arm: it bound a port with `bind_to_any_port` and let the `Server` go out of scope, assuming that closed the listener. **It does not** - connect SUCCEEDED, nothing accepted, and the call died at the 1 s READ timeout reporting "Failed to read connection", byte-identical to the case it existed to contrast with. Port 1 on loopback answers RST and discriminates. Match on "read" and "establish", never on "connection", which appears in both of httplib's strings.
+  **And the 6063 ms that proved the old split was halving a budget was ALSO disproving the connect hypothesis the whole time** - 3 + 3 is both READ windows with connect contributing nothing. It sat in our own release note, in the paragraph explaining why the split was wrong. Writing the arithmetic down is not the same as asking which phase the seconds belonged to.
+
+- **THE WRITE PATHS CARRIED THE DATABASE'S CLASSIFICATION AND THE READ PATHS DID NOT, SO `ctx.collections()` REPORTED A DATABASE OUTAGE AS `internal` / 500.** Found in the same session, from a consumer's report that the mechanism "arrives stripped". `insert` and `store` both do `catch (const Client::Error& e) { throw apiErrorFor(e); }`; `find`, `get` and the vector `search` had **no such arm at all**, so a `Client::Error` from a read fell through to `guarded()`, which catches `std::exception` and converts it to `ApiError(Internal, "internal")` - dropping `details` with it. `apiErrorFor` is in the same file.
+  The live cost: a cold similarity search overran the 5 s `DbGateway` deadline, the client raised `DeadlineExceeded`, and the script was told `internal` / 500 about what is really **`db_unavailable` / 503 with a `Retry-After`**. A consumer who had deliberately made `e.code` load-bearing for their database bucket therefore could not see a database fault as one, so the remedy - wait - was unreachable from the only channel they branch on. Same family as `unknownKeys()` being called in one handler while six siblings stayed broken: **the arm was added where the lesson was learned (a write) and not to the class (any database call)**.
+  **The coverage boundary is written beside the arms because the suite looks like it covers this: `test_db_errors.cpp` pins the MAPPING, nothing pins the ARM** - making a read fail needs a database that fails and those tests share a live one, so deleting the three catches leaves the suite entirely green. Note what the arm does NOT buy on `get`: `Client::get` returns nullopt for both "absent" and "the call failed", so a transport failure the client swallows still reads as a missing document.
+
+- **I INFERRED A CONSUMER'S ERROR-TAGGING ORDER FROM ITS SYMPTOM AND WAS WRONG - THE THIRD TIME IN A FORTNIGHT OF READING SOMEONE ELSE'S CODE OFF OUR OWN LOGS.** Told that a database failure had been bucketed as an upstream 5xx, I proposed the mechanism: a `status >= 500` arm running ahead of the `e.code` check. `code` was the first arm and always had been; the slug never arrived as `code` at all. The question was answerable by asking, and the previous two instances (`kitchen_presets`, a consumer's call sites) were already written in this file when I did it again. **Equally: the stripped-read defect above is real and does NOT explain what they measured** - the generic arm yields `internal` / 500 and they saw a 503 with no code - so accepting their diagnosis wholesale would have closed the question on a cause that does not fit. A tidy explanation that fits is more expensive than none, and one that does not even fit should be said out loud rather than absorbed.
+
+- **A HARNESS THAT DIFFERENCES TWO MEASUREMENTS MUST ASSERT THE PRESENCE OF THE FIELD IT IS READING, NOT MERELY A 200 - MINE SUBTRACTED TWO 404s AND REPORTED A PROVIDER TIME OF MINUS 0.066 SECONDS.** Timing an embedding provider by differencing a `query_text` search against a `query_vector` control on the same collection, I had the route path wrong (`/api/v1/projects/{p}/...`, not `/api/v1/{p}/...`), both arms answered 404 with an EMPTY BODY, and the script cheerfully produced a negative duration from two failures. The sign is what gave it away, which is luck: had the control been the slower 404 the number would have been small, positive and plausible. It now asserts HTTP 200 **and** the presence of the `results` KEY on every arm before recording anything, because an absent key and an empty list must never render the same in a number you intend to subtract - the same trap as a baseline probe that recorded an error envelope as a legitimate empty ranking.