Repository navigation
fix: #50 Host 端口热加载与 Host 离线错误码语义(SDK/CLI/docs) - #54
Open
grapedev-bot wants to merge 4 commits into
Open
grapedev-bot wants to merge 4 commits into
grapedev-bot wants to merge 4 commits into
Conversation
grapedev-bot
force-pushed
the
feat/issue-50
branch
from
November 4, 2026 10:02
2a14d63 to
217e6bd
Compare
6 tasks
Collaborator
Author
|
[QA Agent] 审查报告 配置检查
变更检视
代码审查结论: ✅ 通过(整体质量良好;以下 2 个 Optional 建议与若干 FYI,无阻塞项)
正确性核对(重点验证项)
安全扫描结论: ✅ 安全
测试验证(本机复跑)
合并检查
|
added 4 commits
November 6, 2026 17:13
证据门:本环境无法访问网关(DNS 不可解析、无隧道凭据),未取得网关端口变更 推送协议证据,故不采用「每个 relay channel 探测 RelayRequest 通知」的推送路径。 改为 Host 侧主动刷新端口集(方案 A2): - portSetRefresher 在接受 relay channel 时调用 ListPorts,1s 去抖、单次 2s 超时, diff 后应用到本次 channel 的 ForwardFromRemotePort;启动时先刷新一次。 - 静态端口模式(HostConfig.Ports 非空)不刷新、不调用 API,语义仍是「需重启」。 - 无 REST 凭据(--token 模式)不刷新,沿用首 channel 端口通知握手。 - API 失败 fail-soft 保留最近端口集;OnPortsChanged 仅在 diff 非空时回调。 - 移除每 channel 探测通知的旧实现(每数据 channel 最多阻塞 2s,且前提无证据)。 测试:diff 幂等、静态忽略、增删端口、去抖、失败/超时/取消、无凭据、并发 -race。
- port create/update/delete 成功后统一输出生效提示:动态端口模式约 1s 自动同步; 静态模式输出重启命令 devbridge host <tunnelId> -p <ports>,不再静默成功。 - show 输出「Host 在线状态」(SDK TunnelStatus.HostOnline,nil 安全)。 - 既有隧道保持动态端口模式(不 pin 端口),由 Host 运行期刷新。 - 测试:中/英文案双全 + 提示必须包含重启命令。
- ports.md:动态 vs 静态端口模式生效机制对照表与刷新说明。 - host.md:端口刷新、Host 在线状态、limits 账户级边界。 - tunnels.md / cli.md:show 输出 Host 在线状态字段。 - troubleshooting.md:公网 404/503 语义表(404 tunnel not found / port not bound、 503+Retry-After host offline)、服务端边界与跨仓依赖 #50、新端口不可达排查。 - 中文同步 docs/zh 对应四篇文档,markdownlint 通过。
spec/plan/task 按 Spec v2 重写,记录:无网关推送证据 → A2 + 降级 B; 问题二仅交付客户端语义并标注跨仓依赖;逐项标注已验证/未验证/无法在本仓库验证。
grapedev-bot
force-pushed
the
feat/issue-50
branch
from
November 6, 2026 09:14
4ef461e to
028d95e
Compare
Collaborator
Author
|
[Coding Agent] 已按 Issue #50 Spec v2 返工并 force-push(head 028d95e,4 个原子提交,已 rebase 到最新 master)。
请按「证据或降级二选一」口径复审。 |
Collaborator
Author
|
[QA Agent] 审查报告 变更检视
代码审查结论: ✅ 通过(Critical 0 / Required 0 / Optional 5) 已核对 Spec v2 的四项核心交付:
问题清单(均为 Optional,不阻塞合并)
安全扫描结论: ✅ 安全
合并检查
验收口径提示(不阻塞本 PR 合并)
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
Issue #50 返工(Spec v2)。分支已 rebase 到最新
master(4 个原子提交,mergeable=true),按「证据或降级二选一」口径重写端口热加载实现,并明确问题二的跨仓边界。
证据门结论:无网关推送证据 → 采用 Host 侧刷新 + 强制降级提示
devbridge-s2.hwtunnel.comDNS 不可解析、无隧道凭据、无devbridge二进制。因此未取得「网关在
port create/update/delete后主动下发全量端口通知」的协议证据(没有新的 relay channel /
RelayRequest载荷样本,也没有下发时机与频率数据)。该路径既有「每数据通道最多阻塞 2s」的性能风险,前提也未验证。
ListPorts,1s 去抖(
portRefreshMinInterval)、单次 2s 超时(portRefreshTimeout),与缓存端口集 diff 后应用到本次 channel 的
ForwardFromRemotePort;启动时先刷新一次。HostConfig.Ports非空):不刷新、不调用 API,语义仍是「需重启」。--token模式(无 REST 凭据):不刷新,沿用首 channel 端口通知握手。HostConfig.OnPortsChanged(added, removed, current)仅在 diff 非空时回调。port create/port update/port delete成功后统一输出中/英提示——动态端口模式约 1s 自动同步;静态模式给出可复制命令
devbridge host <tunnelId> -p <ports>。删除端口此前无任何提示,本次补齐,不再静默成功。
提交(4 组)
feat(sdk): #50 Host 端口集运行期刷新(ListPorts 按需 + 1s 去抖,不依赖网关推送)feat(cli): #50 端口变更生效性提示(中/英 i18n)与 show Host 在线状态docs: #50 端口生效机制、Host 在线状态与公网状态码语义(中/英)docs: #50 任务文档 v2(证据门结论、方案 A2/降级 B、验证矩阵)验证记录
go-sdk:go test -race -count=1 ./...通过--token)不刷新TestPortSetRefresherWithoutAPICredentialTestPortNotifierConcurrentUpdates(-race)cli:go test ./...通过,TestPortChangeHintShowsRestartCommandshowHost 在线状态TestTunnelStatusHostOnline+cli/cmd/tunnel.gonpm run lint:docs:0 issuesRetry-After待有凭据环境执行的端到端复测(原始复现场景)
验收口径:
port create后 ≤2s 内200,无需重启/重连 Host;提交命令、时间戳、状态码、time_total。问题二(Host 离线返回 404)边界
本仓库仅含 CLI / go-sdk / docs,无 Relay 代码,文档变更不构成缺陷修复。本 PR 在本仓库交付:
devbridge show输出「Host 在线状态」(由status.hostConnectionCount派生);TunnelStatus.HostOnline()判定辅助(nil 安全);404 tunnel not found/port not bound与503 + Retry-After (host offline)语义表、服务端边界说明、新增端口不可达排查步骤。
公网 404 与 502/503 +
Retry-After的判定由网关实现,已在 docs 与 Issue #50 记录跨仓依赖;未端到端验证前 Issue 不关闭,关闭流程为 QA 通过 →
pending_review→ 人工确认。跨仓依赖待办
404 tunnel not found与502/503 + Retry-After (host offline)判定;测试命令