fix(disk-gc): actually write the host-band state file so escalations and recoveries can fire #106

Merged
abiba-bot merged 2 commits from fix/host-disk-band-state-file-20260916 into master 2026-09-16 01:00:29 +00:00
3 changed files with 2 additions and 19 deletions
Showing only changes of commit 39209c7ac9 - Show all commits
+1
View File
@@ -1 +1,2 @@
__pycache__/
state/host-disk-bands.json
+1 -1
View File
@@ -65,7 +65,7 @@ Host filesystems have their own risk profile and their own bands. A host root ne
**Escalations are STATE-CHANGE driven, not per-run.** A volume alerts ONCE when it enters a higher band (GREEN->WARN, WARN->AMBER, AMBER->RED) and ONCE when it drops back down (a recovery notice). While a volume stays in the same band, it is reported in the scan output only — no DM, no channel alert. This prevents the same 96% easystore2 from re-DMing the owner on every 6-hour scan and drowning a real warning in noise.
**State lives in a small JSON state file:** the scanner resolves it to an absolute path from the script's location — `$(dirname "$0")/state/host-disk-bands.json` (i.e., the `state/` directory next to the `scripts/` directory in the prose-contracts repo). Keyed by `host/volume` → last-seen band. The scanner reads the prior band, compares to the current band, and DMs only on a transition. The state file is written after every scan. (Chosen over a periodic digest because the scan already runs every 6h and a transition is genuinely new, actionable state that warrants an immediate DM — but only once.)
**State lives in a small JSON state file:** the scanner resolves it to an absolute path from the script's location — `$(dirname "$0")/state/host-disk-bands.json` (i.e., the `state/` directory next to the `scripts/` directory in the prose-contracts repo). The state file is gitignored runtime state — the scanner creates it on first run. Keyed by `host/volume` → last-seen band. The scanner reads the prior band, compares to the current band, and DMs only on a transition. The state file is written after every scan. (Chosen over a periodic digest because the scan already runs every 6h and a transition is genuinely new, actionable state that warrants an immediate DM — but only once.)
**Volume naming rule:** Every host line MUST name the volume and what lives on it. Example output:
-18
View File
@@ -1,18 +0,0 @@
{
"acerpve//": "GREEN",
"acerpve//media/mediastore": "GREEN",
"acerpve//media/storage": "GREEN",
"amdpve//": "GREEN",
"amdpve//media/mediastore": "GREEN",
"amdpve//media/storage": "GREEN",
"storepve//": "GREEN",
"storepve//media/easystore2": "HOST-RED",
"storepve//media/mediastore": "GREEN",
"storepve//media/reanim": "HOST-WARN",
"storepve//media/storage": "GREEN",
"minipve//": "GREEN",
"minipve//media/storage": "GREEN",
"ocupve//": "GREEN",
"ocupve//media/mediastore": "GREEN",
"ocupve//media/storage": "GREEN"
}