feat!: remove has_ai_task and the task build reasons (#29085)
Drops the `has_ai_task` column from `template_versions` and `workspace_builds` (with its index and view projections) and removes the three task build reasons (`task_auto_pause`, `task_manual_pause`, `task_resume`) from the `build_reason` enum. Existing rows are remapped before the enum swap: automatic pauses become `autostop`, manual pauses and resumes become `initiator`, and `workspace_build_orchestrations.child_reason` follows the same mapping. The query filters, provisionerdserver flag writes, and audit ignore entries for the column go with it. **Migration cost:** recreating `build_reason` rewrites `workspace_builds`. `TestMigration000593TaskBuildReasonRewriteTiming` seeds 1,000 workspaces, 100,000 builds (30,000 with task reasons) and 5,000 orchestrations and asserts the migration stays under a two-minute bound; locally it takes about 0.7 to 1.0 s. The test is skipped under `-short`. **Breaking change:** the down migration re-adds `has_ai_task` as `false` and restores the enum values; remapped reasons keep their new values. **Review changes:** the migration test now asserts only the row remaps (schema and enum introspection removed per review); renumbered from 000592 to 000593. **Stack context:** Coder Tasks removal stack (CODAGT-642): #28743 frontend → #28788 CLI → #28789 API → #28790 provisioner → #29084 notifications → **#29085 build reasons** → #29086 tables → #28750 permissions. The last four PRs replace the single data-drop migration that used to live in #28750; each carries one concern and its own migration number. > Created by Xum (AI agent) on behalf of @ibetitsmike.
This commit is contained in:
1 parent
f809776229
commit
25af21b5d5
18 files changed
+516
-179
No files matched your search
@@ -130,7 +130,6 @@ LEFT JOIN LATERAL (
|
||||
workspace_builds.id,
|
||||
workspace_builds.transition,
|
||||
workspace_builds.template_version_id,
|
||||
workspace_builds.has_ai_task,
|
||||
workspace_builds.has_external_agent,
|
||||
template_versions.name AS template_version_name,
|
||||
provisioner_jobs.id AS provisioner_job_id,
|
||||
@@ -351,21 +350,6 @@ WHERE
|
||||
(latest_build.template_version_id = template.active_version_id) = sqlc.narg('using_active') :: boolean
|
||||
ELSE true
|
||||
END
|
||||
-- Filter by has_ai_task, checks if this is a task workspace.
|
||||
AND CASE
|
||||
WHEN sqlc.narg('has_ai_task')::boolean IS NOT NULL
|
||||
THEN sqlc.narg('has_ai_task')::boolean = EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
tasks
|
||||
WHERE
|
||||
-- Consider all tasks, deleting a task does not turn the
|
||||
-- workspace into a non-task workspace.
|
||||
tasks.workspace_id = workspaces.id
|
||||
)
|
||||
ELSE true
|
||||
END
|
||||
-- Filter by has_external_agent in latest build
|
||||
AND CASE
|
||||
WHEN sqlc.narg('has_external_agent') :: boolean IS NOT NULL THEN
|
||||
|
||||
Reference in new issue
Block a user