From 0cf6f6a4c5c75c736e6fe3b1c726ef80c0a6c802 Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 24 Jan 2026 04:31:20 +0000 Subject: feat: implement dependency-ordered task execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add dependency tracking and validation for tasks to enforce execution order (schema changes → backend → UI) as specified in Section 1.3 of ralph-features-spec.md. Changes: - Add depends_on field to Task model (Vec) for explicit dependencies - Create database migration for depends_on column with GIN index - Add dependency_analysis.rs module with: - can_start_task() for checking if all dependencies are complete - Auto-detection of dependency patterns from file paths - Detection of schema/types/backend/UI categories - Warnings for potential dependency violations - Add DependencyOrderingConfig to daemon config with: - enabled: Enable/disable dependency checking - auto_detect: Auto-detect dependencies from file patterns - warn_on_violation: Warn on detected violations - Integrate dependency checks into task manager scheduling - Add depends_on to DaemonCommand::SpawnTask protocol The daemon performs dependency validation as a sanity check but defers to the server for authoritative scheduling decisions. Co-Authored-By: Claude Opus 4.5 --- makima/src/db/models.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'makima/src/db/models.rs') diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index 58f4da1..f3977e0 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -531,6 +531,13 @@ pub struct Task { /// Standalone completed tasks can be dismissed by the user. #[serde(default)] pub hidden: bool, + + // Dependency tracking for dependency-ordered execution + /// Task IDs that must complete before this task can start. + /// Used for enforcing execution order: schema changes → backend → UI. + #[serde(default, skip_serializing_if = "Option::is_none")] + #[sqlx(json)] + pub depends_on: Option>, } impl Task { @@ -611,8 +618,8 @@ pub struct TaskListResponse { } /// Request payload for creating a new task -#[derive(Debug, Deserialize, ToSchema)] -#[serde(rename_all = "camelCase")] +#[derive(Debug, Default, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase", default)] pub struct CreateTaskRequest { /// Contract this task belongs to (optional for branched/anonymous tasks) pub contract_id: Option, @@ -653,6 +660,10 @@ pub struct CreateTaskRequest { pub branched_from_task_id: Option, /// Conversation history to initialize the task with (JSON array of messages) pub conversation_history: Option, + /// Task IDs that must complete before this task can start. + /// Used for enforcing execution order: schema changes → backend → UI. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub depends_on: Option>, } /// Request payload for updating a task -- cgit v1.2.3