Skip to content

refactor(codersdk): use shared error helpers in chat endpoints - #27858

Merged
dylanhuff-at-coder merged 2 commits into
mainfrom
dylan/plat-378-chats-read-body-as-json
Aug 5, 2026
Merged

refactor(codersdk): use shared error helpers in chat endpoints#27858
dylanhuff-at-coder merged 2 commits into
mainfrom
dylan/plat-378-chats-read-body-as-json

Conversation

@dylanhuff-at-coder

@dylanhuff-at-coder dylanhuff-at-coder commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Migrate chat endpoint response decoding to ReadBodyAsJSON and consolidate ReadBodyAsError construction through newResponseError, so empty-body and non-JSON errors consistently include the request method and URL.

Stacked on #27857, with the lint rule following in #27859. Refs #27044.

Reviewed and updated by Coder Agents on behalf of @dylanhuff-at-coder.

@linear-code

linear-code Bot commented Aug 4, 2026

Copy link
Copy Markdown

PLAT-378

dylanhuff-at-coder commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

@dylanhuff-at-coder
dylanhuff-at-coder force-pushed the dylan/plat-378-chats-read-body-as-json branch from c50480e to 8708970 Compare August 5, 2026 17:52
@dylanhuff-at-coder
dylanhuff-at-coder force-pushed the dylan/plat-378-codersdk-read-body-as-json branch from a08a60d to 0f4d0e0 Compare August 5, 2026 17:52
dylanhuff-at-coder added a commit that referenced this pull request Aug 5, 2026
This PR migrates 224 typed JSON response sites across 46 files to
`codersdk.ReadBodyAsJSON`, so invalid 2xx bodies return structured
errors while preserving URL credential redaction.

It intentionally excludes agent-direct HTTP, Azure IMDS, `UseNumber`,
and chat paths; stacked on #27804, with chat and lint
follow-ups in #27858 and #27859. Refs
#27044.

Reviewed and updated by Coder Agents on behalf of @dylanhuff-at-coder.
Base automatically changed from dylan/plat-378-codersdk-read-body-as-json to main August 5, 2026 20:22
@dylanhuff-at-coder
dylanhuff-at-coder marked this pull request as ready for review August 5, 2026 20:22
@dylanhuff-at-coder
dylanhuff-at-coder force-pushed the dylan/plat-378-chats-read-body-as-json branch from 8708970 to c844638 Compare August 5, 2026 20:31
@dylanhuff-at-coder
dylanhuff-at-coder marked this pull request as draft August 5, 2026 20:50
@dylanhuff-at-coder
dylanhuff-at-coder marked this pull request as ready for review August 5, 2026 20:54
@dylanhuff-at-coder
dylanhuff-at-coder marked this pull request as draft August 5, 2026 21:02
@dylanhuff-at-coder
dylanhuff-at-coder marked this pull request as ready for review August 5, 2026 21:12

@BobbyHo BobbyHo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@dylanhuff-at-coder
dylanhuff-at-coder merged commit ed10064 into main Aug 5, 2026
29 checks passed
@dylanhuff-at-coder
dylanhuff-at-coder deleted the dylan/plat-378-chats-read-body-as-json branch August 5, 2026 21:41
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 5, 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