screen-locker/screen_locker
Krzysztof kuhy Rudnicki ffc6c72df0 Push under a persisted per-install uuid, not a fixed role id
screen_locker pushed manual workouts as "pc" and the workout app as "phone".
A role constant collides the moment a second machine takes the same role, and
after a reinstall the new install inherits the previous one's CRDT identity.
Both halves now mint a uuid once and persist it: the PC in
~/.local/share/screen_locker/.device_id, the app under SharedPreferences
'crdt.nodeId' -- the same key every sibling app uses.

The old constant survives as the legacy id and is passed to sync_log /
syncLog, so devices/<legacy>/ is skipped as this device's own rather than
re-downloaded and re-merged as a peer's on every tick. It drops to None once
that path is reclaimed.

Note the *read* loop in _workout_sync deliberately still merges every device
including this one: the PC needs its own manual workouts in the merged view,
so "skip own" would be wrong there. Only the push path and the HLC node id
move.

The test fixture redirecting the new id file is added in the same change that
introduces the constant -- without it the first test that syncs mints a uuid
into the real state dir and this machine's live sync identity is decided by
whichever test ran first. Verified: ~/.local/share/screen_locker/ held no
.device_id after a full suite run.

Verified against the live backend, not just mocks: ran the real
push_pc_workouts, which minted 57582b3b and pushed 9 records. In the RTDB the
new device's log is a strict superset of both old paths -- 0 of devices/pc/'s
10 records and 0 of devices/phone/'s 9 are missing from it.

Python: 907 tests, 100% branch coverage. workout_app: 313 tests, analyzer
clean. Pins bumped to crdt-sync-v0.6.0 / crdt_sync_dart-v0.7.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GZH89WEqAjuJT8WZdqc7AP
2026-08-09 17:31:15 +02:00
..
tests Push under a persisted per-install uuid, not a fixed role id 2026-08-09 17:31:15 +02:00
__init__.py Fix test discovery and coverage for python_pkg modules 2025-12-02 22:33:34 +01:00
_auto_upgrade.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_compliance_state.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_constants.py Push under a persisted per-install uuid, not a fixed role id 2026-08-09 17:31:15 +02:00
_device.py Push under a persisted per-install uuid, not a fixed role id 2026-08-09 17:31:15 +02:00
_early_bird.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_extra_benefits.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_heat_skip.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_log_io.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_log_mixin.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_manual_push.py Push under a persisted per-install uuid, not a fixed role id 2026-08-09 17:31:15 +02:00
_manual_sync.py Give manual workouts full effect parity; raise minimum to 5, double budget 2026-07-19 13:50:39 +02:00
_manual_workout_dialog.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_manual_workout_widgets.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_manual_workout.py Give manual workouts full effect parity; raise minimum to 5, double budget 2026-07-19 13:50:39 +02:00
_mcp.py Port the MCP server to mcp 2.x, and say what each tool is allowed to do 2026-08-03 19:48:07 +02:00
_phone_verification.py Make Check Phone week-aware; add RunnerUp GPS tolerance; fix CLI weekly count 2026-07-18 06:55:55 +02:00
_runnerup_db.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_runnerup_verification.py Make Check Phone week-aware; add RunnerUp GPS tolerance; fix CLI weekly count 2026-07-18 06:55:55 +02:00
_shutdown_base.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_shutdown.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_sick_dialog.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_sick_tracker.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_status_data.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_status_view_verify.py Make Check Phone week-aware; add RunnerUp GPS tolerance; fix CLI weekly count 2026-07-18 06:55:55 +02:00
_status.py Make Check Phone week-aware; add RunnerUp GPS tolerance; fix CLI weekly count 2026-07-18 06:55:55 +02:00
_surface_group.py Type the surface groups properly and exempt the test helpers by name 2026-07-25 16:56:59 +02:00
_sync_retry.py Retry sync past the boot/resume network race, and stop blaming the token 2026-07-20 08:46:37 +02:00
_temperature_status_mixin.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_temperature.py Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00
_time_check.py Support multiple workouts per day; fix the dead sync; ban silent failures 2026-07-17 09:22:31 +02:00
_ui_flows_relaxed.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_ui_flows.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_ui_widgets.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_unlock_view.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_wake_state.py Migrate to the shared gatelock backend 2026-06-21 20:11:16 +02:00
_weekly_check.py Give manual workouts full effect parity; raise minimum to 5, double budget 2026-07-19 13:50:39 +02:00
_window_setup.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
_workout_credit.py Give manual workouts full effect parity; raise minimum to 5, double budget 2026-07-19 13:50:39 +02:00
_workout_sync.py Sync workouts through Firebase, mirroring to GitHub during the cutover 2026-08-05 08:12:40 +02:00
adjust_shutdown_schedule.sh fix: resolve shutdown-schedule canonical path via guardctl dynamically 2026-07-04 11:48:39 +02:00
screen_lock.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00
status_view.py Stop the lock screen scrolling itself, and make every screen fit 768px 2026-08-03 15:57:48 +02:00