Run reviews and nudges on the state-driven coordinator

This commit is contained in:
Ian Gulliver
2026-10-21 12:54:34 -07:00
parent 97b71416d5
commit b4a454bab1
16 changed files with 718 additions and 567 deletions
+6 -2
View File
@@ -158,9 +158,13 @@ func (s *Store) FreezeWorkflow(ctx context.Context, name string) (FrozenWorkflow
}
func (s *Store) TaskWorkflow(ctx context.Context, taskID string) (FrozenWorkflow, error) {
return taskWorkflow(ctx, s.db, taskID)
}
func taskWorkflow(ctx context.Context, q querier, taskID string) (FrozenWorkflow, error) {
f := FrozenWorkflow{}
defID := sql.NullString{}
err := s.db.QueryRowContext(ctx, `
err := q.QueryRowContext(ctx, `
SELECT r.workflow_name, r.workflow_definition_id, r.workflow_brief, r.workflow_title, r.audit
FROM tasks t JOIN tasks r ON r.id = CASE WHEN t.workflow_stage != '' THEN t.parent_task_id ELSE t.id END
WHERE t.id = ?`, taskID).Scan(&f.Name, &defID, &f.Brief, &f.Title, &f.Audit)
@@ -174,7 +178,7 @@ func (s *Store) TaskWorkflow(ctx context.Context, taskID string) (FrozenWorkflow
return FrozenWorkflow{}, fmt.Errorf("%w: task %s has no workflow", ErrNotFound, taskID)
}
f.DefinitionID = defID.String
f.Definition, err = loadDefinition(ctx, s.db, f.DefinitionID)
f.Definition, err = loadDefinition(ctx, q, f.DefinitionID)
return f, err
}