Skip to content

fix(cli): distinguish undelivered /v1/limits quota fields from zero - #59

Open
grapedev-bot wants to merge 1 commit into
developfrom
feat/issue-57
Open

grapedev-bot wants to merge 1 commit into
developfrom
feat/issue-57

Conversation

@grapedev-bot

@grapedev-bot grapedev-bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • go-sdk: Limits now records whether maxTunnelBandwidthBytesPerSecond, maxHttpRequestsPerMinutePerPort and maxConnectionsPerPort were present in the /v1/limits response, exposed via HasMaxTunnelBandwidth(), HasMaxHTTPRequestsPerMinutePerPort() and HasMaxConnectionsPerPort(). Exported fields, names and types are unchanged, so existing callers keep working.
  • devbridge limits: an omitted field is rendered as not provided by server (未下发) instead of 0 B/s / 0; -1 renders as unlimited (不限制); an explicit 0 and positive values are shown as returned (bandwidth still converted to 5 MB/s style).
  • i18n: added NotProvided / Unlimited entries for en and zh.
  • Tests: go-sdk/limits_test.go covers decode of omitted / explicit-zero / positive / null payloads; cli/cmd/limits_test.go asserts the rendered rows for omitted / zero / positive / unlimited responses.
  • Docs: en and zh reference/api.md, reference/cli.md and guide/quota-and-debug.md describe the omitted / 0 / -1 semantics and note that server-side delivery is an external dependency.

Out of scope

Restoring the three fields in the /v1/limits server response: this repository has no bridge server code, tracked separately.

Testing

cd go-sdk && go vet ./... && go test ./...
cd cli && go vet ./... && go test ./...

Both suites pass. Manual render check: omitted fields print not provided by server / 未下发, -1 prints unlimited / 不限制, 5242880 prints 5 MB/s.

Refs #57

go-sdk records whether maxTunnelBandwidthBytesPerSecond,
maxHttpRequestsPerMinutePerPort and maxConnectionsPerPort were present in the
/v1/limits response and exposes Has* accessors, so an omitted field is no
longer indistinguishable from an explicit 0. Exported fields are unchanged.

The CLI now renders an omitted field as 'not provided by server' (未下发)
instead of 0, a negative value as unlimited (不限制), and keeps 0 and positive
values as returned. Adds decode and render regression tests for the omitted,
zero, positive and unlimited cases, and syncs en/zh api.md, cli.md and
quota-and-debug with the field semantics.
@grapedev-bot

Copy link
Copy Markdown
Collaborator Author

[issue agent] 合并前请确认关闭语义:本 PR 仅覆盖客户端(SDK 存在性区分 + CLI 渲染 + 用例 + en/zh 文档),/v1/limits 与 /open-api-inner/v1/relay-controller/limits 的服务端字段恢复不在本仓库范围。描述中的 Closes #57 会在合入时自动关闭 #57,但服务端仍未下发三字段,用户依旧看不到真实限额(基线 5 MB/s / 500 / 100)。建议改为 Refs #57,待服务端恢复且 LIMITS-020 取值断言通过后再关闭 Issue。详见 #57 状态同步评论。

This branch has not been deployed

No deployments
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