fix(backend): include surface flag in OpenAPI stale-contract hint#10294
Open
kodjima33 wants to merge 1 commit into
Open
fix(backend): include surface flag in OpenAPI stale-contract hint#10294kodjima33 wants to merge 1 commit into
kodjima33 wants to merge 1 commit into
Conversation
The stale/missing-file hint from export_openapi.py's --check told users to run `export_openapi.py --write <path>`, omitting the surface-selection flag. Surface is a separate flag (defaults to `public`), not inferred from the output path, so following the hint verbatim for a non-public surface silently exports the public surface into the wrong file (e.g. 17-path public spec overwriting the 309-path app-client spec) and --check then validates the wrong surface as up to date. check_spec now takes the surface and prefixes the correct flag (`--app-client ` / `--surface integration-public `; empty for public) in both the stale and does-not-exist hints. Regression test asserts each surface's hint carries its selector. Verified: exercised check_spec directly for all three surfaces plus the does-not-exist branch (correct flag in every hint, public unchanged); full tests/unit/test_openapi_contract.py green (15 passed) via the pinned openapi runner venv. fixes #10217
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.
What
The
--checkfailure hint inbackend/scripts/export_openapi.pynow includes the surface-selection flag, so following it verbatim regenerates the correct surface.Why
From #10217:
check_spechad no knowledge of which surface was being checked, so itsis stale/does not existhints always emitted the bare--write <path>command, which defaults to the public surface.Change
check_spec(path, generated, surface='public')now prefixes the correct selector via a newsurface_flag()helper:--app-clientfor app-client,--surface integration-publicfor integration-public, empty for public (default invocation unchanged).main()passesargs.surfaceintocheck_spec.test_stale_hint_includes_surface_flag_for_non_public_surfacesasserts each surface's hint carries its selector and that public stays flag-free.Verified
check_speccode path for all three surfaces plus the does-not-exist branch (via the pinned openapi runner venv): every hint carries the right flag; the public hint is byte-for-byte the previous default.... run backend/scripts/export_openapi.py --app-client --write <path>... --surface integration-public --write <path>... export_openapi.py --write <path>(unchanged)tests/unit/test_openapi_contract.py— 15 passed (including the new regression test).black --line-length 120 --skip-string-normalizationclean on both files.Auto-generated from issue feedback by the mini issues-improver. Review before merge.