From bdf2a9809c10a75afd16276432bac0dc266efb9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McKayla=20=E3=81=AF=E3=81=AA?= Date: Fri, 11 Sep 2026 21:57:31 +0000 Subject: [PATCH 1/4] chore: remove stale TODO shims and dead code --- cli/configssh.go | 11 +--------- coderd/httpmw/organizationparam.go | 9 +-------- coderd/httpmw/organizationparam_test.go | 11 ---------- .../timings-aggregation/fake-terraform.sh | 3 --- vpn/tun_windows.go | 20 ------------------- 5 files changed, 2 insertions(+), 52 deletions(-) diff --git a/cli/configssh.go b/cli/configssh.go index f618418e5d3..db344ed6c2a 100644 --- a/cli/configssh.go +++ b/cli/configssh.go @@ -7,7 +7,6 @@ import ( "fmt" "io" "io/fs" - "net/http" "os" "path/filepath" "runtime" @@ -456,15 +455,7 @@ func (r *RootCmd) configSSH() *serpent.Command { coderdConfig, err := client.SSHConfiguration(ctx) if err != nil { - // If the error is 404, this deployment does not support - // this endpoint yet. Do not error, just assume defaults. - // TODO: Remove this in 2 months (May 31, 2023). Just return the error - // and remove this 404 check. - var sdkErr *codersdk.Error - if !xerrors.As(err, &sdkErr) || sdkErr.StatusCode() != http.StatusNotFound { - return xerrors.Errorf("fetch coderd config failed: %w", err) - } - coderdConfig.HostnamePrefix = "coder." + return xerrors.Errorf("fetch coderd config failed: %w", err) } configOptions, err := mergeSSHOptions(sshConfigOpts, coderdConfig, string(root), coderBinary) diff --git a/coderd/httpmw/organizationparam.go b/coderd/httpmw/organizationparam.go index 349ffe25e6c..d62ca67eaef 100644 --- a/coderd/httpmw/organizationparam.go +++ b/coderd/httpmw/organizationparam.go @@ -69,14 +69,7 @@ func ExtractOrganizationParam(db database.Store) func(http.Handler) http.Handler // If the name is exactly "default", then we fetch the default // organization. This is a special case to make it easier // for single org deployments. - // - // arg == uuid.Nil.String() should be a temporary workaround for - // legacy provisioners that don't provide an organization ID. - // This prevents a breaking change. - // TODO: This change was added March 2024. Nil uuid returning the - // default org should be removed some number of months after - // that date. - if arg == codersdk.DefaultOrganization || arg == uuid.Nil.String() { + if arg == codersdk.DefaultOrganization { organization, dbErr = db.GetDefaultOrganization(ctx) } else { // Try by name or uuid. diff --git a/coderd/httpmw/organizationparam_test.go b/coderd/httpmw/organizationparam_test.go index 5ebbc429e15..aef26bc7bcf 100644 --- a/coderd/httpmw/organizationparam_test.go +++ b/coderd/httpmw/organizationparam_test.go @@ -227,16 +227,5 @@ func TestOrganizationParam(t *testing.T) { res = rw.Result() defer res.Body.Close() require.Equal(t, http.StatusOK, res.StatusCode, "by default keyword") - - // Try by legacy - // TODO: This can be removed when legacy nil uuids are no longer supported. - // This is a temporary measure to ensure as legacy provisioners use - // nil uuids as the org id and expect the default org. - chi.RouteContext(r.Context()).URLParams.Add("organization", uuid.Nil.String()) - chi.RouteContext(r.Context()).URLParams.Add("user", user.ID.String()) - rtr.ServeHTTP(rw, r) - res = rw.Result() - defer res.Body.Close() - require.Equal(t, http.StatusOK, res.StatusCode, "by nil uuid (legacy)") }) } diff --git a/provisioner/terraform/testdata/timings-aggregation/fake-terraform.sh b/provisioner/terraform/testdata/timings-aggregation/fake-terraform.sh index 582df28c621..96a310a5938 100755 --- a/provisioner/terraform/testdata/timings-aggregation/fake-terraform.sh +++ b/provisioner/terraform/testdata/timings-aggregation/fake-terraform.sh @@ -123,9 +123,6 @@ function terraform_apply() { EOL } -# TODO: remove -echo "$@" >>/tmp/blah - case "$1" in version) terraform_version diff --git a/vpn/tun_windows.go b/vpn/tun_windows.go index fadf6caf27d..c91308df81a 100644 --- a/vpn/tun_windows.go +++ b/vpn/tun_windows.go @@ -138,23 +138,3 @@ func windowsUptime() time.Duration { r, _, _ := getTickCount64Proc.Call() return time.Duration(int64(r)) * time.Millisecond } - -// TODO(@dean): implement a way to install/uninstall the wintun driver, most -// likely as a CLI command -// -// This is taken from Tailscale: -// https://github.com/tailscale/tailscale/blob/3abfbf50aebbe3ba57dc749165edb56be6715c0a/cmd/tailscaled/tailscaled_windows.go#L543 -func uninstallWinTun(logf logger.Logf) { - dll := windows.NewLazyDLL("wintun.dll") - if err := dll.Load(); err != nil { - logf("Cannot load wintun.dll for uninstall: %v", err) - return - } - - logf("Removing wintun driver...") - err := wintun.Uninstall() - logf("Uninstall: %v", err) -} - -// TODO(@dean): remove -var _ = uninstallWinTun From b25dd386fb965e953b260e413e8aeb6f9514a134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McKayla=20=E3=81=AF=E3=81=AA?= Date: Fri, 11 Sep 2026 22:14:41 +0000 Subject: [PATCH 2/4] chore: keep nil uuid default org behavior and wintun uninstall --- coderd/httpmw/organizationparam.go | 9 +++++---- coderd/httpmw/organizationparam_test.go | 8 ++++++++ vpn/tun_windows.go | 20 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/coderd/httpmw/organizationparam.go b/coderd/httpmw/organizationparam.go index d62ca67eaef..35744463fd4 100644 --- a/coderd/httpmw/organizationparam.go +++ b/coderd/httpmw/organizationparam.go @@ -66,10 +66,11 @@ func ExtractOrganizationParam(db database.Store) func(http.Handler) http.Handler var organization database.Organization var dbErr error - // If the name is exactly "default", then we fetch the default - // organization. This is a special case to make it easier - // for single org deployments. - if arg == codersdk.DefaultOrganization { + // If the name is exactly "default" or the nil UUID, then we fetch + // the default organization. This is a special case to make it + // easier for single org deployments, and external callers depend + // on the nil UUID resolving to the default org. + if arg == codersdk.DefaultOrganization || arg == uuid.Nil.String() { organization, dbErr = db.GetDefaultOrganization(ctx) } else { // Try by name or uuid. diff --git a/coderd/httpmw/organizationparam_test.go b/coderd/httpmw/organizationparam_test.go index aef26bc7bcf..3d12e805847 100644 --- a/coderd/httpmw/organizationparam_test.go +++ b/coderd/httpmw/organizationparam_test.go @@ -227,5 +227,13 @@ func TestOrganizationParam(t *testing.T) { res = rw.Result() defer res.Body.Close() require.Equal(t, http.StatusOK, res.StatusCode, "by default keyword") + + // Try by nil uuid, which resolves to the default org. + chi.RouteContext(r.Context()).URLParams.Add("organization", uuid.Nil.String()) + chi.RouteContext(r.Context()).URLParams.Add("user", user.ID.String()) + rtr.ServeHTTP(rw, r) + res = rw.Result() + defer res.Body.Close() + require.Equal(t, http.StatusOK, res.StatusCode, "by nil uuid (legacy)") }) } diff --git a/vpn/tun_windows.go b/vpn/tun_windows.go index c91308df81a..fadf6caf27d 100644 --- a/vpn/tun_windows.go +++ b/vpn/tun_windows.go @@ -138,3 +138,23 @@ func windowsUptime() time.Duration { r, _, _ := getTickCount64Proc.Call() return time.Duration(int64(r)) * time.Millisecond } + +// TODO(@dean): implement a way to install/uninstall the wintun driver, most +// likely as a CLI command +// +// This is taken from Tailscale: +// https://github.com/tailscale/tailscale/blob/3abfbf50aebbe3ba57dc749165edb56be6715c0a/cmd/tailscaled/tailscaled_windows.go#L543 +func uninstallWinTun(logf logger.Logf) { + dll := windows.NewLazyDLL("wintun.dll") + if err := dll.Load(); err != nil { + logf("Cannot load wintun.dll for uninstall: %v", err) + return + } + + logf("Removing wintun driver...") + err := wintun.Uninstall() + logf("Uninstall: %v", err) +} + +// TODO(@dean): remove +var _ = uninstallWinTun From d99c163ee9add3b66332861ec88ca74967bc2adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McKayla=20=E3=81=AF=E3=81=AA?= Date: Fri, 11 Sep 2026 16:30:40 -0600 Subject: [PATCH 3/4] Update coderd/httpmw/organizationparam.go --- coderd/httpmw/organizationparam.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coderd/httpmw/organizationparam.go b/coderd/httpmw/organizationparam.go index 35744463fd4..089188b9c91 100644 --- a/coderd/httpmw/organizationparam.go +++ b/coderd/httpmw/organizationparam.go @@ -68,8 +68,7 @@ func ExtractOrganizationParam(db database.Store) func(http.Handler) http.Handler // If the name is exactly "default" or the nil UUID, then we fetch // the default organization. This is a special case to make it - // easier for single org deployments, and external callers depend - // on the nil UUID resolving to the default org. + // easier for single org deployments. if arg == codersdk.DefaultOrganization || arg == uuid.Nil.String() { organization, dbErr = db.GetDefaultOrganization(ctx) } else { From 2cf09aee6a1c041a45d43461bf786534a47823cf Mon Sep 17 00:00:00 2001 From: McKayla Washburn-Love Date: Fri, 11 Sep 2026 22:50:49 +0000 Subject: [PATCH 4/4] more --- coderd/wsbuilder/wsbuilder.go | 6 +---- codersdk/users.go | 48 +---------------------------------- 2 files changed, 2 insertions(+), 52 deletions(-) diff --git a/coderd/wsbuilder/wsbuilder.go b/coderd/wsbuilder/wsbuilder.go index 45071f0ccbe..16cac866d69 100644 --- a/coderd/wsbuilder/wsbuilder.go +++ b/coderd/wsbuilder/wsbuilder.go @@ -1394,9 +1394,5 @@ func (b *Builder) usingDynamicParameters() bool { if err != nil { return false // Let another part of the code get this error } - if tpl.UseClassicParameterFlow { - return false - } - - return true + return !tpl.UseClassicParameterFlow } diff --git a/codersdk/users.go b/codersdk/users.go index c784c13e8c9..98925146c89 100644 --- a/codersdk/users.go +++ b/codersdk/users.go @@ -2,7 +2,6 @@ package codersdk import ( "context" - "encoding/json" "fmt" "net/http" "strconv" @@ -165,26 +164,7 @@ type CreateFirstUserResponse struct { OrganizationID uuid.UUID `json:"organization_id" format:"uuid"` } -// CreateUserRequest -// Deprecated: Use CreateUserRequestWithOrgs instead. This will be removed. -// TODO: When removing, we should rename CreateUserRequestWithOrgs -> CreateUserRequest -// Then alias CreateUserRequestWithOrgs to CreateUserRequest. -// @typescript-ignore CreateUserRequest type CreateUserRequest struct { - Email string `json:"email" validate:"required,email" format:"email"` - Username string `json:"username" validate:"required,username"` - Name string `json:"name" validate:"user_real_name"` - Password string `json:"password"` - // UserLoginType defaults to LoginTypePassword. - UserLoginType LoginType `json:"login_type"` - // DisableLogin sets the user's login type to 'none'. This prevents the user - // from being able to use a password or any other authentication method to login. - // Deprecated: Set UserLoginType=LoginTypeDisabled instead. - DisableLogin bool `json:"disable_login"` - OrganizationID uuid.UUID `json:"organization_id" validate:"" format:"uuid"` -} - -type CreateUserRequestWithOrgs struct { Email string `json:"email" validate:"required_unless=ServiceAccount true,omitempty,email" format:"email"` Username string `json:"username" validate:"required,username"` Name string `json:"name" validate:"user_real_name"` @@ -201,33 +181,7 @@ type CreateUserRequestWithOrgs struct { Roles []string `json:"roles,omitempty"` } -// UnmarshalJSON implements the unmarshal for the legacy param "organization_id". -// To accommodate multiple organizations, the field has been switched to a slice. -// The previous field will just be appended to the slice. -// Note in the previous behavior, omitting the field would result in the -// default org being applied, but that is no longer the case. -// TODO: Remove this method in it's entirety after some period of time. -// This will be released in v1.16.0, and is associated with the multiple orgs -// feature. -func (r *CreateUserRequestWithOrgs) UnmarshalJSON(data []byte) error { - // By using a type alias, we prevent an infinite recursion when unmarshalling. - // This allows us to use the default unmarshal behavior of the original type. - type AliasedReq CreateUserRequestWithOrgs - type DeprecatedCreateUserRequest struct { - AliasedReq - OrganizationID *uuid.UUID `json:"organization_id" format:"uuid"` - } - var dep DeprecatedCreateUserRequest - err := json.Unmarshal(data, &dep) - if err != nil { - return err - } - *r = CreateUserRequestWithOrgs(dep.AliasedReq) - if dep.OrganizationID != nil { - r.OrganizationIDs = append(r.OrganizationIDs, *dep.OrganizationID) - } - return nil -} +type CreateUserRequestWithOrgs = CreateUserRequest type UpdateUserProfileRequest struct { Username string `json:"username" validate:"required,username"`