Skip to content

feat: add cron-expression deferred distribution windows - #813

Open
Calebstack wants to merge 1 commit into
RevoraOrg:masterfrom
Calebstack:feat/deferred-distribution-cron-windows
Open

feat: add cron-expression deferred distribution windows#813
Calebstack wants to merge 1 commit into
RevoraOrg:masterfrom
Calebstack:feat/deferred-distribution-cron-windows

Conversation

@Calebstack

Copy link
Copy Markdown

Overview

This PR adds deferred distribution scheduling with cron-expression window definitions, a CronWindowValidator that rejects overlaps with known Stellar maintenance, and persistence so treasury operators can tune settlement cadence without redeploys.

Related Issue

Closes #661

Changes

🗓️ Cron window scheduling

  • [ADD] src/db/migrations/025_create_distribution_schedules.sql
    • Per-offering cron + timezone persistence table.
  • [ADD] src/services/cronScheduleService.ts (+ tests)
    • Validate-before-persist path; rejects Stellar conflicts and offering overlaps; logs expression diffs.
  • [MODIFY] src/services/distributionScheduler.ts (+ tests)
    • Cron gate for deferred runs, 1st-Monday maintenance constraint, year-skip lookahead, offering-scoped window de-dupe, scheduler.window.rejected metrics/logs.
  • [MODIFY] Offering / revenue report repositories to read & write cron schedules.

Verification Results

npx jest --runInBand --forceExit \
  src/services/distributionScheduler.test.ts \
  src/services/__tests__/distributionScheduler.test.ts \
  src/services/cronScheduleService.test.ts \
  --coverage=false
✅ passed
Acceptance Criteria Status
Cron expressions persisted per offering distribution_schedules + offerings mirror
Reject windows overlapping Stellar maintenance CronWindowValidator + 1st-Monday constraint
Overlap rejection logs expression diff scheduler.window.rejected + diff payload
DST / leap-day / year-skip coverage ✅ Tests included

Timeline

  • Calebstack committed

Persist and validate per-offering cron schedules, reject Stellar
maintenance overlaps, and gate deferred distribution runs.

Closes RevoraOrg#661
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add deferred distribution scheduling with cron-expression window definitions

1 participant