-
Notifications
You must be signed in to change notification settings - Fork 2
feat(orchestration): Phase 1 — TaskGraph core types, DAG operations, persistence #1236
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestorchestrationTask orchestration / DAG schedulingTask orchestration / DAG scheduling
Description
Parent: #1235
Summary
Implement core type system, DAG algorithms, and SQLite persistence for task orchestration.
Branch: feat/m33/orchestration-types
Feature flag: orchestration (optional, not default)
Deliverables
New files
crates/zeph-core/src/orchestration/mod.rs— module declaration, feature-gatedcrates/zeph-core/src/orchestration/graph.rs—TaskGraph,TaskNode,TaskId,TaskStatus,GraphStatus,TaskResult,FailureStrategy,GraphId,GraphStoretraitcrates/zeph-core/src/orchestration/dag.rs—validate,toposort,ready_tasks,propagate_failurecrates/zeph-core/src/orchestration/error.rs—OrchestrationErrorenumcrates/zeph-core/src/orchestration/config.rs—OrchestrationConfigcrates/zeph-memory/src/sqlite/graph_store.rs—SqliteGraphStoreimplcrates/zeph-memory/migrations/021_task_graphs.sql— SQLite schema
Modified files
crates/zeph-core/src/lib.rs—#[cfg(feature = "orchestration")] pub mod orchestrationcrates/zeph-core/src/config/types.rs— addorchestrationfield toConfigcrates/zeph-core/Cargo.toml— addorchestrationfeatureCargo.tomlroot — feature propagationcrates/zeph-memory/src/sqlite/mod.rs—pub mod graph_store(feature-gated)crates/zeph-memory/Cargo.toml—orchestrationfeature
Key design decisions
- ADR-021: Persistence in zeph-memory, trait in zeph-core (zeph-core never depends on sqlx)
TaskId(u32)indexes intoVec<TaskNode>(not HashMap — O(1) access, max_tasks=20)- Edges implicit in
TaskNode.depends_on(no separate edge list) - Only
Completedunblocks downstream;Skippedtriggers transitive skip propagation GraphStoretrait:save_graph,load_graph,list_graphs,delete_graph
DAG algorithms
- Cycle detection: Kahn's algorithm — simultaneously validates acyclicity and produces topological sort
- Ready tasks: scan for Pending tasks with all deps Completed
- Failure propagation: Abort (cancel all), Skip (transitive), Retry (reset to Ready), Ask (pause)
- Validation: valid TaskId refs, no self-references, cycle-free, at least one root
Tests (~35)
- Cycle detection: single cycle, multi-node cycle, no cycle, self-reference
- Topological sort: linear chain, diamond, wide parallel, single node, empty graph
- Ready tasks: initial roots, after completion, skipped does NOT unblock
- Failure propagation: abort cascades, skip cascades transitively, retry resets status
- Validation: invalid TaskId references, empty graph, single task
- Serialization round-trip for all types (serde JSON)
- Persistence: save/load round-trip, list, delete (test SQLite)
- Display impls for user-facing types
Dependencies
None — first phase.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestorchestrationTask orchestration / DAG schedulingTask orchestration / DAG scheduling