fix(sdk): regenerate OpenAPI types for the /v1/ready endpoint - #384
Merged
Conversation
The OpenAPI Spec job fails on dev at "Check for uncommitted changes": regenerating sdk/typescript/src/api-types.gen.ts from api/openapi.yaml produces a 176-line diff. #374 documented GET /v1/ready in the spec — the readiness endpoint from the liveness/readiness split (#243) — but did not regenerate the SDK types, so the committed output no longer matches the spec it is generated from. That check exists precisely to catch this. Regenerated. The only route added is /v1/ready. tsc --noEmit is clean and all 49 TypeScript SDK tests pass against the new types.
Correcting my previous commit, which fixed a quarter of the problem. The OpenAPI Spec job does not run openapi-typescript directly any more — #353 replaced it with `python3 scripts/generate_sdk_models.py`, which regenerates four files and diffs all of them: sdk/typescript/src/api-types.gen.ts sdk/go/openapi/models_gen.go sdk/python/src/trident_indexer/openapi_models_gen.py sdk/rust/src/openapi_models_gen.rs I regenerated only the TypeScript one, so the job stayed red. Running the real generator produces 958 lines across all four. The trigger is #374's liveness/readiness split (#243): `HealthResponse` in the spec became `LivenessResponse` plus `ReadyResponse`/`ReadyChecks`, and `/v1/ready` was documented as a new path. That rename also broke the Python package: `src/trident_indexer/__init__.py` re-exported `HealthResponse`, which the generator no longer emits, so `mypy --strict` failed with attr-defined and every pytest collection errored. Updated the re-export and `__all__` to the three new names. Verified per SDK: cargo clippy -p trident-sdk -D warnings; go build and go vet in sdk/go; tsc --noEmit and 49 tests in sdk/typescript; mypy --strict and 38 tests in sdk/python.
The OpenAPI Spec job kept failing on a one-line diff after regeneration:
-use serde::{Deserialize, Serialize};
+use serde::{Serialize, Deserialize};
Two CI jobs were asserting opposite content for the same file. quicktype
emits `{Serialize, Deserialize}`; `cargo fmt --all` reorders it
alphabetically, and openapi_models_gen.rs is reachable from lib.rs so it is
not skipped. Whichever job ran last left the other red — the Rust job on a
formatting diff, or this check on the reordered import.
Fixed in the generator rather than around it: generate_rust now runs rustfmt
over its output, so the committed file is simultaneously what quicktype
produces and what cargo fmt wants. Anyone regenerating gets the same bytes.
I first tried `ignore` in rustfmt.toml — that option is nightly-only and CI
is on stable, so it did nothing but emit warnings. Removed.
Verified: regenerating twice produces byte-identical output, cargo fmt
--check is clean, and cargo clippy -p trident-sdk -D warnings passes.
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.
The
OpenAPI Specjob is failing ondevat Check for uncommitted changes.#374 documented
GET /v1/readyinapi/openapi.yaml— the readiness endpoint from the liveness/readiness split (#243) — but did not regeneratesdk/typescript/src/api-types.gen.ts. Regenerating produces a 176-line diff, so the committed types no longer match the spec they are generated from. That check exists precisely to catch this.Regenerated. The only route added is
/v1/ready.tsc --noEmitis clean and all 49 TypeScript SDK tests pass against the new types.Not fixed here
Two other checks are red on
dev, and both are genuine security findings rather than merge fallout — they need dependency work and their own triage, so they are out of scope for a codegen refresh:govulncheckreports agoogle.golang.org/grpcadvisory reachable fromgen/trident_grpc.pb.goviaStreamEvents/Recv. Needs a grpc bump and a regenerated stub.Both belong with the existing audit backlog in #373.