X Tutup
Skip to content

fix(coderd): handle ignored errors across coderd packages#22851

Open
mafredri wants to merge 1 commit intomainfrom
fix/errcheck-coderd
Open

fix(coderd): handle ignored errors across coderd packages#22851
mafredri wants to merge 1 commit intomainfrom
fix/errcheck-coderd

Conversation

@mafredri
Copy link
Member

@mafredri mafredri commented Mar 9, 2026

Address errcheck violations by properly handling errors that were previously assigned to blank identifiers across coderd/ sub-packages.

Changes

chatd/chatprompt

  • Return json.Marshal errors where function signature allows; use static JSON fallback where it does not.

chatd/chatloop/compaction

  • Return json.Marshal errors from tryCompact; use static JSON fallback in publishCompactionError helper.

chatd/chattest

  • Log HTTP handler encode errors via log.Printf; return early from streaming handlers on writeSSEEvent failure.

chatd/chattool/createworkspace

  • Log UpdateChatWorkspace error at warn level via new logger field on CreateWorkspaceOptions.

chatd/chattool/execute

  • Append ProcessOutput error to timeout message so it is visible in ExecuteResult.Error.

chats.go

  • Log sendEvent errors at debug level, matching patterns already used elsewhere in the same file.

database/db2sdk

  • Return wrapped error from json.Unmarshal; use static JSON fallbacks for json.Marshal on known-safe map types.

provisionerdserver

  • Log stream.Send failure at warn level with both send and original error context.

provisionerjobs, workspaceagents, workspacebuilds

  • Add //nolint:errcheck for HTTP response writes where status is already committed (standard pattern in the codebase).

Part of the effort to enable errcheck.check-blank in golangci-lint.


🤖 This PR was created with the help of Coder Agents, and reviewed by a human 🏂🏻.

Handle previously ignored error return values in coderd:

- coderd/chats.go: check sendEvent errors, log on failure
- coderd/chatd/chattest: thread testing.TB through server structs,
  replace log.Printf with t.Logf, check writeSSEEvent errors
- coderd/chatd/chattool/createworkspace.go: log UpdateChatWorkspace
  failure instead of discarding both return values
- coderd/chatd/chattool/execute.go: surface ProcessOutput error in
  the timeout message returned to the caller
- coderd/provisionerdserver: log stream.Send failure in the
  DownloadFile error helper
@mafredri mafredri force-pushed the fix/errcheck-coderd branch from 9e39484 to 83387dd Compare March 9, 2026 18:24
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

X Tutup