testsAndMisc/docs/superpowers/contracts/monitor-split-2026-08-17.json
Krzysztof kuhy Rudnicki 728301c9a4 monitor: split 449 -> 215 + 138 + 136, partitioned by probe kind
lib/monitor.sh was 199 lines over the cap. Its eleven _check_* probes
move into two siblings: monitor_checks_health.sh (format indicators,
battery, storage, the three enforcer daemons) and
monitor_checks_policy.sh (hosts blocklist, DNS chain, launcher,
companion app, boot persistence).

A single monitor_checks.sh was tried first and left at 265 lines — still
over, the net-zero outcome. Two libraries split the cluster at its own
seam and land both comfortably under.

The _MONITOR_* constants are partitioned by reader so no file assigns a
global it never reads. The five read only by the policy probes move into
that file; the ones monitor.sh reads itself or shares between both
children stay put. shellcheck is clean on each file standing alone.

Not a deployment concern: lib/monitor.sh is PC-side, consumed by
run_phone.sh, and deploy.sh never references lib/ — so neither copy list
changes.

Verified three ways: test_monitor.sh reports 9 passed / 0 failed, the
same count as before; verify_shell_split.sh confirms all 25 top-level
functions moved verbatim; and run_phone.sh --help exits 0, proving the
source chain resolves in the real consumer. Over-cap count 24 -> 23.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-17 14:59:41 +02:00

18 lines
1.0 KiB
JSON

{
"title": "split lib/monitor.sh under the 250-line cap",
"objective": "Move monitor.sh's eleven _check_* probes into two sibling libraries so every resulting file is under 250 lines, with monitoring behaviour byte-identical.",
"acceptance_criteria": [
"test_monitor.sh reports exactly 9 passed, 0 failed — the same count as before the split",
"verify_shell_split.sh reports all 25 top-level functions moved verbatim",
"run_phone.sh --help exits 0, proving the source chain resolves in the real consumer",
"shellcheck is clean on each of the three files checked standing alone, with no suppressions",
"check_file_length.sh --all drops from 24 over-cap files to 23, with no new file over the cap"
],
"out_of_scope": [
"deploy.sh copy lists: lib/monitor.sh is PC-side and deploy.sh never references lib/",
"Any behavioural change to the probes themselves",
"Running the probes against a real device"
],
"verifier": "bash phone_focus_mode/lib/tests/test_monitor.sh + meta/scripts/verify_shell_split.sh + shellcheck"
}