Skip to content

[Repo Assist] refactor(server): remove writeJSONResponse passthrough wrapper#3001

Merged
lpcox merged 1 commit intomainfrom
repo-assist/improve-remove-write-json-wrapper-2026-04-01-411345abe8a11876
Apr 1, 2026
Merged

[Repo Assist] refactor(server): remove writeJSONResponse passthrough wrapper#3001
lpcox merged 1 commit intomainfrom
repo-assist/improve-remove-write-json-wrapper-2026-04-01-411345abe8a11876

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Apr 1, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Removes the private writeJSONResponse function from internal/server/http_helpers.go, which was a pure one-liner passthrough to httputil.WriteJSONResponse with no added behaviour. The 4 call sites are updated to use httputil.WriteJSONResponse directly.

Motivation

Identified in #2987 (Semantic Function Clustering analysis) as a "< 30 min" quick win:

internal/server/http_helpers.go:22 defines a private one-liner that simply delegates to httputil.WriteJSONResponse — 4 call sites inside internal/server/ use the wrapper instead of the public function directly. Recommendation: Remove and update callers. Zero behaviour change, eliminates one indirection layer.

Changes

File Change
internal/server/http_helpers.go Removed writeJSONResponse; writeErrorResponse now calls httputil.WriteJSONResponse directly
internal/server/handlers.go Added httputil import; 2 call sites updated
internal/server/health.go Added httputil import; 1 call site updated
internal/server/routed.go Added httputil import; 1 call site updated

Test Status

⚠️ Infrastructure failure: The build environment does not have Go 1.25.0 available (required by go.mod) and the toolchain download is blocked by the network firewall. The changes are a mechanical rename with no logic changes — the type signatures and behaviour are identical to the wrapper being removed. CI in GitHub Actions should pass normally.

Closes part of #2987 (the quick-win checklist item for writeJSONResponse).

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

The private writeJSONResponse function in http_helpers.go was a pure
passthrough to httputil.WriteJSONResponse with no added behaviour.
Remove it and update the 4 callers to use httputil.WriteJSONResponse
directly, eliminating one indirection layer.

Identified in #2987 (Semantic Function Clustering analysis).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox lpcox marked this pull request as ready for review April 1, 2026 20:07
Copilot AI review requested due to automatic review settings April 1, 2026 20:07
@lpcox lpcox merged commit 849d51d into main Apr 1, 2026
3 checks passed
@lpcox lpcox deleted the repo-assist/improve-remove-write-json-wrapper-2026-04-01-411345abe8a11876 branch April 1, 2026 20:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes the private writeJSONResponse helper from internal/server/http_helpers.go (a pure passthrough to internal/httputil.WriteJSONResponse) and updates server handlers to call httputil.WriteJSONResponse directly, reducing indirection in the internal/server package.

Changes:

  • Deleted writeJSONResponse from internal/server/http_helpers.go.
  • Updated writeErrorResponse to call httputil.WriteJSONResponse directly.
  • Updated 4 call sites across server handlers/middleware to use httputil.WriteJSONResponse and added the required imports.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/server/http_helpers.go Removes the one-line wrapper and routes error responses directly through httputil.WriteJSONResponse.
internal/server/handlers.go Replaces wrapper usage with httputil.WriteJSONResponse for /close responses and adds import.
internal/server/health.go Replaces wrapper usage with httputil.WriteJSONResponse for /health response and adds import.
internal/server/routed.go Replaces shutdown middleware response writer with httputil.WriteJSONResponse and adds import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants