ci: gate CLI consumer contract on openapi.json changes - #374
Merged
Conversation
Deploying koyori with
|
| Latest commit: |
67600d7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9493fcc3.koyori.pages.dev |
| Branch Preview URL: | https://ci-openapi-consumer-contract.koyori.pages.dev |
Assisted-by: multi-agent-shogun-aki-tweak
cli-test.yml の drift gate 失敗時に ::error と修復コマンドを案内。 CLAUDE.md の API 表面変更手順に CLI 再生成を追記。 Assisted-by: multi-agent-shogun-aki-tweak
Assisted-by: multi-agent-shogun-aki-tweak
sousuke0422
force-pushed
the
ci/openapi-consumer-contract-gate
branch
from
July 18, 2026 09:44
4060b14 to
67600d7
Compare
yupix
approved these changes
Jul 18, 2026
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.
openapi.json(API 契約)の変更で CLI の消費者契約型チェックが CI で必ず走るようにし、「backend が契約から endpoint を撤去 × 消費者がまだ叩いている」class を 実行時 405 でなく CI で赤検知する恒久ガードを追加する。背景(動機=#364)
#364 のレビューで露呈: backend が
POST /v1/tenants/{tenant_id}/users/me/tasksを撤去しても、その endpoint を叩く CLI(apps/cli/src/commands/my.tsのmy add)の契約チェックが CI で走らず、実行時に 405 で初めて壊れる。原因は二つ:cli-test.ymlの trigger paths がapps/cli/**のみで、正典契約apps/frontend/openapi.jsonの変更では発火しなかった。src/api/paths.ts)は手書き committed で、契約から型を再生成する CI ステップが無く、契約撤去を型レベルで検知できなかった。変更(発火だけで終わらせず「意味のある検知」にする)
cli-test.ymlのpull_request/pushpaths にapps/frontend/openapi.jsonを追加(既存apps/cli/**は維持)。openapi-typescript7.13.0 とopenapi:generatescript を追加し、CI で正典openapi.jsonから消費者型(src/api/openapi.d.ts)を毎回再生成する。openapi-contract.ts): CLI が使う全 path + HTTP method を生成型へ型レベルで照合。正典から path または method(POST 等)が消えるとtscが当該 path 名付きで失敗する。git diff --exit-code -- src/api/openapi.d.tsで committed 生成物の drift も検知。apps/frontend/openapi.json変更時の CLI Unit Test workflow のみ。backend の実装変更は既存の OpenAPI Drift Check が担い、consumer CLI を過剰発火させない。赤/緑実証(#364 シナリオ・シミュレーション)
jqでpaths[/v1/tenants/{tenant_id}/users/me/tasks].postを削った型でpnpm build→ exit 2 /TS2344: Type '/v1/tenants/{tenant_id}/users/me/tasks' does not satisfy constraint never(CLImy addが使う POST 消失を検知)。※正典openapi.jsonは未変更・commit に撤去なし。pnpm openapi:generate→pnpm buildexit 0 / 生成物git diffexit 0。検証
pnpm install --frozen-lockfile(供給網 policy pass)・CLI application typecheck・contract test typecheck・生成物 drift・CLI tests 6 files / 23 tests、いずれも PASS(SKIP 0)。スコープ外
本 PR は 検知機構のみ。#364 本体の endpoint 撤去や CLI
my addの挙動修正は一切含まない。Assisted-by: multi-agent-shogun-aki-tweak