Kaynağa Gözat

fix(prod): the apt hold on the database packages was gone; re-applied

Found while verifying something else: apt-mark showhold printed nothing
and dpkg -l showed ii rather than hi for all three packages. The 2.17.2
window took the unhold route and the re-hold was forgotten, so the
protection had been off for three days with nothing to show it.

This mattered today rather than in theory. smartbotic-database 2.18.0-1
was available in apt at that moment, so a routine apt-get upgrade would
have taken the database, the client and the CLI up a version - and that
postinst calls systemctl directly, so it would have restarted prod and
run whatever 2.18.0's first boot does, unannounced, on a box holding
four tenants' data.

Re-held all three, the CLI included since it is version-matched to the
client, and verified the control FIRES rather than trusting the command
that set it: apt-get -s upgrade now reports them kept back with zero
Inst lines. Deliberate upgrades still work with
--allow-change-held-packages.

CLAUDE.md had predicted this exact failure in writing, which is the part
worth keeping: a written warning is not a control. Checking showhold now
belongs to closing any window that touched a held package.

Also records that a claim about the SERVER needs a server-side
measurement: server-info reports server 2.17.2 commit 0cd2285, where
db_client from /api/v1/version only reports the library the build links.
A consumer caught me resting a lock-scope claim on that field.
fszontagh 1 ay önce
ebeveyn
işleme
e8b2ff0eda
1 değiştirilmiş dosya ile 3 ekleme ve 0 silme
  1. 3 0
      CLAUDE.md

+ 3 - 0
CLAUDE.md

@@ -220,6 +220,9 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
   **To actually hold a start for this package: `systemctl mask` the unit for the duration**, confirmed upstream - a masked unit REFUSES the start and the postinst's `|| true` absorbs the failure, so the install completes with nothing running. Then unmask and start deliberately. Upstream is also moving the postinst to `deb-systemd-invoke` so `policy-rc.d` will work too, but that is ROADMAP, not shipped. Whichever route, PROVE it by reading `ActiveEnterTimestamp` before and after the install rather than assuming the hold took.
 - **A DATABASE OUTAGE ERASES ITS OWN EVIDENCE FROM THE FUNCTION RUN LOG, because the run log lives in the database.** Observed by a consumer diagnosing the 50-second window: ZERO recorded function runs inside it, not failures. They had to infer the gap from the surrounding minute-cron ticks (16:21:05, then 16:22:46) rather than read it. So when diagnosing a past outage, the run log goes QUIET rather than showing errors, and absence of failures there is not evidence that nothing failed - the same absence-is-not-information trap as a missing `scan_capped`, one layer out.
 - **THE DATABASE PACKAGES ARE ON APT HOLD, so an upgrade needs `--allow-change-held-packages` or it FAILS.** `apt-mark showhold` lists `smartbotic-database` and `libsmartbotic-db-client`; our three app packages are not held, which is why an ordinary vectorapi release needs nothing special. A pinned install without the flag dies with `E: Held packages were changed and -y was used without --allow-change-held-packages` - caught here by a `--dry-run` a few hours before a window, which is the only reason it was not discovered mid-outage. **Prefer the FLAG over `apt-mark unhold` plus a re-hold:** the hold is per PACKAGE rather than per version, so it survives the upgrade and keeps protecting the new version automatically, whereas the unhold route leaves the database freely upgradable if the re-hold is ever forgotten - a protection silently switched off is worse than an install that refuses.
+  **AND THAT IS EXACTLY WHAT HAPPENED. THE HOLD WAS GONE, MEASURED 2026-10-15: `apt-mark showhold` printed NOTHING** and `dpkg -l` showed `ii` rather than `hi` for all three. So the 2.17.2 window took the unhold route, the re-hold was forgotten, and the protection this paragraph calls load-bearing was off for three days with nothing to show it. **`smartbotic-database 2.18.0-1` was sitting in apt at that moment**, so any routine `apt-get upgrade` on that box would have upgraded the database, the client and the CLI, and the database postinst calls `systemctl` DIRECTLY - so it would have restarted prod and run whatever 2.18.0's first boot does, unannounced, on a box holding four tenants' data. Re-held all three (the CLI too, since it is version-matched to the client), and **verified the control actually fires rather than trusting the command's output**: `apt-get -s upgrade` now reports them under "The following packages have been kept back" with ZERO `Inst` lines. A deliberate upgrade still works with `--allow-change-held-packages`.
+  Two things worth taking from it. The note PREDICTED this failure in writing and the prediction still came true, because a written warning is not a control - **check `apt-mark showhold` as part of closing any window that touched a held package**, since the evidence is one command and the failure is invisible until the day it costs an outage. And it was found by accident, while verifying something unrelated: the `ii`/`hi` column appeared in a listing I had pulled to check a version. That is the second time this exact column has carried the answer while being read past.
+  **CHECK THE SERVER'S VERSION WITH `smartbotic-db-cli server-info`, NEVER with `db_client` FROM `/api/v1/version`.** A consumer pushed back on a claim of mine that rested on the latter, correctly: `db_client` is the version of the client library the BUILD LINKS, and a lock's scope is a SERVER property, so that field cannot establish it - the same trap this file already records from the other direction, where a 2.14 client against a 2.13 server reads 2.14.0 while the capped path runs. Verified properly: `server-info` reports `server: 2.17.2 (commit 0cd2285)` and the server's own view of the client. The general form is that **a claim about the server needs a server-side measurement, and a version string is the weakest kind of evidence available for it** - prefer the measured behaviour when you have it.
   **The signal was in plain sight and I walked past it.** `dpkg -l` prints `hi` rather than `ii` for a held package, and that appeared in the very first prod inventory of the day; I read the versions out of that output and ignored the status column. Always `--dry-run` a pinned install before a window and read what it says it will do: this one also confirmed 2 upgraded, 1 newly installed (`smartbotic-db-cli`, which is how `encryption-verify` arrives on prod), 0 removed and nothing held back.
 - **Abseil ABI:** `smartbotic-database`/client debs must be built against the system's current Abseil; a stale build crash-loops on `libabsl_*.so.<old>`. Rebuild the DB if it won't start.
 - **`--rebuild-base` is required when `DB_CLIENT_VERSION` moves.** The client version is baked into the Docker BASE image, so bumping the variable alone leaves the release build compiling against the old headers - it fails on the new entry points, or worse, silently links the old ones. Note `devstack/run-tests.sh` installs the client debs explicitly, so the TEST path can be on a newer client than the RELEASE path: a green suite is not evidence about the packages.