summaryrefslogtreecommitdiff
path: root/makima/src/server/handlers/contracts.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/server/handlers/contracts.rs')
-rw-r--r--makima/src/server/handlers/contracts.rs85
1 files changed, 1 insertions, 84 deletions
diff --git a/makima/src/server/handlers/contracts.rs b/makima/src/server/handlers/contracts.rs
index 8a6ce0f..a83c72d 100644
--- a/makima/src/server/handlers/contracts.rs
+++ b/makima/src/server/handlers/contracts.rs
@@ -575,90 +575,7 @@ pub async fn update_contract(
}),
).await;
- // If contract is part of a directive chain step, update the step status
- // and emit an event for the directive engine to process
- let pool_for_step = pool.clone();
- let contract_id_for_step = contract.id;
- tokio::spawn(async move {
- // Look up the step by contract_id
- match repository::get_step_by_contract_id(&pool_for_step, contract_id_for_step).await {
- Ok(Some(step)) => {
- // Get the chain to find the directive_id
- let directive_id = match repository::get_directive_chain(&pool_for_step, step.chain_id).await {
- Ok(Some(chain)) => chain.directive_id,
- Ok(None) => {
- tracing::warn!(
- chain_id = %step.chain_id,
- "Chain not found for step"
- );
- return;
- }
- Err(e) => {
- tracing::warn!(
- chain_id = %step.chain_id,
- error = %e,
- "Failed to get chain for step"
- );
- return;
- }
- };
-
- // Update step status to 'evaluating'
- if let Err(e) = repository::update_step_status(&pool_for_step, step.id, "evaluating").await {
- tracing::warn!(
- step_id = %step.id,
- contract_id = %contract_id_for_step,
- error = %e,
- "Failed to update step status to evaluating"
- );
- } else {
- tracing::info!(
- step_id = %step.id,
- contract_id = %contract_id_for_step,
- chain_id = %step.chain_id,
- directive_id = %directive_id,
- "Contract completed - step transitioned to evaluating"
- );
-
- // Emit directive event for contract completion
- if let Err(e) = repository::emit_directive_event(
- &pool_for_step,
- directive_id,
- Some(step.chain_id),
- Some(step.id),
- "contract_completed",
- "info",
- Some(serde_json::json!({
- "contract_id": contract_id_for_step,
- "step_id": step.id,
- "step_name": step.name
- })),
- "system",
- None,
- ).await {
- tracing::warn!(
- step_id = %step.id,
- error = %e,
- "Failed to emit contract_completed directive event"
- );
- }
- }
- }
- Ok(None) => {
- tracing::debug!(
- contract_id = %contract_id_for_step,
- "Contract not linked to any directive chain step"
- );
- }
- Err(e) => {
- tracing::warn!(
- contract_id = %contract_id_for_step,
- error = %e,
- "Failed to look up step for completed contract"
- );
- }
- }
- });
+ // TODO: Directive engine integration (removed for reimplementation)
}
// Get summary with counts