Skip to content

feat: add template builder deployment config and telemetry types - #25082

Merged
jeremyruppel merged 4 commits into
mainfrom
jeremy/devex-280-be-deployment-config-fields-telemetry-coderd
May 11, 2026
Merged

feat: add template builder deployment config and telemetry types#25082
jeremyruppel merged 4 commits into
mainfrom
jeremy/devex-280-be-deployment-config-fields-telemetry-coderd

Conversation

@jeremyruppel

Copy link
Copy Markdown
Contributor

Adds CODER_TEMPLATE_BUILDER_ENABLED and CODER_TEMPLATE_BUILDER_REGISTRY_URL deployment config options for the template builder feature (DEVEX-280). When disabled (the default), all /api/v2/templatebuilder/* endpoints return 404.

  • TemplateBuilderConfig struct with Enabled and RegistryURL fields, registered as serpent options in the Template Builder deployment group
  • RequireTemplateBuilderEnabled middleware returns 404 (not 403) when the feature is off, hiding the endpoints entirely
  • /templatebuilder route group in coderd.go with apiKey auth and the feature gate; sibling tickets (DEVEX-275, 276, 277, 279) add handlers under this group
  • TemplateBuilderSession telemetry struct on the Snapshot, tracking wizard entry and compose completion events; user-supplied variable values are excluded

Refs https://linear.app/codercom/issue/DEVEX-280

Implementation plan

See the plan file for the full design rationale and decision log.

Key decisions:

  • Config flag (not experiment): the feature is opt-in, not experimental. 404 instead of 403 hides the feature when disabled.
  • Direct Report() with partial snapshots for telemetry emission (matches CLI invocation pattern), rather than periodic DB collection.
  • Registry URL default: https://registry.coder.com.
  • Route at /api/v2/templatebuilder (not org-scoped): the catalog is global, org only matters at template creation time.

🤖 Generated by Coder Agents

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Docs preview

📖 View docs preview for docs/reference/api/general.md

@jeremyruppel jeremyruppel changed the title feat(coderd): add template builder deployment config and telemetry types feat: add template builder deployment config and telemetry types May 8, 2026
Comment on lines +2501 to +2514
// TemplateBuilderSession tracks a single event in the template builder
// wizard. Two events are emitted per session: one on wizard entry and
// one on compose completion. User-supplied variable values are never
// included.
type TemplateBuilderSession struct {
ID uuid.UUID `json:"id"`
EventType string `json:"event_type"`
UserID uuid.UUID `json:"user_id"`
BaseTemplateID string `json:"base_template_id,omitempty"`
ModuleIDs []string `json:"module_ids,omitempty"`
DurationSeconds float64 `json:"duration_seconds,omitempty"`
Success bool `json:"success,omitempty"`
CreatedAt time.Time `json:"created_at"`
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's important we include base template ID/module IDs in the wizard entry event because the goal is to make this builder URL-addressable, enabling pre-filled template builder forms and selections

@jeremyruppel
jeremyruppel requested review from aslilac and mafredri May 8, 2026 14:23
@jeremyruppel
jeremyruppel marked this pull request as ready for review May 8, 2026 17:21
Comment thread codersdk/deployment.go Outdated
Comment thread codersdk/deployment.go
}
deploymentGroupTemplateBuilder = serpent.Group{
Name: "Template Builder",
YAML: "templateBuilder",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I didn't even know about this. sure, this is a good approach 👍

Comment thread coderd/coderd.go Outdated
Comment thread coderd/httpmw/templatebuilder_test.go Outdated
Comment thread coderd/httpmw/templatebuilder_test.go Outdated
Comment thread codersdk/deployment.go Outdated
jeremyruppel and others added 4 commits May 11, 2026 09:39
Add CODER_TEMPLATE_BUILDER_ENABLED and CODER_TEMPLATE_BUILDER_REGISTRY_URL
deployment config options for the template builder feature. When disabled
(the default), all /api/v2/templatebuilder/* endpoints return 404.

- Add TemplateBuilderConfig struct with Enabled and RegistryURL fields
- Register deployment options with Template Builder group
- Add RequireTemplateBuilderEnabled middleware returning 404 when disabled
- Register /templatebuilder route group in coderd.go with feature gate
- Add TemplateBuilderSession telemetry struct to Snapshot for tracking
  wizard entry and compose completion events
- Auto-generate TypeScript types, swagger docs, CLI help, and server config
- Rename CODER_TEMPLATE_BUILDER_ENABLED to CODER_DISABLE_TEMPLATE_BUILDER
  (default false = enabled by default), matching DisableWorkspaceSharing
- Replace middleware-based gating with static if-guard in coderd.go
- Remove templatebuilder middleware and test files (unused)
Co-authored-by: Kayla はな <mckayla@hey.com>
@jeremyruppel
jeremyruppel force-pushed the jeremy/devex-280-be-deployment-config-fields-telemetry-coderd branch from 937071c to 9c3b658 Compare May 11, 2026 13:39
@jeremyruppel
jeremyruppel merged commit a1dbd75 into main May 11, 2026
31 checks passed
@jeremyruppel
jeremyruppel deleted the jeremy/devex-280-be-deployment-config-fields-telemetry-coderd branch May 11, 2026 13:48
@github-actions github-actions Bot locked and limited conversation to collaborators May 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants