steam-backlog-enforcer/steam_backlog_enforcer/main
Krzysztof kuhy Rudnicki 47f77f5f1e
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (push) Waiting to run
Tests / test (push) Waiting to run
Make serve re-runnable, and cover it to 100%
The serve rework was sitting untracked: a /proc-based port guard, the
start-or-defer decision, and a stale-bundle rebuild. It had no tests, and it
changed cmd_serve(_config, state) to cmd_serve(argv) without updating the one
test that called it, so the suite was red and coverage was 251 lines short.

Tests, all against fakes:
- _fake_proc builds a synthetic /proc. _NET_TCP is derived from _PROC at
  import time, so patch_proc redirects both; patching _PROC alone would have
  had these tests parse the host's real process table.
- _serve_guard is split across two test files to stay under the 250-line cap.
  os is replaced wholesale in every termination test, so no signal can reach a
  real process even if the guard's self-protection were removed.
- _web_build mocks subprocess entirely and redirects every path constant into
  tmp_path. _no_subprocess now blocks _web_build.subprocess.run too: an
  unguarded test would fire a real `npm run build`, rewriting web/dist and
  perturbing frontend_is_stale() for every later test in the run.

Source changes, both required rather than incidental:
- _serve_guard's wildcard match was a `# noqa: S104` on a "0.0.0.0" literal,
  which the no-noqa hook rejects outright. It is now the all-zero hex column
  /proc actually prints, so the dotted-quad literal never appears.
- main/__init__.py's serve dispatch arm was itself uncovered; it now has a
  test asserting the raw argv passes through unparsed.

Also drops the document.hidden guard from useBudgetPoll: it skipped the very
first load, so the budget panel sat on "Reading budget state…" forever in a
background tab, which is every tab under browser automation.

Verified: 1712 python tests, 100% branch coverage; 128 vitest, 100%. The
guard's /proc parser was checked read-only against a real listener on :8000
and resolved the same pid as `ss`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MKFzwzwRU1JD7SFLHtQBsz
2026-08-29 18:52:11 +02:00
..
__init__.py Make serve re-runnable, and cover it to 100% 2026-08-29 18:52:11 +02:00
__main__.py Split main.py (1076 lines) into a main/ package 2026-08-23 19:56:34 +02:00
_registry.py Split main.py (1076 lines) into a main/ package 2026-08-23 19:56:34 +02:00
_shared.py Grade against 3.14 too, not just run on it 2026-08-29 11:44:25 +02:00
abandon.py Allow abandoning a manual pick at any time; cap picks at 2 2026-08-24 15:41:32 +02:00
install.py Split main.py (1076 lines) into a main/ package 2026-08-23 19:56:34 +02:00
misc.py Make serve re-runnable, and cover it to 100% 2026-08-29 18:52:11 +02:00
picks.py Show which games make up the gaming budget, and bill osu!lazer 2026-08-29 18:32:03 +02:00
status.py Show which games make up the gaming budget, and bill osu!lazer 2026-08-29 18:32:03 +02:00