Commit Graph
29 Commits
Author SHA1 Message Date
gurix 1a8e4e2186 fix: verify /proc/PID/cmdline in isRinging to prevent PID reuse false positives 2026-06-18 16:45:52 +02:00
gurix b62a1d10c1 fix: rotate wecker.log to prevent unbounded growth 2026-06-18 16:41:30 +02:00
gurix d349478e07 fix: start wecker without shell=True 2026-06-18 16:38:58 +02:00
gurix 7e8e915024 fix: use fcntl file lock to prevent PID file race condition 2026-06-18 15:27:21 +02:00
gurix 058de8089c fix: use constant-time comparison for API key 2026-06-18 15:23:57 +02:00
gurix 124a6a4916 fix: remove custom command from setAlarm to prevent command injection 2026-06-18 15:23:14 +02:00
Markus Graf 75b56e2f1e refactor: extract _default_command() to eliminate DRY violation
The default wecker.py shell command was duplicated across set_alarm()
and start_ringing(). Extracted a shared _default_command() helper so
both callers use the same definition.
2026-05-19 15:31:24 +02:00
Markus Graf 41d8ffc404 refactor: rename startWecker/stopWecker mutations to startRinging/stopRinging
'Wecker' is a Swiss-German term with no meaning in English.
Renaming to startRinging/stopRinging for better clarity.
2026-05-19 15:28:44 +02:00
Markus Graf df7bec1054 feat: add startWecker and stopWecker mutations to start/stop alarm via API
- Add startWecker mutation: starts wecker.py via subprocess if not already ringing
- Add stopWecker mutation: kills the running wecker process via SIGTERM if ringing
- Both mutations handle the 'already ringing' / 'not ringing' edge cases gracefully
- Update README with API documentation for the new mutations
- Add comprehensive tests (unit + GraphQL endpoint)
2026-05-19 15:22:48 +02:00
Markus Graf 558c4ff5b6 Add isRinging query to check alarm state via API
Features:
- New GraphQL query 'isRinging' returns true/false if wecker is active
- Checks the wecker process via PID file (PID_FILE in common.py)

DRY refactoring:
- Extract PID_FILE into shared common.py module
- Both wecker.py and api/schema.py import from common
- DRY enforcement tests verify identity (is) not just equality

Tests:
- test_is_ringing_returns_false_when_not_running
- test_is_ringing_returns_true_when_running
- test_pid_file_defined_once_across_modules (DRY enforcement)
- test_pid_file_same_shared_constant_in_api (DRY enforcement)
- Cleaned up unused imports in test_single_instance.py

Docs:
- Updated README.md with isRinging query documentation
2026-05-19 15:15:05 +02:00
Markus Graf 29aff04e33 Emphasize strict adherence to development guidelines (TDD, DRY, MVP) 2026-05-19 14:48:58 +02:00
Markus Graf 62c98f0a87 Add unit tests for single instance enforcement 2026-05-19 14:45:26 +02:00
Markus Graf 6c088661fd Implement single instance enforcement using PID file 2026-05-19 14:39:51 +02:00
Markus Graf 190c1c8b0d chore: add *.pid to .gitignore 2026-05-11 22:11:13 +02:00
Markus Graf 64947deeb1 fix: use append (>>) instead of overwrite (>) for cron logs and add missing dependencies
- Fixed api/schema.py to generate cron jobs using '>> wecker.log' so logs aren't truncated.
- Added test_bugfix_default_command_uses_append_for_logs in tests/test_api.py to prevent regression.
- Added RPi.GPIO and pygame to pyproject.toml via 'uv add' to fix ModuleNotFoundError in cron jobs.
- Updated README.md to reflect that system python packages are no longer needed.
2026-05-11 22:08:57 +02:00
Markus Graf ff79224560 feat: make command parameter optional in set_alarm mutation 2026-05-11 15:05:29 +02:00
Markus Graf 5b5b845e41 Fix premature evaluation after blinking completes
When transitioning from STATE_BLINKING to STATE_WAIT_FOR_INPUT, the script used a stale timestamp `now` from before the blocking `blink_led` function. This caused the puzzle to immediately evaluate as failed. Updated to use `time.time()` after blinking finishes to ensure the user gets the full 3 seconds to enter their answer.
2026-05-10 07:41:00 +02:00
Markus Graf a7c4febd67 test: add tests and refactor wecker.py state machine for testability 2026-05-09 22:31:28 +02:00
Markus Graf 1a9bcd7158 docs: update README with systemd instructions and tailscale ip 2026-05-09 22:24:51 +02:00
Markus Graf 90001675ce docs: update README with graphql api documentation and uv setup 2026-05-09 22:18:43 +02:00
Markus Graf 96aa183434 feat: implement graphql API with static key authentication 2026-05-09 22:18:40 +02:00
Markus Graf 36bfe0c69d feat: implement crontab manager for managing alarms 2026-05-09 22:18:38 +02:00
Markus Graf ea0f4c0a83 chore: setup environment variables and gitignore for API key 2026-05-09 22:18:35 +02:00
Markus Graf a215eb7106 chore: setup uv dependency management and required packages 2026-05-09 22:18:29 +02:00
Markus Graf be7f037c13 docs: add TDD, MVP, and linting guidelines to AGENTS.md 2026-05-09 22:18:25 +02:00
Markus Graf a00a79ff86 docs: move author section to bottom of README 2026-05-01 07:36:11 +02:00
Markus Graf 0c9108686b docs: document ALSA audio error fix for cron and update agent instructions 2026-05-01 07:33:25 +02:00
Markus Graf dd4b3367b0 docs: Add cronjob setup instructions to README 2026-04-30 13:41:40 +02:00
Markus Graf f44e0c5fdb Initial commit: Add smart arcade button alarm clock 2026-04-30 13:32:32 +02:00