Jesús Pérez bb55c80d2b
feat(workflow-engine): autonomous scheduling with timezone and distributed lock
Add cron-based autonomous workflow firing with two hardening layers:

  - Timezone-aware scheduling via chrono-tz: ScheduledWorkflow.timezone
    (IANA identifier), compute_next_fire_at/after_tz, validate_timezone;
    DST-safe, UTC fallback when absent; validated at config load and REST API

  - Distributed fire-lock via SurrealDB conditional UPDATE (locked_by/locked_at
    fields, 120 s TTL); WorkflowScheduler gains instance_id (UUID) as lock owner;
    prevents double-fires across multi-instance deployments without extra infra

  - ScheduleStore: try_acquire_fire_lock, release_fire_lock (own-instance guard),
    full CRUD (load_one/all, full_upsert, patch, delete, load_runs)

  - REST: 7 endpoints (GET/PUT/PATCH/DELETE schedules, runs history, manual fire)
    with timezone field in all request/response types

  - Migrations 010 (schedule tables) + 011 (timezone + lock columns)
  - Tests: 48 passing (was 26); ADR-0034; changelog; feature docs updated
2026-02-26 11:34:44 +00:00

62 lines
1.3 KiB
TOML

[package]
name = "vapora-workflow-engine"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
[dependencies]
vapora-shared = { workspace = true }
vapora-swarm = { workspace = true }
vapora-agents = { workspace = true }
vapora-knowledge-graph = { workspace = true }
# Async runtime
tokio = { workspace = true, features = ["full"] }
futures = { workspace = true }
async-trait = { workspace = true }
# Message queue
async-nats = { workspace = true }
# Serialization
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
toml = { workspace = true }
# Utilities
uuid = { workspace = true, features = ["v4"] }
chrono = { workspace = true, features = ["serde"] }
dashmap = { workspace = true }
# Logging
tracing = { workspace = true }
# Error handling
thiserror = { workspace = true }
anyhow = { workspace = true }
# Metrics
prometheus = { workspace = true }
# Persistence
surrealdb = { workspace = true }
# Authorization
cedar-policy = "4.9"
# Scheduling
cron = "0.12"
chrono-tz = "0.10"
[dev-dependencies]
mockall = { workspace = true }
wiremock = { workspace = true }
tokio = { workspace = true, features = ["test-util"] }
tempfile = { workspace = true }