Skip to content

fix!: make DeploymentConfig fields non-optional - #31689

Draft
DanielleMaywood wants to merge 1 commit into
mainfrom
deployment-config-required-fields
Draft

DanielleMaywood wants to merge 1 commit into
mainfrom
deployment-config-required-fields

Conversation

@DanielleMaywood

Copy link
Copy Markdown
Contributor

Makes codersdk.DeploymentConfig describe what the server actually sends, so the frontend can use the generated type instead of a hand-written copy.

  • codersdk.DeploymentConfig.Values is now DeploymentValues instead of *DeploymentValues, and neither config nor options is omitempty. The generated TypeScript type now has both fields as required.
  • GET /api/v2/deployment/config returns the same JSON as before. The handler always set both fields. It now writes a *DeploymentConfig: if it wrote the struct by value, the embedded values would not be addressable, so encoding/json would skip serpent's pointer-receiver MarshalJSON and send fields such as access_url as raw objects. TestDeploymentValues catches this. I also checked that the marshalled bytes match the old struct shape exactly.
  • site/src/api/api.ts no longer declares its own DeploymentConfig. feat: refactor deployment config #6347 added that copy in March 2023, when it removed the generated type. chore: support external types in typescript codegen #9633 brought the generated type back in September 2023, but the copy stayed. Because the generated options is readonly, the deployment settings views and useDeploymentOptions now accept readonly SerpentOption[]. The ?. after config is removed where it became redundant.

Breaking (Go SDK only): code that treats DeploymentConfig.Values as a pointer must use the value directly. For example, dc.Values != nil no longer compiles, and &dc.Values replaces dc.Values where a *DeploymentValues is needed. The HTTP API does not change.

This PR is the base of a stack that ends in #31634, which replaces knip with fallow.

Stack plan
  1. This PR: DeploymentConfig fields are non-optional and the hand-written frontend type is removed.
  2. chore(site): fixes for the dead code and import cycle that fallow found and knip did not.
  3. chore: replace knip with fallow and gate site PRs on fallow audit #31634: knip is replaced with fallow, and make lint gates site changes with fallow audit.

🤖 This PR was generated by Coder Agents on behalf of @DanielleMaywood.

codersdk.DeploymentConfig.Values is now a DeploymentValues instead of a
pointer, and neither field is omitempty. The server always sets both,
so the JSON response is unchanged, and the generated TypeScript type
now marks both fields as required.

The frontend's hand-written DeploymentConfig, added in 2023 when the
type generator could not emit this type, is removed in favor of the
generated one.

BREAKING CHANGE: Go SDK callers that treat DeploymentConfig.Values as a
pointer must use the value directly.
@DanielleMaywood DanielleMaywood added the release/breaking This label is applied to PRs to detect breaking changes as part of the release process label Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/breaking This label is applied to PRs to detect breaking changes as part of the release process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant