Skip to content

ci: Verify public API snapshot check#668

Closed
marandaneto wants to merge 1 commit into
mainfrom
ci/verify-public-api-snapshot-drift
Closed

ci: Verify public API snapshot check#668
marandaneto wants to merge 1 commit into
mainfrom
ci/verify-public-api-snapshot-drift

Conversation

@marandaneto

Copy link
Copy Markdown
Member

💡 Motivation and Context

Open a draft PR that intentionally adds a new public API without updating references/public_api_snapshot.txt, so we can verify the new public API snapshot CI check fails as expected.

💚 How did you test it?

  • uv run --extra dev ruff format --check posthog/__init__.py
  • uv run --extra dev ruff check posthog/__init__.py
  • uv run --extra dev mypy --no-site-packages --config-file mypy.ini posthog/__init__.py | uv run --extra dev mypy-baseline filter
  • uv run --extra dev python .github/scripts/check_public_api.py (expected failure: snapshot is out of date and shows posthog.public_api_snapshot_probe in the generated API)

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran sampo add to generate a changeset file

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "ci: verify public API snapshot drift" | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

posthog-python Compliance Report

Date: 2026-06-15 18:24:21 UTC
Duration: 176148ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 518ms
Format Validation.Event Has Uuid 1507ms
Format Validation.Event Has Lib Properties 1507ms
Format Validation.Distinct Id Is String 1507ms
Format Validation.Token Is Present 1507ms
Format Validation.Custom Properties Preserved 1507ms
Format Validation.Event Has Timestamp 1507ms
Retry Behavior.Retries On 503 9519ms
Retry Behavior.Does Not Retry On 400 3505ms
Retry Behavior.Does Not Retry On 401 3508ms
Retry Behavior.Respects Retry After Header 9514ms
Retry Behavior.Implements Backoff 23517ms
Retry Behavior.Retries On 500 7516ms
Retry Behavior.Retries On 502 7509ms
Retry Behavior.Retries On 504 7516ms
Retry Behavior.Max Retries Respected 23517ms
Deduplication.Generates Unique Uuids 1508ms
Deduplication.Preserves Uuid On Retry 7514ms
Deduplication.Preserves Uuid And Timestamp On Retry 14519ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 7510ms
Deduplication.No Duplicate Events In Batch 1503ms
Deduplication.Different Events Have Different Uuids 1507ms
Compression.Sends Gzip When Enabled 1507ms
Batch Format.Uses Proper Batch Structure 1507ms
Batch Format.Flush With No Events Sends Nothing 1005ms
Batch Format.Multiple Events Batched Together 1505ms
Error Handling.Does Not Retry On 403 3508ms
Error Handling.Does Not Retry On 413 3508ms
Error Handling.Retries On 408 7509ms

Feature_Flags Tests

16/16 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 1007ms
Request Payload.Flags Request Uses V2 Query Param 1007ms
Request Payload.Flags Request Hits Flags Path Not Decide 1006ms
Request Payload.Flags Request Omits Authorization Header 1007ms
Request Payload.Token In Flags Body Matches Init 1006ms
Request Payload.Groups Round Trip 1007ms
Request Payload.Groups Default To Empty Object 1006ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It 1007ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 1006ms
Request Payload.Disable Geoip Omitted Defaults To False 1007ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 1007ms
Request Lifecycle.No Flags Request On Init Alone 503ms
Request Lifecycle.No Flags Request On Normal Capture 1507ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 1011ms
Request Lifecycle.Mock Response Value Is Returned To Caller 1002ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 1509ms

@marandaneto

Copy link
Copy Markdown
Member Author

Run make public_api_check
python .github/scripts/check_public_api.py
Public API snapshot is out of date. Run make public_api_snapshot.
--- references/public_api_snapshot.txt
+++ generated public API
@@ -940,6 +940,7 @@
function posthog.join() -> None
function posthog.load_feature_flags()
function posthog.new_context(fresh: bool = False, capture_exceptions: bool = True, client: Optional[Client] = None)
+function posthog.public_api_snapshot_probe() -> str
function posthog.request.batch_post(api_key: str, host: Optional[str] = None, gzip: bool = False, timeout: int = 15, path: str = EVENTS_ENDPOINT, **kwargs) -> requests.Response
function posthog.request.determine_server_host(host: Optional[str]) -> str
function posthog.request.disable_connection_reuse() -> None

make: *** [Makefile:12: public_api_check] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant