mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-24 02:36:19 +01:00
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 (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / web-coverage (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
kuhy 2026-11-11: game-design research needs Librarian (app 4197610) actually played during the 6-day total block. New root command total-block-research --until T opens ONE window per lock: <= 48 h, never past the lock end, a rerun never extends it. The command only validates and records (/var/lib/steam-backlog- enforcer, root 0700; lock id + deadline + two latches). The daemon opens and closes everything: Steam hosts names, the store block, the total-block chain (IP cache kept) and the steam package, reinstalled with only guard-lib's package-block hook masked for that one pacman call (--hookdir, proved in a guest). Lock file, hook and end date are never touched. Browser-game sites stay null-routed. Only Librarian may run: loop-local allowed set, strict mode (no whitelist exceptions, no zero-achievement games), launchers and counted games killed; state.json is never read or written. Expiry latches the record, then the ordinary tick re-applies hosts (now reconciled each tick), chain, uninstall and purge; the normal store block is restored once, unconditionally. Failure modes: missing/corrupt/unparseable record = no window and a corrupt one also refuses a new window (fail closed); a clock set back cannot reopen a latched window. Checked: 3290 tests at 100% coverage; whole-tree pylint 10/10 run in three parts (the hook exceeds the 60 s cap, so SKIP=pylint here); vmbox guest with real guardctl package-block and the real unit, window opened, Librarian-only enforced, clock moved past the deadline and the full block re-applied. Not verified on the host. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWWzuCEg1m87jpKyRrw
65 lines
2.7 KiB
Python
65 lines
2.7 KiB
Python
"""Which commands stay usable under each lock.
|
|
|
|
A leaf module (no imports) so the CLI dispatcher in ``main._shared`` and the
|
|
root daemon's control socket consult ONE table: a lock the daemon enforced
|
|
differently from the CLI would be a way around it for anyone who can reach
|
|
the socket. ``main._shared`` cannot be imported by the daemon directly --
|
|
``main`` imports the enforce loop, which starts the control socket.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
# Commands that remain usable while the manual pick lock is active.
|
|
# Principle: only what is needed to release the lock (done/check) or
|
|
# that cannot change the game assignment (status, enforce, setup, serve).
|
|
_MANUAL_LOCK_EXEMPT_COMMANDS = frozenset(
|
|
{
|
|
"done",
|
|
"check",
|
|
"status",
|
|
"enforce",
|
|
"setup",
|
|
"serve",
|
|
"abandon-pick",
|
|
# Allowed so a second game can be locked in alongside the first; the
|
|
# cap inside cmd_pick_manual is what stops this being a way out.
|
|
"pick-manual",
|
|
# The daily gaming budget is orthogonal to which game is assigned, and
|
|
# gaming-unblock is a recovery hatch for a stuck bind mount - locking
|
|
# it behind a manual pick would leave Steam masked with no way back.
|
|
"gaming-status",
|
|
"gaming-unblock",
|
|
"gaming-reset",
|
|
# Reconciles the block's domain list; cannot shorten or end a lock.
|
|
"total-block-refresh",
|
|
# Records the one bounded research window (see _research_window); the
|
|
# lock itself and its end date stay untouched.
|
|
"total-block-research",
|
|
}
|
|
)
|
|
|
|
# Commands that remain usable while a total gaming block is active. Far
|
|
# stricter than _MANUAL_LOCK_EXEMPT_COMMANDS: no done/pick/reset/
|
|
# add-exception - nothing here shortens or ends a total block. The one bounded
|
|
# opening is total-block-research: root-only, a single <= 48 h window per lock
|
|
# that only Librarian may use, recorded in a root-only state directory; the
|
|
# daemon re-applies the full block when it expires (the lock's end is fixed).
|
|
#
|
|
# gaming-unblock is included because a playtime bind mount makes the total
|
|
# block's own `pacman -R steam` fail EBUSY - it must stay reachable exactly
|
|
# when the two collide. gaming-reset is NOT included: it shortens enforcement.
|
|
# serve changes nothing itself (every job it starts is lock-checked on its own)
|
|
# and refusing it took the web UI down for the whole block, crash-looping its
|
|
# systemd unit, the first time anything restarted it.
|
|
_TOTAL_BLOCK_EXEMPT_COMMANDS = frozenset(
|
|
{
|
|
"status",
|
|
"enforce",
|
|
"gaming-status",
|
|
"gaming-unblock",
|
|
"serve",
|
|
"total-block-refresh",
|
|
"total-block-research",
|
|
}
|
|
)
|