mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-22 06:42:20 +01:00
main.py became main/ with __main__.py, so the invocation string baked into
run.sh and the systemd unit (`python -m steam_backlog_enforcer.main`) stays
byte-identical and nothing needs redeploying. Commands are grouped into
sibling modules (status, install, picks, abandon, misc), with _shared.py as
a leaf holding the lock helpers and constants both need, and _registry.py
holding the command tables. main/__init__.py keeps every public and private
name importable, so `from steam_backlog_enforcer.main import X` is unchanged.
The subtle part is patch targets. The test suite builds them as
f"{PKG}.{name}", so a grep for the literal module path found nothing -- but
once a command moves to a submodule it resolves its dependencies from that
module's globals, and patching the main package's re-export silently stops
biting. Measured which of the 36 patched symbols moved: 8 could have passed
vacuously. Rather than repair PKG per class, the five test_main*.py files
(all cap violators anyway) were regrouped to mirror the production modules,
so each file has exactly one correct PKG. Verified by mutation: breaking a
line in status/misc/picks/_shared each makes the corresponding tests fail.
test_web_server.py patched main_mod.serve, which no longer intercepts
cmd_serve; repointed at main.misc and confirmed it fails when the call is
removed. Added tests for the __main__ shim, which coverage would otherwise
report at 0% under fail_under = 100.
Shared test builders live in tests/_main_helpers.py, reachable because the
Phase 0 name-tests-test exclude allows tests/_*.py.
1290 tests pass; every main/ module reports 100% coverage; `main`, `status`,
`bogus` and `--status` produce byte-identical output and exit codes to
pre-refactor. 55 -> 49 files over the cap.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPpmMpTSkp8UziRc5u8B7P
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| _main_helpers.py | ||
| conftest.py | ||
| test_actions.py | ||
| test_cmd_done_part2.py | ||
| test_cmd_playtime.py | ||
| test_config.py | ||
| test_desktop_env.py | ||
| test_enforce_loop_part2.py | ||
| test_enforce_loop_part3.py | ||
| test_enforce_loop.py | ||
| test_enforcer_part2.py | ||
| test_enforcer.py | ||
| test_game_install_part2.py | ||
| test_game_install_part3.py | ||
| test_game_install.py | ||
| test_hltb_detail.py | ||
| test_hltb_part2.py | ||
| test_hltb_part3.py | ||
| test_hltb_search_part2.py | ||
| test_hltb_search.py | ||
| test_hltb.py | ||
| test_library_hider_part2.py | ||
| test_library_hider.py | ||
| test_main_abandon.py | ||
| test_main_dispatch_extra.py | ||
| test_main_dispatch.py | ||
| test_main_done.py | ||
| test_main_entrypoint.py | ||
| test_main_install.py | ||
| test_main_misc_gating.py | ||
| test_main_misc.py | ||
| test_main_part2.py | ||
| test_main_part2b.py | ||
| test_main_part2c.py | ||
| test_main_pick_cap.py | ||
| test_main_pick_manual.py | ||
| test_main_picks.py | ||
| test_main_shared.py | ||
| test_main_status.py | ||
| test_mcp.py | ||
| test_playtime_block_part2.py | ||
| test_playtime_block.py | ||
| test_playtime_part2.py | ||
| test_playtime_tick.py | ||
| test_playtime.py | ||
| test_polls_tracking_part2.py | ||
| test_polls_tracking.py | ||
| test_protondb.py | ||
| test_scanning_part2.py | ||
| test_scanning_part3.py | ||
| test_scanning_part4.py | ||
| test_scanning.py | ||
| test_stats.py | ||
| test_steam_api.py | ||
| test_store_blocker_part2.py | ||
| test_store_blocker.py | ||
| test_total_block.py | ||
| test_update_restart_guard.py | ||
| test_web_dataset.py | ||
| test_web_server.py | ||
| test_whitelist.py | ||