summaryrefslogtreecommitdiff
path: root/makima/src/db/repository.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-15 22:58:17 +0000
committersoryu <soryu@soryu.co>2026-02-15 22:58:17 +0000
commitbf087f48af2962d884b861345ae52be4f4a54daa (patch)
treeb366e28a9c1e85d893fdfb8692bb9ee28e52f011 /makima/src/db/repository.rs
parente449d55e70453a28f1de6dc8ceccc0f23fcce4e1 (diff)
downloadsoryu-bf087f48af2962d884b861345ae52be4f4a54daa.tar.gz
soryu-bf087f48af2962d884b861345ae52be4f4a54daa.zip
Add verifier post-directive
Diffstat (limited to 'makima/src/db/repository.rs')
-rw-r--r--makima/src/db/repository.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/makima/src/db/repository.rs b/makima/src/db/repository.rs
index ed4a1fa..71ad524 100644
--- a/makima/src/db/repository.rs
+++ b/makima/src/db/repository.rs
@@ -5198,6 +5198,7 @@ pub struct DirectiveCompletionCheck {
pub completion_task_id: Uuid,
pub task_status: String,
pub pr_url: Option<String>,
+ pub task_name: String,
}
/// Get idle directives that need a completion task spawned.
@@ -5212,6 +5213,7 @@ pub async fn get_idle_directives_needing_completion(
FROM directives d
WHERE d.status = 'idle'
AND d.completion_task_id IS NULL
+ AND d.pr_branch IS NULL
AND d.repository_url IS NOT NULL
AND EXISTS (
SELECT 1 FROM directive_steps ds
@@ -5225,13 +5227,33 @@ pub async fn get_idle_directives_needing_completion(
.await
}
+/// Get directives that attempted completion (pr_branch set) but have no PR URL yet
+/// and no active completion task. These need a verification task spawned.
+pub async fn get_directives_needing_verification(
+ pool: &PgPool,
+) -> Result<Vec<Directive>, sqlx::Error> {
+ sqlx::query_as::<_, Directive>(
+ r#"
+ SELECT d.*
+ FROM directives d
+ WHERE d.status = 'idle'
+ AND d.pr_branch IS NOT NULL
+ AND d.pr_url IS NULL
+ AND d.completion_task_id IS NULL
+ AND d.repository_url IS NOT NULL
+ "#,
+ )
+ .fetch_all(pool)
+ .await
+}
+
/// Get directives with active completion tasks, joined with task status.
pub async fn get_completion_tasks_to_check(
pool: &PgPool,
) -> Result<Vec<DirectiveCompletionCheck>, sqlx::Error> {
sqlx::query_as::<_, DirectiveCompletionCheck>(
r#"
- SELECT d.id as directive_id, d.owner_id, d.completion_task_id, t.status as task_status, d.pr_url
+ SELECT d.id as directive_id, d.owner_id, d.completion_task_id, t.status as task_status, d.pr_url, t.name as task_name
FROM directives d
JOIN tasks t ON t.id = d.completion_task_id
WHERE d.completion_task_id IS NOT NULL