Skip to content

feat(core): append-only ledger core — claim, fold, recovery and cron parser #578

Closed

Description

@ajianaz

What problem does this solve?

Unattended runs need at-most-once firing that survives crashes and never loses or overwrites a result. Hermes shipped exactly these failures: jobs silently skipped behind a serial tick (#9086) and delivered runs overwritten as errors by a heartbeat/fence timeout (#105861). The same claim/fold engine is later reused by delegation and the task board.

Proposed solution

Pure module in tole-core (injected clock and storage, no IO assumptions), per docs/automation-design.md §3–4:

  • Records: job, fire (claim with fire_id + pid/start-time lease, appended before execution), done (never overwritten), delivery (separate from run status), missed/blocked (with reason), hook_seen.
  • ready(now), claim, settle, recover(now, alive); state is a fold over the log.
  • Small in-tree 5-field cron + @every parser, property-tested against a minute-walking oracle.
  • Catch-up policy skip | one with grace_minutes; every skip is a missed record.

Acceptance: crash-injection test (kill between every append) shows no lost and no double fire; concurrent ticks cannot double-claim; perf numbers reported against docs/perf.md.

Alternatives considered

A cron crate (dependency weight vs ~200 audited lines); SQLite (rejected: append-only JSONL is the storage rule).

Are you willing to contribute the implementation?

Yes, I can do it

Before submitting

  • I searched existing issues and didn't find a duplicate

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions