Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[FEATURE] Carry the naked upstream HTTP status code through the provider invoker boundary

未关闭
#115 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@jeffreyaven 已经在做这个了。

开始于 2026年7月3日。

评估

这个 Issue 还没有评估数据。

描述

enhancement

Description

providerinvoker.Result is currently {Body any, Messages []string}. The anysdkhttp invoker consumes the *http.Response internally, so consumers (stackql) never see the upstream HTTP status code as a value. The status survives only as text embedded in error message strings, and only when the error body parses into the shapes that processHttpResponse formats as:

HTTP response error.  Status code 403.  Detail: '...'
Response error.  Status code 403.  Body: {...}

Error bodies published verbatim (non-object JSON, HTML, XML, plain text) carry no structured status fragment at all.

Impact

stackql/stackql#670 (MCP tools must distinguish "query ran, zero rows" from "query failed upstream", with 404 mapping onto an empty result set under database semantics) had to be implemented in stackql by regex-parsing status codes back out of message text:

  • (?i)status code:?\s*(\d{3}) in two packages (internal/stackql/execution and internal/stackql/mcpbackend), plus
  • a deliberately loose (?i)\b404\b|not\s+found fallback for unstructured bodies.

That is fragile by construction, duplicated, and imprecise for the verbatim-body case.

Proposal

Expose the status code on the invoker result, eg:

type Result struct {
	Body       any
	Messages   []string
	StatusCode int // 0 when no HTTP exchange occurred
}

or alternatively a typed upstream error carrying StatusCode. Additive and backwards compatible. The invoker sets it from the final httpResponse.StatusCode on both success and error paths, including the parsed-error-envelope (HasError) path and the verbatim-body path.

Companion

stackql-side consumption is tracked in ; on completion stackql deletes both regexes and the loose fallback.

主要语言
Go
星标
0
派生
1
平均合并
33 分钟
30 天内合并 PR
7

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

stackql/any-sdk 的其他 Issue

查看 stackql/any-sdk 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。