summaryrefslogtreecommitdiff
path: root/makima/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/server')
-rw-r--r--makima/src/server/handlers/directives.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/makima/src/server/handlers/directives.rs b/makima/src/server/handlers/directives.rs
index 25b2dc4..929769c 100644
--- a/makima/src/server/handlers/directives.rs
+++ b/makima/src/server/handlers/directives.rs
@@ -824,7 +824,28 @@ pub async fn update_goal(
};
match repository::update_directive_goal(pool, auth.owner_id, id, &req.goal).await {
- Ok(Some(directive)) => Json(directive).into_response(),
+ Ok(Some(directive)) => {
+ // Clear non-started steps so replanning starts fresh
+ match repository::clear_pending_directive_steps(pool, id).await {
+ Ok(count) => {
+ if count > 0 {
+ tracing::info!(
+ directive_id = %id,
+ removed_steps = count,
+ "Cleared pending steps after goal update — replanning will generate new steps"
+ );
+ }
+ }
+ Err(e) => {
+ tracing::warn!(
+ directive_id = %id,
+ error = %e,
+ "Failed to clear pending steps after goal update"
+ );
+ }
+ }
+ Json(directive).into_response()
+ }
Ok(None) => (
StatusCode::NOT_FOUND,
Json(ApiError::new("NOT_FOUND", "Directive not found")),