mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-10 18:07:05 +01:00
- Sick days screen (own name, sick icon, cat-2 fill): tap today or a later day to mark it sick, tap again to clear; past days inert. Writes the sickdays wire format (state sick/cleared + actor, one HLC per write) to sickdays-sync/devices via crdt_sync syncLog. - Mutual exclusion in both pickers: each syncs the other pool on open and refuses a date it holds, naming the pool; an unreadable pool refuses all. - Native SickDays cache (fail closed via DayCache); AlarmReceiver skips the ring with reason "sick_day" (no markFired, no ring_started); StickCheck verdict sick_day, streak skips sick days; stakes card says so. - Pre-alarm pool sync: allow-while-idle alarm at 21:00 and A-30 (request code 1006) runs a headless engine (poolSyncMain) that pulls both pools from RTDB and rewrites both native caches, so a PC mark arrives with the app closed. The ring decision stays a cache read. - JVM unit tests (JUnit 4.13.2) for DayCache, RingDecision, PoolSyncSchedule, StickCheck; Dart tests; Dart->Python interop check. pylint hook skipped: verify.py imports sickdays, not in the hook env until the sickdays-v0.1.0 tag exists; run by hand in a sickdays venv (10.00/10). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xfj1sxKH9VBPqpcAni8Jry
58 lines
1.7 KiB
Bash
Executable File
58 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# ============================================================================
|
|
# Cross-language check for the sick-day pool.
|
|
#
|
|
# phone_app/lib/services/sick_day_pool.dart writes the wire format that
|
|
# ~/src/utils/sickdays (Python) owns. This writes a pool through the Dart
|
|
# rules and reads it back through the Python ones, and fails on any
|
|
# disagreement about which days are sick.
|
|
#
|
|
# Requires a Python with sickdays importable: SICKDAYS_PYTHON, else the venv
|
|
# sickdays/install.sh creates.
|
|
#
|
|
# Usage: phone_app/scripts/sick_days_interop/check.sh
|
|
# ============================================================================
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
APP_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
readonly SCRIPT_DIR APP_DIR
|
|
readonly SICKDAYS_PYTHON="${SICKDAYS_PYTHON:-$HOME/.local/share/sickdays/venv/bin/python}"
|
|
|
|
TEMP_DIR=""
|
|
cleanup() {
|
|
if [[ -n "$TEMP_DIR" && -d "$TEMP_DIR" ]]; then
|
|
rm -rf "$TEMP_DIR"
|
|
fi
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
validate_requirements() {
|
|
if [[ ! -x "$SICKDAYS_PYTHON" ]]; then
|
|
echo "Error: no sickdays python at $SICKDAYS_PYTHON (set SICKDAYS_PYTHON)" >&2
|
|
exit 1
|
|
fi
|
|
command -v flutter >/dev/null || { echo "Error: flutter not on PATH" >&2; exit 1; }
|
|
}
|
|
|
|
main() {
|
|
validate_requirements
|
|
TEMP_DIR="$(mktemp -d)"
|
|
local pool="$TEMP_DIR/sick_days.json"
|
|
|
|
echo "== sick-day interop: Dart writes =="
|
|
(
|
|
cd "$APP_DIR"
|
|
SICK_DAYS_INTEROP_OUT="$pool" flutter test test/sick_day_interop_writer_test.dart \
|
|
| tail -1
|
|
)
|
|
[[ -s "$pool" ]] || { echo "Error: Dart wrote no fixture" >&2; exit 1; }
|
|
|
|
echo "== sick-day interop: Python reads =="
|
|
"$SICKDAYS_PYTHON" -I "$SCRIPT_DIR/verify.py" "$pool"
|
|
}
|
|
|
|
main "$@"
|