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-gated
crates/zeph-core/src/orchestration/graph.rs — TaskGraph, TaskNode, TaskId, TaskStatus, GraphStatus, TaskResult, FailureStrategy, GraphId, GraphStore trait
crates/zeph-core/src/orchestration/dag.rs — validate, toposort, ready_tasks, propagate_failure
crates/zeph-core/src/orchestration/error.rs — OrchestrationError enum
crates/zeph-core/src/orchestration/config.rs — OrchestrationConfig
crates/zeph-memory/src/sqlite/graph_store.rs — SqliteGraphStore impl
crates/zeph-memory/migrations/021_task_graphs.sql — SQLite schema
Modified files
crates/zeph-core/src/lib.rs — #[cfg(feature = "orchestration")] pub mod orchestration
crates/zeph-core/src/config/types.rs — add orchestration field to Config
crates/zeph-core/Cargo.toml — add orchestration feature
Cargo.toml root — feature propagation
crates/zeph-memory/src/sqlite/mod.rs — pub mod graph_store (feature-gated)
crates/zeph-memory/Cargo.toml — orchestration feature
Key design decisions
ADR-021 : Persistence in zeph-memory, trait in zeph-core (zeph-core never depends on sqlx)
TaskId(u32) indexes into Vec<TaskNode> (not HashMap — O(1) access, max_tasks=20)
Edges implicit in TaskNode.depends_on (no separate edge list)
Only Completed unblocks downstream; Skipped triggers transitive skip propagation
GraphStore trait: 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.
Parent: #1235
Summary
Implement core type system, DAG algorithms, and SQLite persistence for task orchestration.
Branch:
feat/m33/orchestration-typesFeature 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 schemaModified 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—orchestrationfeatureKey design decisions
TaskId(u32)indexes intoVec<TaskNode>(not HashMap — O(1) access, max_tasks=20)TaskNode.depends_on(no separate edge list)Completedunblocks downstream;Skippedtriggers transitive skip propagationGraphStoretrait:save_graph,load_graph,list_graphs,delete_graphDAG algorithms
Tests (~35)
Dependencies
None — first phase.