Compare commits

...

6 Commits

Author SHA1 Message Date
f79b3c69cf Take the freshness gate's four bumps: flutter_secure_storage 11.1.1, sqflite 2.4.4, sqflite_common_ffi 2.4.3, @types/node 26.5.1
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
Tests / lock-popup-safety (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
Pre-push ci-mirror was red at HEAD on exactly these four; the lock was
regenerated with the pinned Flutter 3.47.4 (which also moves
flutter_secure_storage_platform_interface to 2.1.0 transitively).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FcU5dCcUNHMAMzUNChdrrJ
2026-09-13 09:54:32 +02:00
967e3cd322 Key every workout day on the LOCAL calendar day, not UTC
A manual workout logged at 00:02 CEST on 2026-09-13 was filed under
2026-09-12: every day-key derivation used datetime.now(tz=UTC), and at
that instant UTC was still yesterday. The 09:18 lock check looked for
2026-09-13, found nothing, and locked the PC — for a workout that was on
disk. The budget counter (a trailing window) counted it fine, which is
why the status showed 1/2 used while the locker still locked. Any log
between local midnight and 02:00 CEST hit this; it had happened before.

- New screen_locker/_day.py: today_str() is the one definition of "what
  day is it" — the local calendar day the user sees on the clock, which
  is also what the phone app, RunnerUp verification, the status window
  and the freedays pool already used. All 14 UTC sites (log writer, lock
  predicates, explain chain, early-bird, wake state, shutdown/sick state,
  sick budget, manual CLI, phone verification) now go through it, writers
  and readers together so no new midnight window opens between them.
- write_signed_entry dedups by workout_id across ALL days: a workout id is
  globally unique, and an entry moved to its correct day must not let its
  synced twin (still stamped with the old day) re-ingest as a duplicate.
- scripts/rekey_log_entry.py: move a wrongly-filed entry to its real day
  (the HMAC never covered the day key, so it still verifies).
- test_local_day_key.py freezes the clock at the exact failing instant.

Replayed the real timeline (log at 00:02:35, evaluate at 09:18:53, weekly
3/5) against HEAD in a throwaway worktree vs this tree:
  HEAD  -> logged under 2026-09-12, LOCK
  fixed -> logged under 2026-09-13, no lock (already_logged)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FcU5dCcUNHMAMzUNChdrrJ
2026-09-13 09:50:06 +02:00
9b39196671 Take gatelock 0.8.1: nested LockConfig
The grab axes are grab=GrabPolicy(kind=..., disable_vt=...,
preempt_weaker_holder=...) and every colour read goes through
config.palette; nothing about the lock's behaviour changed. Also carries
the pylint hook on 4.0.8 with the source-only scope config; the gate
stays at 8.0 until the remaining findings are cleared.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHCbkJWXHjtTUaqvnHRAqA
2026-09-12 19:52:38 +02:00
fc9720fafe Take the freshness gate's ten bumps: Flutter 3.47.4, mcp 2.2.0, React 19.3, node 24.21
Web lint, tests and build pass on the new pins; the Python suite is
unaffected (mcp is the optional MCP-server extra).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHCbkJWXHjtTUaqvnHRAqA
2026-09-12 19:52:30 +02:00
3444a4e9a4 Re-point paths for the ~ reorganisation (home-tidy)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AwtowrowDXx6ccmWVPkCaF
2026-09-11 19:07:30 +02:00
e98884b200 Re-point paths for the ~ reorganisation (home-tidy)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AwtowrowDXx6ccmWVPkCaF
2026-09-11 18:46:28 +02:00
76 changed files with 814 additions and 478 deletions

2
.fvmrc
View File

@ -1,3 +1,3 @@
{
"flutter": "3.47.2"
"flutter": "3.47.4"
}

View File

@ -31,7 +31,7 @@ jobs:
# developed against (Dart SDK ^3.12.2) so CI's analyzer matches local.
- uses: subosito/flutter-action@v2
with:
flutter-version: 3.47.2
flutter-version: 3.47.4
channel: stable
cache: true
# The web-lint / web-typecheck / web-coverage hooks run npm inside web/.
@ -41,7 +41,7 @@ jobs:
# landed in 8f91158.
- uses: actions/setup-node@v4
with:
node-version: "24.20.0"
node-version: "24.21.0"
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install status-UI packages

View File

@ -50,7 +50,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
flutter-version: 3.47.2
flutter-version: 3.47.4
channel: stable
cache: true

View File

@ -98,7 +98,7 @@ repos:
- types-requests>=2.31.0
- repo: https://github.com/pylint-dev/pylint
rev: v3.3.2
rev: v4.0.8
hooks:
# Two hooks, because the three checks below are not defects in a test
# suite -- they are how pytest and unit-testing private mixins work --
@ -126,7 +126,7 @@ repos:
# direct URLs for one distribution, so any pin that drifts from
# the manifest becomes an unresolvable hook environment rather
# than merely an old one.
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock
- crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync
- freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays
- mcp>=2,<3
@ -146,7 +146,7 @@ repos:
# direct URLs for one distribution, so any pin that drifts from
# the manifest becomes an unresolvable hook environment rather
# than merely an old one.
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock
- crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync
- freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays
- mcp>=2,<3
@ -277,7 +277,7 @@ repos:
# Four markdown namespaces (README / CLAUDE* / DOCS* / TODO*), plus the
# rule that a TODO carries "REMOVE ME AFTER FINISH" and nothing else may.
# Shared gate in ~/utils owns the namespaces and the exemption list, so
# Shared gate in ~/src/utils owns the namespaces and the exemption list, so
# one repo's idea of a valid name cannot drift from every other repo's.
- id: md-naming
name: markdown naming convention

View File

@ -71,7 +71,7 @@ an exempt extension, no `# noqa`-style suppressions.
A refactor without a gate silently regrows. Before this task is done:
1. Wire the shared gate `~/utils/scripts/check_file_length.sh` into this repo's
1. Wire the shared gate `~/src/utils/scripts/check_file_length.sh` into this repo's
`.pre-commit-config.yaml` as a local hook. If the repo has no pre-commit
config, add a minimal one.
2. The hook checks **files in the commit** (not the whole tree), so unrelated
@ -82,7 +82,7 @@ A refactor without a gate silently regrows. Before this task is done:
## Done condition
- `bash ~/utils/scripts/check_file_length.sh --all` from this repo root exits 0.
- `bash ~/src/utils/scripts/check_file_length.sh --all` from this repo root exits 0.
- The repo's own test suite and coverage bar are still green.
- `pre-commit run --files <changed files>` passes.
- A deliberately over-250-line test file, staged, makes `git commit` **fail**.

View File

@ -7,7 +7,7 @@
## Goal
`bash ~/utils/scripts/check_file_length.sh --all` from the repo root exits 0.
`bash ~/src/utils/scripts/check_file_length.sh --all` from the repo root exits 0.
Everything else in `refactor_claude_todo.md` still applies (no gaming the cap,
no deleting tests, no suppressions). This file only adds what the previous
@ -16,7 +16,7 @@ session learned the hard way.
## Start here (do this first, it costs one command)
```bash
cd ~/screen-locker/stronglift_replacement/workout_app
cd ~/src/screen-locker/stronglift_replacement/workout_app
env -u GIT_DIR flutter test 2>&1 | tail -1 # MUST print: +402: All tests passed!
```
@ -145,10 +145,10 @@ extension in a part still reaches `_privateField`.
## Verify (all of it, every batch)
```bash
cd ~/screen-locker/stronglift_replacement/workout_app
cd ~/src/screen-locker/stronglift_replacement/workout_app
env -u GIT_DIR dart analyze lib/ # must be "No issues found!"
env -u GIT_DIR flutter test 2>&1 | tail -1 # must be +402
cd ~/screen-locker && pre-commit run # includes the 100% Flutter coverage gate
cd ~/src/screen-locker && pre-commit run # includes the 100% Flutter coverage gate
```
`dart analyze` is a **no-op on test files** — `analysis_options.yaml` excludes
@ -157,7 +157,7 @@ signal.
## Done condition
- `bash ~/utils/scripts/check_file_length.sh --all` exits 0.
- `bash ~/src/utils/scripts/check_file_length.sh --all` exits 0.
- 402 Dart tests pass; `flutter` coverage still 100%.
- `pre-commit run --all-files` passes.
- The app still runs on the phone: use the `phone-deploy` skill

View File

@ -1,12 +1,12 @@
# Task: replace blind coordinate tapping with element-targeted Android UI automation
> **STATUS 2026-08-10: BUILT.** The tool now exists at
> `~/testsAndMisc/python_pkg/android_ui/` (see its README). It covers `dump` /
> `~/src/testsAndMisc/python_pkg/android_ui/` (see its README). It covers `dump` /
> `find` / `tap` / `type` / `wait` / `focus` with verified typing, ambiguity as
> an error, keyboard detection, and partial-tree retries — all exercised
> against the physical Pixel 6a. What remains from the spec below is the
> optional MCP wrapper, `scroll_to()`, and rolling it out to `~/todo` and
> `~/dufs-cloud/app`. Everything after this line is the original brief, kept
> optional MCP wrapper, `scroll_to()`, and rolling it out to `~/src/todo` and
> `~/src/dufs-cloud/app`. Everything after this line is the original brief, kept
> because it records WHY each guarantee exists.
## what
@ -51,7 +51,7 @@ nodes by class and gave exact centers, and the retry worked first time.
New shared tool, not a per-repo copy. Two options, pick one:
- `~/testsAndMisc/python_pkg/android_ui/` — a CLI (`android-ui find "Connect
- `~/src/testsAndMisc/python_pkg/android_ui/` — a CLI (`android-ui find "Connect
Firebase"`, `android-ui tap "Connect Firebase"`, `android-ui dump`), matching
how `app_icons` is already shared across repos.
- An MCP server exposing the same as tools, which is what makes it available to
@ -59,9 +59,9 @@ New shared tool, not a per-repo copy. Two options, pick one:
asked for "some tool ... (mcp?) which also translates to UI".
Consumers (every repo with an Android surface):
- `~/screen-locker/stronglift_replacement/workout_app`
- `~/todo`
- `~/dufs-cloud/app`
- `~/src/screen-locker/stronglift_replacement/workout_app`
- `~/src/todo`
- `~/src/dufs-cloud/app`
- any future Flutter app (this should be part of the app scaffold)
## must
@ -108,7 +108,7 @@ emulator and not a debug-only Flutter driver session.
- This session's working recovery: `uiautomator dump` + the bounds-parsing
python in the screen-locker scratchpad (`ui.xml`, `ui2.xml`).
- `~/screen-locker/CLAUDE.md` — "You are NOT done until you install the new
- `~/src/screen-locker/CLAUDE.md` — "You are NOT done until you install the new
version on the phone itself", which is why agent-driven UI is on the critical
path for every task in this repo.
- Note `uiautomator dump` returns an empty/partial tree while an animation is

View File

@ -1,13 +1,13 @@
## Shared gatelock library
`~/utils/gatelock` is **not** its own git repo — `git -C ~/utils/gatelock
rev-parse --show-toplevel` resolves to `/home/kuhy/utils`, so it's a
subdirectory of the `~/utils` monorepo. Per audit scope, gatelock itself was
`~/src/utils/gatelock` is **not** its own git repo — `git -C ~/src/utils/gatelock
rev-parse --show-toplevel` resolves to `/home/kuhy/src/utils`, so it's a
subdirectory of the `~/src/utils` monorepo. Per audit scope, gatelock itself was
not walked against all 28 rules and no separate
`~/utils/gatelock/DESIGN_AUDIT_TODO.md` was written.
`~/src/utils/gatelock/DESIGN_AUDIT_TODO.md` was written.
What's relevant here: gatelock defines exactly **one** real design token —
`LockConfig.bg: str = "#1a1a1a"` (`~/utils/gatelock/gatelock/_window.py:71`),
`LockConfig.bg: str = "#1a1a1a"` (`~/src/utils/gatelock/gatelock/_window.py:71`),
applied via `self.root.configure(bg=self._config.bg, ...)` in
`LockWindow.setup()` (`_window.py:143`). Both consumer repos re-hardcode
this same literal instead of reading it back off their own `LockConfig`

View File

@ -14,7 +14,7 @@ independently, in 9 files. Evidence:
`_sick_dialog.py` (18), `_temperature_status_mixin.py` (5).
`#1a1a1a` alone (the background) appears **31 times** — and it is *also*
already defined once, correctly, as `LockConfig.bg = "#1a1a1a"` in
`~/utils/gatelock/gatelock/_window.py:71`. None of the 31 in-repo literals
`~/src/utils/gatelock/gatelock/_window.py:71`. None of the 31 in-repo literals
import or reference it; `LockWindow.setup()` in gatelock applies
`config.bg` to the root window (`_window.py:143`), and then every
screen-locker dialog re-hardcodes the same string as if gatelock's value

View File

@ -47,7 +47,7 @@ production in this user's other repos — read both before designing this
one:
1. **diet-guard's Contents-API repo sync**
(`~/diet-guard/diet_guard/_sync.py` + `_sync_github.py` +
(`~/src/diet-guard/diet_guard/_sync.py` + `_sync_github.py` +
`_sync_merge.py`, ~120/190/80 lines respectively). `GitHubSyncClient`
(`_sync_github.py:38`) wraps the GitHub Contents API with
`get_file_text(path)`, `put_file_text(path, text, message=...)`,
@ -59,7 +59,7 @@ one:
fine-grained PAT read from `~/.config/diet_guard/sync_token` (scoped to
just that one repo's contents).
2. **wake-alarm's Gist-based sync**
(`~/wake-alarm/shutdown-wrapper.sh`, phone app writes to a **private
(`~/src/wake-alarm/shutdown-wrapper.sh`, phone app writes to a **private
Gist**, not a repo). Config at `~/.config/wake_alarm/gist_sync.json`
with `token`/`gist_id`. Much simpler (single JSON blob, no per-device
paths, no merge step) — matches wake-alarm's much simpler data shape (one
@ -148,7 +148,7 @@ sync code first.
- `screen_locker/_constants.py` (`WORKOUT_APP_JSON_REMOTES`,
`WORKOUT_HTTP_PORT` — new `SYNC_*` constants go here too)
- `stronglift_replacement/workout_app/lib/` (phone-side push, new work)
- Reference-only, do not modify: `~/diet-guard/diet_guard/_sync_github.py`,
`_sync.py`, `_sync_merge.py`; `~/wake-alarm/shutdown-wrapper.sh`
- Reference-only, do not modify: `~/src/diet-guard/diet_guard/_sync_github.py`,
`_sync.py`, `_sync_merge.py`; `~/src/wake-alarm/shutdown-wrapper.sh`
- **Do not touch**: `screen_locker/_runnerup_verification.py`,
`_runnerup_db.py` (hard boundary, see Context above)

View File

@ -15,7 +15,7 @@ to have very different shareability:
`put_file_text` / `list_directory` against a private repo) is genuinely
shared already — it's independently duplicated almost line-for-line
between todo's `GitHubClient` and diet-guard's `GitHubSyncClient`
(`~/diet-guard/diet_guard/_sync_github.py`, 191 lines, `requests`-only).
(`~/src/diet-guard/diet_guard/_sync_github.py`, 191 lines, `requests`-only).
Extracting this into a shared Python lib (and a shared Dart lib for
todo's/diet-guard's Dart-side client) is low-risk, small, and is the part
Workstream C already committed to (Contents-API pattern, not Gist —
@ -70,7 +70,7 @@ library too:
## 3. Per-app migration cost (revised — the original doc's "todo = smallest
lift" assumption does not hold)
Checked `~/todo/lib/data/note_repository.dart`: notes are **mutated in
Checked `~/src/todo/lib/data/note_repository.dart`: notes are **mutated in
place** — `upsert()` does `INSERT ... ON CONFLICT DO UPDATE SET text = ?,
priority = ?, status = ?, updated_at = ?`, relying on `sqlite_crdt`'s
per-column Hybrid-Logical-Clock last-writer-wins to reconcile concurrent
@ -138,8 +138,8 @@ off the shelf.
## Critical files referenced (read-only during this pass)
- `~/todo/lib/sync/sync_service.dart`, `~/todo/lib/data/note_repository.dart`
- `~/diet-guard/diet_guard/_sync.py`, `_sync_github.py`, `_sync_merge.py`
- `~/diet-guard/app/lib/services/sync_merge.dart`
- `~/wake-alarm/shutdown-wrapper.sh`
- `~/src/todo/lib/sync/sync_service.dart`, `~/src/todo/lib/data/note_repository.dart`
- `~/src/diet-guard/diet_guard/_sync.py`, `_sync_github.py`, `_sync_merge.py`
- `~/src/diet-guard/app/lib/services/sync_merge.dart`
- `~/src/wake-alarm/shutdown-wrapper.sh`
- `docs/todo/workstream-c-github-sync-workout-data.md` (this repo)

View File

@ -8,9 +8,9 @@ fell out of it (both resolved by explicit user call, 2026-07-04).
**The two shared libraries are now implemented and locally verified
(2026-07-05):**
- `~/crdt-sync` (Python) — 60 tests, 100% branch coverage, clean
- `~/src/utils/crdt-sync` (Python) — 60 tests, 100% branch coverage, clean
ruff/mypy/pylint/bandit/pre-commit. Local git repo, one commit.
- `~/crdt_sync_dart` (pure Dart, no Flutter dep) — 59 tests, clean
- `~/src/utils/crdt_sync_dart` (pure Dart, no Flutter dep) — 59 tests, clean
`dart analyze`. Local git repo, one commit.
Both implement the unified LWW-map-with-sticky-remove scheme (`Hlc`,
@ -62,7 +62,7 @@ from-scratch CRDT implementation.
**diet-guard and wake-alarm do NOT use CRDTs today.** Their existing
"merge" mechanisms are much simpler:
- diet-guard: `_sync_merge.merge_logs` (`~/diet-guard/diet_guard/_sync_merge.py`,
- diet-guard: `_sync_merge.merge_logs` (`~/src/diet-guard/diet_guard/_sync_merge.py`,
81 lines) is a tombstone-aware, entry-key-based merge — closer to
last-write-wins per entry than a general CRDT. Transport is
`_sync_github.GitHubSyncClient` against a private repo's Contents API
@ -151,9 +151,9 @@ time this is scoped for real.
## Critical files (reference only — read, do not modify, during scoping)
- `~/todo/lib/sync/sync_service.dart`, `sync_settings.dart` (CRDT-via-package pattern)
- `~/diet-guard/diet_guard/_sync.py`, `_sync_github.py`, `_sync_merge.py`
- `~/diet-guard/app/lib/services/sync_service.dart`, `sync_merge.dart`
- `~/wake-alarm/shutdown-wrapper.sh`
- `~/src/todo/lib/sync/sync_service.dart`, `sync_settings.dart` (CRDT-via-package pattern)
- `~/src/diet-guard/diet_guard/_sync.py`, `_sync_github.py`, `_sync_merge.py`
- `~/src/diet-guard/app/lib/services/sync_service.dart`, `sync_merge.dart`
- `~/src/wake-alarm/shutdown-wrapper.sh`
- `docs/todo/workstream-c-github-sync-workout-data.md` (this repo — resolve
its open questions jointly with this one, not independently)

View File

@ -42,7 +42,7 @@ readonly REPO_DIR="$SCRIPT_DIR"
readonly SYSTEMD_USER_DIR="$HOME/.config/systemd/user"
readonly PROD_PYTHON="/usr/bin/python3"
# The shared lock backend, developed in lockstep with this repo.
readonly GATELOCK_DIR="$HOME/utils/gatelock"
readonly GATELOCK_DIR="$HOME/src/utils/gatelock"
echo "=== Screen Locker Installer ==="
@ -58,7 +58,7 @@ fi
# 2. Install the package ------------------------------------------------------
# --break-system-packages is required on Arch (PEP 668). Editable so a later
# `git pull` in THIS clone updates the running service with no reinstall. That
# is also why the clone must live somewhere durable (~/screen-locker), never a
# is also why the clone must live somewhere durable (~/src/screen-locker), never a
# scratch directory: a non-editable snapshot would freeze at this commit and
# silently stop tracking the repo.
echo "[2/4] Installing screen_locker into user site-packages (editable)..."
@ -69,7 +69,7 @@ echo "[2/4] Installing screen_locker into user site-packages (editable)..."
# pyproject.toml pins `gatelock @ git+https://.../@gatelock-v0.2.1`, so the
# install above resolves that pin and overwrites any local editable gatelock
# with a frozen wheel built from the tag. That silently reverts every
# unreleased change in ~/utils/gatelock and breaks the other lockers that
# unreleased change in ~/src/utils/gatelock and breaks the other lockers that
# depend on them -- observed: it removed `ScrollableSurface` and took
# diet_guard down with it.
#
@ -122,7 +122,7 @@ if ! (cd /tmp && "$PROD_PYTHON" -c "import screen_locker" 2>/dev/null); then
fi
if ! (cd /tmp && "$PROD_PYTHON" -c "import gatelock" 2>/dev/null); then
echo "ERROR: $PROD_PYTHON cannot import gatelock (the shared lock" >&2
echo " backend). Install it editable from ~/utils/gatelock." >&2
echo " backend). Install it editable from ~/src/utils/gatelock." >&2
exit 1
fi
if [[ -d "$GATELOCK_DIR" ]]; then

View File

@ -53,7 +53,7 @@ ensure_runtime_deps() {
echo "WARNING: could not install $1 automatically" >&2
}
_pip_runtime_dep gatelock \
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.1#subdirectory=gatelock"
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock"
_pip_runtime_dep crdt_sync \
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.0#subdirectory=crdt-sync"
}

View File

@ -2,8 +2,8 @@
> "do dopamine-ux-04-screen-locker". It is self-contained -- it needs no context from
> any other session.
>
> Canonical copy: `~/utils/dopamine-ux/04-screen-locker.md` (source of truth; this is a
> distributed copy). Running order and cross-prompt rules: `~/utils/dopamine-ux/00-INDEX.md`.
> Canonical copy: `~/src/utils/dopamine-ux/04-screen-locker.md` (source of truth; this is a
> distributed copy). Running order and cross-prompt rules: `~/src/utils/dopamine-ux/00-INDEX.md`.
> Generated 2026-08-16 from a survey of this repo -- line numbers are accurate
> as of that date; **anchor on the symbol names, not the line numbers.**
@ -19,10 +19,10 @@ Do **both**, in the same session that completes the work:
Do not leave a finished prompt lying in the repo -- a stale prompt is
indistinguishable from a pending one, and the next session will re-run it.
2. **Log completion in the canonical index**, in `~/utils` (a *different* repo,
2. **Log completion in the canonical index**, in `~/src/utils` (a *different* repo,
so it needs its own commit):
```bash
cd ~/utils
cd ~/src/utils
# append to the "Completion log" table in dopamine-ux/00-INDEX.md:
# | 04-screen-locker.md | DONE <YYYY-MM-DD> | <impl commit sha> | <one-line note> |
git add dopamine-ux/00-INDEX.md
@ -69,7 +69,7 @@ the data already exists, is already true, and needs no new state.
## where
Repo: `~/screen-locker`.
Repo: `~/src/screen-locker`.
Primary:
- `screen_locker/_status_sections.py` — the section renderers used by the status
@ -136,7 +136,7 @@ Primary:
- optional: a daily streak alongside the weekly one. Note this **would** be new
state (the existing streak is consecutive-*weeks*), so it triggers the conftest
requirement above. diet-guard's consecutive-*day* streak
(`~/diet-guard/diet_guard/_daystatus.py` ~:144) is the precedent to mirror.
(`~/src/diet-guard/diet_guard/_daystatus.py` ~:144) is the precedent to mirror.
## done
@ -144,7 +144,7 @@ Primary:
the current streak, bonus hours and early-bird state — with the real values
from `extra_benefits_state.json`, not placeholders.
2. A week-transition milestone reaches the UI instead of only `_logger.info`.
3. `cd ~/screen-locker && python -m pytest` passes.
3. `cd ~/src/screen-locker && python -m pytest` passes.
4. `pre-commit run --files <changed files>` is clean — including the 250-line cap
(`scripts/check_file_length.py`) and the silent-failure check.
5. `git diff` touches no enforcement logic: no change to lock decisions, weekly
@ -155,7 +155,7 @@ Primary:
Desktop — this is a desktop Python app.
```
cd ~/screen-locker
cd ~/src/screen-locker
python -m screen_locker --status # CLI: confirm the values it prints
screen-locker-status # the Tk window: confirm they render
```
@ -176,7 +176,7 @@ Current real state for comparison: `screen_locker/extra_benefits_state.json` and
(the enforcement invariant) and the reward strings ~:130-139.
- `screen_locker/_unlock_view.py` — the existing celebration, for tone.
- `screen_locker/status_view.py` — check its line count **before** editing.
- `~/screen-locker/CLAUDE.md` — repo rules (no silent failures, ruff `select=ALL`).
- `~/src/screen-locker/CLAUDE.md` — repo rules (no silent failures, ruff `select=ALL`).
## context you would otherwise rediscover
@ -196,7 +196,7 @@ Current real state for comparison: `screen_locker/extra_benefits_state.json` and
tunable is a module-level constant. An opt-out toggle has no existing home;
for a self-restriction tool, requiring a code edit to disable is arguably
correct, so prefer a constant in `_constants.py` over new state.
- `~/gatelock` is **not** a repo — it is `~/utils/gatelock/gatelock/`, consumed as
- `~/gatelock` is **not** a repo — it is `~/src/utils/gatelock/gatelock/`, consumed as
a pinned git dep, and it holds no workout state.
- Manual workouts were **not** removed: `_manual_workout.py` implements a
rate-limited, evidence-gated subsystem (budget 2 per 7 days, 10 per 30).

View File

@ -2,8 +2,8 @@
> "do dopamine-ux-05-workout-app". It is self-contained -- it needs no context from
> any other session.
>
> Canonical copy: `~/utils/dopamine-ux/05-workout-app.md` (source of truth; this is a
> distributed copy). Running order and cross-prompt rules: `~/utils/dopamine-ux/00-INDEX.md`.
> Canonical copy: `~/src/utils/dopamine-ux/05-workout-app.md` (source of truth; this is a
> distributed copy). Running order and cross-prompt rules: `~/src/utils/dopamine-ux/00-INDEX.md`.
> Generated 2026-08-16 from a survey of this repo -- line numbers are accurate
> as of that date; **anchor on the symbol names, not the line numbers.**
@ -19,10 +19,10 @@ Do **both**, in the same session that completes the work:
Do not leave a finished prompt lying in the repo -- a stale prompt is
indistinguishable from a pending one, and the next session will re-run it.
2. **Log completion in the canonical index**, in `~/utils` (a *different* repo,
2. **Log completion in the canonical index**, in `~/src/utils` (a *different* repo,
so it needs its own commit):
```bash
cd ~/utils
cd ~/src/utils
# append to the "Completion log" table in dopamine-ux/00-INDEX.md:
# | 05-workout-app.md | DONE <YYYY-MM-DD> | <impl commit sha> | <one-line note> |
git add dopamine-ux/00-INDEX.md
@ -74,7 +74,7 @@ number with a motion token while you are in the file.
## where
Repo: `~/screen-locker`. App: `~/screen-locker/stronglift_replacement/workout_app`
Repo: `~/src/screen-locker`. App: `~/src/screen-locker/stronglift_replacement/workout_app`
(a Flutter app nested inside the screen-locker repo; that directory contains **no
Python** — only the app and two design docs).
@ -175,7 +175,7 @@ Theme: `lib/ui/theme.dart` — local hand-copy, **no `design_system` dependency*
2. Finishing a workout produces a haptic and a visible dialog arrival; step 2
adds a sound.
3. No inline animation duration remains in `exercise_tile_rows.dart`.
4. `cd ~/screen-locker/stronglift_replacement/workout_app && flutter analyze` clean.
4. `cd ~/src/screen-locker/stronglift_replacement/workout_app && flutter analyze` clean.
5. `flutter test` passes **and coverage stays at 100%**.
6. With OS "remove animations" on, the app works and durations are zero.
7. Step 2: the settings toggle flips, persists across restart, and silences both
@ -187,7 +187,7 @@ Theme: `lib/ui/theme.dart` — local hand-copy, **no `design_system` dependency*
```
adb devices # confirm 23181JEGR08034
cd ~/screen-locker/stronglift_replacement/workout_app
cd ~/src/screen-locker/stronglift_replacement/workout_app
flutter build apk --release
adb install -r build/app/outputs/flutter-apk/app-release.apk
```
@ -209,7 +209,7 @@ state what you felt and heard; do not infer them from the code.
`setLastWorkoutType` as the public-wrapper pattern.
- `lib/screens/settings_screen_sections.dart` ~:1-11 — the coverage/line-cap
comments, and `_SyncSection` as the section pattern.
- `~/utils/unified-design-system/motion.md` — motion/haptic vocabulary from
- `~/src/utils/unified-design-system/motion.md` — motion/haptic vocabulary from
prompt 01. **Prompt 01 must have run first.**
## context you would otherwise rediscover

View File

@ -7,7 +7,7 @@ requires-python = ">=3.14"
# crdt-sync: shared CRDT merge scheme + GitHub-Contents-API sync transport,
# also used by diet_guard; here for phone-workout GitHub sync (Workstream C)
dependencies = [
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock",
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock",
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync",
"freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays",
]
@ -22,7 +22,7 @@ screen-locker-web = "screen_locker._web_server:main"
# so the systemd/CLI system-python path stays dependency-light and never has
# to import the MCP SDK.
[project.optional-dependencies]
mcp = ["mcp==2.1.1"]
mcp = ["mcp==2.2.0"]
[tool.setuptools.packages.find]
# This repo also holds stronglift_replacement/ (an unrelated Flutter app, not
@ -178,6 +178,14 @@ persistent = true
jobs = 0
py-version = "3.14"
ignore = [".venv", "__pycache__"]
# Test suites intentionally use patterns (protected-access, fixture-arg
# shadowing) that don't apply to source code; ruff's per-file-ignores carry
# the equivalent exemptions, so tests stay linted -- by ruff. This is the same
# source-only pylint scope wake-alarm / diet-guard / testsAndMisc use. It has
# to be `ignore-paths`, not `ignore = ["tests"]`: `ignore` only matches the
# basename of what pylint is *given*, and pre-commit hands it explicit file
# paths, so a directory name in `ignore` never fires under the hook.
ignore-paths = ["^(.*/)?tests/.*$"]
ignore-patterns = [".*\\.pyi$"]
[tool.pylint.messages_control]

View File

@ -5,8 +5,8 @@ codespell==2.4.3
coverage==7.16.0
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync
freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock
mcp==2.1.1
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock
mcp==2.2.0
mypy==2.3.1
pre-commit==4.6.2
pylint==4.0.8
@ -19,5 +19,5 @@ pytest-xdist==3.8.0
# token over the REST endpoint; crdt-sync already pulls requests in, but this
# module imports it itself, so it is declared rather than assumed.
requests==2.34.2
ruff==0.16.6
ruff==0.16.7
types-requests==2.33.0.20260906

View File

@ -14,7 +14,6 @@ rather than at the old ``_compliance_state`` path.
from __future__ import annotations
from datetime import UTC, datetime
import json
import logging
from typing import TYPE_CHECKING
@ -27,6 +26,7 @@ from screen_locker._constants import (
EARLY_BIRD_END_MINUTE,
EARLY_BIRD_START_HOUR,
)
from screen_locker._day import today_str
from screen_locker._log_io import load_workout_log
from screen_locker._sick_tracker import is_sick_day as _is_sick_day
from screen_locker._weekly_check import RELAXED_DAY_SKIP_TYPE
@ -41,15 +41,15 @@ _logger = logging.getLogger(__name__)
def _today_str() -> str:
"""Return today's date as ``YYYY-MM-DD`` in UTC."""
return datetime.now(tz=UTC).strftime("%Y-%m-%d")
"""Return today's LOCAL date as ``YYYY-MM-DD`` (see ``screen_locker._day``)."""
return today_str()
def is_scheduled_skip_today(today: date | None = None) -> bool:
"""Return True if *today* is in the shared free-day pool.
The source moved from this app's own ``scheduled_skips.json`` to the
fleet-wide pool (``~/utils/freedays``), so one marked day now stands down
fleet-wide pool (``~/src/utils/freedays``), so one marked day now stands down
every gate app at once instead of only this one.
The date is **local**, not UTC. The file-backed check this replaces

View File

@ -38,6 +38,7 @@ from screen_locker._compliance_trace import (
describe_auto_upgrade_opportunity,
describe_degraded_sources,
)
from screen_locker._day import today_str as local_day
if TYPE_CHECKING:
from collections.abc import Sequence
@ -79,7 +80,7 @@ def explain_lock_decision(
reported via ``heat_skip_evaluated=False``, not guessed.
"""
instant = now if now is not None else datetime.now(tz=UTC)
today_str = instant.astimezone(UTC).strftime("%Y-%m-%d")
today_str = local_day(instant)
local_dt = instant.astimezone()
local_minutes = local_dt.hour * 60 + local_dt.minute

32
screen_locker/_day.py Normal file
View File

@ -0,0 +1,32 @@
"""The one definition of "what day is it" for every day-keyed file.
``log.json``, ``sick_day_state.json``, ``early_bird_pending.json``,
``wake_state.json`` and the sick history are all keyed by ``YYYY-MM-DD``.
Until 2026-09-13 each writer and reader derived that key on its own, and
most of them used ``datetime.now(tz=UTC)`` while the lock window, the phone
app, RunnerUp verification and the status window used LOCAL time. In CEST
that is a two-hour window after local midnight in which a workout logged
"today" was filed under yesterday — the lock check then looked for today,
found nothing, and locked the PC for a workout that was on disk.
The day is the **local calendar day**: it is what the user sees on the
clock when they log, what the lock screen names when it says "no workout
for today", and what the phone already writes. Every module goes through
:func:`today_str` so the two can never disagree again; tests freeze the
clock by patching ``screen_locker._day.datetime``.
"""
from __future__ import annotations
from datetime import UTC, datetime
def today_str(now: datetime | None = None) -> str:
"""Return the local calendar day of *now* (default: this instant) as ``YYYY-MM-DD``.
*now* may be in any timezone; it is converted to the machine's local zone
first, which is the only conversion that turns ``22:02Z`` on the 12th
into the 13th the user actually logged on.
"""
instant = now if now is not None else datetime.now(tz=UTC)
return instant.astimezone().strftime("%Y-%m-%d")

View File

@ -23,14 +23,15 @@ from screen_locker._constants import (
EARLY_BIRD_START_HOUR,
EXTRA_BENEFITS_FILE,
)
from screen_locker._day import today_str
from screen_locker._extra_benefits import has_extended_early_bird
_logger = logging.getLogger(__name__)
def _today_str() -> str:
"""Return today's date as YYYY-MM-DD in UTC."""
return datetime.now(tz=UTC).strftime("%Y-%m-%d")
"""Return today's LOCAL date as YYYY-MM-DD (see ``screen_locker._day``)."""
return today_str()
class EarlyBirdMixin:

View File

@ -39,15 +39,15 @@ def build_heat_skip_content(
*both* edges if it ever outgrows the display -- and it has to be in the
fit check for that reason.
"""
outer = tk.Frame(parent, bg=_COLORS.bg)
outer = tk.Frame(parent, bg=_COLORS.palette.bg)
outer.place(relx=0.5, rely=0.5, anchor="center")
tk.Label(
outer,
text="\u2600 Too hot to workout?",
font=_COLORS.font("body", bold=True, family=_FONT),
bg=_COLORS.bg,
fg=_COLORS.warning,
bg=_COLORS.palette.bg,
fg=_COLORS.palette.warning,
).pack(pady=(0, _COLORS.space("sm")))
tk.Label(
@ -57,28 +57,28 @@ def build_heat_skip_content(
f" (threshold: {HEAT_SKIP_TEMP_THRESHOLD}\u00b0C)"
),
font=_COLORS.font("body", family=_FONT),
bg=_COLORS.bg,
fg=_COLORS.muted,
bg=_COLORS.palette.bg,
fg=_COLORS.palette.muted,
).pack(pady=_COLORS.space("xs"))
tk.Label(
outer,
text="Skip today's workout due to extreme heat?",
font=_COLORS.font("body", family=_FONT),
bg=_COLORS.bg,
fg=_COLORS.muted,
bg=_COLORS.palette.bg,
fg=_COLORS.palette.muted,
).pack(pady=(_COLORS.space("xs"), 0))
btn_frame = tk.Frame(outer, bg=_COLORS.bg)
btn_frame = tk.Frame(outer, bg=_COLORS.palette.bg)
btn_frame.pack(pady=_COLORS.space("lg"))
skip_button = tk.Button(
btn_frame,
text="Skip workout",
command=on_skip,
bg=_COLORS.warning,
fg=_COLORS.on_fill,
activebackground=_COLORS.warning,
bg=_COLORS.palette.warning,
fg=_COLORS.palette.on_fill,
activebackground=_COLORS.palette.warning,
font=_COLORS.font("label", family=_FONT),
padx=_COLORS.space("md"),
pady=_COLORS.space("sm"),
@ -91,9 +91,9 @@ def build_heat_skip_content(
btn_frame,
text="No, I'll workout",
command=on_decline,
bg=_COLORS.field_bg,
fg=_COLORS.fg,
activebackground=_COLORS.field_bg,
bg=_COLORS.palette.field_bg,
fg=_COLORS.palette.fg,
activebackground=_COLORS.palette.field_bg,
font=_COLORS.font("label", family=_FONT),
padx=_COLORS.space("md"),
pady=_COLORS.space("sm"),
@ -131,7 +131,7 @@ class HeatSkipMixin:
# This window is destroyed before the main GateRoot is created.
root = tk.Tk()
root.title("Extreme Heat")
root.configure(bg=_COLORS.bg)
root.configure(bg=_COLORS.palette.bg)
root.attributes("-fullscreen", True)
root.attributes("-topmost", True)
root.grab_set()

View File

@ -11,6 +11,7 @@ from typing import TYPE_CHECKING
from gatelock.log_integrity import compute_entry_hmac
from screen_locker import _compliance_state
from screen_locker._day import today_str
from screen_locker._log_io import load_workout_log
from screen_locker._manual_workout import MANUAL_WORKOUT_TYPE, manual_sync_record_id
@ -78,6 +79,22 @@ def _entry_workout_id(date: str, entry: Mapping[str, object]) -> str | None:
return _derive_workout_id(date, workout_data)
def _is_logged_anywhere(logs: dict[str, list[dict]], workout_id: str) -> bool:
"""True if any day already holds an entry with this ``workout_id``.
Searched across ALL days, not just the one being written: a workout id is
globally unique (it embeds its own date), and a copy of the same workout
can arrive keyed on a different day — e.g. an entry moved to the local day
it was really logged on, then its synced twin coming back stamped with
the old UTC day. Per-day dedup would append that twin as a duplicate.
"""
return any(
_entry_workout_id(day, e) == workout_id
for day, entries in logs.items()
for e in entries
)
def write_signed_entry(
log_file: Path, date: str, workout_data: Mapping[str, object]
) -> RecordResult:
@ -87,7 +104,7 @@ def write_signed_entry(
workout) and manual-sync ingestion, which files a synced workout under its
OWN date so the weekly count places it in the right ISO week. The log is
day-keyed but now holds MULTIPLE entries per day: this APPENDS rather than
overwrites. If an entry with the same ``workout_id`` already exists for the
overwrites. If an entry with the same ``workout_id`` already exists on ANY
day, it is a no-op — the log itself is the idempotency store, so
re-verifying the same workout never double-records. Every write normalizes
the whole file to the list shape, progressively migrating legacy entries.
@ -100,9 +117,7 @@ def write_signed_entry(
prior = list(entries)
workout_id = _derive_workout_id(date, workout_data)
if workout_id is not None and any(
_entry_workout_id(date, e) == workout_id for e in entries
):
if workout_id is not None and _is_logged_anywhere(logs, workout_id):
return RecordResult(appended=False, prior_entries=prior)
entry: dict[str, object] = {
@ -153,5 +168,5 @@ class LogMixin:
credit only for a genuinely new workout and scale it by whether today
already had one.
"""
today = datetime.now(tz=UTC).strftime("%Y-%m-%d")
today = today_str()
return write_signed_entry(self.log_file, today, self.workout_data)

View File

@ -18,10 +18,10 @@ that can drift.
from __future__ import annotations
import argparse
from datetime import UTC, datetime
import logging
from typing import TYPE_CHECKING
from screen_locker._day import today_str
from screen_locker._manual_sync import ingest_manual_records
from screen_locker._manual_workout import (
SPORT_CHOICES,
@ -129,10 +129,10 @@ def run_manual_log(log_file: Path, argv: Sequence[str]) -> int:
add_manual_arguments(parser)
args = parser.parse_args(list(argv))
# UTC, matching how the budget windows compute "today" -- a local date
# near midnight would file the workout in a different window than the one
# it is then counted in.
date = args.date or datetime.now(tz=UTC).strftime("%Y-%m-%d")
# The LOCAL day, like every other day-key (screen_locker._day): the old
# UTC default filed a workout logged at 00:02 CEST under yesterday, and the
# lock check then could not find it "today".
date = args.date or today_str()
draft = _draft(args)
# Validated here as well as inside the ingest, purely so a person running
# this by hand gets the concrete field error on stderr and a non-zero exit

View File

@ -42,21 +42,21 @@ class ManualWorkoutDialogMixin(
def _show_manual_workout_form(self) -> None:
"""Render the manual-workout evidence form, or a budget-exhausted note."""
self.clear_container()
self._label("Log Manual Workout", color=self._colors.accent, pad="xs")
self._label("Log Manual Workout", color=self._colors.palette.accent, pad="xs")
if _manual_workout.is_budget_exhausted(self.log_file):
self._text(
"Manual-workout budget exhausted for this window.",
color=self._colors.danger,
color=self._colors.palette.danger,
)
self._text(
_manual_workout.budget_summary(self.log_file),
color=self._colors.muted,
color=self._colors.palette.muted,
)
row = self._button_row()
self._button(
row,
"BACK",
bg=self._colors.field_bg,
bg=self._colors.palette.field_bg,
command=self._on_manual_workout_cancelled,
width=12,
).pack(side="left", padx=self._colors.space("sm"))
@ -64,7 +64,7 @@ class ManualWorkoutDialogMixin(
self._text(
_manual_workout.budget_summary(self.log_file),
role="label",
color=self._colors.accent,
color=self._colors.palette.accent,
pad="xs",
)
self._build_manual_workout_form()
@ -106,8 +106,8 @@ class ManualWorkoutDialogMixin(
# Both sport sub-frames occupy the same full-width grid slot; only the
# selected one is shown (see _on_mw_sport_changed).
act_row = self._mw_next_full_row(form)
self._mw_tt_frame = tk.Frame(form, bg=self._colors.bg)
self._mw_other_frame = tk.Frame(form, bg=self._colors.bg)
self._mw_tt_frame = tk.Frame(form, bg=self._colors.palette.bg)
self._mw_other_frame = tk.Frame(form, bg=self._colors.palette.bg)
for sport_frame in (self._mw_tt_frame, self._mw_other_frame):
sport_frame.grid_columnconfigure(0, weight=1, uniform="mwact")
sport_frame.grid_columnconfigure(1, weight=1, uniform="mwact")
@ -151,20 +151,20 @@ class ManualWorkoutDialogMixin(
)
self._mw_error_label = self._text(
"", role="label", color=self._colors.danger, pad="xs"
"", role="label", color=self._colors.palette.danger, pad="xs"
)
button_row = self._button_row()
self._button(
button_row,
"SUBMIT",
bg=self._colors.accent,
bg=self._colors.palette.accent,
command=self._submit_manual_workout_form,
width=12,
).pack(side="left", padx=self._colors.space("sm"))
self._button(
button_row,
"BACK",
bg=self._colors.field_bg,
bg=self._colors.palette.field_bg,
command=self._on_manual_workout_cancelled,
width=12,
).pack(side="left", padx=self._colors.space("sm"))

View File

@ -48,13 +48,13 @@ class ManualWorkoutSportFieldsMixin:
self._mw_sport_var = tk.StringVar(
value=_manual_workout.SPORT_LABELS[_manual_workout.SPORT_TABLE_TENNIS]
)
row = tk.Frame(parent, bg=self._colors.bg)
row = tk.Frame(parent, bg=self._colors.palette.bg)
tk.Label(
row,
text="Sport:",
font=self._colors.font("body"),
fg=self._colors.fg,
bg=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
).pack(side="left", padx=self._colors.space("xs"))
for label in _manual_workout.SPORT_LABELS.values():
tk.Radiobutton(
@ -65,14 +65,14 @@ class ManualWorkoutSportFieldsMixin:
# Radiobutton's command takes no argument -- bind the label.
command=lambda chosen=label: self._on_mw_sport_changed(chosen),
font=self._colors.font("body"),
fg=self._colors.fg,
bg=self._colors.bg,
activeforeground=self._colors.fg,
activebackground=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
activeforeground=self._colors.palette.fg,
activebackground=self._colors.palette.bg,
# Without selectcolor the indicator is a white blob on the dark
# overlay; the OptionMenu was the one unstyled widget in this
# form, which likely added to it reading as dead.
selectcolor=self._colors.field_bg,
selectcolor=self._colors.palette.field_bg,
highlightthickness=0,
).pack(side="left", padx=self._colors.space("xs"))
self._mw_grid(parent, row, full=True)

View File

@ -19,6 +19,7 @@ from screen_locker._constants import (
MANUAL_WORKOUT_BUDGET_PER_7_DAYS,
MANUAL_WORKOUT_BUDGET_PER_30_DAYS,
)
from screen_locker._day import today_str
from screen_locker._log_io import load_workout_log
if TYPE_CHECKING:
@ -38,8 +39,8 @@ SPORT_LABELS: dict[str, str] = {
def _today_iso() -> str:
"""Return today's date as ``YYYY-MM-DD`` (UTC)."""
return datetime.now(tz=UTC).strftime("%Y-%m-%d")
"""Return today's LOCAL date as ``YYYY-MM-DD`` (see ``screen_locker._day``)."""
return today_str()
def _parse_iso(date_str: str) -> datetime | None:

View File

@ -72,8 +72,8 @@ class ManualWorkoutFormWidgetsMixin:
parent,
text=title,
font=self._colors.font("body", bold=True),
fg=self._colors.accent,
bg=self._colors.bg,
fg=self._colors.palette.accent,
bg=self._colors.palette.bg,
anchor="w",
)
self._mw_grid(parent, label, full=True)
@ -95,7 +95,7 @@ class ManualWorkoutFormWidgetsMixin:
one field per form should ask.
"""
var = tk.StringVar()
cell = tk.Frame(parent, bg=self._colors.bg)
cell = tk.Frame(parent, bg=self._colors.palette.bg)
# Label beside the field, not above it. Stacked, each of the ten cells
# cost two lines plus the gap between them, and the form measured
# 1320px against a 768px panel; side-by-side each cell is one line
@ -105,17 +105,17 @@ class ManualWorkoutFormWidgetsMixin:
cell,
text=label,
font=self._colors.font("label"),
fg=self._colors.fg,
bg=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
anchor="w",
).pack(side="left", padx=(0, self._colors.space("xs")))
entry = tk.Entry(
cell,
textvariable=var,
font=self._colors.font("label"),
bg=self._colors.field_bg,
fg=self._colors.fg,
insertbackground=self._colors.fg,
bg=self._colors.palette.field_bg,
fg=self._colors.palette.fg,
insertbackground=self._colors.palette.fg,
**self._colors.focus_kwargs(),
)
entry.pack(side="left", fill="x", expand=True)
@ -130,13 +130,13 @@ class ManualWorkoutFormWidgetsMixin:
) -> tk.IntVar:
"""Add a half-width label + numeric Spinbox and return its IntVar."""
var = tk.IntVar(value=0)
row = tk.Frame(parent, bg=self._colors.bg)
row = tk.Frame(parent, bg=self._colors.palette.bg)
tk.Label(
row,
text=label,
font=self._colors.font("label"),
fg=self._colors.fg,
bg=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
).pack(side="left", padx=self._colors.space("xs"))
tk.Spinbox(
row,
@ -157,22 +157,22 @@ class ManualWorkoutFormWidgetsMixin:
whole rows of a form that has to fit a 768px panel, and two of them
sit side by side just as legibly.
"""
cell = tk.Frame(parent, bg=self._colors.bg)
cell = tk.Frame(parent, bg=self._colors.palette.bg)
tk.Label(
cell,
text=label,
font=self._colors.font("label"),
fg=self._colors.fg,
bg=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
anchor="w",
).pack(fill="x")
text_widget = tk.Text(
cell,
height=2,
font=self._colors.font("label"),
bg=self._colors.field_bg,
fg=self._colors.fg,
insertbackground=self._colors.fg,
bg=self._colors.palette.field_bg,
fg=self._colors.palette.fg,
insertbackground=self._colors.palette.fg,
**self._colors.focus_kwargs(),
)
text_widget.pack(pady=self._colors.space("xs"), fill="x")
@ -187,7 +187,7 @@ class ManualWorkoutFormWidgetsMixin:
def _mw_rpe_row(self, parent: tk.Widget) -> None:
"""Add the RPE (rate of perceived exertion) spinbox row."""
row = tk.Frame(parent, bg=self._colors.bg)
row = tk.Frame(parent, bg=self._colors.palette.bg)
tk.Label(
row,
text=(
@ -195,8 +195,8 @@ class ManualWorkoutFormWidgetsMixin:
f"({MANUAL_WORKOUT_RPE_MIN}-{MANUAL_WORKOUT_RPE_MAX}):"
),
font=self._colors.font("label"),
fg=self._colors.fg,
bg=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
).pack(side="left", padx=self._colors.space("xs"))
tk.Spinbox(
row,
@ -234,7 +234,7 @@ class ManualWorkoutFormWidgetsMixin:
Still built on the primary surface only -- an independently scrolled
copy per monitor would show two different parts of one form.
"""
form = tk.Frame(self.container.first, bg=self._colors.bg)
form = tk.Frame(self.container.first, bg=self._colors.palette.bg)
# No outer gap: the budget line above and the first section heading
# below already separate the grid, and on a 1024x600 panel this form
# fits by single-digit pixels.

View File

@ -135,7 +135,7 @@ def get_flags() -> dict[str, bool]:
``is_scheduled_skip_today`` keeps its name but no longer reads this app's
``scheduled_skips.json``: it is now the shared, fleet-wide free-day pool
(``~/utils/freedays``), so a true here also means diet-guard, wake-alarm,
(``~/src/utils/freedays``), so a true here also means diet-guard, wake-alarm,
leetcode-guard and home-guard are standing down today.
"""
history = load_history()

View File

@ -8,7 +8,6 @@ import json
import logging
from pathlib import Path
import tempfile
import time
from screen_locker._adb_transport import AdbTransportMixin
from screen_locker._constants import (
@ -16,6 +15,7 @@ from screen_locker._constants import (
WORKOUT_APP_JSON_REMOTES,
WORKOUT_DURATION_ACCEPT_MINUTES,
)
from screen_locker._day import today_str
from screen_locker._http_workout_fetch import HttpWorkoutFetchMixin
from screen_locker._log_mixin import write_signed_entry
from screen_locker._time_check import check_clock_skew
@ -41,7 +41,7 @@ class PhoneVerificationMixin(AdbTransportMixin, HttpWorkoutFetchMixin):
only fall back to a stale/older payload if no candidate is from today.
"""
tmp = Path(tempfile.gettempdir()) / "workout_result.json"
today = time.strftime("%Y-%m-%d")
today = today_str()
first_parsed: dict | None = None
for remote in WORKOUT_APP_JSON_REMOTES:
ok, _ = self._run_adb(["pull", remote, str(tmp)])
@ -91,7 +91,7 @@ class PhoneVerificationMixin(AdbTransportMixin, HttpWorkoutFetchMixin):
must reflect a workout done *right now*. For crediting a workout
found dated earlier in the week, see ``_try_fill_stronglifts_for_week``.
"""
today = time.strftime("%Y-%m-%d")
today = today_str()
if data.get("date") != today:
return "stale", f"Workout JSON is from {data.get('date')}, not today"
return self._validate_json_content(data)

View File

@ -7,7 +7,6 @@ Root DB fallback lives in ``_runnerup_db.py``.
from __future__ import annotations
from datetime import UTC, datetime
import logging
from typing import Any
@ -18,6 +17,7 @@ from screen_locker._constants import (
RUNNERUP_EXPORT_DIRS,
WORKOUT_DURATION_ACCEPT_MINUTES,
)
from screen_locker._day import today_str
from screen_locker._runnerup_backfill import RunnerUpBackfillMixin
from screen_locker._runnerup_db import RunnerUpDbMixin
from screen_locker._runnerup_tcx import RunnerUpTcxMixin
@ -77,7 +77,7 @@ class RunnerUpVerificationMixin(
fails validation), or ``None`` if no today's file exists at all
(caller should try the root DB path instead).
"""
today = datetime.now(tz=UTC).astimezone().strftime("%Y-%m-%d")
today = today_str()
exports = self._find_runnerup_exports_for_date(today)
if not exports:
_logger.warning(

View File

@ -2,7 +2,6 @@
from __future__ import annotations
from datetime import UTC, datetime
import logging
import subprocess
from typing import TYPE_CHECKING
@ -11,6 +10,7 @@ from screen_locker._constants import (
ADJUST_SHUTDOWN_SCRIPT,
SHUTDOWN_CONFIG_FILE,
)
from screen_locker._day import today_str
from screen_locker._shutdown_sick_state import SickDayStateMixin
from screen_locker._wake_alarm import WakeAlarmMixin
@ -76,7 +76,7 @@ class ShutdownMixin(SickDayStateMixin, WakeAlarmMixin):
Returns True if successful, False otherwise.
"""
today = datetime.now(tz=UTC).strftime("%Y-%m-%d")
today = today_str()
self._restore_original_config_if_needed()
if self._sick_mode_used_today():
_logger.warning("Sick mode already used today")

View File

@ -10,11 +10,12 @@ overwrite the fresh base when it runs later in the same startup.
from __future__ import annotations
from datetime import UTC, datetime
import json
import logging
from typing import TYPE_CHECKING, Any
from screen_locker._day import today_str
if TYPE_CHECKING:
from pathlib import Path
@ -62,7 +63,7 @@ def reset_to_base_if_new_day(
Returns True if a reset was performed, False if today was already reset.
"""
today = datetime.now(tz=UTC).strftime("%Y-%m-%d")
today = today_str()
if state_file.exists():
try:

View File

@ -10,11 +10,11 @@ earlier, so the following day can put them back.
from __future__ import annotations
from datetime import UTC, datetime
import json
import logging
from screen_locker._constants import SICK_DAY_STATE_FILE
from screen_locker._day import today_str
_logger = logging.getLogger(__name__)
@ -30,7 +30,7 @@ class SickDayStateMixin:
try:
with SICK_DAY_STATE_FILE.open() as f:
state = json.load(f)
today = datetime.now(tz=UTC).strftime("%Y-%m-%d")
today = today_str()
return state.get("date") == today
except (OSError, json.JSONDecodeError) as exc:
_logger.warning(
@ -112,7 +112,7 @@ class SickDayStateMixin:
if loaded is None:
return
state_date, orig_mw, orig_ts = loaded
today = datetime.now(tz=UTC).strftime("%Y-%m-%d")
today = today_str()
if state_date != today:
self._write_restored_config(orig_mw, orig_ts, state_date)
except (OSError, json.JSONDecodeError) as e:

View File

@ -22,6 +22,7 @@ from screen_locker._constants import (
SICK_LOCKOUT_MULTIPLIER_PER_RECENT,
SICK_LOCKOUT_SECONDS,
)
from screen_locker._day import today_str
_logger = logging.getLogger(__name__)
@ -43,8 +44,8 @@ class SickHistory:
def _today_iso() -> str:
"""Return today's date as ``YYYY-MM-DD`` (UTC)."""
return datetime.now(tz=UTC).strftime("%Y-%m-%d")
"""Return today's LOCAL date as ``YYYY-MM-DD`` (see ``screen_locker._day``)."""
return today_str()
def _parse_iso(date_str: str) -> datetime | None:

View File

@ -31,7 +31,7 @@ class SickCommitmentMixin:
self._label(
"Commit to working out tomorrow?",
role="display",
color=self._colors.warning,
color=self._colors.palette.warning,
pad="md",
)
# ~80 chars at font_size 16 would render as one unbroken line past the
@ -46,20 +46,20 @@ class SickCommitmentMixin:
self._commitment_remaining = COMMITMENT_PROMPT_TIMEOUT_SECONDS
self._commitment_timer_label = self._text(
f"Auto-skipping in {COMMITMENT_PROMPT_TIMEOUT_SECONDS}s",
color=self._colors.muted,
color=self._colors.palette.muted,
)
row = self._button_row()
self._button(
row,
"YES",
bg=self._colors.success,
bg=self._colors.palette.success,
command=lambda: self._answer_commitment(commit=True),
width=12,
).pack(side="left", padx=self._colors.space("sm"))
self._button(
row,
"NO",
bg=self._colors.field_bg,
bg=self._colors.palette.field_bg,
command=lambda: self._answer_commitment(commit=False),
width=12,
).pack(side="left", padx=self._colors.space("sm"))

View File

@ -35,34 +35,39 @@ class SickDialogMixin(SickCommitmentMixin):
history = _sick_tracker.load_history()
self._sick_history_cache: SickHistory = history
self.clear_container()
self._label("Sick Day Request", color=self._colors.warning, pad="sm")
self._text(_sick_tracker.budget_summary(history), color=self._colors.warning)
self._label("Sick Day Request", color=self._colors.palette.warning, pad="sm")
self._text(
_sick_tracker.budget_summary(history), color=self._colors.palette.warning
)
recent = _sick_tracker.format_recent_justifications(history)
if recent:
self._text(
"Recent sick days:", role="label", color=self._colors.muted, pad="sm"
"Recent sick days:",
role="label",
color=self._colors.palette.muted,
pad="sm",
)
self._text(recent, role="label", color=self._colors.muted, pad="sm")
self._text(recent, role="label", color=self._colors.palette.muted, pad="sm")
had_commitment = _sick_tracker.had_commitment_for_today(history)
if had_commitment:
self._text(
"⚠ Yesterday you committed to working out today.",
role="body",
color=self._colors.danger,
color=self._colors.palette.danger,
)
self._text(
"Breaking the commitment costs 2 sick-budget days.",
role="label",
color=self._colors.danger,
color=self._colors.palette.danger,
)
self._build_justification_form(had_commitment=had_commitment)
def _build_justification_form(self, *, had_commitment: bool) -> None:
"""Add justification form fields and submit button to the container."""
form = self.container.child_frame(bg=self._colors.bg)
form = self.container.child_frame(bg=self._colors.palette.bg)
form.pack(pady=self._colors.space("sm"))
self._sick_symptom_var = tk.StringVar()
@ -70,7 +75,9 @@ class SickDialogMixin(SickCommitmentMixin):
self._sick_severity_var = tk.IntVar(value=5)
self._sick_text_widget = self._add_form_widgets(form)
self._sick_error_label = self._text("", color=self._colors.danger, pad="sm")
self._sick_error_label = self._text(
"", color=self._colors.palette.danger, pad="sm"
)
button_row = self._button_row()
# Starts disabled during the forced-read delay -- field_bg (our
@ -79,7 +86,7 @@ class SickDialogMixin(SickCommitmentMixin):
self._sick_submit_button = self._button(
button_row,
"SUBMIT",
bg=self._colors.field_bg,
bg=self._colors.palette.field_bg,
command=self._submit_sick_justification,
width=12,
)
@ -87,7 +94,7 @@ class SickDialogMixin(SickCommitmentMixin):
self._button(
button_row,
"BACK",
bg=self._colors.field_bg,
bg=self._colors.palette.field_bg,
command=self._start_phone_check,
width=12,
).pack(side="left", padx=self._colors.space("sm"))
@ -110,14 +117,14 @@ class SickDialogMixin(SickCommitmentMixin):
label="When did it start? (e.g. last night):",
variable=self._sick_onset_var,
)
sev_row = parent.child_frame(bg=self._colors.bg)
sev_row = parent.child_frame(bg=self._colors.palette.bg)
sev_row.pack(pady=self._colors.space("sm"))
sev_row.child_widgets(
tk.Label,
text="Severity (1-10):",
font=self._colors.font("label"),
fg=self._colors.fg,
bg=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
).pack(side="left", padx=self._colors.space("xs"))
sev_row.child_widgets(
tk.Spinbox,
@ -132,8 +139,8 @@ class SickDialogMixin(SickCommitmentMixin):
tk.Label,
text=(f"Describe how you feel (min {SICK_JUSTIFICATION_MIN_CHARS} chars):"),
font=self._colors.font("label"),
fg=self._colors.fg,
bg=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
).pack(pady=self._colors.space("sm"))
text_widgets = TextGroup(
list(
@ -142,9 +149,9 @@ class SickDialogMixin(SickCommitmentMixin):
width=60,
height=6,
font=self._colors.font("label"),
bg=self._colors.field_bg,
fg=self._colors.fg,
insertbackground=self._colors.fg,
bg=self._colors.palette.field_bg,
fg=self._colors.palette.fg,
insertbackground=self._colors.palette.fg,
**self._colors.focus_kwargs(),
)
)

View File

@ -40,12 +40,16 @@ class StatusSectionsMixin:
self._text(
f"{mark} Today ({day.label}): {entry_str}",
role="body",
color=self._colors.success if day.counted else self._colors.warning,
color=self._colors.palette.success
if day.counted
else self._colors.palette.warning,
)
if day.source:
# Secondary provenance note on an already-shown entry -- a
# deliberately caption-sized exception to the 16px floor.
self._text(day.source, role="caption", color=self._colors.muted, pad="xs")
self._text(
day.source, role="caption", color=self._colors.palette.muted, pad="xs"
)
def _section_week(self, parent: tk.Widget, week: WeeklySummary) -> None:
"""Render this ISO week's per-day breakdown and totals."""
@ -61,20 +65,20 @@ class StatusSectionsMixin:
self._text(
f"{mark} {day.label}: {entry_str}",
role="body",
color=self._colors.muted,
color=self._colors.palette.muted,
pad="xs",
)
if week.remaining > 0:
self._text(
f"Need {week.remaining} more this week.",
role="body",
color=self._colors.warning,
color=self._colors.palette.warning,
)
elif week.extra > 0:
self._text(
f"{week.extra} above the weekly minimum!",
role="body",
color=self._colors.success,
color=self._colors.palette.success,
)
def _section_lock_explanation(
@ -86,13 +90,15 @@ class StatusSectionsMixin:
self._text(
expl.reason,
role="body",
color=self._colors.danger if expl.fired else self._colors.success,
color=self._colors.palette.danger
if expl.fired
else self._colors.palette.success,
)
if expl.auto_upgrade.would_attempt:
self._text(
f"Pending auto-upgrade: {expl.auto_upgrade.reason}",
role="label",
color=self._colors.warning,
color=self._colors.palette.warning,
)
def _section_sick_budget(self, parent: tk.Widget, sick: SickBudgetStatus) -> None:
@ -103,7 +109,9 @@ class StatusSectionsMixin:
f"{sick.used_7d}/{sick.budget_7d} week · {sick.used_30d}/{sick.budget_30d} "
f"month · {sick.used_90d}/{sick.budget_90d} quarter · debt {sick.debt}",
role="body",
color=self._colors.danger if sick.exhausted else self._colors.muted,
color=self._colors.palette.danger
if sick.exhausted
else self._colors.palette.muted,
)
def _section_manual_workout_budget(
@ -116,7 +124,9 @@ class StatusSectionsMixin:
f"{manual.used_7d}/{manual.budget_7d} week · "
f"{manual.used_30d}/{manual.budget_30d} month",
role="body",
color=self._colors.danger if manual.exhausted else self._colors.muted,
color=self._colors.palette.danger
if manual.exhausted
else self._colors.palette.muted,
)
def _section_sync_backend(self, parent: tk.Widget) -> None:
@ -134,7 +144,9 @@ class StatusSectionsMixin:
self._text(
format_sync_line(status),
role="body",
color=self._colors.muted if status.healthy else self._colors.danger,
color=self._colors.palette.muted
if status.healthy
else self._colors.palette.danger,
)
def _section_shutdown(
@ -154,7 +166,7 @@ class StatusSectionsMixin:
self._text(
"Live shutdown config unavailable.",
role="body",
color=self._colors.warning,
color=self._colors.palette.warning,
)
# Rest-of-week/next-week/explanation are speculative annotations, not
# the section's primary content -- a deliberate caption-sized
@ -164,7 +176,9 @@ class StatusSectionsMixin:
f"{d.label} {d.hour:02d}:00" for d in shutdown.rest_of_week
)
self._text(
f"Rest of week: {rest_line}", role="caption", color=self._colors.muted
f"Rest of week: {rest_line}",
role="caption",
color=self._colors.palette.muted,
)
next_line = ", ".join(
f"{d.label} {d.hour:02d}:00" for d in shutdown.next_week_preview
@ -172,6 +186,8 @@ class StatusSectionsMixin:
self._text(
f"Next week (speculative): {next_line}",
role="caption",
color=self._colors.muted,
color=self._colors.palette.muted,
)
self._text(
shutdown.explanation, role="caption", color=self._colors.palette.muted
)
self._text(shutdown.explanation, role="caption", color=self._colors.muted)

View File

@ -40,7 +40,9 @@ class TemperatureStatusMixin:
result = self._temp_result
if result is None:
self._text(
"Checking Warsaw temperature…", role="caption", color=self._colors.muted
"Checking Warsaw temperature…",
role="caption",
color=self._colors.palette.muted,
)
return
if result.timed_out:
@ -48,14 +50,14 @@ class TemperatureStatusMixin:
f"Warsaw temperature check timed out after ~"
f"{int(HARD_TIMEOUT_SECONDS)}s — network may be down.",
role="caption",
color=self._colors.warning,
color=self._colors.palette.warning,
)
return
if result.temp_celsius is None:
self._text(
"Warsaw temperature check failed (network/API error).",
role="caption",
color=self._colors.warning,
color=self._colors.palette.warning,
)
return
hot = result.temp_celsius >= HEAT_SKIP_TEMP_THRESHOLD
@ -63,13 +65,13 @@ class TemperatureStatusMixin:
f"Warsaw: {result.temp_celsius:.0f}°C (heat-skip threshold "
f"{HEAT_SKIP_TEMP_THRESHOLD}°C)",
role="caption",
color=self._colors.warning if hot else self._colors.muted,
color=self._colors.palette.warning if hot else self._colors.palette.muted,
)
if hot:
self._text(
"Would trigger heat-skip today.",
role="caption",
color=self._colors.danger,
color=self._colors.palette.danger,
)
def _start_temperature_check(self) -> None:

View File

@ -30,7 +30,10 @@ class UIFlowsMixin(SickDayFlowMixin, LockoutFlowMixin):
"""
self.clear_container()
self._label(
"Checking phone...", role="display", color=self._colors.warning, pad="lg"
"Checking phone...",
role="display",
color=self._colors.palette.warning,
pad="lg",
)
self._text("Looking for today's workout in StrongLifts...", role="body")
@ -54,52 +57,58 @@ class UIFlowsMixin(SickDayFlowMixin, LockoutFlowMixin):
"""Show TRY AGAIN and (if budget allows) I'm sick after a failed check."""
self.clear_container()
self._label(
"No Workout Found", role="display", color=self._colors.danger, pad="md"
"No Workout Found",
role="display",
color=self._colors.palette.danger,
pad="md",
)
self._text(message, color=self._colors.warning)
self._text(message, color=self._colors.palette.warning)
# Never accuse the user of skipping a workout the machine simply could
# not see. On 2026-08-24 this screen said "No Workout Found" after a
# 1h57m session, because Firebase was unreadable and the GitHub mirror
# had been stale for nine days -- neither of which was shown here.
diagnosis = explain_findings(collect_source_findings())
if diagnosis:
self._text(diagnosis, color=self._colors.muted)
self._text(diagnosis, color=self._colors.palette.muted)
history = _sick_tracker.load_history()
self._text(_sick_tracker.budget_summary(history), color=self._colors.muted)
self._text(
_manual_workout.budget_summary(self.log_file), color=self._colors.muted
_sick_tracker.budget_summary(history), color=self._colors.palette.muted
)
self._text(
_manual_workout.budget_summary(self.log_file),
color=self._colors.palette.muted,
)
frame = self._button_row()
self._button(
frame,
"TRY AGAIN",
bg=self._colors.accent,
bg=self._colors.palette.accent,
command=self._start_phone_check,
width=12,
).pack(side="left", padx=self._colors.space("sm"))
if _sick_tracker.is_budget_exhausted(history):
self._text(
"Sick budget exhausted. No 'I'm sick' option available.",
color=self._colors.danger,
color=self._colors.palette.danger,
)
else:
self._button(
frame,
"I'm sick",
bg=self._colors.warning,
bg=self._colors.palette.warning,
command=self.ask_if_sick,
width=12,
).pack(side="left", padx=self._colors.space("sm"))
if _manual_workout.is_budget_exhausted(self.log_file):
self._text(
"Manual-workout budget exhausted. No manual-log option available.",
color=self._colors.danger,
color=self._colors.palette.danger,
)
else:
self._button(
frame,
"Log Manual Workout",
bg=self._colors.accent,
bg=self._colors.palette.accent,
command=self._show_manual_workout_form,
width=16,
).pack(side="left", padx=self._colors.space("sm"))
@ -112,11 +121,13 @@ class UIFlowsMixin(SickDayFlowMixin, LockoutFlowMixin):
"✓ Manual Workout Logged!",
role="display",
scale=1.3,
color=self._colors.success,
color=self._colors.palette.success,
pad="lg",
)
self._text(entry.get("source", ""), role="subtitle", color=self._colors.success)
self._text("Unlocking...", role="body", color=self._colors.muted)
self._text(
entry.get("source", ""), role="subtitle", color=self._colors.palette.success
)
self._text("Unlocking...", role="body", color=self._colors.palette.muted)
unlock_delay = 1500 if self.demo_mode else 2000
self.root.after(unlock_delay, self.unlock_screen)
@ -134,11 +145,11 @@ class UIFlowsMixin(SickDayFlowMixin, LockoutFlowMixin):
"✓ Workout Verified!",
role="display",
scale=1.3,
color=self._colors.success,
color=self._colors.palette.success,
pad="lg",
)
self._text(message, role="subtitle", color=self._colors.success)
self._text("Unlocking...", role="body", color=self._colors.muted)
self._text(message, role="subtitle", color=self._colors.palette.success)
self._text("Unlocking...", role="body", color=self._colors.palette.muted)
unlock_delay = 1500 if self.demo_mode else 2000
self.root.after(unlock_delay, self.unlock_screen)
elif status == "too_short":
@ -175,7 +186,10 @@ class UIFlowsMixin(SickDayFlowMixin, LockoutFlowMixin):
"""
self.clear_container()
self._label(
"Checking RunnerUp...", role="display", color=self._colors.warning, pad="lg"
"Checking RunnerUp...",
role="display",
color=self._colors.palette.warning,
pad="lg",
)
self._text("Looking for today's run in RunnerUp...", role="body")
executor = ThreadPoolExecutor(max_workers=1)
@ -196,11 +210,13 @@ class UIFlowsMixin(SickDayFlowMixin, LockoutFlowMixin):
"✓ Run Verified!",
role="display",
scale=1.3,
color=self._colors.success,
color=self._colors.palette.success,
pad="lg",
)
self._text(message, role="subtitle", color=self._colors.success)
self._text("Unlocking...", role="body", color=self._colors.muted)
self._text(message, role="subtitle", color=self._colors.palette.success)
self._text(
"Unlocking...", role="body", color=self._colors.palette.muted
)
unlock_delay = 1500 if self.demo_mode else 2000
self.root.after(unlock_delay, self.unlock_screen)
else:

View File

@ -33,7 +33,7 @@ class LockoutFlowMixin:
f"Go work out!\nLocked for {self.lockout_time} seconds",
role="display",
scale=1.5,
color=self._colors.danger,
color=self._colors.palette.danger,
pad="lg",
)
self.countdown_label = self._label(
@ -82,10 +82,10 @@ class LockoutFlowMixin:
self._label(
"Cannot Verify Workout",
role="display",
color=self._colors.warning,
color=self._colors.palette.warning,
pad="md",
)
self._text(message, color=self._colors.warning)
self._text(message, color=self._colors.palette.warning)
self._text(
"Connect phone via ADB to skip this wait,\n"
"or wait for the penalty timer.\n\n"

View File

@ -24,7 +24,7 @@ class UIFlowsRelaxedMixin:
self._label(
"Verifying Workout",
role="display",
color=self._colors.warning,
color=self._colors.palette.warning,
pad="lg",
)
self._text(
@ -61,15 +61,15 @@ class UIFlowsRelaxedMixin:
"✓ Workout Verified!",
role="display",
scale=1.3,
color=self._colors.success,
color=self._colors.palette.success,
pad="lg",
)
self._text(message, role="subtitle", color=self._colors.success)
self._text(message, role="subtitle", color=self._colors.palette.success)
if adjusted:
self._text(
"Shutdown time moved later!",
role="subtitle",
color=self._colors.warning,
color=self._colors.palette.warning,
)
self.root.after(2000, self.close)
else:
@ -81,22 +81,22 @@ class UIFlowsRelaxedMixin:
self._label(
"Workout Not Found",
role="display",
color=self._colors.danger,
color=self._colors.palette.danger,
pad="md",
)
self._text(message, color=self._colors.warning)
self._text(message, color=self._colors.palette.warning)
frame = self._button_row()
self._button(
frame,
"TRY AGAIN",
bg=self._colors.accent,
bg=self._colors.palette.accent,
command=self._start_verify_workout_check,
width=12,
).pack(side="left", padx=self._colors.space("sm"))
self._button(
frame,
"Close",
bg=self._colors.field_bg,
bg=self._colors.palette.field_bg,
command=self.close,
width=12,
).pack(side="left", padx=self._colors.space("sm"))
@ -116,28 +116,28 @@ class UIFlowsRelaxedMixin:
self._label(
"Optional Day (Tue / Wed / Thu)",
role="title",
color=self._colors.warning,
color=self._colors.palette.warning,
pad="md",
)
self._text(
f"Weekly workouts: {count} / {WEEKLY_WORKOUT_MINIMUM}\n"
"No penalty for skipping today.",
role="subtitle",
color=self._colors.muted,
color=self._colors.palette.muted,
pad="sm",
)
frame = self._button_row()
self._button(
frame,
"Skip — No Penalty",
bg=self._colors.success,
bg=self._colors.palette.success,
command=self._skip_relaxed_day,
width=18,
).pack(side="left", padx=self._colors.space("sm"))
self._button(
frame,
"Log Stronglift Workout",
bg=self._colors.accent,
bg=self._colors.palette.accent,
command=self._start_relaxed_phone_check,
width=20,
).pack(side="left", padx=self._colors.space("sm"))
@ -158,7 +158,10 @@ class UIFlowsRelaxedMixin:
"""Run Stronglift check in relaxed mode (no screen grab, no sick option)."""
self.clear_container()
self._label(
"Checking phone...", role="display", color=self._colors.warning, pad="lg"
"Checking phone...",
role="display",
color=self._colors.palette.warning,
pad="lg",
)
self._text("Looking for today's workout in StrongLifts...", role="body")
executor = ThreadPoolExecutor(max_workers=1)
@ -192,21 +195,26 @@ class UIFlowsRelaxedMixin:
"""Show retry and skip-close when workout not found in relaxed mode."""
self.clear_container()
self._label(
"No Workout Found", role="display", color=self._colors.danger, pad="md"
"No Workout Found",
role="display",
color=self._colors.palette.danger,
pad="md",
)
self._text(
f"❌ {message}\n\nReason: {status}", color=self._colors.palette.warning
)
self._text(f"❌ {message}\n\nReason: {status}", color=self._colors.warning)
frame = self._button_row()
self._button(
frame,
"TRY AGAIN",
bg=self._colors.accent,
bg=self._colors.palette.accent,
command=self._start_relaxed_phone_check,
width=12,
).pack(side="left", padx=self._colors.space("sm"))
self._button(
frame,
"Close (Skip)",
bg=self._colors.success,
bg=self._colors.palette.success,
command=self.close,
width=14,
).pack(side="left", padx=self._colors.space("sm"))

View File

@ -20,14 +20,14 @@ class SickDayFlowMixin:
def _get_sick_day_status(self) -> tuple[str, str]:
"""Determine sick day status text and color."""
if self._sick_mode_used_today():
return "Shutdown time already adjusted today", self._colors.warning
return "Shutdown time already adjusted today", self._colors.palette.warning
if self._adjust_shutdown_time_earlier():
return (
"Shutdown time moved 1.5 hours earlier ✓\n(Will revert tomorrow)"
), self._colors.success
), self._colors.palette.success
return (
"Could not adjust shutdown time (check permissions)",
self._colors.danger,
self._colors.palette.danger,
)
def _proceed_to_sick_countdown(self) -> None:
@ -54,7 +54,7 @@ class SickDayFlowMixin:
countdown: int,
) -> None:
"""Display sick day UI labels and countdown."""
self._label("Sick Day Mode", color=self._colors.warning, pad="md")
self._label("Sick Day Mode", color=self._colors.palette.warning, pad="md")
self._text(status_text, color=status_color)
minutes = countdown // 60
self._text(

View File

@ -54,14 +54,14 @@ class UIFormFieldsMixin:
nothing focused the user's typing goes nowhere and there is no other
window on screen to make that obvious.
"""
row = parent.child_frame(bg=self._colors.bg)
row = parent.child_frame(bg=self._colors.palette.bg)
row.pack(pady=self._colors.space("sm"), fill="x")
row.child_widgets(
tk.Label,
text=label,
font=self._colors.font("label"),
fg=self._colors.fg,
bg=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
anchor="w",
).pack(side="top", anchor="w")
entries = row.child_widgets(
@ -69,9 +69,9 @@ class UIFormFieldsMixin:
textvariable=variable,
width=50,
font=self._colors.font("label"),
bg=self._colors.field_bg,
fg=self._colors.fg,
insertbackground=self._colors.fg,
bg=self._colors.palette.field_bg,
fg=self._colors.palette.fg,
insertbackground=self._colors.palette.fg,
**self._colors.focus_kwargs(),
)
entries.pack(side="top", anchor="w", pady=self._colors.space("xs"))
@ -96,14 +96,14 @@ class UIFormFieldsMixin:
not advertised anywhere. On a lock surface that means a user who tabs
into it can never reach the submit button.
"""
row = parent.child_frame(bg=self._colors.bg)
row = parent.child_frame(bg=self._colors.palette.bg)
row.pack(pady=self._colors.space("sm"), fill="x")
row.child_widgets(
tk.Label,
text=label,
font=self._colors.font("label"),
fg=self._colors.fg,
bg=self._colors.bg,
fg=self._colors.palette.fg,
bg=self._colors.palette.bg,
anchor="w",
).pack(side="top", anchor="w")
boxes = row.child_widgets(
@ -112,9 +112,9 @@ class UIFormFieldsMixin:
height=height,
wrap="word",
font=self._colors.font("label"),
bg=self._colors.field_bg,
fg=self._colors.fg,
insertbackground=self._colors.fg,
bg=self._colors.palette.field_bg,
fg=self._colors.palette.fg,
insertbackground=self._colors.palette.fg,
**self._colors.focus_kwargs(),
)
boxes.pack(side="top", anchor="w", pady=self._colors.space("xs"))

View File

@ -69,8 +69,8 @@ class UIWidgetsMixin(UIFormFieldsMixin):
tk.Label,
text=text,
font=self._colors.font(role, bold=True, scale=scale),
fg=color or self._colors.fg,
bg=self._colors.bg,
fg=color or self._colors.palette.fg,
bg=self._colors.palette.bg,
)
label.pack(pady=self._colors.space(pad))
return label
@ -92,8 +92,8 @@ class UIWidgetsMixin(UIFormFieldsMixin):
tk.Label,
text=text,
font=self._colors.font(role, scale=scale),
fg=color or self._colors.fg,
bg=self._colors.bg,
fg=color or self._colors.palette.fg,
bg=self._colors.palette.bg,
)
label.pack(pady=self._colors.space(pad))
return label
@ -109,12 +109,12 @@ class UIWidgetsMixin(UIFormFieldsMixin):
the bug by omission.
"""
fills = {
self._colors.accent,
self._colors.success,
self._colors.warning,
self._colors.danger,
self._colors.palette.accent,
self._colors.palette.success,
self._colors.palette.warning,
self._colors.palette.danger,
}
return self._colors.on_fill if bg in fills else self._colors.fg
return self._colors.palette.on_fill if bg in fills else self._colors.palette.fg
def _button(
self,
@ -174,6 +174,6 @@ class UIWidgetsMixin(UIFormFieldsMixin):
on every screen: the pixels it spends are the ones the manual-workout
form has left over on a 1024x600 panel.
"""
frame = self.container.child_frame(bg=self._colors.bg)
frame = self.container.child_frame(bg=self._colors.palette.bg)
frame.pack(pady=self._colors.space("sm"))
return frame

View File

@ -31,35 +31,35 @@ class UnlockViewMixin:
"Great job! 💪",
role="display",
scale=1.5,
color=self._colors.success,
color=self._colors.palette.success,
pad="lg",
)
if credit.shutdown_adjusted:
self._text(
"Shutdown time +2h later! 🎁",
role="title",
color=self._colors.warning,
color=self._colors.palette.warning,
)
if credit.extra_bonus_delta > 0:
self._text(
f"Extra workout today! +{credit.extra_bonus_delta}h tonight",
role="subtitle",
color=self._colors.warning,
color=self._colors.palette.warning,
)
if credit.new_debt is not None:
self._text(
f"Workout debt: {credit.new_debt}",
role="subtitle",
color=self._colors.warning
color=self._colors.palette.warning
if credit.new_debt > 0
else self._colors.muted,
else self._colors.palette.muted,
)
streak = current_streak(EXTRA_BENEFITS_FILE)
if streak >= 1:
self._text(
f"🔥 {streak}-week streak (5+ workouts each)",
role="label",
color=self._colors.muted,
color=self._colors.palette.muted,
)
self._text("Screen Unlocked!", role="display", pad="md")
if self.workout_data.get("type") in _COMMITTABLE:

View File

@ -11,20 +11,20 @@ by patching ``screen_locker._wake_state.WAKE_STATE_FILE``.
from __future__ import annotations
from datetime import UTC, datetime
import json
import logging
from gatelock.log_integrity import verify_entry_hmac
from screen_locker._constants import WAKE_STATE_FILE
from screen_locker._day import today_str
_logger = logging.getLogger(__name__)
def _today_str() -> str:
"""Return today's date as YYYY-MM-DD in UTC."""
return datetime.now(tz=UTC).strftime("%Y-%m-%d")
"""Return today's LOCAL date as YYYY-MM-DD (see ``screen_locker._day``)."""
return today_str()
def load_wake_state() -> dict[str, object] | None:

View File

@ -210,8 +210,8 @@ class WindowSetupMixin:
self.root,
text="✕ Close Demo",
font=self._colors.font("caption"),
bg=self._colors.danger,
fg=self._colors.on_fill,
bg=self._colors.palette.danger,
fg=self._colors.palette.on_fill,
command=self.close,
cursor="hand2",
)
@ -238,7 +238,7 @@ class WindowSetupMixin:
still does not fit scrolls, because ``_ensure_container`` wraps these
windows in a viewport too.
"""
self.root.configure(bg=self._colors.bg, cursor="arrow")
self.root.configure(bg=self._colors.palette.bg, cursor="arrow")
self.root.protocol("WM_DELETE_WINDOW", self.close)
# "" hands sizing back to the geometry manager instead of pinning it.
self.root.geometry("")

View File

@ -21,7 +21,7 @@
# whole ratchet.
#
# Add to /etc/sudoers.d/workout-locker:
# <username> ALL=(root) NOPASSWD: /home/kuhy/screen-locker/screen_locker/adjust_shutdown_schedule.sh
# <username> ALL=(root) NOPASSWD: /home/kuhy/src/screen-locker/screen_locker/adjust_shutdown_schedule.sh
set -euo pipefail

View File

@ -15,6 +15,7 @@ from typing import TYPE_CHECKING
from gatelock import (
GateRoot,
GrabPolicy,
LockConfig,
LockWindow,
)
@ -184,14 +185,17 @@ class ScreenLocker(
# color/font fields apply everywhere, so this is built unconditionally.
self._colors = LockConfig(
mode="hard",
grab="local" if demo_mode else "global",
disable_vt=not demo_mode,
# Opt in: a weaker holder (diet_guard, leetcode_guard) that already
# owns the grab must stand down rather than block enforcement
# forever -- the 2026-08-21 lockout was diet_guard holding it for
# hours. Safe in this direction only; gatelock never signals a
# holder that outranks us, so wake_alarm can still take the screen.
preempt_weaker_holder=not demo_mode,
grab=GrabPolicy(
kind="local" if demo_mode else "global",
disable_vt=not demo_mode,
# Opt in: a weaker holder (diet_guard, leetcode_guard) that
# already owns the grab must stand down rather than block
# enforcement forever -- the 2026-08-21 lockout was diet_guard
# holding it for hours. Safe in this direction only; gatelock
# never signals a holder that outranks us, so wake_alarm can
# still take the screen.
preempt_weaker_holder=not demo_mode,
),
)
# Built before setup(), which calls build_surface per live output.
self.container = FrameGroup([])

View File

@ -103,7 +103,7 @@ class StatusWindow(
# but it shares UIWidgetsMixin's factory with the locker, which now
# builds through a group. Filling the window rather than centring, so
# this is built here instead of via FrameGroup.single().
frame = tk.Frame(root, bg=self._colors.bg)
frame = tk.Frame(root, bg=self._colors.palette.bg)
frame.pack(fill="both", expand=True)
self.container = FrameGroup([frame])
self._start_temperature_check()
@ -127,11 +127,15 @@ class StatusWindow(
if self._phone_check_result is not None:
status, message = self._phone_check_result
color = (
self._colors.success if status == "verified" else self._colors.warning
self._colors.palette.success
if status == "verified"
else self._colors.palette.warning
)
self._text(f"Phone check ({status}): {message}", role="body", color=color)
if self._credit_message is not None:
self._text(self._credit_message, role="body", color=self._colors.success)
self._text(
self._credit_message, role="body", color=self._colors.palette.success
)
# "Check Phone"/"Log Manual Workout" are the primary write actions
# (accent, high contrast per rule 3); "Refresh"/"Close" are secondary
# utility actions (muted) -- two tiers instead of four arbitrary hues.
@ -139,7 +143,7 @@ class StatusWindow(
self._button(
frame,
"Check Phone",
bg=self._colors.accent,
bg=self._colors.palette.accent,
command=self._on_check_phone_clicked,
width=14,
).pack(side="left", padx=self._colors.space("sm"))
@ -147,21 +151,21 @@ class StatusWindow(
self._button(
frame,
"Log Manual Workout",
bg=self._colors.accent,
bg=self._colors.palette.accent,
command=self._show_manual_workout_form,
width=16,
).pack(side="left", padx=self._colors.space("sm"))
self._button(
frame,
"Refresh",
bg=self._colors.field_bg,
bg=self._colors.palette.field_bg,
command=self._on_refresh_clicked,
width=10,
).pack(side="left", padx=self._colors.space("sm"))
self._button(
frame,
"Close",
bg=self._colors.field_bg,
bg=self._colors.palette.field_bg,
command=self.root.destroy,
width=8,
).pack(side="left", padx=self._colors.space("sm"))
@ -219,7 +223,7 @@ def main(argv: list[str] | None = None) -> None:
root = tk.Tk()
root.title("Workout Status")
root.configure(bg=_STATUS_COLORS.bg)
root.configure(bg=_STATUS_COLORS.palette.bg)
root.minsize(560, 200)
def refresh() -> None:

View File

@ -184,7 +184,7 @@ class TestMultiLineField:
) -> None:
"""Both halves fan out, like every other widget helper here."""
locker = create_locker(mock_tk, tmp_path)
parent = locker.container.child_frame(bg=locker._colors.bg)
parent = locker.container.child_frame(bg=locker._colors.palette.bg)
mock_tk.Text.reset_mock()
boxes = locker._add_label_text(parent, label="Why?", height=3)
@ -202,7 +202,7 @@ class TestMultiLineField:
advertised way out -- on this lock, that means never reaching SUBMIT.
"""
locker = create_locker(mock_tk, tmp_path)
parent = locker.container.child_frame(bg=locker._colors.bg)
parent = locker.container.child_frame(bg=locker._colors.palette.bg)
boxes = locker._add_label_text(parent, label="Why?")
@ -213,7 +213,7 @@ class TestMultiLineField:
def test_paste_is_disabled(self, mock_tk: MagicMock, tmp_path: Path) -> None:
"""The justification has to be typed, like every other field here."""
locker = create_locker(mock_tk, tmp_path)
parent = locker.container.child_frame(bg=locker._colors.bg)
parent = locker.container.child_frame(bg=locker._colors.palette.bg)
boxes = locker._add_label_text(parent, label="Why?")

View File

@ -0,0 +1,140 @@
"""The workout day is the LOCAL calendar day, on every writer and reader.
Regression for 2026-09-13: a manual workout logged at 00:02 local (CEST,
``22:02Z`` the day before) was filed under the previous day because every
day-key derivation used ``datetime.now(tz=UTC)``. The lock check then looked
for the local date, found nothing, and locked the PC — while the trailing
window budget (which does not key on an exact date) happily counted it. Any
log between 00:00 and 02:00 local landed on yesterday.
Each test freezes the clock at that exact instant through
``screen_locker._day`` so the same mismatch can never come back on one of the
fourteen former ``now(tz=UTC)`` sites without failing here.
"""
from __future__ import annotations
from datetime import UTC, datetime, tzinfo
import json
import time
from typing import TYPE_CHECKING
from unittest.mock import patch
import pytest
from screen_locker import _day
from screen_locker._compliance_predicates import has_logged_today
from screen_locker._compliance_state import explain_lock_decision
from screen_locker._log_io import load_workout_log
from screen_locker._log_mixin import write_signed_entry
from screen_locker._sick_tracker import SickHistory
if TYPE_CHECKING:
from collections.abc import Iterator
from pathlib import Path
# 00:02:35 on 2026-09-13 in Europe/Warsaw — the football was logged then.
JUST_AFTER_MIDNIGHT_UTC = datetime(2026, 9, 12, 22, 2, 35, tzinfo=UTC)
LOCAL_DAY = "2026-09-13"
UTC_DAY = "2026-09-12"
@pytest.fixture
def warsaw_after_midnight(monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:
"""Pin TZ to Europe/Warsaw and the clock to 00:02:35 local on the 13th."""
monkeypatch.setenv("TZ", "Europe/Warsaw")
time.tzset()
class _FrozenClock:
"""Stands in for ``datetime`` inside ``_day``; only ``now`` is called."""
@staticmethod
def now(tz: tzinfo | None = None) -> datetime:
return JUST_AFTER_MIDNIGHT_UTC.astimezone(tz or UTC)
monkeypatch.setattr(_day, "datetime", _FrozenClock)
yield
monkeypatch.delenv("TZ")
time.tzset()
class TestTodayStr:
"""``_day.today_str`` is the single source of "what day is it"."""
def test_uses_the_local_calendar_day(self, warsaw_after_midnight: None) -> None:
assert _day.today_str() == LOCAL_DAY
def test_explicit_instant_is_converted_to_local(
self, warsaw_after_midnight: None
) -> None:
assert _day.today_str(JUST_AFTER_MIDNIGHT_UTC) == LOCAL_DAY
class TestAfterMidnightLog:
"""A workout logged just after local midnight counts for the new day."""
def test_write_and_lock_check_agree(
self, tmp_path: Path, warsaw_after_midnight: None
) -> None:
log_file = tmp_path / "log.json"
write_signed_entry(
log_file,
_day.today_str(),
{"type": "manual_workout", "start_time": "14:30"},
)
assert list(load_workout_log(log_file)) == [LOCAL_DAY]
with patch(
"screen_locker._compliance_predicates.verify_entry_hmac", return_value=True
):
assert has_logged_today(log_file) is True
def test_explain_sees_the_workout(
self, tmp_path: Path, warsaw_after_midnight: None
) -> None:
"""The read-only decision chain keys on the same local day."""
log_file = tmp_path / "log.json"
log_file.write_text(json.dumps({LOCAL_DAY: [{"workout_data": {"type": "x"}}]}))
with patch(
"screen_locker._compliance_predicates.verify_entry_hmac", return_value=True
):
result = explain_lock_decision(
log_file=log_file,
early_bird_pending_file=tmp_path / "early_bird_pending.json",
sick_history=SickHistory(),
extended_early_bird=False,
weekly_minimum_met=True,
relaxed_day=False,
now=JUST_AFTER_MIDNIGHT_UTC,
)
assert result.fired is False
assert result.stage == "already_logged"
def test_utc_day_entry_does_not_count(
self, tmp_path: Path, warsaw_after_midnight: None
) -> None:
"""An entry filed under the UTC day is yesterday's, not today's."""
log_file = tmp_path / "log.json"
log_file.write_text(json.dumps({UTC_DAY: [{"workout_data": {"type": "x"}}]}))
with patch(
"screen_locker._compliance_predicates.verify_entry_hmac", return_value=True
):
assert has_logged_today(log_file) is False
class TestCrossDayDedup:
"""``write_signed_entry`` dedups by workout_id across ALL days.
Moving an entry to its correct day must not let its synced copy re-ingest
under the old key: the id is globally unique, so the log is searched
whole, not per day.
"""
def test_same_workout_id_on_another_day_is_not_appended(
self, tmp_path: Path
) -> None:
log_file = tmp_path / "log.json"
data = {"type": "manual_workout", "workout_id": "manual:2026-09-12T14:30"}
assert write_signed_entry(log_file, LOCAL_DAY, data).appended is True
result = write_signed_entry(log_file, UTC_DAY, data)
assert result.appended is False
assert UTC_DAY not in load_workout_log(log_file)

View File

@ -32,7 +32,7 @@ class TestSectionManualWorkoutBudget:
for c in mock_tk.Label.call_args_list
if "week" in c.kwargs.get("text", "")
]
assert any(c.kwargs.get("fg") == window._colors.danger for c in calls)
assert any(c.kwargs.get("fg") == window._colors.palette.danger for c in calls)
def test_not_exhausted_uses_normal_color(self, mock_tk: MagicMock) -> None:
snap = _snapshot(
@ -44,7 +44,7 @@ class TestSectionManualWorkoutBudget:
for c in mock_tk.Label.call_args_list
if "week" in c.kwargs.get("text", "")
]
assert any(c.kwargs.get("fg") == window._colors.muted for c in calls)
assert any(c.kwargs.get("fg") == window._colors.palette.muted for c in calls)
class TestManualWorkoutButtonVisibility:

View File

@ -168,7 +168,7 @@ class TestSectionSickBudget:
for c in mock_tk.Label.call_args_list
if "week" in c.kwargs.get("text", "")
]
assert any(c.kwargs.get("fg") == window._colors.danger for c in calls)
assert any(c.kwargs.get("fg") == window._colors.palette.danger for c in calls)
def test_not_exhausted_uses_normal_color(self, mock_tk: MagicMock) -> None:
"""Not exhausted uses normal color."""
@ -179,7 +179,7 @@ class TestSectionSickBudget:
for c in mock_tk.Label.call_args_list
if "week" in c.kwargs.get("text", "")
]
assert any(c.kwargs.get("fg") == window._colors.muted for c in calls)
assert any(c.kwargs.get("fg") == window._colors.palette.muted for c in calls)
class TestSectionShutdown:

View File

@ -41,7 +41,7 @@ class TestPhoneCheckResultRendering:
if "Phone check" in c.kwargs.get("text", "")
]
assert calls
assert calls[-1].kwargs.get("fg") == window._colors.success
assert calls[-1].kwargs.get("fg") == window._colors.palette.success
def test_non_verified_result_shown_in_orange(self, mock_tk: MagicMock) -> None:
"""Non verified result shown in orange."""
@ -54,7 +54,7 @@ class TestPhoneCheckResultRendering:
if "Phone check" in c.kwargs.get("text", "")
]
assert calls
assert calls[-1].kwargs.get("fg") == window._colors.warning
assert calls[-1].kwargs.get("fg") == window._colors.palette.warning
class TestButtons:

View File

@ -55,7 +55,9 @@ class TestLockerFansOut:
row = locker._button_row()
mock_tk.Button.reset_mock()
locker._button(row, "OK", bg=locker._colors.accent, command=lambda: None)
locker._button(
row, "OK", bg=locker._colors.palette.accent, command=lambda: None
)
assert mock_tk.Button.call_count == len(TWO_OUTPUTS)

View File

@ -147,7 +147,7 @@ class TestGetSickDayStatus:
)
text, color = locker._get_sick_day_status()
assert "already adjusted" in text
assert color == locker._colors.warning
assert color == locker._colors.palette.warning
def test_adjustment_success(
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
@ -162,7 +162,7 @@ class TestGetSickDayStatus:
)
text, color = locker._get_sick_day_status()
assert "earlier" in text
assert color == locker._colors.success
assert color == locker._colors.palette.success
def test_adjustment_failure(
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
@ -177,7 +177,7 @@ class TestGetSickDayStatus:
)
text, color = locker._get_sick_day_status()
assert "Could not adjust" in text
assert color == locker._colors.danger
assert color == locker._colors.palette.danger
class TestShowRetryAndSick:

View File

@ -161,7 +161,7 @@ class TestSetupVerifyWindow:
locker.root.minsize.assert_called_once()
locker.root.maxsize.assert_called_once()
locker.root.configure.assert_called_with(
bg=locker._colors.bg,
bg=locker._colors.palette.bg,
cursor="arrow",
)
locker.root.protocol.assert_called_with(

View File

@ -143,7 +143,7 @@ class FormHost(UIWidgetsMixin, ManualWorkoutDialogMixin):
self.log_file = Path(self._log_dir.name) / "log.json"
self.log_file.write_text("{}")
self._colors = LockConfig()
self.container = FrameGroup.single(root, bg=self._colors.bg)
self.container = FrameGroup.single(root, bg=self._colors.palette.bg)
def _on_manual_workout_saved(self, entry: dict[str, object]) -> None:
"""Unused here; the form is never submitted."""

View File

@ -3,7 +3,7 @@
This used to append to ``screen_locker/scheduled_skips.json``, which only
screen-locker read. That file is no longer consulted by anything: the lock
chain now asks the shared pool (``~/utils/freedays``), so a day taken here
chain now asks the shared pool (``~/src/utils/freedays``), so a day taken here
also stands down diet-guard, wake-alarm, leetcode-guard and home-guard.
Kept as a thin wrapper rather than deleted because ``arm.sh`` calls it, and

View File

@ -3,7 +3,7 @@
# ============================================================================
# Fail if any dependency in the commit is behind its ecosystem's newest stable.
#
# Thin delegate to the shared gate in ~/utils, which owns the registry
# Thin delegate to the shared gate in ~/src/utils, which owns the registry
# adapters, the pre-release rules and the allowlist semantics. Copying that
# logic here is what lets one repo's idea of "current" drift from every other
# repo's -- so this script only locates the shared checker and forwards its
@ -18,12 +18,12 @@
set -euo pipefail
readonly SHARED_GATE="${UTILS_ROOT:-$HOME/utils}/scripts/check_dependency_freshness.sh"
readonly SHARED_GATE="${UTILS_ROOT:-$HOME/src/utils}/scripts/check_dependency_freshness.sh"
main() {
if [[ ! -x "$SHARED_GATE" ]]; then
echo "Error: shared dependency-freshness gate not found at $SHARED_GATE" >&2
echo " Clone github.com/kuhyx/utils to ~/utils, or set" >&2
echo " Clone github.com/kuhyx/utils to ~/src/utils, or set" >&2
echo " UTILS_ROOT to where it lives." >&2
exit 1
fi

View File

@ -3,7 +3,7 @@
# ============================================================================
# Fail if any markdown file breaks the shared naming convention.
#
# Thin delegate to the shared gate in ~/utils, which owns the four namespaces
# Thin delegate to the shared gate in ~/src/utils, which owns the four namespaces
# (README / CLAUDE* / DOCS* / TODO*), the "REMOVE ME AFTER FINISH" marker rule
# and the exemption list. Copying that logic here is what lets one repo's idea
# of a valid name drift from every other repo's -- so this script only locates
@ -16,12 +16,12 @@
set -euo pipefail
readonly SHARED_GATE="${UTILS_ROOT:-$HOME/utils}/scripts/check_md_naming.sh"
readonly SHARED_GATE="${UTILS_ROOT:-$HOME/src/utils}/scripts/check_md_naming.sh"
main() {
if [[ ! -x "$SHARED_GATE" ]]; then
echo "Error: shared markdown-naming gate not found at $SHARED_GATE" >&2
echo " Clone github.com/kuhyx/utils to ~/utils, or set" >&2
echo " Clone github.com/kuhyx/utils to ~/src/utils, or set" >&2
echo " UTILS_ROOT to where it lives." >&2
exit 1
fi

View File

@ -5,7 +5,7 @@
#
# The apps depend on crdt_sync as a *git dependency pinned to a tag*, so what
# CI builds is whatever that tag points at. A `dependency_overrides:` entry
# pointing at ~/utils/crdt_sync_dart is invaluable while developing an unreleased
# pointing at ~/src/utils/crdt_sync_dart is invaluable while developing an unreleased
# library change -- and catastrophic if it survives the commit: local tests go
# green against code CI has never seen, and the failure is silent in both
# directions.

View File

@ -43,7 +43,7 @@ import tkinter as tk
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from gatelock import LockConfig, LockWindow
from gatelock import GrabPolicy, LockConfig, LockWindow
from screen_locker._workout_app import ProcessHooks, workout_app_binary
from screen_locker._workout_handoff import lock_grab_handoff
@ -130,7 +130,7 @@ def main() -> int:
root = tk.Tk()
root.title("Workout handoff demo")
# Local grab + VT switching enabled: every escape hatch stays open.
config = LockConfig(mode="hard", grab="local", disable_vt=False)
config = LockConfig(mode="hard", grab=GrabPolicy(kind="local", disable_vt=False))
hooks = _DemoHooks()
lock = LockWindow(root, config, hooks)
hooks.lock = lock

View File

@ -31,7 +31,7 @@ _logger = logging.getLogger(__name__)
REPO_ROOT = Path(__file__).resolve().parent.parent
TODO_FILE = REPO_ROOT / "refactor_claude_todo.md"
GATE = REPO_ROOT / "scripts" / "check_file_length.sh"
FALLBACK_GATE = Path.home() / "utils" / "scripts" / "check_file_length.sh"
FALLBACK_GATE = Path.home() / "src/utils" / "scripts" / "check_file_length.sh"
BEGIN_MARKER = "<!-- BEGIN GENERATED VIOLATIONS -->"
END_MARKER = "<!-- END GENERATED VIOLATIONS -->"

97
scripts/rekey_log_entry.py Executable file
View File

@ -0,0 +1,97 @@
#!/usr/bin/env python3
r"""Move one ``log.json`` entry to the day it was really logged on.
Until 2026-09-13 the PC filed workouts under the UTC day, so anything logged
between local midnight and 02:00 CEST landed on *yesterday*. The code now
keys on the local day (``screen_locker._day``); this script repairs an entry
that was filed under the wrong key before that fix.
The HMAC signs ``timestamp`` + ``workout_data`` + ``workout_id`` — never the
day key — so the entry moves verbatim and still verifies. Its ``workout_id``
is kept too: the write chokepoint dedups by id across all days, so the synced
copy (still stamped with the old day) is recognised rather than re-ingested.
Reads and writes ``log.json`` directly rather than importing ``screen_locker``,
like the other scripts here: recovery must work while the package is mid-edit.
Usage:
python3 scripts/rekey_log_entry.py --workout-id manual:2026-09-12T14:30 \\
--to 2026-09-13
"""
from __future__ import annotations
import argparse
import json
import logging
from pathlib import Path
import sys
LOG_FILE = Path(__file__).resolve().parent.parent / "screen_locker" / "log.json"
_logger = logging.getLogger(__name__)
def _report(message: str) -> None:
"""Write one line to stdout (matches the other scripts in this directory)."""
sys.stdout.write(f"{message}\n")
def rekey(log: dict, workout_id: str, to_day: str) -> str:
"""Move the entry carrying ``workout_id`` under ``to_day`` in place.
Idempotent: an entry already under ``to_day`` is left alone. Raises
``LookupError`` when the id is not in the log at all — a silent no-op
there would let a caller revoke a sick day against nothing.
"""
for day, entries in log.items():
if not isinstance(entries, list):
continue
for entry in entries:
if entry.get("workout_id") != workout_id:
continue
if day == to_day:
return f" {workout_id}: already under {to_day} — nothing to do"
entries.remove(entry)
if not entries:
del log[day]
log.setdefault(to_day, []).append(entry)
return f" {workout_id}: moved {day} -> {to_day}"
msg = f"{workout_id} is not in the log"
raise LookupError(msg)
def main() -> int:
"""Re-key one entry and rewrite the log, or exit non-zero having changed nothing."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--workout-id", required=True, help="entry's workout_id")
parser.add_argument("--to", required=True, help="YYYY-MM-DD to file it under")
parser.add_argument("--log-file", default=str(LOG_FILE))
args = parser.parse_args()
log_path = Path(args.log_file)
try:
log = json.loads(log_path.read_text())
except (OSError, json.JSONDecodeError) as exc:
_logger.exception("Cannot read %s", log_path)
_report(f"ERROR: cannot read {log_path}: {exc}")
return 1
try:
outcome = rekey(log, args.workout_id, args.to)
except LookupError as exc:
_logger.exception("Nothing changed")
_report(f"ERROR: {exc} — nothing changed")
return 1
try:
log_path.write_text(json.dumps(log, indent=2))
except OSError as exc:
_logger.exception("Could not write %s", log_path)
_report(f"ERROR: could not write {log_path}: {exc}")
return 1
_report(outcome)
return 0
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s")
sys.exit(main())

View File

@ -18,7 +18,7 @@ whole ``tk`` module for every test so the suite can never reach a display, and
widget heights can only be measured by really rendering them. Like
``verify_lock_popup_safety.py``, this re-executes itself under Xvfb:
cd ~/screen-locker && python3 -m scripts.verify_screen_fits
cd ~/src/screen-locker && python3 -m scripts.verify_screen_fits
Run as a *module*, not a path: ``-m`` puts the repo root on ``sys.path`` so
``screen_locker`` resolves from the checkout. Running it as a path only works

View File

@ -235,10 +235,10 @@ packages:
dependency: "direct main"
description:
name: flutter_secure_storage
sha256: "15e8c8fe269fdf7d469b23008ab3df521c8b826ed345820532364c31bdebace6"
sha256: d87713a152ee2f255117bdbbf43da1dea1797e0551e499e0334f0c9dcfafddd2
url: "https://pub.dev"
source: hosted
version: "11.0.0"
version: "11.1.1"
flutter_secure_storage_darwin:
dependency: transitive
description:
@ -259,10 +259,10 @@ packages:
dependency: transitive
description:
name: flutter_secure_storage_platform_interface
sha256: "788060052712555182aba55ecb5f8b6e5cb9cfe8f776c83249a61fe3ce877db4"
sha256: "4bc033841169d07f690d46d89dbc3f5305b6562820822445384c82e0866e2719"
url: "https://pub.dev"
source: hosted
version: "2.0.3"
version: "2.1.0"
flutter_secure_storage_web:
dependency: transitive
description:
@ -714,10 +714,10 @@ packages:
dependency: "direct main"
description:
name: sqflite
sha256: "58a799e6ac17dd32fbab93813d39ed835a75ccc0f8f85b8955fe318c6712b082"
sha256: "54ad23e2a79c846b596b6c56cdd9c867ea58c288258402316b602f78df0cbfe0"
url: "https://pub.dev"
source: hosted
version: "2.4.3"
version: "2.4.4"
sqflite_android:
dependency: transitive
description:
@ -738,10 +738,10 @@ packages:
dependency: "direct main"
description:
name: sqflite_common_ffi
sha256: d5564f1308cafbf064be498f2beb1e993e742985a7cca9e2e228d6cbccd84a05
sha256: "4ec920a01788641fa1c9922e757c108427e7f8634cce3ce8a1073d573060f4a3"
url: "https://pub.dev"
source: hosted
version: "2.4.2+1"
version: "2.4.3"
sqflite_darwin:
dependency: transitive
description:

View File

@ -16,7 +16,7 @@ dependencies:
path: crdt_sync_dart
flutter:
sdk: flutter
flutter_secure_storage: 11.0.0
flutter_secure_storage: 11.1.1
# One-tap sign-in for the sync account. App-side only: crdt_sync stays pure
# Dart so it keeps working on Linux desktop and headless.
@ -26,10 +26,10 @@ dependencies:
path_provider: 2.1.6
permission_handler: 13.0.2
shared_preferences: 2.5.5
sqflite: 2.4.3
sqflite: 2.4.4
# Linux desktop has no sqflite plugin; the FFI factory drives the same
# schema (and already backed the test suite before the desktop target).
sqflite_common_ffi: 2.4.2+1
sqflite_common_ffi: 2.4.3
sync_settings_ui:
git:
url: https://github.com/kuhyx/utils
@ -55,7 +55,7 @@ flutter:
- assets/sounds/break_end.mp3
# Launcher icon generation. Source art is produced by the shared generator:
# PYTHONPATH=~/testsAndMisc python3 -m python_pkg.app_icons generate --app <key>
# PYTHONPATH=~/src/testsAndMisc python3 -m python_pkg.app_icons generate --app <key>
# then run: dart run flutter_launcher_icons
flutter_launcher_icons:
android: true

240
web/package-lock.json generated
View File

@ -8,8 +8,8 @@
"name": "screen-locker-web",
"version": "0.0.0",
"dependencies": {
"react": "19.2.8",
"react-dom": "19.2.8"
"react": "19.3.0",
"react-dom": "19.3.0"
},
"devDependencies": {
"@eslint/js": "10.0.1",
@ -17,9 +17,9 @@
"@testing-library/jest-dom": "7.0.1",
"@testing-library/react": "16.3.3",
"@testing-library/user-event": "14.6.7",
"@types/node": "26.4.1",
"@types/react": "19.2.18",
"@types/react-dom": "19.2.7",
"@types/node": "26.5.1",
"@types/react": "19.3.0",
"@types/react-dom": "19.3.0",
"@vitejs/plugin-react": "6.1.1",
"@vitest/coverage-v8": "5.0.0",
"eslint": "10.10.0",
@ -28,8 +28,8 @@
"globals": "17.12.0",
"jsdom": "30.0.1",
"typescript": "6.0.3",
"typescript-eslint": "8.69.0",
"vite": "8.2.2",
"typescript-eslint": "8.70.0",
"vite": "8.3.0",
"vitest": "5.0.0"
}
},
@ -124,7 +124,6 @@
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.29.7",
"@babel/generator": "^7.29.7",
@ -479,7 +478,6 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=20.19.0"
},
@ -528,7 +526,6 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=20.19.0"
}
@ -1097,7 +1094,6 @@
"integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
@ -1237,50 +1233,47 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "26.4.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.4.1.tgz",
"integrity": "sha512-k97ENvZWtvA6yqz5/FS6a7duDgOPEeOQOc2iKS/nY6mX6qJUKtLnWzQS+Xj6tXweyj6ZcTAK2Qecetnvi9nCLA==",
"version": "26.5.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.5.1.tgz",
"integrity": "sha512-CzNm2FezW4VR/LjG6yUdiEgLE/rAQ9Slj5gCu/C2VrdcW7I0ahNZ8DRbHT7zOZ6r3ONgd/bsQIeSaoDGrd1C6g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~8.3.0"
"undici-types": "~8.9.0"
}
},
"node_modules/@types/react": {
"version": "19.2.18",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz",
"integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",
"version": "19.3.0",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",
"integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"csstype": "^3.2.2"
}
},
"node_modules/@types/react-dom": {
"version": "19.2.7",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.7.tgz",
"integrity": "sha512-I8bPpDLcHBv1qiIiXDCy71Rt8eQDKJP0sMSWJphDdAcdqiJ1sGpZamavoEIRZmYzjia9LuEb2HlYdDpmoENpvQ==",
"version": "19.3.0",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz",
"integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==",
"dev": true,
"license": "MIT",
"peer": true,
"peerDependencies": {
"@types/react": "^19.2.0"
"@types/react": "^19.3.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.69.0.tgz",
"integrity": "sha512-t5jQTKPIgVW1PE6dR6H6Qz5gm8zjMlX5/2gRaOGd9eO6V7J+tQc6iWKukEe7dY8u9HyYasQ0yfF0/FSSTEO2gA==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.70.0.tgz",
"integrity": "sha512-/v8HZt6RlyIZxB3ntehELOcUcfxKPVGWXnQdJuHRmzrqgF8nQypcC/oxGW+Ot4VGKDq81XugPKxx0n5PBtf9PA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/regexpp": "^4.12.2",
"@typescript-eslint/scope-manager": "8.69.0",
"@typescript-eslint/type-utils": "8.69.0",
"@typescript-eslint/utils": "8.69.0",
"@typescript-eslint/visitor-keys": "8.69.0",
"@typescript-eslint/scope-manager": "8.70.0",
"@typescript-eslint/type-utils": "8.70.0",
"@typescript-eslint/utils": "8.70.0",
"@typescript-eslint/visitor-keys": "8.70.0",
"ignore": "^7.0.5",
"natural-compare": "^1.4.0",
"ts-api-utils": "^2.5.0"
@ -1293,15 +1286,15 @@
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"@typescript-eslint/parser": "^8.69.0",
"@typescript-eslint/parser": "^8.70.0",
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
"version": "7.0.8",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.8.tgz",
"integrity": "sha512-YYNsSlXBjMk92SKnkwvB5LOVSa6OznlFUGcsvrFgNJbJCd0M1XKeFVRc8ZByeCqz32FivYNHJVooLmdqrmvp/Q==",
"version": "7.0.9",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.9.tgz",
"integrity": "sha512-brTTsvFRt5C1gGHtPst/281UjPD5t9fBqbgoMPlVWy11ZLTPfu7HxK4ZYqO9H7o/yC9rSTCI85EaQ4OoY12qYw==",
"dev": true,
"license": "MIT",
"engines": {
@ -1309,17 +1302,16 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.69.0.tgz",
"integrity": "sha512-l4b0DhWioGg6Gt2ebGlvfkFMOjRsauxtsnDRwUSRX1qHq3HdTfQHV8wW9zEXeciai6HfeaKOedQn2Zoofx3WBw==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.70.0.tgz",
"integrity": "sha512-zYvrmj9Yxd63UGaXw+kdt6A0F0s0qveJyuatIM77bYC2DE4pgmg7a50u8LR7PRtXd0x+h+Tl3eXabGm06SWd3Q==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.69.0",
"@typescript-eslint/types": "8.69.0",
"@typescript-eslint/typescript-estree": "8.69.0",
"@typescript-eslint/visitor-keys": "8.69.0",
"@typescript-eslint/scope-manager": "8.70.0",
"@typescript-eslint/types": "8.70.0",
"@typescript-eslint/typescript-estree": "8.70.0",
"@typescript-eslint/visitor-keys": "8.70.0",
"debug": "^4.4.3"
},
"engines": {
@ -1335,14 +1327,14 @@
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.69.0.tgz",
"integrity": "sha512-yi4obFrHMmnsesWehHbkg9zMA7Jt8cXT+mKM08G999pH1yT6nqgsHx7MYm0uY1wAj8CqiBXYRJ7WAT0QdQHQXg==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.70.0.tgz",
"integrity": "sha512-hFHbTNqhU9G+2eKFXCBVb1tjFT/LceiJ4+HfLO4pTpDI0KHi6iajpcFFkaSQ9gXmCh7n82A0PthaayEdN6mspQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.69.0",
"@typescript-eslint/types": "^8.69.0",
"@typescript-eslint/tsconfig-utils": "^8.70.0",
"@typescript-eslint/types": "^8.70.0",
"debug": "^4.4.3"
},
"engines": {
@ -1357,14 +1349,14 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.69.0.tgz",
"integrity": "sha512-ewfspqWvSxKSOaplqAUNbaSFO0eB6w1EtQ+esfYFRm3614Ty4uNtExkcbgd6nWsXphbqKyf9ZYdbZdv2xEoWEQ==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.70.0.tgz",
"integrity": "sha512-8nP3Kwh5hlgZ4FicGvmznAmJe8UL4sdU8tLukrPaMuQmDuk4Y8xYfzu/aYZW4xT2JCgc7H/TpDI5cGlxcWJSqQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.69.0",
"@typescript-eslint/visitor-keys": "8.69.0"
"@typescript-eslint/types": "8.70.0",
"@typescript-eslint/visitor-keys": "8.70.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1375,9 +1367,9 @@
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.69.0.tgz",
"integrity": "sha512-xNqK7YTDZsLniQMV/4rpFR8Z5JlqeRvVjuG1YgF/mdPVH84HSD19L8CczMA0qg2RfwEV231GHH3VnToJDo4MfQ==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.70.0.tgz",
"integrity": "sha512-adnkeeNq9Sq1sUf4+FRVc0KdgYghzsgFpZSQVZVvY0LCuUuN0FnQgyGzCJeC4fW1cdXseBAjU2EOqUIjbNcZUw==",
"dev": true,
"license": "MIT",
"engines": {
@ -1392,15 +1384,15 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.69.0.tgz",
"integrity": "sha512-ZfoJAVg3JZndQEpEl9petVlxau3lRuElc4HRMuAlLCf8to04/iHz692RUSNmXKDjEuJmIL+KZ2/BsOcBc16dsA==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.70.0.tgz",
"integrity": "sha512-NUMKIhYVaVIVLnRL9CRt+VVcuLgSHUCpXn4/+K8wql+vdInUzvx8BjUO1oJ7cG9shjFJKtF8F8Hh2kCh3/KBVw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.69.0",
"@typescript-eslint/typescript-estree": "8.69.0",
"@typescript-eslint/utils": "8.69.0",
"@typescript-eslint/types": "8.70.0",
"@typescript-eslint/typescript-estree": "8.70.0",
"@typescript-eslint/utils": "8.70.0",
"debug": "^4.4.3",
"ts-api-utils": "^2.5.0"
},
@ -1417,9 +1409,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.69.0.tgz",
"integrity": "sha512-K3VrubUPhlo9VDBS6QdI8YB5j7ClpqLRdefcz6PFrhnwicehBweqQ9Evhl4l+FYz0HdDmMqIiSX0aldGRYtDCA==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.70.0.tgz",
"integrity": "sha512-asTOIYhDg4zdzOScCyaytrsV3cR6B4ecPQlXw/dJIm7J/MZTtCtfVII9JD8Geh4jTCrK/Xe6cg5UevoleMcoJQ==",
"dev": true,
"license": "MIT",
"engines": {
@ -1431,16 +1423,16 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.69.0.tgz",
"integrity": "sha512-AdFkgqck3Vudb/kWnxlyafU/4aBhHrbQ9locP2N4psXTy5mOBg0SHJumnLvx7r6g1gV4DKvUFwV2nJZBoqOD8w==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.70.0.tgz",
"integrity": "sha512-d9NmHMPEKQ7QCLLm1jI3zmoQBwT5KwFYjXBJ9ymZfKCUU+5rmTRykKAFvH5Qn/ZCds3CEAFS9OC9M/jkl0X2bA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.69.0",
"@typescript-eslint/tsconfig-utils": "8.69.0",
"@typescript-eslint/types": "8.69.0",
"@typescript-eslint/visitor-keys": "8.69.0",
"@typescript-eslint/project-service": "8.70.0",
"@typescript-eslint/tsconfig-utils": "8.70.0",
"@typescript-eslint/types": "8.70.0",
"@typescript-eslint/visitor-keys": "8.70.0",
"debug": "^4.4.3",
"minimatch": "^10.2.2",
"semver": "^7.7.3",
@ -1472,16 +1464,16 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.69.0.tgz",
"integrity": "sha512-tUbx60BBqQa31kXF5MCsOOLL5E/WzUuxIn7YpAvq+eaUlqvk8/NXnXMBNAdLCr0icjkzem7iUA5QqWHe/hJ1aw==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.70.0.tgz",
"integrity": "sha512-oZmtKJz/4fufZ2p3+Cn3ijEojcdfR+1zYDH2xKYrEly0dR/Q/1xUPRCOlKGxod78nWlU2UnDe09GZ3TaknBFGA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.9.1",
"@typescript-eslint/scope-manager": "8.69.0",
"@typescript-eslint/types": "8.69.0",
"@typescript-eslint/typescript-estree": "8.69.0"
"@typescript-eslint/scope-manager": "8.70.0",
"@typescript-eslint/types": "8.70.0",
"@typescript-eslint/typescript-estree": "8.70.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1496,13 +1488,13 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.69.0.tgz",
"integrity": "sha512-+rmdgPA+EXkNgKYvHvFfhrs35utXbwaC5PGpDquSXcoXQDKUA5UjV0LmTucG/4JXkM31BTu4TilHtrN8IVBe8w==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.70.0.tgz",
"integrity": "sha512-BoC8PiO4Hkdo0TVJh9Ntxr5MxPDI7/oFsrygN5ADelFSeXG/qgNuucIGA+L5Z6JpPTE/uRfcTWtscjbUaufepQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.69.0",
"@typescript-eslint/types": "8.70.0",
"eslint-visitor-keys": "^5.0.0"
},
"engines": {
@ -1549,7 +1541,6 @@
"integrity": "sha512-toMg6PZGCIa/lQNCDoASrfb1ly4hsUKXFtFYC9kD4t78o5Y6LyNJU7AENt8eHPr3quYdxaxK7hj2mnbFfUk9NA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@bcoe/v8-coverage": "^1.0.2",
"@vitest/istanbul-lib-coverage": "^1.0.0",
@ -1640,7 +1631,6 @@
"integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@ -1803,7 +1793,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.11.12",
"caniuse-lite": "^1.0.30001809",
@ -2057,7 +2046,6 @@
"integrity": "sha512-NPXn6r5zl4uET1DAVPaOwzX3rut4c0wcmw3dWJAfOsTM5+TogXo0DDjz8pwm/hL8cyVNpHqeK4JpN0NjnyFFNw==",
"dev": true,
"license": "MIT",
"peer": true,
"workspaces": [
"packages/*"
],
@ -2614,7 +2602,6 @@
"integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@keyv/serialize": "^1.1.1"
}
@ -2993,9 +2980,9 @@
"license": "MIT"
},
"node_modules/nanoid": {
"version": "3.3.18",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz",
"integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==",
"version": "3.3.19",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz",
"integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==",
"dev": true,
"funding": [
{
@ -3138,7 +3125,6 @@
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -3147,9 +3133,9 @@
}
},
"node_modules/postcss": {
"version": "8.5.26",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.26.tgz",
"integrity": "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==",
"version": "8.5.28",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz",
"integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==",
"dev": true,
"funding": [
{
@ -3167,7 +3153,7 @@
],
"license": "MIT",
"dependencies": {
"nanoid": "^3.3.17",
"nanoid": "^3.3.18",
"picocolors": "^1.1.1",
"source-map-js": "^1.2.1"
},
@ -3231,26 +3217,24 @@
"license": "MIT"
},
"node_modules/react": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz",
"integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",
"version": "19.3.0",
"resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz",
"integrity": "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/react-dom": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz",
"integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==",
"version": "19.3.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.0.tgz",
"integrity": "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==",
"license": "MIT",
"peer": true,
"dependencies": {
"scheduler": "^0.27.0"
"scheduler": "^0.28.0"
},
"peerDependencies": {
"react": "^19.2.8"
"react": "^19.3.0"
}
},
"node_modules/react-is": {
@ -3332,9 +3316,9 @@
}
},
"node_modules/scheduler": {
"version": "0.27.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
"integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
"version": "0.28.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
"integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",
"license": "MIT"
},
"node_modules/semver": {
@ -3546,7 +3530,6 @@
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@ -3556,16 +3539,16 @@
}
},
"node_modules/typescript-eslint": {
"version": "8.69.0",
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.69.0.tgz",
"integrity": "sha512-B3MltX0VqjUBNEe3b3sSuiRbfa6XrfHFtBiPamjT5AsW/dfq+y+bc0wyuS9DxAS1LyzCxRp2+rxzpLUvqM2BvA==",
"version": "8.70.0",
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.70.0.tgz",
"integrity": "sha512-P/W5cz70/cQAuKfY3xwQMWWTV7BvJ0mAQmi+9mBcsVPaBUpd6Ohpa+fECv9rBFrQcig86jAiNBFNWUqnTjr4pw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "8.69.0",
"@typescript-eslint/parser": "8.69.0",
"@typescript-eslint/typescript-estree": "8.69.0",
"@typescript-eslint/utils": "8.69.0"
"@typescript-eslint/eslint-plugin": "8.70.0",
"@typescript-eslint/parser": "8.70.0",
"@typescript-eslint/typescript-estree": "8.70.0",
"@typescript-eslint/utils": "8.70.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -3590,9 +3573,9 @@
}
},
"node_modules/undici-types": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
"integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
"version": "8.9.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
"integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",
"dev": true,
"license": "MIT"
},
@ -3638,17 +3621,16 @@
}
},
"node_modules/vite": {
"version": "8.2.2",
"resolved": "https://registry.npmjs.org/vite/-/vite-8.2.2.tgz",
"integrity": "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q==",
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/vite/-/vite-8.3.0.tgz",
"integrity": "sha512-lhZBVvEHefgE+HQZC9O7EBJgCU/nVzFNl7vkS4RE0APtWLP02/8QVIkQtzBxPquh7lq5/78NHipTj7ODQ6XuyQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"lightningcss": "^1.33.0",
"picomatch": "^4.0.5",
"postcss": "^8.5.26",
"rolldown": "~1.2.4",
"picomatch": "^4.0.7",
"postcss": "^8.5.28",
"rolldown": "~1.2.6",
"tinyglobby": "^0.2.17"
},
"bin": {
@ -3665,7 +3647,7 @@
},
"peerDependencies": {
"@types/node": "^20.19.0 || >=22.12.0",
"@vitejs/devtools": "^0.4.0 || ^0.5.0",
"@vitejs/devtools": "^0.7.1",
"esbuild": "^0.27.0 || ^0.28.0",
"jiti": ">=1.21.0",
"less": "^4.0.0",
@ -3722,7 +3704,6 @@
"integrity": "sha512-gpsMNoRhMjMktVxPtstOH4/PJuPyovVaMDr4oDilXaGH1EcqM2OE96SoHT2VIQ6fTGtTjqmHDrEu2X9RQiXf8Q==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/chai": "^5.2.2",
"@vitest/mocker": "5.0.0",
@ -3934,7 +3915,6 @@
"integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}

View File

@ -14,8 +14,8 @@
"coverage": "vitest run --coverage"
},
"dependencies": {
"react": "19.2.8",
"react-dom": "19.2.8"
"react": "19.3.0",
"react-dom": "19.3.0"
},
"devDependencies": {
"@eslint/js": "10.0.1",
@ -23,9 +23,9 @@
"@testing-library/jest-dom": "7.0.1",
"@testing-library/react": "16.3.3",
"@testing-library/user-event": "14.6.7",
"@types/node": "26.4.1",
"@types/react": "19.2.18",
"@types/react-dom": "19.2.7",
"@types/node": "26.5.1",
"@types/react": "19.3.0",
"@types/react-dom": "19.3.0",
"@vitejs/plugin-react": "6.1.1",
"@vitest/coverage-v8": "5.0.0",
"eslint": "10.10.0",
@ -34,8 +34,8 @@
"globals": "17.12.0",
"jsdom": "30.0.1",
"typescript": "6.0.3",
"typescript-eslint": "8.69.0",
"vite": "8.2.2",
"typescript-eslint": "8.70.0",
"vite": "8.3.0",
"vitest": "5.0.0"
}
}

View File

@ -1,5 +1,5 @@
/*
* Tokens from ~/utils/unified-design-system (DOCS-tokens.md). Values are copied
* Tokens from ~/src/utils/unified-design-system (DOCS-tokens.md). Values are copied
* rather than imported because that system ships as documentation plus
* per-stack generators, not an npm package -- keep these in step with it rather
* than inventing new ones.

View File

@ -61,7 +61,7 @@ export function makeHealth(over: Partial<HealthPayload> = {}): HealthPayload {
armed: true,
disarmed: false,
disarm_marker: '/home/kuhy/.local/share/screen_locker/DISARMED',
log_file: '/home/kuhy/screen-locker/screen_locker/log.json',
log_file: '/home/kuhy/src/screen-locker/screen_locker/log.json',
log_age_seconds: 3600,
decision_log_file: '/home/kuhy/.local/share/screen_locker/decisions.jsonl',
last_decision_age_seconds: 120,

View File

@ -19,4 +19,4 @@ ExecStart=/usr/bin/python3 -m screen_locker.screen_lock --sync-only
# disabled early-bird-workout-check.timer and nothing noticed for 13 days).
# ExecStartPost without "-" means a disarmed locker marks this unit failed, so
# it surfaces in `systemctl --user --failed` instead of scrolling past.
ExecStartPost=/usr/bin/python3 %h/screen-locker/scripts/check_enforcement_armed.py --quiet
ExecStartPost=/usr/bin/python3 %h/src/screen-locker/scripts/check_enforcement_armed.py --quiet