Cron job store: per-profile JSON with cross-process file locking #775
Notifications
Due Date
No due date set.
Blocks
Reference: sam/archie#775
Reference in new issue
Block a user
Slice 1 of the cron/scheduling epic (archie-core-1786637496320-249-be6d9a20). Implements the durable job store: one JSON file per profile at the conventional path, CRUD operations, and cross-process file locking so a CLI edit and a daemon writer don't corrupt each other.
The ticker engine (internal/domain/scheduling) consumes this through its
JobSourceinterface. The store's only contract with the engine isDue(ctx, now) -> ([]Job, error)— the engine applies no schedule arithmetic of its own, so the store owns cron expressions, fixed intervals, and catch-up windows.Acceptance criteria
<config_dir>/cron/jobs.jsonor equivalent). Schema is durable and version-stamped for forward compatibility.flockor OS equivalent) makes concurrent CLI+daemon writers serial; last-writer-wins is documented as the conflict policy.scheduling.JobSourceso the ticker engine can poll it without knowing the file layout or format.phase="source" KindJobErrorrather than crashing the loop.Close reason
Slice 1 of cron/scheduling epic landed: per-profile JSON store with cross-process flock, merge-semantic Update, version-stamped schema, ErrCorruptFile on truncated files, ErrUnsupportedSchema on forward versions. Implements scheduling.JobSource so the ticker engine can poll it without knowing the file layout. Adversarial review applied: deep-copy Get/List, pool validation in Create/Update, ErrScheduleUnsupported on Once MarkRun, 0o600 file mode, SetEscapeHTML(false) for operator-readable files, fsync before rename for durability, ErrClosed sentinel after Close, real cross-process flock test via os/exec. task check green.
Imported from beads
archie-core-1786637496320-249-be6d9a20.1· GitHub #680 · type feature · priority P2 · created 2026-08-27 · closed 2026-08-28