testsAndMisc/docs/superpowers/evidence/focus-owner-location-and-workout-2026-08-09.json
Krzysztof kuhy Rudnicki d0fcda3a47
Some checks are pending
Pre-commit checks / pre-commit (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
Provision home coordinates out of git; layer the workout signal; drop the test hook
The geofence needs HOME_LAT/HOME_LON, but those say where I live, so the
committed policy asset is generated with --redact-home and the real values are
pushed to app-private storage instead. push_home_location.sh greps
config_secrets.sh rather than sourcing it -- that file holds other secrets and
this script has no business evaluating them -- and refuses the shipped
REDACTED_* placeholder with a message naming the file to fill in, rather than
writing whatever the parse happened to land on.

Private storage was chosen for its lifetime as much as its permissions: it does
not survive an uninstall, so reinstalling forces re-provisioning instead of
silently inheriting a stale home. The default umask left the file 666, so the
script chmods it 600; the shell user gets Permission denied, and the
/data/local/tmp staging copy is removed after the transfer.

Every read failure returns null rather than throwing. Null reaches the
enforcement layer as location-unknown, which already fails closed into
enforcing -- so a corrupt coordinates file cannot become an unlock, and cannot
crash the service either.

Workout detection replaces a root-only SQLite read of StrongLifts' private
database. The manual source is time-boxed rather than a plain toggle, because a
workout mode left on by accident is indistinguishable from having no exception
at all. The guarded wrapper catches broadly and times out: nothing about a
workout probe failing should be able to stop enforcement running. The combined
source can name which signal opened the exception, so the UI can explain an
unlock rather than presenting it as magic. Only the two sources verified to
exist on this device will be wired -- com.kuhy.workout_app exposes nothing
readable and org.runnerup is not installed.

HideTestReceiver is deleted. It proved setApplicationHidden persistence, which
is what it was for, but it applied policy from an exported receiver and that has
no place in a build that will later hold device owner. Confirmed absent from the
rebuilt and reinstalled APK.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AwepyL5Lxs5QKbKkMpxxxL
2026-08-09 21:42:20 +02:00

59 lines
5.0 KiB
JSON

{
"intent": "Let the geofence work without committing the user's home coordinates, and detect workouts through channels an unrooted app can read.",
"scope": [
"focus_owner/lib/home_location.dart - new: read/write/clear app-private coordinates",
"focus_owner/scripts/push_home_location.sh - new: provisioning from config_secrets.sh",
"focus_owner/lib/workout_signal.dart - new: manual, guarded and combined sources",
"focus_owner/test/{home_location,workout_signal}_test.dart - new: 24 tests",
"focus_owner/android/.../HideTestReceiver.kt - DELETED, plus its manifest entry",
"Non-goal: no Device Owner provisioning; the app still applies no policy"
],
"changes": [
"Coordinates are pushed to app-private storage rather than committed. The asset stays redacted, and the provisioning script greps config_secrets.sh instead of sourcing it - that file holds other secrets and this script has no business evaluating them.",
"Private storage was chosen for its lifetime as much as its permissions: it does not survive an uninstall, so reinstalling forces re-provisioning rather than silently inheriting a stale home.",
"Every failure mode in HomeLocationStore.read returns null instead of throwing. Null flows into the enforcement layer as location-unknown, which already fails closed into enforcing - so a corrupt file cannot become an unlock, and cannot crash the service either.",
"The manual workout signal is time-boxed rather than a toggle: a workout mode left on by accident is indistinguishable from having no exception at all.",
"GuardedWorkoutSignal catches broadly and times out, because nothing about a workout probe failing should be able to stop enforcement running. CombinedWorkoutSignal can name the source that opened the exception, so the UI can explain an unlock rather than presenting it as magic.",
"HideTestReceiver deleted. It had served its purpose - proving setApplicationHidden persistence - and it applied policy from an exported receiver, which has no place in a build that will later hold device owner."
],
"verification": [
{
"command": "./focus_owner/scripts/push_home_location.sh (real config_secrets.sh)",
"result": "pass",
"evidence": "Exits non-zero with \"HOME_LAT is 'REDACTED_LAT', not a coordinate - fill in .../config_secrets.sh\". The shipped placeholder cannot silently become a geofence anchor."
},
{
"command": "./focus_owner/scripts/push_home_location.sh --secrets <real-shaped> && --check",
"result": "pass",
"evidence": "'Coordinates written to com.kuhy.focus_owner private storage' then 'OK coordinates provisioned (43 bytes)'. --check reports presence and size only, never the coordinates themselves, since its output lands in scrollback and transcripts."
},
{
"command": "adb shell run-as ... ls -la; adb shell cat /data/data/.../home_location.json",
"result": "pass",
"evidence": "-rw------- after an explicit chmod 600 (the default umask had left it 666), and the shell user gets 'Permission denied'. The /data/local/tmp staging copy is gone."
},
{
"command": "cd focus_owner && flutter analyze && flutter test",
"result": "pass",
"evidence": "'No issues found!' and 67 tests passing, 24 new. Covers malformed JSON, a non-object document, missing and non-numeric coordinates (the shape a leaked placeholder would take), out-of-range values, window expiry, and probes that throw or hang."
},
{
"command": "rebuild + reinstall + dumpsys package | grep -c HideTest + am start",
"result": "pass",
"evidence": "0 references in the installed APK. App launches and stays alive with no FATAL entries. dumpsys device_policy still reports Device Owner Type: -1."
}
],
"risks": [
"push_home_location.sh depends on run-as, which only works against a debuggable build. A release APK will need a different channel for the coordinates.",
"The coordinates now exist on the device in plaintext inside app-private storage. That is the same exposure the rooted system already accepted for config_secrets.sh, but it is worth stating: root or a full device backup would reveal them.",
"GuardedWorkoutSignal catches Object deliberately. That is the right call inside an enforcement loop, but it means a genuinely broken Health Connect integration will look identical to 'no workout in progress' - it needs its own logging when that path is implemented.",
"workoutExemptPackages still hardcodes the youtube.com mapping, so a new unblock domain in config.sh will not map to a package by itself.",
"Untouched and still true: DO hiding in user 0 is unproven, and BOOT_COMPLETED does not fire until first unlock."
],
"rollback": [
"git revert. All the new files are additive and nothing outside focus_owner imports them.",
"On the device: adb shell run-as com.kuhy.focus_owner rm -f files/home_location.json removes the provisioned coordinates.",
"After rollback validate: flutter analyze && flutter test pass, and push_home_location.sh --check reports no coordinates provisioned."
]
}