From 0173f4c56c290bc620f3d03f12492bc11dd87154 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Fri, 21 Aug 2026 13:06:19 +0200 Subject: [PATCH] Queue behind stronger lockers; bump gatelock to v0.7.1 Diet_guard was one of the two lockers missing gatelock's wait_for_turn fix -- confirmed live on 2026-08-21, it held the global grab for ~3 minutes against a newly-arriving, higher-ranked screen_locker, which just retried and logged instead of making progress. Now queues behind any stronger claim before arming. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_018M5gKyYzxWG6QkCaj1wWfk --- .pre-commit-config.yaml | 2 +- app/pubspec.yaml | 2 +- diet_guard/_gatelock.py | 4 ++++ pyproject.toml | 2 +- requirements.txt | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a1f3e7..0dfd775 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -102,7 +102,7 @@ repos: additional_dependencies: - pytest - requests - - gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.5.0#subdirectory=gatelock + - gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.1#subdirectory=gatelock - crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.6.0#subdirectory=crdt-sync - mcp>=2,<3 - pydantic diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 4de82bc..377b8ce 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -2,7 +2,7 @@ name: diet_guard_app description: "Companion phone app for diet_guard: log meals on the go." publish_to: 'none' -version: 1.0.40+1 +version: 1.0.41+1 environment: sdk: ^3.12.2 diff --git a/diet_guard/_gatelock.py b/diet_guard/_gatelock.py index dc5503a..2b6cfd8 100644 --- a/diet_guard/_gatelock.py +++ b/diet_guard/_gatelock.py @@ -52,6 +52,7 @@ from gatelock import ( LockConfig, LockWindow, SurfaceInfo, + wait_for_turn, ) from diet_guard._gate import due_slots @@ -151,6 +152,9 @@ class MealGate(_GateCalendar): disable_vt=config.resolved_disable_vt(), ) arbiter.publish() + # Wait with nothing on screen for any stronger claim; never exits + # here, so a higher-ranked locker means "later", never "skip". + wait_for_turn(arbiter) arbiter.acquire_holder() self._lock = LockWindow(self.root, config, hooks=self, arbiter=arbiter) self._vars = make_vars(self.root) diff --git a/pyproject.toml b/pyproject.toml index c5f6110..65c0f25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "1.0.0" description = "Tkinter/systemd log-to-unlock meal gate with calorie/macro budget tracking" requires-python = ">=3.10" dependencies = [ - "gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.5.0#subdirectory=gatelock", + "gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.1#subdirectory=gatelock", "crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.6.0#subdirectory=crdt-sync", "requests>=2.31.0", ] diff --git a/requirements.txt b/requirements.txt index 4540b2b..d7f14d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ bandit>=1.7.0 codespell>=2.2.0 coverage>=7.4.0 crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.6.0#subdirectory=crdt-sync -gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.5.0#subdirectory=gatelock +gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.1#subdirectory=gatelock mcp>=2,<3 mypy>=1.8.0 pre-commit>=3.6.0