steam-backlog-enforcer/CLAUDE.md
Krzysztof kuhy Rudnicki 7554b58ab7
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
feat: add block-gaming command (Stage 4) + guard-lib migration cleanup
Adds `block-gaming <days>`: uninstalls Steam, kills/uninstalls known game
launchers, and blocks Steam + game-website domains (hosts + iptables) for a
fixed number of days with no in-app way to lift it early. Enforcement is
tamper-resistant via guard-lib's package-block (bind-mounted lock file) and
re-asserted every enforce tick.

Also migrates store_blocker.py's hosts-file locking from raw chattr/mount
calls to guard-lib's file-guard, using the new `sync` subcommand (not
`pacman-relock`) so our own legitimate edits aren't reverted as drift.

Fixes found during live verification:
- iptables never blocked real IPs because DNS was resolved after /etc/hosts
  already redirected every blocked domain to 0.0.0.0 locally - reordered so
  iptables resolves first.
- Game-website blocks only covered bare apex domains; sites that
  301-redirect to www (e.g. newgrounds.com) sailed right through - added
  automatic www. variant generation.
- Launchers (e.g. prismlauncher) were only killed, never uninstalled -
  added best-effort pacman-package removal keyed off /proc/<pid>/exe.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFNiYQQgSLAkiBXswyimPq
2026-07-04 11:45:54 +02:00

2.3 KiB

do NOT run tests unless specifically instructed to do so or before committing If tests fail on the same issue twice in a row, STOP and ask the user how to proceed instead of continuing to fix and retry. ALWAYS confirm that the feature you add / bug you fixed behaves as it should by running the program after your changes (not tests!) and inspecting output comparing it with what user wanted, after confirming by yourself ask user if the program behaves as they intended After running tests fix all coverage gaps and issues, do not ignore unless specifically instructed to do so

@/home/kuhy/.claude/rules/typescript-5-es2022.instructions.md

Steam Backlog Enforcer Notes

  • Fixed in commit 8b7bdb6: conftest.py safety net redirects all filesystem paths (STEAMAPPS_PATH, CONFIG_DIR, STATE_FILE, etc.) to tmp_path. Tests are safe to run without asking about state.json first.
  • The pre-commit pytest-coverage hook is currently broken (measures all of python_pkg at 100%, not just the changed subpackage). There's an in-progress fix via scripts/pytest_changed_packages.py + .pre-commit-config.yaml change that still needs lint fixes.
  • Clearing hltb_cache.json alone is not enough for run.sh/done reassignment: snapshot.json also stores completionist_hours, and stale snapshot values can still drive reassignment decisions unless refreshed.
  • After fixing Steam Backlog Enforcer logic, always run a live verification pass with python_pkg/steam_backlog_enforcer/run.sh (or equivalent command) before declaring the fix done.
  • cmd_done completion path can pick next game from snapshot-only hours; keep it aligned with HLTB cache/refresh before pick_next_game to avoid prologue-derived stale times (e.g., A Space 0.56h while cache has ~20h).
  • HLTB renames games (e.g., "Needy Streamer Overload" → "NEEDY GIRL OVERDOSE"). The old name lives in game_alias. Both game_name and game_alias must be checked when matching — fixed in _pick_best_hltb_entry.
  • ALWAYS clear HLTB cache and re-run run.sh after changing the HLTB picking/matching algorithm. Delete ~/.config/steam_backlog_enforcer/hltb_cache.json (entire file, not just one entry) so all games get re-matched with the new logic. Then run ./run.sh to verify correct results. Stale cache entries from the old algorithm will persist and hide bugs otherwise.