Add CI check for amctl client codegen drift#888
Conversation
Regenerate cli/pkg/clients/amsvc/gen/types.gen.go from the current api_v1_openapi.yaml to catch up to existing drift (new Metadata fields, AgentFromKind -> KindName).
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add CI check for amctl client codegen drift
Purpose
The amctl CLI client at
cli/pkg/clients/amsvc/gen/is generated fromagent-manager-service/docs/api_v1_openapi.yaml. There is currently no automated check that the committed client stays in sync with the spec, so silent drift accumulates and only surfaces when someone notices a build break or wrong field name at runtime. This PR adds a PR-time check.Goals
types.gen.goso the new check passes onmainApproach
New workflow
.github/workflows/cli-codegen-check.yamltriggered on PRs that touch:agent-manager-service/docs/api_v1_openapi.yamlcli/pkg/clients/amsvc/**MakefileSteps:
oapi-codegenpinned tov2.6.0(matches the version recorded in the existing generated files).make amctl-gen-client(the existing target).git diff --exit-code -- cli/pkg/clients/amsvc/gen— fail with a clear message telling the developer to runmake amctl-gen-clientand commit the result.cd cli && go build ./...so a regen that still type-mismatches consumer code fails the workflow rather than silently passing.The regenerated
types.gen.gois included to clear pre-existing drift:Metadatafield onAddAgentKindVersionRequest,AgentKindVersionResponse,PublishAgentKindRequestAgentFromKindstruct removed, replaced by flatKindName *stringonAgentResponsego build ./...incli/passes against the regenerated types — no consumer code referenced the removed symbols.User stories
N/A — internal CI safeguard.
Release note
N/A — internal CI change, not user-facing.
Documentation
N/A — no user-facing change.
Training
N/A.
Certification
N/A — no impact on certification exams.
Marketing
N/A — internal CI change.
Automation tests
Security checks
Samples
N/A.
Related PRs
None.
Migrations (if applicable)
N/A.
Test environment
oapi-codegenv2.6.0Learning
Used the same pattern the agent-manager-service workflow uses for its
codegenfmt-checkjob — regenerate in CI and fail on diff. The workflow caught real existing drift on first run, which is the desired behavior.