ci: add public API snapshot check#667
Merged
Merged
Conversation
5 tasks
Contributor
posthog-python Compliance ReportDate: 2026-06-15 15:57:21 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
.github/scripts/check_public_api.py:253-263
The `--check` flag is defined and documented, but `args.check` is never read in the body of `main()`. The snapshot check always runs when `--write` is absent, making the flag purely cosmetic. Per the simplicity rules, superfluous parts should be removed — callers (including the Makefile) can invoke the script without `--check` and get the same behaviour.
```suggestion
parser.add_argument(
"--write",
action="store_true",
help="write the generated public API snapshot (default: check)",
)
args = parser.parse_args()
```
### Issue 2 of 2
.github/scripts/check_public_api.py:150
Every branch of `_record` returns a non-`None` string; the `| None` in the return type is unreachable. This misleads type checkers and readers into thinking `None` is a meaningful output, and the downstream walrus-operator filter `if (record := _record(obj))` reads as though it guards against `None` when it only ever filters empty strings (which also never occur in practice).
```suggestion
def _record(obj: object) -> str:
```
Reviews (1): Last reviewed commit: "ci: restore release checkout depth" | Re-trigger Greptile |
Member
Author
|
Addressed Greptile's feedback in 03bab2e: removed the unused |
Contributor
|
Reviews (2): Last reviewed commit: "ci: simplify public API snapshot check C..." | Re-trigger Greptile |
dustinbyrne
approved these changes
Jun 15, 2026
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.
💡 Motivation and Context
Add a generated public API snapshot check so CI can catch accidental changes to the SDK's exported public surface. The snapshot can be regenerated intentionally with
make public_api_snapshot.💚 How did you test it?
uv run --extra dev python .github/scripts/check_public_api.pyuv run --extra dev ruff check .github/scripts/check_public_api.pyuv run --extra dev ruff format --check .github/scripts/check_public_api.py📝 Checklist
If releasing new changes
sampo addto generate a changeset file