diff options
| author | soryu <soryu@soryu.co> | 2026-01-31 22:53:28 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-31 22:54:50 +0000 |
| commit | 44bb3fe07ab191abd8260af6975bc175c223878e (patch) | |
| tree | 1d7dd73756345f3671af32cc84b9b4235d34d173 /makima/src/daemon/api/supervisor.rs | |
| parent | a6e36a8bfecb9ebe6c7b135b9e01557f7ebc3e58 (diff) | |
| download | soryu-makima/contract-management-improvements.tar.gz soryu-makima/contract-management-improvements.zip | |
feat: Add contract management system improvements (Phase 1)makima/contract-management-improvements
- Add docs/contract-management-spec.md with full system design
- Add docs/plans/implementation-plan.md with 5-phase rollout plan
- Add validate_deliverable() function and use in mark_deliverable_complete
- Add PhaseChangeResult enum and change_contract_phase_with_version() with FOR UPDATE locking
- Enforce phase_guard at API level for all callers
This addresses critical issues in contract management:
- Deliverable validation to prevent marking non-existent deliverables complete
- Version conflict detection for phase changes with row locking
- Phase guard enforcement at API level (applies to all callers including supervisors)
- Comprehensive specification and implementation plan for future phases
Diffstat (limited to 'makima/src/daemon/api/supervisor.rs')
| -rw-r--r-- | makima/src/daemon/api/supervisor.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/makima/src/daemon/api/supervisor.rs b/makima/src/daemon/api/supervisor.rs index c841b21..c2da1db 100644 --- a/makima/src/daemon/api/supervisor.rs +++ b/makima/src/daemon/api/supervisor.rs @@ -233,22 +233,43 @@ impl ApiClient { } /// Advance contract to a new phase. + /// + /// When `confirmed` is false and phase_guard is enabled, returns a response with + /// `status: "pending_confirmation"` containing deliverables for user review. + /// When `confirmed` is true, proceeds with the phase transition. pub async fn supervisor_advance_phase( &self, contract_id: Uuid, phase: &str, + confirmed: bool, ) -> Result<JsonValue, ApiError> { #[derive(Serialize)] struct AdvancePhaseRequest { phase: String, + confirmed: bool, } let req = AdvancePhaseRequest { phase: phase.to_string(), + confirmed, }; self.post(&format!("/api/v1/contracts/{}/phase", contract_id), &req) .await } + /// Request phase advancement without confirmation (for phase_guard check). + /// + /// This method calls `supervisor_advance_phase` with `confirmed=false`. + /// If phase_guard is enabled, the response will have `status: "pending_confirmation"` + /// and the caller should prompt the user for confirmation before calling again with + /// `confirmed=true`. + pub async fn supervisor_request_phase_advance( + &self, + contract_id: Uuid, + phase: &str, + ) -> Result<JsonValue, ApiError> { + self.supervisor_advance_phase(contract_id, phase, false).await + } + /// Get individual task details. pub async fn supervisor_get_task(&self, task_id: Uuid) -> Result<JsonValue, ApiError> { self.get(&format!("/api/v1/mesh/tasks/{}", task_id)).await |
