Files
automaton/tasks/complete/linux-schedule-parity/IMPLEMENTATION.md
T

1.6 KiB

Implementation: linux-schedule-parity

What was implemented

_install_cron_block(name, project, interval_seconds) — new

Inserts a cron block (# automaton-loop:<name> / # end automaton-loop:<name>) into the user's crontab via crontab -. Returns 0 on success, 2 on write error. Interval is rounded to full minutes (minimum 1). Strips any prior block for the same loop before inserting (idempotent).

_enable_schedule(name, project) — new

Inverse of _disable_schedule. Platform dispatch:

  • Linux: calls _install_cron_block (re-inserts cron entry after resume)
  • Darwin: renames com.automaton.loop.{name}.plist.disabled → com.automaton.loop.{name}.plist
  • Windows: no-op (no OS schedule support in v1)

Reads loop.json → schedule.interval_seconds for the interval; falls back to 3600s (config default). Non-int values return fallback without crashing.

_disable_schedule(name, project) — already existed

Verified and refined. Strips the # automaton-loop:<name> block from crontab. Platform dispatch: Linux (crontab), Darwin (rename .plist → .plist.disabled), Windows (no-op).

Files changed

  • scripts/status.py — added _install_cron_block, _enable_schedule (lines ~1850-1890)

Tests

13 tests in tests/test_linux_schedule_parity.py covering:

  • Fresh cron block writes, prior block stripping, write error handling
  • Interval rounding and minimum clamping
  • Enable schedule: stub exists/absent, interval from cfg, garbage interval fallback, idempotent calls
  • Darwin/Windows dispatch branches
  • Disable schedule: block extraction correctness