summaryrefslogtreecommitdiff
path: root/makima/src/db
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-22 13:17:17 +0000
committerGitHub <noreply@github.com>2026-01-22 13:17:17 +0000
commit265f8cf14fec9d7116d09af49e4b48b357faceda (patch)
treec98ff8be7dd5f01692446e01c7b568279b0635ac /makima/src/db
parenta363bfdd7a3e81b75bf230e45d001b80f759ca57 (diff)
downloadsoryu-265f8cf14fec9d7116d09af49e4b48b357faceda.tar.gz
soryu-265f8cf14fec9d7116d09af49e4b48b357faceda.zip
Fix completion actions: default to PR and support remote repos (#21)
* Fix completion actions: default to PR and support remote repos - Change default completion action from 'branch' to 'pr' for tasks using daemon working directory - Allow PR completion action to work without target_repo_path if the worktree already has an origin remote configured (e.g., when cloned from a remote URL) - Update create_pull_request to accept optional target_repo parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add dismiss functionality for completed standalone tasks ## Changes ### Backend - Add 'hidden' field to Task model (models.rs) - Add database migration for hidden column (20250122000000_add_task_hidden.sql) - Update task listing queries to include hidden field and filter out hidden tasks - Update update_task_for_owner to handle hidden field ### Frontend - Add hidden field to TaskSummary interface (api.ts) - Add dismissTask API function (api.ts) - Add hideTask function to useTasks hook - Add Dismiss button to TaskList for completed standalone tasks - Wire up onDismiss handler in mesh.tsx route ## Behavior - Completed standalone tasks (tasks without a contract) show a "Dismiss" button - Dismissing a task sets hidden=true and removes it from the task list - Hidden tasks are filtered out by default in all task listing queries Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/src/db')
-rw-r--r--makima/src/db/models.rs12
-rw-r--r--makima/src/db/repository.rs25
2 files changed, 27 insertions, 10 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs
index bf95a3a..6ede268 100644
--- a/makima/src/db/models.rs
+++ b/makima/src/db/models.rs
@@ -525,6 +525,12 @@ pub struct Task {
/// Used to track the origin of "what if" explorations.
#[serde(skip_serializing_if = "Option::is_none")]
pub branched_from_task_id: Option<Uuid>,
+
+ // UI visibility
+ /// Whether this task is hidden from the UI (user dismissed it).
+ /// Standalone completed tasks can be dismissed by the user.
+ #[serde(default)]
+ pub hidden: bool,
}
impl Task {
@@ -564,6 +570,9 @@ pub struct TaskSummary {
/// True for contract supervisor tasks
#[serde(default)]
pub is_supervisor: bool,
+ /// Whether this task is hidden from the UI (user dismissed it)
+ #[serde(default)]
+ pub hidden: bool,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
@@ -586,6 +595,7 @@ impl From<Task> for TaskSummary {
subtask_count: 0, // Would need separate query
version: task.version,
is_supervisor: task.is_supervisor,
+ hidden: task.hidden,
created_at: task.created_at,
updated_at: task.updated_at,
}
@@ -670,6 +680,8 @@ pub struct UpdateTaskRequest {
/// Explicitly clear daemon_id (set to NULL)
#[serde(default)]
pub clear_daemon_id: bool,
+ /// Whether this task is hidden from the UI (user dismissed it)
+ pub hidden: Option<bool>,
/// Version for optimistic locking
pub version: Option<i32>,
}
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs
index 7387735..84afc8d 100644
--- a/makima/src/db/repository.rs
+++ b/makima/src/db/repository.rs
@@ -733,6 +733,7 @@ pub async fn get_task(pool: &PgPool, id: Uuid) -> Result<Option<Task>, sqlx::Err
}
/// List all top-level tasks (no parent), ordered by created_at DESC.
+/// Hidden tasks are excluded by default.
pub async fn list_tasks(pool: &PgPool) -> Result<Vec<TaskSummary>, sqlx::Error> {
sqlx::query_as::<_, TaskSummary>(
r#"
@@ -742,10 +743,10 @@ pub async fn list_tasks(pool: &PgPool) -> Result<Vec<TaskSummary>, sqlx::Error>
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
- t.version, t.is_supervisor, t.created_at, t.updated_at
+ t.version, t.is_supervisor, COALESCE(t.hidden, false) as hidden, t.created_at, t.updated_at
FROM tasks t
LEFT JOIN contracts c ON t.contract_id = c.id
- WHERE t.parent_task_id IS NULL
+ WHERE t.parent_task_id IS NULL AND COALESCE(t.hidden, false) = false
ORDER BY t.priority DESC, t.created_at DESC
"#,
)
@@ -763,7 +764,7 @@ pub async fn list_subtasks(pool: &PgPool, parent_id: Uuid) -> Result<Vec<TaskSum
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
- t.version, t.is_supervisor, t.created_at, t.updated_at
+ t.version, t.is_supervisor, COALESCE(t.hidden, false) as hidden, t.created_at, t.updated_at
FROM tasks t
LEFT JOIN contracts c ON t.contract_id = c.id
WHERE t.parent_task_id = $1
@@ -1129,6 +1130,7 @@ pub async fn get_task_for_owner(
}
/// List all top-level tasks (no parent) for an owner, ordered by created_at DESC.
+/// Hidden tasks are excluded by default.
pub async fn list_tasks_for_owner(
pool: &PgPool,
owner_id: Uuid,
@@ -1141,10 +1143,10 @@ pub async fn list_tasks_for_owner(
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
- t.version, t.is_supervisor, t.created_at, t.updated_at
+ t.version, t.is_supervisor, COALESCE(t.hidden, false) as hidden, t.created_at, t.updated_at
FROM tasks t
LEFT JOIN contracts c ON t.contract_id = c.id
- WHERE t.owner_id = $1 AND t.parent_task_id IS NULL
+ WHERE t.owner_id = $1 AND t.parent_task_id IS NULL AND COALESCE(t.hidden, false) = false
ORDER BY t.priority DESC, t.created_at DESC
"#,
)
@@ -1167,7 +1169,7 @@ pub async fn list_subtasks_for_owner(
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
- t.version, t.is_supervisor, t.created_at, t.updated_at
+ t.version, t.is_supervisor, COALESCE(t.hidden, false) as hidden, t.created_at, t.updated_at
FROM tasks t
LEFT JOIN contracts c ON t.contract_id = c.id
WHERE t.owner_id = $1 AND t.parent_task_id = $2
@@ -1217,6 +1219,7 @@ pub async fn update_task_for_owner(
let repository_url = req.repository_url.or(existing.repository_url);
let target_repo_path = req.target_repo_path.or(existing.target_repo_path);
let completion_action = req.completion_action.or(existing.completion_action);
+ let hidden = req.hidden.unwrap_or(existing.hidden);
let daemon_id = if req.clear_daemon_id {
None
} else {
@@ -1232,8 +1235,8 @@ pub async fn update_task_for_owner(
progress_summary = $8, last_output = $9, error_message = $10,
merge_mode = $11, pr_url = $12, daemon_id = $13,
target_repo_path = $14, completion_action = $15, repository_url = $16,
- updated_at = NOW()
- WHERE id = $1 AND owner_id = $2 AND version = $17
+ hidden = $17, updated_at = NOW()
+ WHERE id = $1 AND owner_id = $2 AND version = $18
RETURNING *
"#,
)
@@ -1253,6 +1256,7 @@ pub async fn update_task_for_owner(
.bind(&target_repo_path)
.bind(&completion_action)
.bind(&repository_url)
+ .bind(hidden)
.bind(req.version.unwrap())
.fetch_optional(pool)
.await?
@@ -1264,7 +1268,7 @@ pub async fn update_task_for_owner(
progress_summary = $8, last_output = $9, error_message = $10,
merge_mode = $11, pr_url = $12, daemon_id = $13,
target_repo_path = $14, completion_action = $15, repository_url = $16,
- updated_at = NOW()
+ hidden = $17, updated_at = NOW()
WHERE id = $1 AND owner_id = $2
RETURNING *
"#,
@@ -1285,6 +1289,7 @@ pub async fn update_task_for_owner(
.bind(&target_repo_path)
.bind(&completion_action)
.bind(&repository_url)
+ .bind(hidden)
.fetch_optional(pool)
.await?
};
@@ -2685,7 +2690,7 @@ pub async fn list_tasks_in_contract(
t.parent_task_id, t.depth, t.name, t.status, t.priority,
t.progress_summary,
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id) as subtask_count,
- t.version, t.is_supervisor, t.created_at, t.updated_at
+ t.version, t.is_supervisor, COALESCE(t.hidden, false) as hidden, t.created_at, t.updated_at
FROM tasks t
LEFT JOIN contracts c ON t.contract_id = c.id
WHERE t.contract_id = $1 AND t.owner_id = $2