Repository navigation
test(openapi): guard client SDK route coverage against openapi.json (#310) - #350
Open
phatloi0010 wants to merge 1 commit into
Open
phatloi0010 wants to merge 1 commit into
phatloi0010 wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Adds
src/__tests__/clientCoverage.test.tsto compare the routes covered by each official client SDK (clients/react-query,clients/go,clients/python) against the committedopenapi.jsonspecification.Closes #310
Changes
src/__tests__/clientCoverage.test.ts:collectReactQueryRoutes(): walksclients/react-query/src/hooks/*.tsforclient.<VERB>("<path>")calls.collectGoRoutes(): walksclients/go/<pkg>/*.gofor<client>.c.<Verb>(ctx, <path>, ...)calls, normalisingurl.PathEscape(...)andstrconv.FormatInt(..., 10)segments into OpenAPI{param}syntax.collectPythonRoutes(): readsclients/python/wraith/client.pyforself._<verb>(...)calls, normalising f-string placeholders ({tx_hash}) to OpenAPI parameter names ({txhash}).SHARED_NON_CLIENT_ROUTES(forx-internal: trueroutes, operational probes/healthz,/readyz,/metrics, and CSV/Parquet file streams) andKNOWN_UNCOVERED_BY_CLIENTrecording today's exact per-client gaps so the check starts green.evaluateClientCoverage()with bidirectional allow-list enforcement: fails naming both the client and the route when a new spec route is missing from a client, and also fails when a newly-implemented route is left on the allow-list so the allow-list can only shrink.react-query,go,python) covers every route inopenapi.jsonnot on its allow-list.guards the guard) confirming real routes are discovered in each client.openapi.jsonfails the check and names both the route and each client (react-query,go,python).Verification
npm run typecheck: PASS (0errors)npx tsc --noEmit: PASS (0errors)npx jest src/__tests__/clientCoverage.test.ts src/__tests__/openapiCoverage.test.ts: PASS (13/13tests passing)