Compare commits

..

3 Commits

Author SHA1 Message Date
50c32c4f40 Find shared sync screen by type, not title
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (flutter, flutter-analyze, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,flutter-analyze) (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / lock-popup-safety (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (0) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (1) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (2) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (3) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (4) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (5) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (6) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (7) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (8) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (9) (push) Has been cancelled
Tests / web-coverage (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Tests / flutter-coverage (push) Has been cancelled
sync_settings_ui 0.7.0 is text-free; its AppBar title is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:08:26 +01:00
459b400b6a Bump sickdays 0.5.0, sync_settings_ui 0.7.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:53:08 +01:00
aa70a9181f Add deploy script and CLAUDE.md deploy line
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 14:42:45 +01:00
7 changed files with 126 additions and 9 deletions

View File

@ -122,3 +122,4 @@ wait, and tests pin the retry to 0.
- lint: `pre-commit run ruff --all-files`
- coverage: `python -m pytest -n auto -p no:sugar -q`
- coverage-gaps: `coverage-gaps coverage.lcov`
- deploy: `git -C ~/src/screen-locker pull --ff-only && bash ~/src/screen-locker/scripts/deploy.sh` (reinstalls, restarts web/poke/runnerup units, health-checks them, then release-deploys the workout app; exit 46 from the phone guard means kuhy reruns it with `PHONE_PROTECT_ALLOW=com.kuhy.workout_app`)

View File

@ -12,7 +12,7 @@ dependencies = [
"freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.0#subdirectory=freedays",
"earned-time @ git+https://github.com/kuhyx/utils@earned-time-v0.21.0#subdirectory=earned_time",
"holds @ git+https://github.com/kuhyx/utils@holds-v0.1.0#subdirectory=holds",
"sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.4.0#subdirectory=sickdays",
"sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.0#subdirectory=sickdays",
]
[project.scripts]

View File

@ -22,7 +22,7 @@ pytest-xdist==3.8.0
# module imports it itself, so it is declared rather than assumed.
requests==2.34.2
ruff==0.17.4
sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.4.0#subdirectory=sickdays
sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.0#subdirectory=sickdays
types-requests==2.33.0.20261030
# Direct dependency since the Firebase session stream (_session_stream) catches
# urllib3's own errors on the long-lived SSE read; requests pulls it in, but

115
scripts/deploy.sh Executable file
View File

@ -0,0 +1,115 @@
#!/bin/bash
# Deploy screen-locker for real: update the live clone, reinstall, restart the
# long-running user units, prove they are healthy, then ship the workout app.
#
# Usage: bash scripts/deploy.sh [--health-only]
#
# Every path is anchored on the LIVE clone (~/src/screen-locker), never on this
# script's own directory: install.sh installs editable from wherever it sits,
# so running a worktree copy of it would point the services at scratch code.
#
# workout-locker.service is deliberately NOT restarted: it is the login-time
# gate and starting it can lock the display. Its timer is only re-enabled.
#
# Phone: phone_deploy.sh refuses com.kuhy.workout_app (exit 46) unless kuhy
# runs this himself with PHONE_PROTECT_ALLOW=com.kuhy.workout_app and the app
# closed. This script never sets that variable; it passes the caller's
# environment through and fails loudly when the guard refuses.
#
# Seams: SCREEN_LOCKER_LIVE (live clone), DEPLOY_WEB_PORT (health port).
# Exit: 0 healthy and installed everywhere | 1 any step or check failed.
set -euo pipefail
readonly LIVE="${SCREEN_LOCKER_LIVE:-$HOME/src/screen-locker}"
readonly PY="/usr/bin/python3"
readonly APP_DIR="stronglift_replacement/workout_app"
readonly PHONE_DEPLOY="$HOME/.claude/scripts/phone_deploy.sh"
readonly UNITS=(screen-locker-web.service workout-poke.service runnerup-watch.service)
die() { echo "deploy: FAIL: $*" >&2; exit 1; }
ok() { echo "deploy: ok: $*"; }
main_pid() { systemctl --user show -p MainPID --value "$1"; }
web_port() {
if [[ -n "${DEPLOY_WEB_PORT:-}" ]]; then
echo "$DEPLOY_WEB_PORT"
else
(cd /tmp && "$PY" -c 'from screen_locker._web_server import DEFAULT_PORT; print(DEFAULT_PORT)')
fi
}
# /api/health answers and reports enforcement armed; retried while the
# freshly restarted server binds its port.
check_web() {
local port body i
port="$(web_port)"
for i in $(seq 1 15); do
if body="$(curl -fsS --max-time 2 "http://127.0.0.1:$port/api/health" 2>/dev/null)"; then
jq -e '.armed == true' >/dev/null <<<"$body" \
|| die "web health on :$port says enforcement is NOT armed"
ok "web /api/health on :$port armed (try $i)"
return 0
fi
sleep 1
done
die "web /api/health on :$port did not answer within 15 s"
}
health() {
local unit
for unit in "${UNITS[@]}"; do
systemctl --user is-active --quiet "$unit" || die "$unit is not active"
ok "$unit active"
done
check_web
"$PY" "$LIVE/scripts/check_enforcement_armed.py" --quiet \
|| die "check_enforcement_armed.py: enforcement is not armed"
ok "enforcement armed"
"$PY" "$LIVE/scripts/poke_selftest.py" sandbox >/dev/null \
|| die "workout-poke sandbox self-test failed"
ok "workout-poke signed sandbox round trip"
local mod
mod="$(cd /tmp && "$PY" -c 'import screen_locker; print(screen_locker.__file__)')"
[[ "$mod" == "$LIVE"/* ]] || die "screen_locker imports from $mod, not $LIVE"
ok "screen_locker imports from the live clone"
}
desktop() {
local unit
declare -A before=()
git -C "$LIVE" pull --ff-only || die "git pull --ff-only in $LIVE (dirty or diverged?)"
[[ "$(git -C "$LIVE" rev-parse HEAD)" == "$(git -C "$LIVE" rev-parse '@{u}')" ]] \
|| die "$LIVE HEAD is not its upstream after the pull"
ok "live clone at $(git -C "$LIVE" rev-parse --short HEAD)"
bash "$LIVE/install.sh" || die "install.sh failed"
for unit in "${UNITS[@]}"; do before[$unit]="$(main_pid "$unit")"; done
systemctl --user restart "${UNITS[@]}" || die "restart of ${UNITS[*]} failed"
for unit in "${UNITS[@]}"; do
[[ "$(main_pid "$unit")" != "${before[$unit]}" ]] \
|| die "$unit kept PID ${before[$unit]}: restart did not take"
done
ok "restarted ${UNITS[*]}"
}
phone() {
local rc=0
bash "$PHONE_DEPLOY" "$LIVE/$APP_DIR" --release || rc=$?
case "$rc" in
0) ok "workout app release build installed on the phone" ;;
46) die "phone_deploy protect guard (exit 46) refused com.kuhy.workout_app;" \
"kuhy runs: PHONE_PROTECT_ALLOW=com.kuhy.workout_app bash $LIVE/scripts/deploy.sh" \
"with the workout app closed" ;;
*) die "phone_deploy.sh exited $rc (see its exit-code table)" ;;
esac
}
if [[ "${1:-}" == "--health-only" ]]; then
health
exit 0
fi
desktop
health
phone
ok "deployed"

View File

@ -1172,11 +1172,11 @@ packages:
dependency: "direct main"
description:
path: sync_settings_ui
ref: "sync_settings_ui-v0.6.3"
resolved-ref: eef7af4c86837ee82891493587ff3456297e5dea
ref: "sync_settings_ui-v0.7.0"
resolved-ref: "3084080d744c348a217727e26a6be838e7d5a4ff"
url: "https://github.com/kuhyx/utils"
source: git
version: "0.6.3"
version: "0.7.0"
synchronized:
dependency: transitive
description:

View File

@ -63,7 +63,7 @@ dependencies:
sync_settings_ui:
git:
url: https://github.com/kuhyx/utils
ref: sync_settings_ui-v0.6.3
ref: sync_settings_ui-v0.7.0
path: sync_settings_ui
url_launcher: 6.3.3
uuid: 4.6.0

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:http/http.dart' as http;
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:sync_settings_ui/sync_settings_ui.dart';
import 'package:workout_app/models/exercise.dart';
import 'package:workout_app/models/workout_plan.dart';
import 'package:workout_app/screens/settings_screen.dart';
@ -105,9 +106,9 @@ void main() {
await tester.tap(iconLabeled('Sync settings'));
await tester.pumpAndSettle();
// The shared package's own screen -- its AppBar title, not this app's.
expect(find.text('Sync settings'), findsOneWidget);
expect(find.text('Firebase sync'), findsWidgets);
// The shared package's own screen (text-free since sync_settings_ui 0.7.0,
// so it is found by type, not by its old AppBar title).
expect(find.byType(SyncSettingsScreen), findsOneWidget);
});
testWidgets('opening Advanced sync (GitHub) pushes the app-local screen', (