Open
feat: #441 契约快照登记 repos vcs-health reset 命令 #90
grape_botAdd on 18 hours ago
feat: #441 契约快照登记 repos vcs-health reset 命令 #90
Open
Merged fromfeat/issue-441intomain
Merge blocked
18 hours ago Associated issue: 请CLI补充相关接口
16 hours ago Changed the target branch from ldw into main
概述
为 Issue #441 在随包契约快照登记
POST /api/repos/{owner}/{repo}/vcs-health/reset(operationIdrepos_vcs-health_reset),registry 按 operationId 自动生成grape repos vcs-health reset,无 CLI 源码改动(契约驱动 R7)。改动
grape_cli/data/openapi.json:新增该 operation(post、owner/repopath 参数、session_only作用域、无 requestBody);minified 风格保持,其余部分字节零 diffgrape_cli/data/examples.json:帮助示例(--dry-run先预览 +--json-out)test/data/commands-snapshot.txt:全量命令树快照新增一行repos vcs-health resettest/test_vcs_health_reset.py:注册 / 命令树 / 成功 / 403 / 404 / 超时 / dry-run / 非重试,共 11 用例README.md/README.zh.md:契约命令示例;顺带清理 README 中残留的合并冲突标记(<<<<<<< HEAD,属基线遗留)CHANGELOG.md:Unreleased / Added 记账docs/issue-441/:spec / plan / task测试
python3 -m pytest -q→ 392 passed(清空平台注入的GRAPE_*环境变量后;受注入环境影响时 5 条既有用例失败,与本改动无关)GRAPE_BASE_URL=<不可达> grape commands vcs→repos vcs-health reset{"ok": true, "reset": true}exit 0;403 → 非零退出 + 保留服务端 message;404 → 非零退出 + message;超时 → exit 1 + 超时说明;--dry-run→ 零写请求、预览脱敏--dry-run/--json-out/ 非幂等(不进_IDEMPOTENT_RETRY_OPS,502 只请求 1 次)均有用例覆盖依赖(跨仓)
当前部署契约
2.3.0a1(401 endpoints)与生产{base}/static/openapi.json均未导出该路径,POST /api/repos/{owner}/{repo}/vcs-health/reset未命中路由(405)。在线grape refresh后可见该命令需服务端仓库(grape-dev/grape)导出该 operation;本 PR 完成 CLI 侧契约快照登记、命令生成与写命令信号契约。关联