Repository navigation
Generate only the API operations the CLI calls - #12
Merged
Merged
Conversation
The committed client held the whole backend API, including admin, billing and webhook surface and every backend proto comment. Now make generate-api-client keeps only the operations listed in scripts/openapi-allowlist.txt, the schemas they reach, and no free text. scripts/openapi-leak-check.sh runs after generation and in CI. It fails on unlisted or uncalled operations, leftover descriptions, admin and billing names, private IPs, internal hostnames and emails. Extra private patterns can come from OPENAPI_LEAK_EXTRA_PATTERNS_FILE. Regenerated from the backend main Swagger (910ec00c) with oapi-codegen v2.8.0. The generated files drop from 3.35 MB to 215 KB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Summary
The committed generated client (
internal/api/generated/) held the whole backend API: admin, billing, payout and webhook surface, plus every backend proto comment. This PR cuts it down to what the CLI calls and adds a guard so the full API can't come back.scripts/openapi-allowlist.txtlists the 24 operations the CLI calls (agents, service accounts, organizations, metrics write credentials, platform versions).scripts/openapi-allowlist.pyruns inmake generate-api-clientafter the Swagger 2 to OpenAPI 3 conversion. It keeps the allow-listed operations, the components they reach through$ref, and their tags, and strips descriptions, summaries, titles and examples.scripts/openapi-leak-check.sh(make leak-check, run after generation and in CI) fails on:.svc,cluster.local,.internal,localhost, and email addressesOPENAPI_LEAK_EXTRA_PATTERNS_FILE.main(910ec00c) with oapi-codegen v2.8.0. The generated files drop from 3.35 MB to 215 KB (−85k lines).CONTRIBUTING.mddocuments how to add an operation.Notes
openapi3.yamlhad drifted fromtypes.gen.go, which had hand edits (Organization.hypervisorDriver, the SolusVM and VirtFusion driver enums). Regenerating from the backend Swagger brings them back in line. The new spec also addsPLATFORM_DRIVER_PTERODACTYLfrom backend main.v1Agentschema still has fields such askubeconfig,agentPublicIp,asnandddosProvider. They belong to the public agent API the CLI uses, so the check does not ban them.Test plan
go build ./...,go vet ./...,make test,golangci-lint runall passmake leak-checkpasses on the new client/v1/admin,Enforcement)go mod tidyis a no-op🤖 Generated with Claude Code