Преглед на файлове

docs: prod disk 84% -> 49%, and three findings from the cleanup

Freed 16 GB of superseded backups (one verified byte-identical to the copy
kept) plus 666 MB of journal; the database preinst's 1.2x check now passes, so
the next upgrade needs no skip. The kept rollback kit held database 2.11.1 and
vectorapi 0.1.7 under a note naming 2.17.2 and 0.13.0 - same filename-glob bug
as my own script - restaged with each Version asserted.

logrotate is NOT INSTALLED on prod, which is the cause this file never looked
for behind the unrotated access log. And 1.9 GB of history sits on two
collections with versioning OFF, unreachable because the cap is already at its
floor; both files were last written in the same minute, which points at the
crash loop's WAL replay and goes upstream as a question.
fszontagh преди 1 месец
родител
ревизия
1480bec678
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7 0
      CLAUDE.md

+ 7 - 0
CLAUDE.md

@@ -576,6 +576,13 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **Verified the path works TODAY rather than reasoning from the fix**, with a throwaway key: create returns 201 and 12 keys, the new secret authenticates 200, DELETE answers 200, the key leaves the listing, **the revoked secret then answers 401**, a second DELETE answers 404, and the admin key still answers 200 - so exactly one key was revoked and the revocation really took effect on authentication, not merely on the listing.
   **And my first attempt at that probe measured nothing while looking like it worked**, which is this file's oldest trap in a new costume: the create carried a `scope` the route rejected, my script parsed only for `id`, so `$ID` was empty - and the follow-on checks dutifully reported "not in the listing", "401", "DELETE 404" and read exactly like a successful revocation test. **An empty variable makes every subsequent assertion pass for the wrong reason.** Print the response body before parsing a field out of it, and assert the precondition - here, that a key was actually created - before interpreting anything downstream of it.
 
+- **PROD'S DISK IS CLEAR AGAIN - 84% TO 49%, 16 GB FROM SUPERSEDED BACKUPS AND 666 MB FROM THE JOURNAL - AND THE PREINST'S OWN CHECK NOW PASSES, SO THE NEXT DATABASE UPGRADE NEEDS NO SKIP.** Done 2026-10-22 with the owner's go-ahead. Deleted, with a manifest left at `/var/backups/DELETED-20261022.txt` so the deletion is documented rather than merely done: the package's own `pre-upgrade-20261022T144409Z-from-2.17.2-1` (6.9 GB, **verified byte-identical to the copy kept** - same newest-snapshot md5 `3043d2e1`, same six projects, same structure, so the two were interchangeable), a 10-20 full copy (5.6 GB), the 10-15 prune tarball (2.5 GB) and the 10-13 one (831 MB). **KEPT one complete cold copy of the whole data directory** (`preupgrade-20261022-1445`, 74 files, all six `env/data.mdb`, `storage.key`, history, snapshots, WAL) plus that evening's snapshot+WAL delta. The check that matters afterwards: `free >= 1.2 x data dir` is now 23975 MB against 8364 MB required.
+  **THE KEPT COPY'S ROLLBACK KIT HELD THE WRONG DEBS, AND IT IS THE SAME GLOB BUG I HIT IN MY OWN SCRIPT THE SAME EVENING.** `ROLLBACK.txt` names `smartbotic-database=2.17.2-1` and `smartbotic-vectorapi=0.13.0-1`, while `./debs/` actually contained **database 2.11.1 and vectorapi 0.1.7** - staged by `ls /var/cache/apt/archives/${p}_*` taking the first alphabetical match. An operator following step 2 would have used apt and been fine; one falling back to the staged files during a repo outage would have installed a nine-version-old database. Restaged from the repo with each file's `Version` field asserted against the version the note names, and `ROLLBACK.txt` amended to say it was wrong. **Stage a versioned artefact by matching the version, and then read the version back out of the file** - a filename glob on the package name is not a match.
+- **LOGROTATE IS NOT INSTALLED ON PROD, WHICH IS WHY NOTHING HAS EVER ROTATED - AND THIS FILE ALREADY RECORDED THE SYMPTOM WITHOUT EVER ASKING WHY.** The note about the nginx access log running back to 2025-11-24 is correct and the cause was never looked for: `dpkg -l logrotate` reports `un` (never installed), there is no `/etc/logrotate.conf`, no binary, no `cron.daily` hook and `logrotate.timer` is `not-found`. `nginx-common` ships `/etc/logrotate.d/nginx` regardless, so the config has sat there for a year with nothing to run it. Current cost: `access.log` 245 MB, `error.log` 79 MB, `/var/log` 655 MB, all growing without bound on a 50 GB disk - plus the analysis trap already recorded here, where a by-hour aggregate silently spans eleven months. **Installing it is a behaviour change on a live box and therefore the owner's call**, but note what rotation does NOT cost: it keeps history as `.gz`, so the evidence that answered the key-revocation sweep tonight would still be there.
+- **1.9 GB OF HISTORY ON TWO COLLECTIONS THAT HAVE VERSIONING *OFF*, AND NO SUPPORTED OPERATION CAN RECLAIM IT.** Measured 2026-10-22: `default:vectorapi_function_jobs.hlog` is **1.4 GB** against a 42 MB live collection, and `justice-pa:vectorapi_function_runs.hlog` is **458 MB** against 875 documents - both reporting `versioning: OFF (no history is recorded)` and `max_versions: 1` since the 2026-10-15 prune, when they measured 24.69 MiB and 8.45 MiB. **`configure --max-versions 1` reclaims NOTHING because the cap is already at its floor** - measured, it answers `cap raised: nothing pruned in 1 ms` - and this file already records that there is no way to discard a collection's history outright. So the bytes are unreachable from every supported direction, and they are carried by every full backup, which is what makes the preinst's 1.2x check 2 GB more expensive than it needs to be.
+  **The tell worth handing upstream: BOTH files were last written at the identical minute, 2026-10-20 18:06, and nothing has touched them since.** Two collections with history disabled growing ~60x between 10-15 and 10-20 and then stopping together points at one event rather than at ordinary writes - and the 10-17 to 10-19 crash loop replayed 69,616 WAL entries on each of roughly 120 boots. **If WAL replay records history, a crash loop silently inflates history on collections that have history switched off**, which would explain the size, the timing and the simultaneity. That is a hypothesis about their internals with one measurement behind it, so it goes to them as a question rather than into a changelog.
+  **And my first attempt to measure it reported the YEAR as a document count.** `smartbotic-db-cli count <coll> | grep -oE '[0-9]+' | head -1` picked `2026` out of the CLI's own timestamped log line, so both collections came back as "2026 docs" and a post-prune check read "queue doc count unchanged: 2026" - a check that could not fail. The tell was two unrelated collections reporting the identical number. Parse the LABELLED field (`documents: 43370`), never the first integer in the output.
+
 ## 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.