Compare commits

...

4 Commits

Author SHA1 Message Date
7aae649d44 Bump crdt_sync_flutter to 0.8.2
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,free-days-interop) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / free-days-interop (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:12:55 +01:00
a353977afd Bump Python pins to latest stable
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:11:05 +01:00
38fb4f3763 Add motion tokens and haptics to the phone app
Motion tokens hand-copied from DOCS-motion.md into theme.dart; every
page route goes through appRoute() (slow, decelerate in, accelerate
out, instant under Remove animations). mediumImpact on the picker
confirm, heavyImpact on a refused time. The Clock app line shows only
when the SET_ALARM handoff finished before its 3 s timeout. Sound is
skipped on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:09:48 +01:00
78c41bd167 Latch the ring's sick/free stand-down
On 2026-11-11 the ring stood down for a sick day, the mark was cleared
at 11:38, and the 19:31 stick check judged a miss and sent a lockdown
for a day whose alarm never rang. AlarmReceiver now latches the skip
and StickCheck honours it after a later clear.

Docs: the 11-01/10-26 PC no_session rings were correct (no session
started before A+15); the focus-owner on-device check is still open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 07:57:50 +01:00
21 changed files with 278 additions and 39 deletions

View File

@ -107,9 +107,9 @@ repos:
# the manifest becomes an unresolvable hook environment rather
# than merely an old one.
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.12.0#subdirectory=gatelock
- crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.0#subdirectory=crdt-sync
- freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.2#subdirectory=freedays
- sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.3#subdirectory=sickdays
- crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync
- freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.3#subdirectory=freedays
- sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.4#subdirectory=sickdays
# Test suites intentionally use patterns (protected-access, magic-value
# comparisons) that don't belong in the source-code 10/10 gate.
exclude: ^(\.venv/)|(^|/)(tests/|conftest\.py)

View File

@ -23,7 +23,7 @@ screen, and every log line and event says `sick_day`.
| Per-locker sheet | `phone_app/lib/screens/sick_day_sheet.dart` (+ the dot in `day_cell.dart`) |
| Sync | `phone_app/lib/services/sick_day_sync.dart` (shared tick: `day_pool_sync.dart`), Firebase only |
| Ring path | `android/.../SickDays.kt` (+ `DayCache.kt`), read in `AlarmReceiver` through `RingDecision.kt` |
| Stick | `StickCheck.kt`: verdict `sick_day`; the streak skips sick days like free days |
| Stick | `StickCheck.kt`: verdict `sick_day`; the streak skips sick days like free days; a ring skipped for a sick day stays `sick_day` after a later clear (`RingWatch.markSkipped`) |
| Pre-alarm sync | `PoolSyncAlarm.kt`, `PoolSyncSchedule.kt`, `PoolSyncEngine.kt` → `poolSyncMain` → `day_pool_refresh.dart` |
## The picker

View File

@ -35,6 +35,19 @@ unreachable counts as "no ping, no session" (fail toward ringing) and is
logged as `firebase_unreachable`. While ringing, stop conditions are polled
every 20 s.
**A `no_session` ring after a phone ring is correct, not a missed read
(traced 2026-11-16).** On 2026-10-26 and 2026-11-01 the PC went
`waiting` → `no_session` at A+15. It never logged `phone_silent`, so it did
see `ring_started`. What it never saw was a session for today: the
session tick logged "Newest morning is 2026-10-25" and "2026-10-29" all
morning. Firebase agrees. On 11-01 the phone fired, opened the ring screen
at 07:43 and then logged nothing until a boot at 11:27: no `dismissed`
event, no session. On 10-26 the session started at 11:01. So the PC was
right on both days. A ringing phone that nobody dismisses is the case the
`no_session` row exists for. `test_fallback_policy.py`
(`test_ring_started_waits_for_the_session_grace`) pins it. Why the phone
went quiet after 07:43 on 11-01 is a separate phone question.
**Sound.** 100 %, unmuted, a tone that rises over the first 60 s.
- Active graphical session on seat0 → user PipeWire (`wpctl` + `pw-play`).
- Otherwise (night lockdown: lightdm masked, nobody logged in; kuhy is not in
@ -129,6 +142,22 @@ retracted) and audit behave exactly as on a normal stick day.
`data.reason = "sick_day"` (by analogy with `free_day`); the audit treats
it as not the morning's ring.
**A stand-down latches at ring time (fixed 2026-11-16).** On 2026-11-11 the
07:40 ring stood down for a sick day (`alarm_fired reason=sick_day`), the
phone cleared the mark at 11:38, and the 19:31 stick check re-read the cache,
found a normal Wednesday with no dismissal and sent a lockdown. That punished
a day whose alarm never rang, so no dismiss was possible. `AlarmReceiver` now
records the skip (`RingWatch.markSkipped`, a `DateHistory` per reason), and
`StickCheck.decideDay` returns `sick_day`/`free_day` for a latched day even
after a clear. The streak look-back skips it too. A phone that was off at A
latches nothing, so a clear still makes that day a stick day (hole 1).
Tests: `StickCheckSickTest`.
**Still open: on-device check.** At the next real miss (Tue/Wed/Thu), right
after 09:30 run `adb -s 23181JEGR08034 logcat -d | grep -E
"LOCKDOWN_ACTIVATED|WORKDAY_LOCKDOWN"` (read-only) and confirm
`LOCKDOWN_ACTIVATED` is followed by `WORKDAY_LOCKDOWN`.
### Escape hatch (until 2026-10-15 inclusive)
Bug-glyph button on the stakes card (spoken label "That was a bug"; the

View File

@ -27,13 +27,15 @@ class AlarmReceiver : BroadcastReceiver() {
}
// A shared free or sick day means the alarm does not ring -- not
// later, not quieter, not at all -- and nothing ring-related is
// recorded: no markFired (the stick's own check skips the day too)
// and no ring_started for the PC. Re-arm for tomorrow (the armed
// recorded: no markFired and no ring_started for the PC. Only the
// skip itself is latched, so the stick still stands the day down if
// the mark is cleared after the ring time. Re-arm for tomorrow (the armed
// instant has passed, so it rolls over) so the day after is normal.
// Both caches fail closed: unreadable means ring.
val skip = RingDecision.skip(FreeDays.isToday(context), SickDays.isToday(context))
if (skip != null) {
Log.i(TAG, "${skip.label}: not ringing; re-armed for tomorrow")
RingWatch.markSkipped(context, skip)
EventLog.append(context, "alarm_fired", mapOf("reason" to skip.wire))
AlarmScheduler.rearmFromStorage(context)
return

View File

@ -32,6 +32,7 @@ object RingWatch {
private const val KEY_FIRED_DATE = "fired_date"
private const val KEY_DISMISSED_DATE = "dismissed_date"
private const val KEY_DISMISSED_DATES = "dismissed_dates"
private const val KEY_SKIPPED_PREFIX = "skipped_dates_"
fun markFired(context: Context) {
prefs(context).edit().putString(KEY_FIRED_DATE, today()).apply()
@ -42,6 +43,21 @@ object RingWatch {
DateHistory.add(prefs(context), KEY_DISMISSED_DATES, LocalDate.now())
}
/**
* Latches that today's ring stood down for [skip]; called from
* [AlarmReceiver]. The stick reads it back via [skippedOn], so clearing
* the mark later that day cannot make the silenced day a miss.
*/
fun markSkipped(context: Context, skip: RingSkip) {
DateHistory.add(prefs(context), KEY_SKIPPED_PREFIX + skip.wire, LocalDate.now())
}
/** Why the ring stood down on [day], or null when it was not skipped. */
fun skippedOn(context: Context, day: LocalDate): RingSkip? =
RingSkip.entries.firstOrNull {
DateHistory.contains(prefs(context), KEY_SKIPPED_PREFIX + it.wire, day)
}
/**
* Whether the dismiss gate completed on [day]; read by [StickRunner],
* which judges past days too. The single [KEY_DISMISSED_DATE] predates

View File

@ -38,6 +38,14 @@ data class StickInputs(
val state: StickState,
/** The last day whose verdict was final, or null before the first run. */
val checkedThrough: LocalDate?,
/**
* Why the daily ring stood down on a day, latched by [AlarmReceiver] at
* ring time, or null when it rang (or the phone was off). Outlives a
* later clear of the mark: the ring was silenced, so no dismiss was
* possible, and a clear at 11:38 must not turn the day into a miss
* (2026-11-11).
*/
val ringSkippedOn: (LocalDate) -> RingSkip? = { null },
)
/** One day's verdict within a run. */
@ -60,7 +68,7 @@ data class StickRun(
* so every rule here is checkable in isolation.
*
* A **miss** is a stick day (Tue/Wed/Thu, [WorkdayStick.STICK_DAYS]) that is
* neither a free day nor a sick day, whose alarm passed by at least [Stakes.STICK_GRACE_MINUTES]
* neither a free day nor a sick day (now, or when its ring stood down), whose alarm passed by at least [Stakes.STICK_GRACE_MINUTES]
* with no dismiss and no escape, and that has not already been penalised.
* Nothing here needs the ring to have *fired*: a phone switched off before
* the alarm misses exactly like one left ringing (hole 1 of the contract).
@ -121,6 +129,11 @@ object StickCheck {
// A sick day stands the stick down like a free day: no miss, no
// streak change, no lockdown -- and nothing carried to tomorrow.
if (inputs.isSick(day)) return StickVerdict.SICK_DAY to state
when (inputs.ringSkippedOn(day)) {
RingSkip.FREE_DAY -> return StickVerdict.FREE_DAY to state
RingSkip.SICK_DAY -> return StickVerdict.SICK_DAY to state
null -> Unit
}
// A dismissed or escaped stick day breaks the chain: the streak
// shown and synced drops to 0 (a lockdown already sent stays).
if (inputs.escapedOn(day)) return StickVerdict.ESCAPED to state.copy(streak = 0)
@ -173,6 +186,6 @@ object StickCheck {
fun isStickDay(day: LocalDate): Boolean = day.dayOfWeek in WorkdayStick.STICK_DAYS
}
/** A day the stick skips entirely: free or sick. */
/** A day the stick skips entirely: free or sick, now or at ring time. */
val StickInputs.standsDown: (LocalDate) -> Boolean
get() = { isFree(it) || isSick(it) }
get() = { isFree(it) || isSick(it) || ringSkippedOn(it) != null }

View File

@ -35,6 +35,7 @@ object StickRunner {
isSick = { SickDays.isSick(context, it) },
state = before,
checkedThrough = StickStore.checkedThrough(context),
ringSkippedOn = { RingWatch.skippedOn(context, it) },
),
)
for ((day, verdict) in run.verdicts) {
@ -69,7 +70,7 @@ object StickRunner {
fun onDismissed(context: Context) {
val today = LocalDate.now()
if (!StickCheck.isStickDay(today) || FreeDays.isFree(context, today) ||
SickDays.isSick(context, today)
SickDays.isSick(context, today) || RingWatch.skippedOn(context, today) != null
) {
return
}

View File

@ -20,6 +20,7 @@ class StickCheckSickTest {
free: Set<LocalDate> = emptySet(),
state: StickState = StickState(),
checkedThrough: LocalDate? = null,
skipped: Map<LocalDate, RingSkip> = emptyMap(),
) = StickInputs(
now = now,
alarm = LocalTime.of(7, 30),
@ -29,6 +30,7 @@ class StickCheckSickTest {
isSick = { it in sick },
state = state,
checkedThrough = checkedThrough,
ringSkippedOn = { skipped[it] },
)
@Test
@ -73,6 +75,40 @@ class StickCheckSickTest {
)
}
@Test
fun aSickMarkClearedAfterTheSkippedRingIsStillSick() {
// 2026-11-11: the ring stood down for a sick day at A, the mark was
// cleared at 11:38, and the 19:31 run must not call the day a miss.
val run = StickCheck.run(
inputs(wed.atTime(19, 31), skipped = mapOf(wed to RingSkip.SICK_DAY)),
)
assertEquals(StickVerdict.SICK_DAY, run.verdicts.single().verdict)
assertEquals(StickState(), run.state)
assertNull(run.signalUntil)
}
@Test
fun aFreeMarkClearedAfterTheSkippedRingIsStillFree() {
val run = StickCheck.run(
inputs(wed.atTime(19, 31), skipped = mapOf(wed to RingSkip.FREE_DAY)),
)
assertEquals(StickVerdict.FREE_DAY, run.verdicts.single().verdict)
}
@Test
fun aSkippedRingDayIsSkippedWhenTheStreakLooksBack() {
val before = StickState(streak = 1, lockedThrough = wed, lastMiss = tue)
val run = StickCheck.run(
inputs(
thu.atTime(9, 0),
state = before,
checkedThrough = tue,
skipped = mapOf(wed to RingSkip.SICK_DAY),
),
)
assertEquals(2, run.state.streak)
}
@Test
fun aFreeDayIsStillNamedFree() {
val run = StickCheck.run(inputs(wed.atTime(9, 0), free = setOf(wed)))

View File

@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:developer' as developer;
import 'package:flutter/services.dart';
import 'package:material_ui/material_ui.dart';
import 'package:wake_alarm_sync/screens/free_days_screen.dart';
@ -14,6 +15,7 @@ import 'package:wake_alarm_sync/services/alarm_sync_service.dart';
import 'package:wake_alarm_sync/services/day_pool_refresh.dart';
import 'package:wake_alarm_sync/services/firebase_backend.dart';
import 'package:wake_alarm_sync/services/sync_settings.dart';
import 'package:wake_alarm_sync/ui/motion_route.dart';
/// Main screen: displays the current alarm time and syncs it to the PC via
/// the shared crdt_sync transport.
@ -117,9 +119,12 @@ class _HomeScreenState extends State<HomeScreen> {
helpText: '',
);
if (picked == null) return;
// The tap that sets the alarm: felt now, before any await or intent.
unawaited(HapticFeedback.mediumImpact());
final accepted = await AlarmPolicy.setEarlier(picked.hour, picked.minute);
if (!mounted) return;
if (!accepted) {
unawaited(HapticFeedback.heavyImpact());
setState(
() => _status =
'That is not earlier than $current. The alarm can only be '
@ -134,6 +139,9 @@ class _HomeScreenState extends State<HomeScreen> {
// publish attempt was the one at startup, so an alarm moved earlier here
// never reached the PC at all.
await _syncToPc();
if (!mounted) return;
// Keep the armed time in the confirmation; the sync result follows it.
setState(() => _status = 'Armed for ${_fmt(_hour, _minute)}. $_status');
}
/// Re-reads the policy and arms the alarm to match it.
@ -180,7 +188,7 @@ class _HomeScreenState extends State<HomeScreen> {
),
onPressed: () => Navigator.push<void>(
context,
MaterialPageRoute<void>(builder: (_) => const FreeDaysScreen()),
appRoute<void>(context, (_) => const FreeDaysScreen()),
),
),
IconButton(
@ -191,7 +199,7 @@ class _HomeScreenState extends State<HomeScreen> {
),
onPressed: () => Navigator.push<void>(
context,
MaterialPageRoute<void>(builder: (_) => const SickDaysScreen()),
appRoute<void>(context, (_) => const SickDaysScreen()),
),
),
IconButton(
@ -204,8 +212,9 @@ class _HomeScreenState extends State<HomeScreen> {
onPressed: () async {
await Navigator.push<void>(
context,
MaterialPageRoute<void>(
builder: (_) => SettingsScreen(alarmService: _service),
appRoute<void>(
context,
(_) => SettingsScreen(alarmService: _service),
),
);
// Publish too, not just reload: a tag registered in Settings

View File

@ -14,6 +14,7 @@ import 'package:wake_alarm_sync/services/alarm_sync_service.dart';
import 'package:wake_alarm_sync/services/data_transfer.dart';
import 'package:wake_alarm_sync/services/firebase_backend.dart';
import 'package:wake_alarm_sync/services/google_sign_in_backend.dart';
import 'package:wake_alarm_sync/ui/motion_route.dart';
import 'package:wake_alarm_sync/ui/theme.dart';
/// Settings screen: links to the two sync surfaces.
@ -121,8 +122,9 @@ class SettingsScreen extends StatelessWidget {
),
trailing: const Icon(Icons.chevron_right),
onTap: () => Navigator.of(context).push<void>(
MaterialPageRoute(
builder: (_) => SyncSettingsScreen(
appRoute<void>(
context,
(_) => SyncSettingsScreen(
accountLoader: loadAccount,
accountSaver: saveAccount,
accountClearer: clearAccount,
@ -140,7 +142,7 @@ class SettingsScreen extends StatelessWidget {
leading: const Icon(Icons.nfc, semanticLabel: 'Room proof'),
trailing: const Icon(Icons.chevron_right),
onTap: () => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (_) => const RoomProofScreen()),
appRoute<void>(context, (_) => const RoomProofScreen()),
),
),
ListTile(
@ -152,7 +154,7 @@ class SettingsScreen extends StatelessWidget {
),
trailing: const Icon(Icons.chevron_right),
onTap: () => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (_) => const SessionTagsScreen()),
appRoute<void>(context, (_) => const SessionTagsScreen()),
),
),
ListTile(
@ -164,7 +166,7 @@ class SettingsScreen extends StatelessWidget {
),
trailing: const Icon(Icons.chevron_right),
onTap: () => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (_) => const HomeLocationScreen()),
appRoute<void>(context, (_) => const HomeLocationScreen()),
),
),
ListTile(
@ -187,7 +189,7 @@ class SettingsScreen extends StatelessWidget {
],
),
onTap: () => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (_) => const GitHubMirrorScreen()),
appRoute<void>(context, (_) => const GitHubMirrorScreen()),
),
),
],

View File

@ -37,7 +37,9 @@ class AlarmArming {
///
/// android_intent_plus v5 uses startActivityForResult and the Clock app
/// never sends a result, so this times out after 3s rather than hang.
Future<void> registerWithClockApp(int hour, int minute) async {
///
/// Returns true only if the launch completed before the timeout.
Future<bool> registerWithClockApp(int hour, int minute) async {
final intent = AndroidIntent(
action: 'android.intent.action.SET_ALARM',
arguments: <String, Object>{
@ -47,6 +49,11 @@ class AlarmArming {
'android.intent.extra.alarm.MESSAGE': 'Wake Alarm',
},
);
await intent.launch().timeout(const Duration(seconds: 3), onTimeout: () {});
var completed = true;
await intent.launch().timeout(
const Duration(seconds: 3),
onTimeout: () => completed = false,
);
return completed;
}
}

View File

@ -53,10 +53,19 @@ class AlarmPublisher {
await applySyncedSettings(service);
final problem = await arming.arm(hour, minute);
if (problem != null) return problem;
await arming.registerWithClockApp(hour, minute);
return 'Synced to PC ✓';
final inClock = await arming.registerWithClockApp(hour, minute);
return syncedStatus(hour, minute, inClock: inClock);
} on Exception catch (e) {
return 'Error: $e';
}
}
}
/// The success line; names the Clock app only when the handoff to it
/// completed before its timeout, so a silent timeout never claims it.
String syncedStatus(int hour, int minute, {required bool inClock}) {
final time =
'${hour.toString().padLeft(2, '0')}:'
'${minute.toString().padLeft(2, '0')}';
return inClock ? 'Synced to PC ✓ Clock app set $time ✓' : 'Synced to PC ✓';
}

View File

@ -7,7 +7,8 @@ import 'dart:math' show pi, sin;
import 'package:flutter/services.dart';
import 'package:material_ui/material_ui.dart';
import 'package:wake_alarm_sync/ui/theme.dart' show AppStatusColors;
import 'package:wake_alarm_sync/ui/theme.dart'
show AppStatusColors, MotionDuration;
export 'package:wake_alarm_sync/ui/spoken_label.dart';
@ -127,7 +128,7 @@ class _StatusCueState extends State<StatusCue>
void initState() {
super.initState();
_shakeCtrl = AnimationController(
duration: const Duration(milliseconds: 300),
duration: MotionDuration.slow,
vsync: this,
);
_shakeAnim = Tween<double>(

View File

@ -0,0 +1,27 @@
/// The app's one page route: slow slide, decelerate in, accelerate out.
library;
import 'package:material_ui/material_ui.dart';
import 'package:wake_alarm_sync/ui/theme.dart';
/// A route to [builder]'s page using the shared motion tokens; instant under
/// the OS "Remove animations" setting.
PageRoute<T> appRoute<T>(BuildContext context, WidgetBuilder builder) {
final duration = motionDuration(context, MotionDuration.slow);
return PageRouteBuilder<T>(
transitionDuration: duration,
reverseTransitionDuration: duration,
pageBuilder: (context, _, _) => builder(context),
transitionsBuilder: (context, animation, secondary, child) {
final slide = Tween<Offset>(begin: const Offset(1, 0), end: Offset.zero)
.animate(
CurvedAnimation(
parent: animation,
curve: MotionCurve.decelerate,
reverseCurve: MotionCurve.accelerate,
),
);
return SlideTransition(position: slide, child: child);
},
);
}

View File

@ -121,3 +121,36 @@ class DayMarkColors extends ThemeExtension<DayMarkColors> {
);
}
}
/// Motion durations, hand-copied from the shared `DOCS-motion.md`.
abstract final class MotionDuration {
/// No animation; the reduced-motion target.
static const Duration instant = Duration.zero;
/// State on an element already under the finger.
static const fast = Duration(milliseconds: 120);
/// Default: anything entering or leaving within the current view.
static const base = Duration(milliseconds: 200);
/// Full-surface change: page transitions. The ceiling.
static const slow = Duration(milliseconds: 320);
}
/// Motion curves, hand-copied from the shared `DOCS-motion.md`.
abstract final class MotionCurve {
/// Default start-and-end-on-screen curve.
static const standard = Cubic(0.2, 0, 0, 1);
/// Entering the screen.
static const decelerate = Cubic(0, 0, 0, 1);
/// Leaving the screen.
static const accelerate = Cubic(0.3, 0, 1, 1);
}
/// [token], or zero when the OS "Remove animations" setting is on.
Duration motionDuration(BuildContext context, Duration token) =>
(MediaQuery.maybeDisableAnimationsOf(context) ?? false)
? MotionDuration.instant
: token;

View File

@ -110,11 +110,11 @@ packages:
dependency: "direct main"
description:
path: crdt_sync_flutter
ref: "crdt_sync_flutter-v0.8.1"
resolved-ref: "3225af8365481677d61a8cabec0c0ad4d0407567"
ref: "crdt_sync_flutter-v0.8.2"
resolved-ref: "1962d303336dfe260850466b8ee841033b9ad1ce"
url: "https://github.com/kuhyx/utils"
source: git
version: "0.8.1"
version: "0.8.2"
cross_file:
dependency: transitive
description:

View File

@ -18,7 +18,7 @@ dependencies:
crdt_sync_flutter:
git:
url: https://github.com/kuhyx/utils
ref: crdt_sync_flutter-v0.8.1
ref: crdt_sync_flutter-v0.8.2
path: crdt_sync_flutter
cupertino_icons: 2.0.0

View File

@ -38,4 +38,12 @@ void main() {
expect(message, isNot(contains('Connect a sync backend')));
expect(message, contains('Sync store unavailable'));
});
test('the Clock line names the time only when the handoff completed', () {
expect(
syncedStatus(6, 5, inClock: true),
'Synced to PC ✓ Clock app set 06:05 ✓',
);
expect(syncedStatus(6, 5, inClock: false), 'Synced to PC ✓');
});
}

View File

@ -0,0 +1,46 @@
/// Tests for the motion tokens and the app route.
library;
import 'package:flutter_test/flutter_test.dart';
import 'package:material_ui/material_ui.dart';
import 'package:wake_alarm_sync/ui/motion_route.dart';
import 'package:wake_alarm_sync/ui/theme.dart';
Future<Duration> _routeDuration(WidgetTester t, {required bool off}) async {
late Duration d;
await t.pumpWidget(
MediaQuery(
data: MediaQueryData(disableAnimations: off),
child: Builder(
builder: (context) {
d = appRoute<void>(
context,
(_) => const SizedBox(),
).transitionDuration;
return const SizedBox();
},
),
),
);
return d;
}
void main() {
test('duration tokens match DOCS-motion', () {
expect(MotionDuration.instant, Duration.zero);
expect(MotionDuration.fast, const Duration(milliseconds: 120));
expect(MotionDuration.base, const Duration(milliseconds: 200));
expect(MotionDuration.slow, const Duration(milliseconds: 320));
});
test('curves match DOCS-motion', () {
expect(MotionCurve.decelerate, const Cubic(0, 0, 0, 1));
expect(MotionCurve.accelerate, const Cubic(0.3, 0, 1, 1));
expect(MotionCurve.standard, const Cubic(0.2, 0, 0, 1));
});
testWidgets('route is slow, instant under disableAnimations', (t) async {
expect(await _routeDuration(t, off: false), MotionDuration.slow);
expect(await _routeDuration(t, off: true), Duration.zero);
});
}

View File

@ -12,11 +12,11 @@ dependencies = [
# Firebase transport for the alarm read. _sync.py imports it lazily and
# falls back to its stdlib GitHub path if the import fails, so a broken
# install degrades the read instead of killing the per-minute trigger.
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.0#subdirectory=crdt-sync",
"freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.2#subdirectory=freedays",
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
"freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.3#subdirectory=freedays",
# Sick days stand the PC's enforcement down (_sick.py). Imported behind
# a guard: missing means "not sick", never a crashed tick.
"sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.3#subdirectory=sickdays",
"sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.4#subdirectory=sickdays",
]
# Package discovery must be explicit: phone_app/ is a Flutter app, not a Python

View File

@ -4,17 +4,17 @@
# it is missing — but it is required here for mypy/pylint/tests.
bandit==1.9.4
codespell==2.4.3
coverage==7.17.2
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.0#subdirectory=crdt-sync
freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.2#subdirectory=freedays
coverage==7.17.3
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync
freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.3#subdirectory=freedays
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.13.0#subdirectory=gatelock
mypy==2.4.1
pre-commit==4.7.0
pylint==4.1.3
pylint==4.1.4
pytest==9.2.0
pytest-cov==7.1.0
pytest-randomly==5.1.0
pytest-sugar==1.1.1
pytest-xdist==3.8.0
ruff==0.17.4
sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.3#subdirectory=sickdays
ruff==0.17.5
sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.4#subdirectory=sickdays