瀏覽代碼

docs: embedding_timeout and db_unavailable are load-bearing for a consumer's fault tagging

novitax's kb-search classifies every failed search by reading e.code, and
those two slugs map to their embed_timeout and db buckets. Recorded so a
rename has to be deliberate, the same way _created_by was.

They moved to the code only because I reworded the 504 in 0.18.1 - the exact
event a prose dependency cannot survive, and their old regex happened to
survive it by accident. So the question before changing a message is not
"will this still parse" but "is anyone parsing it", which is cheaper to
ask than to grep for.

Also records what the host actually hands a function, which is answerable
only from source: throwApiError sets message, code, status and details as
real properties, so e.code is a field and digging the slug out of the message
is a branch that cannot fire. And both rate_limited and memory_pressure do
reach the runner surface.
fszontagh 3 周之前
父節點
當前提交
8b200dbd91
共有 1 個文件被更改,包括 5 次插入 和 0 次删除
  1. 5 0
      CLAUDE.md

+ 5 - 0
CLAUDE.md

@@ -679,6 +679,11 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **WHAT WAS DELIBERATELY LEFT HARDCODED, because "make everything configurable" is not the same request.** SECURITY bounds stay fixed - `kMaxSecretNameLength`, `kMaxSecretValueBytes`, `kMaxSecretsPerProject`, `kMaxLiteral`, `kMaxNameLen` - since an operator-settable security limit widens what a single misconfiguration can do. INTERNAL batching stays fixed (`kMaxReclaimPerPass`, `kMaxTrimPerAppend`, `kNameLookupLimit`, `kDefaultListLimit`), because those are implementation decisions rather than operator questions, and `mime_words`'s 45 is RFC 2047's number and not ours to pick. Still OPEN and named rather than quietly skipped: the four `kRetryAfter*` durations in `errors.hpp`, `kValuesLimitCap`, and `kFallbackWallCeilingMs`. The Retry-After ones need settings reaching `retryAfterSeconds()`, which is deliberately PURE and has no settings access - a dependency injection worth doing properly rather than in a hotfix.
   **AND A FALSIFICATION CAUGHT THAT ONE OF THESE CHANGES WAS UNTESTED, WHICH IS THE PART TO COPY.** Reverting `vectorSearch` to use the constant instead of its new `scanCap` parameter left the whole `test_vector_scan` file GREEN - 8 of 8 passing - because every test there calls the pure depth helpers with the DEFAULT cap and nothing exercised a custom one. Three tests now pass explicit caps, both lowered and raised. The remaining gap is stated in the test file rather than implied: `opts.limit = scanCap` and the `scan >= scanCap` exit inside `vectorSearch()` need a live database and a collection larger than the cap, so a pass there means "the walk's arithmetic obeys the cap" and NEVER "a lowered setting is honoured end to end".
 
+- **TWO ERROR SLUGS ARE LOAD-BEARING FOR A CONSUMER'S FAULT CLASSIFICATION AND MUST NOT BE RENAMED AS A TIDY-UP: `embedding_timeout` AND `db_unavailable`.** novitax's `/fn/novitax/aliz/kb-search` tags every failed search by reading `e.code` first, and those two map to their `embed_timeout` and `db` buckets. Same treatment `_created_by` got when they made it their attribution channel: granularity we added for our own reasons became someone else's only signal, and a refactor that looked lossless would silently remove it.
+  **It is a BETTER dependency than the one it replaced, and the swap is the lesson.** They had been pattern-matching our PROSE - `/timeout|timed out|deadline/i` - which survived 0.18.1's reworded 504 only because "deadline" happens to appear in the new sentence and "Timeout" appears inside the field name `embedTimeoutMs`. I reworded that message in the very release they were depending on, which is exactly the event a prose dependency cannot survive, and they moved to the code when told. **So the useful rule for any message change is not "will this still parse" but "is anyone parsing it at all" - and the answer is cheaper to get by asking than by grepping their repo.**
+  Two things they measured that are worth keeping because I could not have answered them from our side either. Their old 5xx arm was `/\b5\d\d\b/` over the message text, which equally matches a port in `127.0.0.1:502`, a byte count or a year - **a three-digit-number check wearing a status check's name** - and it is gone now that `e.status` is known to exist. And a test they had written an hour earlier asserting the slug was read out of the MESSAGE passed against `'vectorapi 504 {"error":"embedding_timeout"}'`, a string that also contains the word "timeout", so the prose arm answered and the assertion could not tell which arm had produced it: green, and blind to the only thing its name mentioned.
+  **WHAT THE HOST ACTUALLY GIVES A FUNCTION, since this keeps being asked and is answerable only from source** (`throwApiError`, `runner/src/host_context.cpp:138`): a JS `Error` carrying `message`, **`code`** (the slug), **`status`** (the HTTP status the same error would have had) and `details` as a real object when non-empty. So `e.code` is a FIELD and digging a slug out of the stringified message is a branch that can never fire for a host-raised error. `host_prelude.js`'s own `fail()` sets `code` the same way, so both halves of the surface agree. And `rate_limited` and `memory_pressure` BOTH reach a function - the first through `requireCapabilityCore` charging the policy's limit on `ctx.collections` data access (a separate bucket from the `/fn` request charge, so a function can be admitted at the request and refused on its data access), the second through the same `translate()` both surfaces use.
+
 ## 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.