docs(gateway): 补齐第三方接入文档体系并接入 API 示例自动生成校验#404
Merged
phantom5099 merged 2 commits into1024XEngineer:mainfrom Apr 23, 2026
Merged
docs(gateway): 补齐第三方接入文档体系并接入 API 示例自动生成校验#404phantom5099 merged 2 commits into1024XEngineer:mainfrom
phantom5099 merged 2 commits into1024XEngineer:mainfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| if startIndex < 0 { | ||
| return "", fmt.Errorf("未找到自动生成起始标记 %q", beginMarker) | ||
| } | ||
| endIndex := strings.Index(documentContent, endMarker) |
There was a problem hiding this comment.
replaceGeneratedBlock 使用 strings.Index(documentContent, endMarker) 查找结束标记,会匹配到文档中第一个 endMarker。如果未来文档前半段出现同名字符串(例如示例代码块或说明文本),这里会与 beginMarker 错配并替换错误区间。建议从 contentStart 之后开始查找结束标记(例如对子串查找再回偏移),确保总是匹配到同一段自动生成块。
| ) | ||
| } | ||
|
|
||
| // replaceGeneratedBlock 将文档中标记区块替换为新生成的文本内容。 |
There was a problem hiding this comment.
这次新增了较多生成逻辑和字符串替换分支(缺失标记、顺序非法、内容不变、正常替换),但当前没有对应 *_test.go 覆盖。建议补一组最小单测,至少覆盖 replaceGeneratedBlock 的成功路径与错误分支,避免后续文档模板调整时静默回归。
Collaborator
Author
|
@xgopilot 请你将review的问题解决,并且也将codecov/patch的覆盖率提至百分之九十五以上! |
处理结果已按本次触发要求完成两项工作,并推送到当前 PR 分支:
未做事项:未改动运行时业务逻辑与文档内容,仅修复脚本逻辑并补测试。 |
…r tests Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: pionxe <148670367+pionxe@users.noreply.github.com>
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
变更摘要
gateway.run与gateway.bindStream双向交互规范。主要改动
docs/guides/gateway-integration-guide.mddocs/reference/gateway-rpc-api.mddocs/reference/gateway-error-catalog.mddocs/reference/gateway-compatibility.mdscripts/generate_gateway_rpc_examples/main.goMakefile增加docs-gateway、docs-gateway-check.github/workflows/ci.yml增加make docs-gateway-checkREADME.md重点说明
gateway-rpc-api.md采用 XGO 风格模板化描述每个方法:Method / Stability / Auth Required / Request Schema / Response Schema / Observation。gateway-rpc-api.md中gateway.run、gateway.bindStream增补了 ACK 与异步事件回流的细节、终态判定与取消路径。gateway-error-catalog.md以表格统一HTTP、JSON-RPC code、gateway_code,并补充Reasoning便于第三方编写 try-catch。gateway-compatibility.md给出字段优雅废弃机制与版本节奏示例(v1.2 Deprecated -> v1.4 Removed)。验证结果
go run ./scripts/generate_gateway_rpc_examplesgo test ./scripts/...make docs-gateway-check影响范围
Checklist