From 7af816032fbc54d5e0a8e94d4a000f307cd3b370 Mon Sep 17 00:00:00 2001 From: soryu Date: Fri, 8 May 2026 16:33:36 +0100 Subject: feat(directives): drop directives.goal — orchestration reads contract body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hard cut. The unified contracts surface owns spec text now; the directive itself is just a folder. The orchestrator daemon reads the active contract's body when it spawns, replans, or runs completion. Schema (migration 20260510000000): - DROP TABLE directive_goal_history - ALTER TABLE directives DROP COLUMN goal - ALTER TABLE directives DROP COLUMN goal_updated_at New repo helper: - get_active_contract_body(directive_id) — picks the active|queued|draft contract (in that order), most-recent first. Backend cuts: - Directive / DirectiveSummary / CreateDirectiveRequest / UpdateDirectiveRequest lose goal & goalUpdatedAt. - CreateDirectiveRequest gains optional `contractBody` — when provided, create_directive_for_owner auto-creates a first contract with that body in the same transaction. - Removed: update_directive_goal, update_directive_goal_keep_orchestrator, save_directive_goal_history, get_directive_goal_history, DirectiveGoalHistory model, UpdateGoalRequest. - Removed handlers::directives::update_goal + the /directives/{id}/goal route. - orchestration::directive::build_planning_prompt / build_completion_prompt / build_order_pickup_prompt now take a `contract_body: &str` instead of `goal_history`. classify_goal_change + try_interrupt_planner_with_goal_edit + GoalChangeKind + GoalEditInterruptResult removed (they were only useful for the small-vs-large goal-edit interrupt cycle). CLI: - `makima directive update-goal` removed (UpdateGoalArgs deleted, Commands enum trimmed, ApiClient::directive_update_goal + UpdateGoalRequest deleted). Frontend: - Directive / DirectiveSummary / CreateDirectiveRequest types lose goal & goalUpdatedAt; CreateDirectiveRequest gains `contractBody`. - useDirective drops updateGoal helper. - api.ts updateDirectiveGoal removed. - Legacy DirectiveList + DirectiveDetail components deleted; the /directives route now always renders the document-mode page. The user-settings documentModeEnabled flag is no longer consulted at the route level. - NewContractModal passes body via contractBody. Co-Authored-By: Claude Opus 4.7 (1M context) --- makima/src/db/models.rs | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'makima/src/db/models.rs') diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index fcccd05..3fb9667 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -2704,14 +2704,16 @@ mod tests { // Directive Types // ============================================================================= -/// A directive — a long-lived top-level entity for managing projects via a DAG of steps. +/// A directive — a long-lived top-level entity that owns a sequence of +/// contracts (see `directive_documents`). The directive itself is a +/// folder; the active contract's body is the spec the orchestrator +/// daemon reads when planning. #[derive(Debug, Clone, FromRow, Serialize, Deserialize, ToSchema)] #[serde(rename_all = "camelCase")] pub struct Directive { pub id: Uuid, pub owner_id: Uuid, pub title: String, - pub goal: String, /// Status: draft, active, idle, paused, archived pub status: String, pub repository_url: Option, @@ -2723,7 +2725,6 @@ pub struct Directive { pub completion_task_id: Option, /// Question timeout mode: "auto" (30s timeout), "semi-auto" (block indefinitely), "manual" (block + ask many questions) pub reconcile_mode: String, - pub goal_updated_at: DateTime, pub started_at: Option>, pub version: i32, pub created_at: DateTime, @@ -2736,16 +2737,6 @@ pub struct Directive { pub is_tmp: bool, } -/// A historical record of a directive goal change. -#[derive(Debug, Clone, FromRow, Serialize, Deserialize, ToSchema)] -#[serde(rename_all = "camelCase")] -pub struct DirectiveGoalHistory { - pub id: Uuid, - pub directive_id: Uuid, - pub goal: String, - pub created_at: DateTime, -} - /// Per-PR snapshot of a directive's goal — the immutable record of what the /// contract said at the moment a PR was raised. Frozen at PR-creation time; /// `pr_state` mirrors the PR's GitHub lifecycle ('open' | 'merged' | 'closed'). @@ -2808,7 +2799,6 @@ pub struct DirectiveSummary { pub id: Uuid, pub owner_id: Uuid, pub title: String, - pub goal: String, pub status: String, pub repository_url: Option, pub orchestrator_task_id: Option, @@ -2833,12 +2823,18 @@ pub struct DirectiveListResponse { pub total: i64, } -/// Request to create a new directive. +/// Request to create a new directive. The directive itself has no spec +/// text — pass `contractBody` to auto-create a first contract whose +/// body is the spec; if omitted, the directive is created empty and +/// the user will create a contract from the UI. #[derive(Debug, Deserialize, ToSchema)] #[serde(rename_all = "camelCase")] pub struct CreateDirectiveRequest { pub title: String, - pub goal: String, + /// Optional. When provided, a first contract is auto-created with + /// this body so the directive is immediately ready to start. + #[serde(default)] + pub contract_body: Option, pub repository_url: Option, pub local_path: Option, pub base_branch: Option, @@ -2846,12 +2842,13 @@ pub struct CreateDirectiveRequest { pub reconcile_mode: Option, } -/// Request to update a directive. +/// Request to update a directive's metadata. Spec edits go through the +/// contracts API now — this endpoint only mutates directive-level +/// fields (title, repo, status, etc.). #[derive(Debug, Default, Deserialize, ToSchema)] #[serde(rename_all = "camelCase")] pub struct UpdateDirectiveRequest { pub title: Option, - pub goal: Option, pub status: Option, pub repository_url: Option, pub local_path: Option, @@ -2864,13 +2861,6 @@ pub struct UpdateDirectiveRequest { pub version: Option, } -/// Request to update a directive's goal (triggers re-planning). -#[derive(Debug, Deserialize, ToSchema)] -#[serde(rename_all = "camelCase")] -pub struct UpdateGoalRequest { - pub goal: String, -} - /// Response for cleanup_directive_tasks (legacy). #[derive(Debug, Serialize, ToSchema)] #[serde(rename_all = "camelCase")] -- cgit v1.2.3