Compare commits

...

2 Commits

Author SHA1 Message Date
94081233f2 ci_mirror: run flutter with the git hook's environment stripped
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
The pre-push gate failed on `flutter analyze` with "The current Flutter SDK
version is 0.0.0-unknown", while the same command passed when run by hand.

`git push` exports GIT_DIR to its hooks, and the flutter tool shells out to
git to identify its own SDK. With GIT_DIR set it reads THIS repository
instead of /opt/flutter -- `flutter --version` inside the hook reports

    Flutter 3.47.0-0.1.pre • channel main • https://github.com/kuhyx/diet-guard
    Framework • revision 84bd5503 (our own HEAD)

so pub cannot resolve any SDK constraint and every dependency is "forbidden".
Worse, flutter writes that answer into its own version cache, so the next
caller -- in any repo -- inherits it until something repairs it.

Wrapping the two flutter calls in `env -u GIT_DIR ...` fixes it at the point
of use. Not `--no-verify`: the gate was right that something was wrong, it
just was not the code being pushed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-26 15:26:54 +02:00
c6663da06a Pin gatelock 0.2.1 for the recovery-loop fail-open fix
0.2.0's recovery loop scheduled the next tick after running it, so any
exception out of a tick permanently ended all re-assertion of coverage, grab
and VT for the rest of the lock -- silently, since Tk logs and swallows
exceptions from `after` callbacks. 0.2.1 moves the reschedule into a
`finally`.

Also in 0.2.1: `holds_grab` no longer reads a grab held by one of our own
transient children (a posted menu) as "the grab was lost" and takes it back.
That one was a real, user-visible bug on screen-locker's gate windows; the
same class of widget on a diet_guard gate would have behaved the same way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-26 15:21:19 +02:00
3 changed files with 17 additions and 4 deletions

View File

@ -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.2.0#subdirectory=gatelock",
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.2.1#subdirectory=gatelock",
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.1.0#subdirectory=crdt-sync",
"requests>=2.31.0",
]

View File

@ -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.1.0#subdirectory=crdt-sync
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.2.0#subdirectory=gatelock
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.2.1#subdirectory=gatelock
mcp>=1.9
mypy>=1.8.0
pre-commit>=3.6.0

View File

@ -88,6 +88,19 @@ run_pytest_clean_venv() {
"$VENV_DIR/bin/python" -m pytest "$@" || fail "pytest (clean requirements.txt venv)"
}
# Run flutter with the calling git hook's environment stripped.
#
# `git push` exports GIT_DIR (and friends) to its hooks, and the flutter tool
# shells out to git to identify its own SDK. With GIT_DIR set it reads THIS
# repository instead of /opt/flutter: `flutter --version` then reports our
# HEAD as the framework revision and our URL as the repository, pub resolves
# the SDK as `0.0.0-unknown`, every version constraint fails, and the wrong
# answer is written into flutter's own version cache for the next caller.
flutter_clean_env() {
env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX \
-u GIT_COMMON_DIR -u GIT_OBJECT_DIRECTORY flutter "$@"
}
# Gate the Flutter companion app the same way: analyze (pre-commit has no Dart
# hooks) then the full test suite. Deliberately fails rather than skips when
# flutter is missing -- a gate that quietly passes on a machine without the
@ -101,9 +114,9 @@ run_flutter_gates() {
fail "flutter is not on PATH but app/ exists (cannot verify the app)"
fi
log "flutter analyze (app/)"
(cd "$APP_DIR" && flutter analyze) || fail "flutter analyze"
(cd "$APP_DIR" && flutter_clean_env analyze) || fail "flutter analyze"
log "flutter test (app/)"
(cd "$APP_DIR" && flutter test) || fail "flutter test"
(cd "$APP_DIR" && flutter_clean_env test) || fail "flutter test"
}
main() {