Просмотр исходного кода

docs: reads of every shape see a disk-only row - the delete-then-insert pattern was exposed at the DELETE

Measured on prod: a filtered listing enumerates an audit-named ghost (control:
0 rows for an impossible value), an unfiltered walk returns 10 of 10, and on
2.20.2 remove() of a disk-only row succeeds where it previously answered
not-found. So 2.20.2 removes a consumer's hazard rather than creating one, and
'still a ghost' does not rule out a failed delete.
fszontagh 1 месяц назад
Родитель
Сommit
f4a443af85
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      CLAUDE.md

+ 5 - 0
CLAUDE.md

@@ -559,6 +559,11 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
 - **PROD'S DISK NOW BLOCKS EVERY DATABASE UPGRADE BY ITSELF, AND THAT IS A STANDING BLOCKER RATHER THAN A ONE-OFF.** `/` is 50 GB at 83%, the data directory is 6.9 GB and `/var/backups` holds 23 GB - a 6.9 GB full cold copy from 2026-10-22 14:42, the package's own 6.9 GB pre-upgrade copy, a 5.6 GB nightly, a 2.5 GB prune-era copy and an 831 MB October 13 one. The preinst's 1.2x requirement therefore fails before any upgrade starts, and **a deb whose preinst refuses leaves the package at its old version while an `apt-get install` of other packages in the same script succeeds**, so the failure can easily be read as "the window worked" if only the app versions are checked afterwards. It is also entangled with the plaintext-credentials decision (every one of those backups holds readable API keys), so freeing the space and resolving that are the same conversation and both are the owner's call.
 - **THE "ONE ORDERING RULE EVERYWHERE" CLAIM IS NOT TRUE, AND THE EXCEPTION IS A CHECK I ADDED IN 0.17.0 WHILE THE RULE WAS ALREADY WRITTEN DOWN HERE.** This file states the order as authorize, then the server's own capability (501), then the REQUEST (422), then the resource (404), and says a request-level fault no amount of creating the resource fixes must not hide behind the resource. `PUT /documents/{id}`'s `ttl_seconds` refusal sits BEHIND the collection lookup, because the handler calls `scoped()` first and that helper both authorizes and raises the 404. Measured on prod: the same refused parameter answers **422 on a collection that exists and 404 on one that does not**. The cost is small and specific - a caller who misspells the collection never learns the parameter is unsupported, and fixes the name only to meet the 422 afterwards - but it is the exact shape the rule exists to prevent, and the rule was in this file before the check was written. **Writing the rule is not applying it, and the gap is one release.**
 
+- **EVERY SHAPE OF READ SEES A DISK-ONLY ROW, SO THE DELETE-THEN-INSERT PATTERN WAS EXPOSED AT THE *DELETE*, NOT AT THE ENUMERATION - AND A CONSUMER'S WHOLE RISK ASSESSMENT TURNED ON WHICH.** Asked by novitax 2026-10-22 after the 2.20.2 census: their re-ingest calls `deleteWhere(collection, 'sourceId', id)` and then POSTs each chunk at a deterministic `sha256(sourceId\0index\0text)`, with NO 409 handling on the insert, because the delete is supposed to have freed the id. Their worry was that a filtered listing reads the mirror, silently skips the ghost, and leaves the POST meeting a taken id - which from 2.20.2 answers `AlreadyExists` where it used to re-create at version 1, failing their whole unit.
+  **Measured on prod with reads only, on one of the audit's own named ghosts** (`novitax:kb_chunks/00158ab8...bf542`): `GET` by id 200, `?filter=sourceId:eq:<its sourceId>` returns **1 row and it IS that id**, and an unfiltered 10000-row walk contains **10 of the 10** listed ghosts. CONTROL: the same filter shape on a sourceId that cannot exist returns 0, so the filter is filtering. So get, filtered find and walk all see them - the audit's "reads find them" is literal.
+  **The hazard was real and sat one step later.** A delete is a WRITE, and pre-2.20.2 a write at a disk-only id answered not-found - which is exactly what the toloajto row did on DELETE as well as PUT and PATCH. So the enumeration succeeded and the removal did not. Measured on 2.20.2 against a disposable disk-only row of ours (a `mailtest` run-log row, never a tenant's): `remove` answers ok, the read back is not found, the control remove of a never-existing id still reports not-found, and a sibling ghost is untouched. **2.20.2 therefore REMOVES that exposure rather than introducing one**, which is the opposite of the consumer's reading, and their refusal to paper over it with 409 tolerance is right: with the delete working, a 409 there now means something genuinely wrong.
+  **AND THE INFERENCE THEY DREW FROM THE CENSUS IS WEAKER THAN IT LOOKS, IN THE DIRECTION THAT MATTERS: "ALL 1964 ARE STILL GHOSTS, SO NO RE-CRAWL HAS TOUCHED THEM" RULES OUT A SUCCESSFUL WRITE AND NOT A FAILED DELETE.** A delete that 404'd performed no write at all, so it left the row exactly as disk-only as it found it. "Still a ghost" is therefore equally consistent with "never re-crawled" and with "re-crawled, and every delete silently failed" - and the second leaves the OLD-text chunk in place beside a new row under the new id, i.e. orphaned stale chunks still retrievable by search, which is the failure they were protecting against arriving through the other door. The discriminating check is a per-source chunk count against what the current text should produce; a census of ghost STATUS cannot answer 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.