fleet monitor T5: snapshot.py — one host's display arithmetic #68

Closed
opened 2026-08-24 18:35:23 +00:00 by ben · 2 comments
Owner

Implement Task 5 of docs/superpowers/plans/2026-08-24-fleet-monitor.md (on main; spec: docs/superpowers/specs/2026-08-24-fleet-monitor-design.md) exactly as written: failing tests first, then the implementation, then the task's own commit. The plan's Global Constraints apply to every task: fleet-tui/** stays vendor-excluded, no product literal in code or fixtures (invented names only), read-only against the factory, offline tests (fake ssh, fixture blobs, swarm.db seeded via the real swarm-db.py), module suite green (cd fleet-tui && python3 -m pytest tests/ — use tui/.venv if no system pytest).

Pure: poll result -> {state ok/off/error, acct letter->name via fleet.conf, limit_parked, slots used/total (HOST_CAPACITY_SLOTS beats registry), running (live run + newest attempt), idle_s, util_24h (overlap sum / horizon*slots), wedges, drive}. stale() re-tags a previous snapshot with its age. Verify ACTIVE_TTL against limit-lib.sh's real CLAUDE_ACTIVE_TTL default.

Implement **Task 5** of `docs/superpowers/plans/2026-08-24-fleet-monitor.md` (on `main`; spec: `docs/superpowers/specs/2026-08-24-fleet-monitor-design.md`) exactly as written: failing tests first, then the implementation, then the task's own commit. The plan's **Global Constraints** apply to every task: `fleet-tui/**` stays vendor-excluded, no product literal in code or fixtures (invented names only), read-only against the factory, offline tests (fake ssh, fixture blobs, swarm.db seeded via the real swarm-db.py), module suite green (`cd fleet-tui && python3 -m pytest tests/` — use `tui/.venv` if no system pytest). Pure: poll result -> {state ok/off/error, acct letter->name via fleet.conf, limit_parked, slots used/total (HOST_CAPACITY_SLOTS beats registry), running (live run + newest attempt), idle_s, util_24h (overlap sum / horizon*slots), wedges, drive}. `stale()` re-tags a previous snapshot with its age. Verify ACTIVE_TTL against limit-lib.sh's real CLAUDE_ACTIVE_TTL default.

swarm-claim host=matou-dev-server-01 run=776
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=776 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #68 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 68,
  "status": "success",
  "commits": [
    "63675a0"
  ],
  "changed_files": [
    "fleet-tui/snapshot.py",
    "fleet-tui/tests/test_snapshot.py",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "python3 stdlib harness over fleet-tui/tests/test_snapshot.py (no system pytest in sandbox)",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; ... bash $t (full offline harness suite incl. vendor-manifest coverage)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "snapshot.build(entry,conf,result,now) pure -> display dict (state ok/off/error, acct letter->name, limit_parked, slots used/total, running, idle_s, util_24h, wedges, drive)": "fleet-tui/snapshot.py build(); test_snapshot.py test_live_run_and_slots, test_idle_account_and_killswitch",
    "slots_total: HOST_CAPACITY_SLOTS env beats registry heavy_slots": "snapshot.py slots_total line; test_capacity_env_overrides_registry_slots",
    "running from newest live run + its newest attempt, else None": "snapshot.py running block; test_live_run_and_slots asserts running dict",
    "idle_s None when running, now-max(ended) else, None with no runs": "snapshot.py idle_s line; test_idle_account_and_killswitch idle_s==3000",
    "util(runs,slots_total,now,horizon_s=86400): overlap sum / horizon*max(1,slots), live end=now, cap 1.0": "snapshot.py util(); test_util_overlap_and_live_cap",
    "stale(prev,now) re-tags prior snapshot state=stale, stale_age_s=now-polled_at": "snapshot.py stale(); test_error_result_and_stale_retag",
    "build on ok:False returns state=error with error": "snapshot.py early return; test_error_result_and_stale_retag",
    "ACTIVE_TTL verified against limit-lib.sh CLAUDE_ACTIVE_TTL default": "grep confirmed default 3600; snapshot.py ACTIVE_TTL=3600 (plan draft 21600 corrected)",
    "fleet-tui/** stays vendor-excluded, no product literal": "onboarding/vendor-exclude already excludes fleet-tui/**; fixtures use invented names (box-a, Acme/widget, alpha/bravo); vendor-manifest coverage test green",
    "module suite green": "stdlib harness 6/6 PASS; full offline harness suite no FAIL"
  },
  "summary": "Added fleet-tui/snapshot.py — pure per-host display arithmetic (build/util/stale) — with test_snapshot.py (6 tests) and STATUS.md update.",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #68 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 68, "status": "success", "commits": [ "63675a0" ], "changed_files": [ "fleet-tui/snapshot.py", "fleet-tui/tests/test_snapshot.py", "STATUS.md" ], "tests": [ { "command": "python3 stdlib harness over fleet-tui/tests/test_snapshot.py (no system pytest in sandbox)", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; ... bash $t (full offline harness suite incl. vendor-manifest coverage)", "exit_code": 0 } ], "criteria": { "snapshot.build(entry,conf,result,now) pure -> display dict (state ok/off/error, acct letter->name, limit_parked, slots used/total, running, idle_s, util_24h, wedges, drive)": "fleet-tui/snapshot.py build(); test_snapshot.py test_live_run_and_slots, test_idle_account_and_killswitch", "slots_total: HOST_CAPACITY_SLOTS env beats registry heavy_slots": "snapshot.py slots_total line; test_capacity_env_overrides_registry_slots", "running from newest live run + its newest attempt, else None": "snapshot.py running block; test_live_run_and_slots asserts running dict", "idle_s None when running, now-max(ended) else, None with no runs": "snapshot.py idle_s line; test_idle_account_and_killswitch idle_s==3000", "util(runs,slots_total,now,horizon_s=86400): overlap sum / horizon*max(1,slots), live end=now, cap 1.0": "snapshot.py util(); test_util_overlap_and_live_cap", "stale(prev,now) re-tags prior snapshot state=stale, stale_age_s=now-polled_at": "snapshot.py stale(); test_error_result_and_stale_retag", "build on ok:False returns state=error with error": "snapshot.py early return; test_error_result_and_stale_retag", "ACTIVE_TTL verified against limit-lib.sh CLAUDE_ACTIVE_TTL default": "grep confirmed default 3600; snapshot.py ACTIVE_TTL=3600 (plan draft 21600 corrected)", "fleet-tui/** stays vendor-excluded, no product literal": "onboarding/vendor-exclude already excludes fleet-tui/**; fixtures use invented names (box-a, Acme/widget, alpha/bravo); vendor-manifest coverage test green", "module suite green": "stdlib harness 6/6 PASS; full offline harness suite no FAIL" }, "summary": "Added fleet-tui/snapshot.py — pure per-host display arithmetic (build/util/stale) — with test_snapshot.py (6 tests) and STATUS.md update.", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/dev-factory#68
No description provided.