diff options
| author | soryu <soryu@soryu.co> | 2026-01-29 01:10:43 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-29 01:10:43 +0000 |
| commit | 3118b241ccb3fb2d89948726b2f83a82de998cf2 (patch) | |
| tree | 211a467ee30b023aa828c3258cad6b6ceb240b36 | |
| parent | 64b32229c5e890a6916ad79d83279bb89d6dbd84 (diff) | |
| download | soryu-3118b241ccb3fb2d89948726b2f83a82de998cf2.tar.gz soryu-3118b241ccb3fb2d89948726b2f83a82de998cf2.zip | |
Fix Red Team UI visibility by adding red_team_enabled to ContractSummary
The Red Team toggle was implemented in the frontend but not visible because
the backend API's ContractSummary response struct was missing the
red_team_enabled field. The frontend relies on this field to:
1. Show the red team badge in the contract list view
2. Show the red team badge and tab in the contract detail view
Changes:
- Add red_team_enabled field to ContractSummary struct in models.rs
- Update list_contracts_for_owner SQL query to include red_team_enabled
- Update get_contract_summary_for_owner SQL query to include red_team_enabled
- Update all fallback ContractSummary constructions in contracts.rs handler
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| -rw-r--r-- | makima/src/db/models.rs | 3 | ||||
| -rw-r--r-- | makima/src/db/repository.rs | 4 | ||||
| -rw-r--r-- | makima/src/server/handlers/contracts.rs | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index d5f2814..bdc3dbb 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -1470,6 +1470,9 @@ pub struct ContractSummary { /// When true, tasks do not auto-execute completion actions and work stays in worktrees. #[serde(default)] pub local_only: bool, + /// Whether red team monitoring is enabled for this contract. + #[serde(default)] + pub red_team_enabled: bool, pub file_count: i64, pub task_count: i64, pub repository_count: i64, diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs index 7c9154f..c5370ff 100644 --- a/makima/src/db/repository.rs +++ b/makima/src/db/repository.rs @@ -2233,7 +2233,7 @@ pub async fn list_contracts_for_owner( r#" SELECT c.id, c.name, c.description, c.contract_type, c.phase, c.status, - c.supervisor_task_id, c.local_only, c.version, c.created_at, + c.supervisor_task_id, c.local_only, c.red_team_enabled, c.version, c.created_at, (SELECT COUNT(*) FROM files WHERE contract_id = c.id) as file_count, (SELECT COUNT(*) FROM tasks WHERE contract_id = c.id) as task_count, (SELECT COUNT(*) FROM contract_repositories WHERE contract_id = c.id) as repository_count @@ -2257,7 +2257,7 @@ pub async fn get_contract_summary_for_owner( r#" SELECT c.id, c.name, c.description, c.contract_type, c.phase, c.status, - c.supervisor_task_id, c.local_only, c.version, c.created_at, + c.supervisor_task_id, c.local_only, c.red_team_enabled, c.version, c.created_at, (SELECT COUNT(*) FROM files WHERE contract_id = c.id) as file_count, (SELECT COUNT(*) FROM tasks WHERE contract_id = c.id) as task_count, (SELECT COUNT(*) FROM contract_repositories WHERE contract_id = c.id) as repository_count diff --git a/makima/src/server/handlers/contracts.rs b/makima/src/server/handlers/contracts.rs index 3ad38da..ac0e5d4 100644 --- a/makima/src/server/handlers/contracts.rs +++ b/makima/src/server/handlers/contracts.rs @@ -368,6 +368,7 @@ pub async fn create_contract( status: contract.status, supervisor_task_id: contract.supervisor_task_id, local_only: contract.local_only, + red_team_enabled: contract.red_team_enabled, file_count: 0, task_count: 0, repository_count: 0, @@ -390,6 +391,7 @@ pub async fn create_contract( status: contract.status, supervisor_task_id: contract.supervisor_task_id, local_only: contract.local_only, + red_team_enabled: contract.red_team_enabled, file_count: 0, task_count: 0, repository_count: 0, @@ -519,6 +521,7 @@ pub async fn update_contract( status: contract.status, supervisor_task_id: contract.supervisor_task_id, local_only: contract.local_only, + red_team_enabled: contract.red_team_enabled, file_count: 0, task_count: 0, repository_count: 0, @@ -1404,6 +1407,7 @@ pub async fn change_phase( status: updated_contract.status, supervisor_task_id: updated_contract.supervisor_task_id, local_only: updated_contract.local_only, + red_team_enabled: updated_contract.red_team_enabled, file_count: 0, task_count: 0, repository_count: 0, |
