fleet monitor T3: probe.py — the host-side JSON dumper #66

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

Implement Task 3 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).

Stdlib-only script shipped over ssh <door> python3 -: dumps registry/capacity text raw, killswitch, loadavg, swarm.db reads (runs 7d, live attempts, open processes, spend 90d daily + per-repo, limit events), markers, reset hint, drive file. Every section independently try/except-guarded into errors; exits 0 on data problems. Test seeds swarm.db through the real swarm-db.py (verify its actual subcommands first).

Implement **Task 3** 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). Stdlib-only script shipped over `ssh <door> python3 -`: dumps registry/capacity text raw, killswitch, loadavg, swarm.db reads (runs 7d, live attempts, open processes, spend 90d daily + per-repo, limit events), markers, reset hint, drive file. Every section independently try/except-guarded into `errors`; exits 0 on data problems. Test seeds swarm.db through the real swarm-db.py (verify its actual subcommands first).

swarm-claim host=elitebook-distributed-server-03 run=752
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=752 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #66 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit be9168b8 is not a valid commit object (fabricated, or never pushed)
  • changed_files: 'fleet-tui/probe.py' is not in the diff of the claimed commits
  • changed_files: 'fleet-tui/tests/test_probe.py' is not in the diff of the claimed commits
  • changed_files: 'STATUS.md' is not in the diff of the claimed commits
envelope
{
  "issue": 66,
  "status": "success",
  "commits": [
    "be9168b8"
  ],
  "changed_files": [
    "fleet-tui/probe.py",
    "fleet-tui/tests/test_probe.py",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "python3 fleet-tui: run test_probe functions (no system pytest; stdlib harness)",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do bash \"$t\"; done (repo offline suite)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "stdlib-only script shipped over ssh python3 -, dumps JSON v1": "fleet-tui/probe.py: imports argparse/glob/json/os/re/sqlite3/time only; PROBE_VERSION=1; test runs it via `python3 -` with script on stdin",
    "registry/capacity text raw": "probe.py registry/capacity_env sections set registry_text/capacity_env_text via _read",
    "killswitch, loadavg": "killswitch section os.path.exists bool; loadavg section os.getloadavg()",
    "swarm.db reads (runs 7d, live attempts, open processes, spend 90d daily+per-repo, limit events)": "_db_sections: runs (ended_at IS NULL OR started_at>=now-7d), attempts JOIN runs live, processes ended_at IS NULL, spend_daily group day+account 90d, spend_repo since --spend-since, events kind LIKE 'limit%'",
    "markers, reset hint, drive file": "_marker for limit/active markers, _reset_hint over newest logs, drive = json.loads of --drive-status",
    "every section independently try/except-guarded into errors; exits 0 on data problems": "section() wraps each in try/except into errors[name]; test_sections_fail_independently asserts registry+db in errors with rc 0",
    "test seeds swarm.db through the real swarm-db.py (verified subcommands)": "test_probe.py seed_db drives swarm-db.py run-start/attempt/spend/run-end --exit/proc-open — verified via grep add_parser",
    "fleet-tui/** vendor-excluded, no product literal, read-only, module suite green": "onboarding/vendor-exclude line 27 fleet-tui/**; fixtures box-a/Acme/widget; probe opens db mode=ro; both probe tests pass + offline suite green"
  },
  "summary": "Added fleet-tui/probe.py, the stdlib-only host-side JSON v1 state dumper (T3), with an offline test seeding swarm.db through the real swarm-db.py.",
  "blockers": []
}
**close-report** for #66 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit be9168b8 is not a valid commit object (fabricated, or never pushed) - changed_files: 'fleet-tui/probe.py' is not in the diff of the claimed commits - changed_files: 'fleet-tui/tests/test_probe.py' is not in the diff of the claimed commits - changed_files: 'STATUS.md' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 66, "status": "success", "commits": [ "be9168b8" ], "changed_files": [ "fleet-tui/probe.py", "fleet-tui/tests/test_probe.py", "STATUS.md" ], "tests": [ { "command": "python3 fleet-tui: run test_probe functions (no system pytest; stdlib harness)", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do bash \"$t\"; done (repo offline suite)", "exit_code": 0 } ], "criteria": { "stdlib-only script shipped over ssh python3 -, dumps JSON v1": "fleet-tui/probe.py: imports argparse/glob/json/os/re/sqlite3/time only; PROBE_VERSION=1; test runs it via `python3 -` with script on stdin", "registry/capacity text raw": "probe.py registry/capacity_env sections set registry_text/capacity_env_text via _read", "killswitch, loadavg": "killswitch section os.path.exists bool; loadavg section os.getloadavg()", "swarm.db reads (runs 7d, live attempts, open processes, spend 90d daily+per-repo, limit events)": "_db_sections: runs (ended_at IS NULL OR started_at>=now-7d), attempts JOIN runs live, processes ended_at IS NULL, spend_daily group day+account 90d, spend_repo since --spend-since, events kind LIKE 'limit%'", "markers, reset hint, drive file": "_marker for limit/active markers, _reset_hint over newest logs, drive = json.loads of --drive-status", "every section independently try/except-guarded into errors; exits 0 on data problems": "section() wraps each in try/except into errors[name]; test_sections_fail_independently asserts registry+db in errors with rc 0", "test seeds swarm.db through the real swarm-db.py (verified subcommands)": "test_probe.py seed_db drives swarm-db.py run-start/attempt/spend/run-end --exit/proc-open — verified via grep add_parser", "fleet-tui/** vendor-excluded, no product literal, read-only, module suite green": "onboarding/vendor-exclude line 27 fleet-tui/**; fixtures box-a/Acme/widget; probe opens db mode=ro; both probe tests pass + offline suite green" }, "summary": "Added fleet-tui/probe.py, the stdlib-only host-side JSON v1 state dumper (T3), with an offline test seeding swarm.db through the real swarm-db.py.", "blockers": [] } ``` </details>

close-report for #66 — status success

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

envelope
{
  "issue": 66,
  "status": "success",
  "commits": [
    "be9168b6c3568026cec6c91a146216f18e7c0262"
  ],
  "changed_files": [
    "fleet-tui/probe.py",
    "fleet-tui/tests/test_probe.py",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "python3 fleet-tui: run test_probe functions (no system pytest; stdlib harness)",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do bash \"$t\"; done (repo offline suite)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "stdlib-only script shipped over ssh python3 -, dumps JSON v1": "fleet-tui/probe.py: imports argparse/glob/json/os/re/sqlite3/time only; PROBE_VERSION=1; test runs it via `python3 -` with script on stdin",
    "registry/capacity text raw": "probe.py registry/capacity_env sections set registry_text/capacity_env_text via _read",
    "killswitch, loadavg": "killswitch section os.path.exists bool; loadavg section os.getloadavg()",
    "swarm.db reads (runs 7d, live attempts, open processes, spend 90d daily+per-repo, limit events)": "_db_sections: runs (ended_at IS NULL OR started_at>=now-7d), attempts JOIN runs live, processes ended_at IS NULL, spend_daily group day+account 90d, spend_repo since --spend-since, events kind LIKE 'limit%'",
    "markers, reset hint, drive file": "_marker for limit/active markers, _reset_hint over newest logs, drive = json.loads of --drive-status",
    "every section independently try/except-guarded into errors; exits 0 on data problems": "section() wraps each in try/except into errors[name]; test_sections_fail_independently asserts registry+db in errors with rc 0",
    "test seeds swarm.db through the real swarm-db.py (verified subcommands)": "test_probe.py seed_db drives swarm-db.py run-start/attempt/spend/run-end --exit/proc-open — verified via grep add_parser",
    "fleet-tui/** vendor-excluded, no product literal, read-only, module suite green": "onboarding/vendor-exclude line 27 fleet-tui/**; fixtures box-a/Acme/widget; probe opens db mode=ro; both probe tests pass + offline suite green"
  },
  "summary": "Added fleet-tui/probe.py, the stdlib-only host-side JSON v1 state dumper (T3), with an offline test seeding swarm.db through the real swarm-db.py.",
  "blockers": []
}
**close-report** for #66 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 66, "status": "success", "commits": [ "be9168b6c3568026cec6c91a146216f18e7c0262" ], "changed_files": [ "fleet-tui/probe.py", "fleet-tui/tests/test_probe.py", "STATUS.md" ], "tests": [ { "command": "python3 fleet-tui: run test_probe functions (no system pytest; stdlib harness)", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do bash \"$t\"; done (repo offline suite)", "exit_code": 0 } ], "criteria": { "stdlib-only script shipped over ssh python3 -, dumps JSON v1": "fleet-tui/probe.py: imports argparse/glob/json/os/re/sqlite3/time only; PROBE_VERSION=1; test runs it via `python3 -` with script on stdin", "registry/capacity text raw": "probe.py registry/capacity_env sections set registry_text/capacity_env_text via _read", "killswitch, loadavg": "killswitch section os.path.exists bool; loadavg section os.getloadavg()", "swarm.db reads (runs 7d, live attempts, open processes, spend 90d daily+per-repo, limit events)": "_db_sections: runs (ended_at IS NULL OR started_at>=now-7d), attempts JOIN runs live, processes ended_at IS NULL, spend_daily group day+account 90d, spend_repo since --spend-since, events kind LIKE 'limit%'", "markers, reset hint, drive file": "_marker for limit/active markers, _reset_hint over newest logs, drive = json.loads of --drive-status", "every section independently try/except-guarded into errors; exits 0 on data problems": "section() wraps each in try/except into errors[name]; test_sections_fail_independently asserts registry+db in errors with rc 0", "test seeds swarm.db through the real swarm-db.py (verified subcommands)": "test_probe.py seed_db drives swarm-db.py run-start/attempt/spend/run-end --exit/proc-open — verified via grep add_parser", "fleet-tui/** vendor-excluded, no product literal, read-only, module suite green": "onboarding/vendor-exclude line 27 fleet-tui/**; fixtures box-a/Acme/widget; probe opens db mode=ro; both probe tests pass + offline suite green" }, "summary": "Added fleet-tui/probe.py, the stdlib-only host-side JSON v1 state dumper (T3), with an offline test seeding swarm.db through the real swarm-db.py.", "blockers": [] } ``` </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#66
No description provided.