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
Generated
+1
-14
@@ -1366,9 +1366,6 @@ const (
|
||||
BuildReasonSshConnection BuildReason = "ssh_connection"
|
||||
BuildReasonVscodeConnection BuildReason = "vscode_connection"
|
||||
BuildReasonJetbrainsConnection BuildReason = "jetbrains_connection"
|
||||
BuildReasonTaskAutoPause BuildReason = "task_auto_pause"
|
||||
BuildReasonTaskManualPause BuildReason = "task_manual_pause"
|
||||
BuildReasonTaskResume BuildReason = "task_resume"
|
||||
)
|
||||
|
||||
func (e *BuildReason) Scan(src interface{}) error {
|
||||
@@ -1418,10 +1415,7 @@ func (e BuildReason) Valid() bool {
|
||||
BuildReasonCli,
|
||||
BuildReasonSshConnection,
|
||||
BuildReasonVscodeConnection,
|
||||
BuildReasonJetbrainsConnection,
|
||||
BuildReasonTaskAutoPause,
|
||||
BuildReasonTaskManualPause,
|
||||
BuildReasonTaskResume:
|
||||
BuildReasonJetbrainsConnection:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -1440,9 +1434,6 @@ func AllBuildReasonValues() []BuildReason {
|
||||
BuildReasonSshConnection,
|
||||
BuildReasonVscodeConnection,
|
||||
BuildReasonJetbrainsConnection,
|
||||
BuildReasonTaskAutoPause,
|
||||
BuildReasonTaskManualPause,
|
||||
BuildReasonTaskResume,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6214,7 +6205,6 @@ type TemplateVersion struct {
|
||||
Message string `db:"message" json:"message"`
|
||||
Archived bool `db:"archived" json:"archived"`
|
||||
SourceExampleID sql.NullString `db:"source_example_id" json:"source_example_id"`
|
||||
HasAITask sql.NullBool `db:"has_ai_task" json:"has_ai_task"`
|
||||
HasExternalAgent sql.NullBool `db:"has_external_agent" json:"has_external_agent"`
|
||||
CreatedByAvatarURL string `db:"created_by_avatar_url" json:"created_by_avatar_url"`
|
||||
CreatedByUsername string `db:"created_by_username" json:"created_by_username"`
|
||||
@@ -6306,7 +6296,6 @@ type TemplateVersionTable struct {
|
||||
Message string `db:"message" json:"message"`
|
||||
Archived bool `db:"archived" json:"archived"`
|
||||
SourceExampleID sql.NullString `db:"source_example_id" json:"source_example_id"`
|
||||
HasAITask sql.NullBool `db:"has_ai_task" json:"has_ai_task"`
|
||||
HasExternalAgent sql.NullBool `db:"has_external_agent" json:"has_external_agent"`
|
||||
}
|
||||
|
||||
@@ -6840,7 +6829,6 @@ type WorkspaceBuild struct {
|
||||
DailyCost int32 `db:"daily_cost" json:"daily_cost"`
|
||||
MaxDeadline time.Time `db:"max_deadline" json:"max_deadline"`
|
||||
TemplateVersionPresetID uuid.NullUUID `db:"template_version_preset_id" json:"template_version_preset_id"`
|
||||
HasAITask sql.NullBool `db:"has_ai_task" json:"has_ai_task"`
|
||||
HasExternalAgent sql.NullBool `db:"has_external_agent" json:"has_external_agent"`
|
||||
NotifiedAutostopDeadline time.Time `db:"notified_autostop_deadline" json:"notified_autostop_deadline"`
|
||||
InitiatorByAvatarUrl string `db:"initiator_by_avatar_url" json:"initiator_by_avatar_url"`
|
||||
@@ -6897,7 +6885,6 @@ type WorkspaceBuildTable struct {
|
||||
DailyCost int32 `db:"daily_cost" json:"daily_cost"`
|
||||
MaxDeadline time.Time `db:"max_deadline" json:"max_deadline"`
|
||||
TemplateVersionPresetID uuid.NullUUID `db:"template_version_preset_id" json:"template_version_preset_id"`
|
||||
HasAITask sql.NullBool `db:"has_ai_task" json:"has_ai_task"`
|
||||
HasExternalAgent sql.NullBool `db:"has_external_agent" json:"has_external_agent"`
|
||||
// The autostop deadline value that an autostop reminder notification was last sent for. Used for idempotence: when it equals the build deadline the reminder has already been sent, and it re-arms automatically when the deadline changes.
|
||||
NotifiedAutostopDeadline time.Time `db:"notified_autostop_deadline" json:"notified_autostop_deadline"`
|
||||
|
||||
Reference in new issue
Block a user