Skip to content

chore: delete dead functions and skip-only or duplicated tests - #29461

Draft
ibetitsmike wants to merge 3 commits into
mainfrom
mike/chore-delete-dead-code-and-stubs
Draft

ibetitsmike wants to merge 3 commits into
mainfrom
mike/chore-delete-dead-code-and-stubs

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Three mechanical clean-ups from the test-suite audit, one commit each:

  1. Skip-only stub tests. Six tests in coderd/exp_chats_test.go whose whole body sat behind an unconditional t.Skip ("legacy chat provider API removed"), plus TestSuspendedPagination (its comment says it existed to check db-fake parity, and dbmem is gone) and TestWorkspaceFilter (its comment says TestWorkspaceFilterManual covers it). The other eight skip-only tests stay: their skip reasons (flakes tracked in issues, manual tests, a pending upstream refactor) still hold.
  2. Duplicated tests. TestServer/Logging/{CreatesFile,Human,JSON} started three server processes to assert that a log file appears (Human duplicated CreatesFile); they are now one server with a {flag, file} table. TestServer_Logging_NoParallel/{Stackdriver,Multiple} are one server with three sinks. The four aibridge/provider Test*_TypeAndName tests are one table.
  3. Functions unreachable from any test or binary. golang.org/x/tools/cmd/deadcode -tags testsmallbatch ./cmd/... ./enterprise/cmd/... with and without -test; the intersection (dead even with every test as a root) is deleted, including the cascade (noopContainerCLI, NoopResolver, NoopResponseWriter, StatusQueue, five unused dbgen helpers, unused functional options, and so on). Left alone on purpose: scripts/rules.go (ruleguard DSL), vpn/ (live on darwin/windows), the coderd/debug.go _debug* swagger stubs, cli.SlimUnsupported (used under the slim build tag), and exported codersdk/agentsdk/workspacesdk symbols that need an external-consumer check first (ChatMessageSource, IsBedrockConfigured, IsChatGitWatchFallbackMessage, OAuth2RevocationTokenTypeHint.Valid, ParameterResolver.Resolve, ValidateNewWorkspaceParameters, ValidateWorkspaceBuildParameters, WithTrace, ServiceBannerFromProto, Stats.SessionCount, AgentReconnectingPTYInitWithContainer).

Net: 46 files, +160 / -2285 lines (582 lines of production code, the rest tests).

Validation

  • go build ./... and go vet -tags=testsmallbatch ./... (compiles every test; only two pre-existing copylocks findings in untouched files)
  • golangci-lint run over all 31 touched packages with a fresh cache: 0 issues
  • deadcode rerun after the deletions: no new cascade; only the deliberately skipped symbols remain
  • go test -race -count=2 -shuffle=on on the folded tests (./cli/ -run 'TestServer/Logging|TestServer_Logging_NoParallel', ./aibridge/provider/): pass
  • Repository pre-commit hook passed on each commit

Part of the test-suite speedup series (see #29457); independent of the other PRs.

Remote validation

Remote run on a dogfood workspace (separate compute), chat https://dogfood.cdr.dev/agents/5bbe73d0-866a-4841-9cc3-c5e5b4d97e44, tested head 3821cba7af8: go build ./... and go vet -tags=testsmallbatch ./... (only the two pre-existing lock-copy findings in untouched files), cli logging tests and aibridge/provider pass, git grep confirms only the intentionally kept codersdk symbol remains; the runner independently verified on base that all eight deleted non-folded tests began with t.Skip. Endorsed verdict: PASS.

Xum (an AI agent) authored this PR on behalf of @ibetitsmike.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant