Closed
refactor: gc-api-doc 作为 submodule 引入仓内 api-doc/ 目录,降低 §5.9.B 查证门槛 #502
aflyingtoAdd on  Aug 8Closed at  Aug 8
aflyingtoCollaborators
Aug 8 Create

Background

§5.9.B 要求涉及 API 调用的改动先查 gc-api-doc 参考仓(git@gitcode.com:gitcode-cli/gc-api-doc.git)确认端点/path/body。但当前 gc-api-doc 是外部独立仓,每次查证需临时 clone(约 120s,6.0M),门槛高,导致:

  • AI 代理倾向跳过查证直接类比 GitHub CLI 或猜语义——这正是 release list bug 前次修复(#256)不彻底的根因:没查 direction 参数就修成 sort.Slice,只排了已返回数据
  • 新环境/新会话每次重新 clone,重复劳动

刚合入主干的 PR #464 正是靠 §5.9.B 查 gc-api-doc 确认 direction 参数才修对。降低查证门槛能预防类似"修不彻底"。

Proposal

将 gc-api-doc 作为 git submodule 引入仓内 api-doc/ 目录:

  • git submodule add git@gitcode.com:gitcode-cli/gc-api-doc.git api-doc
  • 生成 .gitmodules + gitlink,git submodule update --init 即可本地获取,无需每次 clone
  • 版本锁定:submodule 锁定特定 commit,确保团队查证一致

Acceptance Criteria

调研结论(已确认)

  • gc-api-doc 仓 6.0M(含 .git 756K),submodule 增量可接受
  • 打包配置天然排除 api-doc/:goreleaser archives 只打包 LICENSE/README/completions+二进制(.goreleaser.yaml:59-63),Dockerfile 只 COPY gc+completions,package.sh 打包二进制产物
  • spec 无 submodule 规则(§9 需用户确认——已确认推进)
  • source-of-truth-matrix.md 未列 gc-api-doc(治理空白,本次补)

时效风险与缓解

submodule 锁定特定 commit,但 gc-api-doc 是"权威真相源"——API 文档随 GitCode 平台更新。锁定旧 commit 可能查到过时端点。缓解:

  • spec 约定定期 git submodule update --remote api-doc(如每月或发版前)
  • 查证时若端点与实测行为不符,优先以远端平台实测为准(source-of-truth-matrix 优先级第 3)

Scope

scope/docs, scope/api, type/refactor, risk/low

Refs

承接 §5.9.B 横切编排资产;release list --limit bug 修复(PR #464)印证查证价值。

likedislike
AaflyingtoCollaborators
Aug 8 Added label: risk/lowscope/apiscope/docs, status/triage,type/refactor
aflyingtoCollaborators
Aug 8 Comments:

验证记录

  • 当前版本或分支: origin/main(HEAD 84f936d,release list bug 已合入)
  • 痛点确认: §5.9.B 查证需临时 clone gc-api-doc(实测约 120s,6.0M),门槛高;release list bug(PR #464)前次 #256 修复不彻底正是跳过查证的后果
  • 方案可行:
    • gc-api-doc 仓 6.0M(含 .git 756K),submodule 增量可接受
    • 打包配置天然排除 api-doc/:goreleaser archives 只打包 LICENSE/README/completions+二进制(.goreleaser.yaml:59-63),Dockerfile 只 COPY gc+completions,package.sh 打包二进制产物——无需改打包配置
    • spec 无 submodule 规则,§9"遇到规范未覆盖情况必须先向用户确认"——已确认推进
    • source-of-truth-matrix.md 未列 gc-api-doc(治理空白,本次补)
  • 结论: 继续修复(进入开发)
likedislike
AaflyingtoCollaborators
Aug 8 Removed label: status/triage
AaflyingtoCollaborators
Aug 8 Added label: status/verified
AaflyingtoCollaborators
Aug 8 Added label: status/in-progress
AaflyingtoCollaborators
Aug 8 Associated pull request
aflyingtoCollaborators
Aug 8 Comments:

开发进度

  • 根因: §5.9.B 查证需临时 clone gc-api-doc(约 120s,6.0M),门槛高,导致 AI 代理跳过查证(release list bug 前次修复不彻底的根因)
  • 主要修改:
    • git submodule add gc-api-doc → api-doc/(生成 .gitmodules + gitlink)
    • spec/governance/source-of-truth-matrix.md:补 gc-api-doc 行 + 查证 API 端点约束
    • AGENTS.md §2.1 顶层目录表 + §2.3 + §9:路径说明更新(submodule 优先 + fallback clone + sync 约定)
    • spec/workflows/development-workflow.md §5.9.B:参考仓/查证路径/仓不可达处理更新
  • 测试: docs-only 改动,go build/vet/pre-commit/regression-core/system test 全过
  • 实际命令验证: api-doc/data/official/openapi.json 可访问(2.5M),go build 不误编译 api-doc
  • 安全影响: submodule gitlink + .gitmodules,无凭证;无敏感文件
  • 风险或未覆盖项: 风险分级 medium(.gitmodules + gitlink default),实际 low;远端 CI 待触发;独立执行主体评审待完成
  • 关联 PR: #465
likedislike
AaflyingtoCollaborators
Aug 8 Close issue
AaflyingtoCollaborators
Aug 8 Added label: status/merged