Task: Add scheduling support

Table of Contents

This page documents a task in the Scheduling subsystem story. It captures the goal, current status, acceptance, and any notes or results.

Goal

Build the ores.scheduler library wrapping pg_cron with a Quartz.NET-style fluent API.

Status

Field Value
State DONE
Parent story Scheduling subsystem
Now Completed 2026-02-27.
Waiting on None.
Next None.
Last touched 2026-02-27

Acceptance

  • Domain types: cron_expression (croncpp-backed, std::expected errors), job_status, job_definition, job_instance.
  • Fluent builder: job_definition_builder with with_name / with_command / with_cron_schedule.
  • cron_scheduler service: invokes cron.schedule / cron.unschedule via sqlgen.
  • ores_scheduler_job_definitions_tbl hand-crafted (cron_job_id bigint, is_active integer don't fit the standard codegen templates); linked to cron.job via cron_job_id.
  • Job instances read directly from cron.job_run_details via raw SQL join (no mirror table needed in Phase 1).
  • description + is_active columns included for the future UI.
  • cron_expression bridges pg_cron's 5-field Unix format and croncpp's 6-field format transparently.

Plan

Captured during execution; cleared into the parent story on close.

Notes

Quartz.NET pattern with all state in the DB: job_definition = persistent plan, job_instance = historical execution.

Result

Scheduling library available end-to-end.

Emacs 29.1 (Org mode 9.6.6)