testsAndMisc/linux_configuration/scripts/periodic_background/system-maintenance/bin
Krzysztof kuhy Rudnicki ff1a1b6a0e usage_report: split usage_report.py 426 -> 101 + 195 + 117 + 68
The entry point now holds only the parser, mode dispatch and main. Three
modules take one concern each: _usage_report_logs (where the logs are,
the state file, per-day segment planning), _usage_report_emit (preflight,
stdout, clipboard), _usage_report_run (the two run paths and the
aggregation they drive).

Verified by the 100%-coverage tests from the previous commit. An AST
comparison of all 22 top-level defs and classes reports 22 identical, 0
mismatches.

All four modules hold 100% line+branch. 204 tests before and after. Both
CLI modes were run against the machine's real logs, which is the check
the unit tests cannot make: they stub the collaborators, so only a real
run proves the new import graph resolves.

Two lessons, recorded because the next target is a 498-line file:

This cut was too big. Two names had to be relocated after their first
placement created an import cycle, and four modules' worth of monkeypatch
targets needed re-pointing. A smaller first slice would have been cheaper.

Patching a moved function must target the module whose namespace resolves
it - the caller's, not the one it was moved to. Getting that wrong on
_run_since made main() call the real function, which read the actual atop
logs and hung the suite rather than failing.

Three import bugs (Path and _fmt_h left under TYPE_CHECKING but used at
runtime, dataclass missing where _Aggregates landed) were caught
immediately by the coverage from the previous commit.

Over-cap 38 -> 37.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-17 12:46:06 +02:00
..
lib Split install_usage_monitoring.sh into an entry plus five libs 2026-08-17 07:26:56 +02:00
__init__.py Split modules, fix tests, fix pre-commit batching 2026-05-22 22:48:28 +02:00
_usage_report_atop.py usage_report: split _usage_report_parsing.py 425 -> 243 + 206 2026-08-17 12:12:11 +02:00
_usage_report_emit.py usage_report: split usage_report.py 426 -> 101 + 195 + 117 + 68 2026-08-17 12:46:06 +02:00
_usage_report_format.py usage_report: split _usage_report_render.py 310 -> 181 + 123 + 24 2026-08-17 11:34:08 +02:00
_usage_report_logs.py usage_report: split usage_report.py 426 -> 101 + 195 + 117 + 68 2026-08-17 12:46:06 +02:00
_usage_report_parsing.py usage_report: split _usage_report_parsing.py 425 -> 243 + 206 2026-08-17 12:12:11 +02:00
_usage_report_pmon.py feat: split oversized modules for 500-line limit, fix kasa coverage gap 2026-06-14 07:19:37 +02:00
_usage_report_render.py usage_report: split _usage_report_parsing.py 425 -> 243 + 206 2026-08-17 12:12:11 +02:00
_usage_report_run.py usage_report: split usage_report.py 426 -> 101 + 195 + 117 + 68 2026-08-17 12:46:06 +02:00
_usage_report_tables.py usage_report: split _usage_report_render.py 310 -> 181 + 123 + 24 2026-08-17 11:34:08 +02:00
_usage_report_types.py fix(usage_report): stop charging atop's HZ field as CPU; bundle since-last-report mode 2026-06-04 18:13:47 +02:00
auto-system-update.sh refactor(linux_configuration/scripts): split all scripts into single_use/ and periodic_background/ 2026-05-15 00:32:35 +02:00
browser-preexec-wrapper.sh Log why Chromium browsers die; whitelist librewolf 2026-08-09 22:27:16 +02:00
hosts-file-monitor.sh refactor(linux_configuration/scripts): split all scripts into single_use/ and periodic_background/ 2026-05-15 00:32:35 +02:00
install_usage_monitoring.sh Split install_usage_monitoring.sh into an entry plus five libs 2026-08-17 07:26:56 +02:00
periodic-system-maintenance.sh fix(maintenance): make repair failures loud instead of silently exiting 0 2026-07-17 08:17:51 +02:00
shutdown-timer-monitor.sh refactor(linux_configuration/scripts): split all scripts into single_use/ and periodic_background/ 2026-05-15 00:32:35 +02:00
usage_report.py usage_report: split usage_report.py 426 -> 101 + 195 + 117 + 68 2026-08-17 12:46:06 +02:00