Skip to content

fix: ignore version value in public API snapshot#677

Merged
marandaneto merged 5 commits into
mainfrom
fix/public-api-version-placeholder
Jun 18, 2026
Merged

fix: ignore version value in public API snapshot#677
marandaneto merged 5 commits into
mainfrom
fix/public-api-version-placeholder

Conversation

@marandaneto

@marandaneto marandaneto commented Jun 18, 2026

Copy link
Copy Markdown
Member

💡 Motivation and Context

The public API snapshot currently records the literal SDK version value from posthog.version.VERSION, so routine version bumps can fail the public API check even though the public API shape has not changed.

This updates snapshot generation to render that value as <version> so version-only changes do not cause public API snapshot drift. The focused regression test now runs in the public API CI job instead of the full package test suite.

While validating CI, the normal Python test jobs were also hanging at process shutdown because test-created clients registered atexit joins and then tried to flush background queues with invalid test API keys. The test suite now disables those client atexit registrations so pytest can exit cleanly after assertions pass.

💚 How did you test it?

  • python .github/scripts/test_check_public_api.py
  • uv run python .github/scripts/check_public_api.py --write
  • uv run python .github/scripts/check_public_api.py
  • uv run pytest --collect-only posthog/test
  • uv run pytest --verbose --timeout=30

📝 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

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented with pi. The change is intentionally scoped to the public API snapshot script: only the posthog.version.VERSION attribute value is templated, while the symbol remains part of the snapshot so public API additions/removals are still detected. A regression test now covers every configured attribute placeholder as part of the public API CI check.

@marandaneto marandaneto self-assigned this Jun 18, 2026
@marandaneto marandaneto marked this pull request as ready for review June 18, 2026 09:03
@marandaneto marandaneto requested a review from a team as a code owner June 18, 2026 09:04
@marandaneto

Copy link
Copy Markdown
Member Author

@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
.github/scripts/check_public_api.py:22
**No automated test for the placeholder substitution**

The checklist notes that tests were not added. Per the team's stated preference for parameterised tests, it would be worth adding a test that constructs a mock griffe attribute object with `path = "posthog.version.VERSION"` and a concrete value (e.g. `"7.19.1"`) and asserts that `_attribute_details` returns a string containing `= <version>`. If `ATTRIBUTE_VALUE_PLACEHOLDERS` is extended in the future, a parameterised test over the dict would catch regressions automatically.

Reviews (1): Last reviewed commit: "fix: ignore version value in public API ..." | Re-trigger Greptile

Comment thread .github/scripts/check_public_api.py
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

posthog-python Compliance Report

Date: 2026-06-18 12:11:54 UTC
Duration: 540095ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 517ms
Format Validation.Event Has Uuid 10008ms
Format Validation.Event Has Lib Properties 10007ms
Format Validation.Distinct Id Is String 10007ms
Format Validation.Token Is Present 10007ms
Format Validation.Custom Properties Preserved 10007ms
Format Validation.Event Has Timestamp 10006ms
Retry Behavior.Retries On 503 18019ms
Retry Behavior.Does Not Retry On 400 12004ms
Retry Behavior.Does Not Retry On 401 10007ms
Retry Behavior.Respects Retry After Header 16014ms
Retry Behavior.Implements Backoff 32027ms
Retry Behavior.Retries On 500 16001ms
Retry Behavior.Retries On 502 16011ms
Retry Behavior.Retries On 504 16010ms
Retry Behavior.Max Retries Respected 32019ms
Deduplication.Generates Unique Uuids 10001ms
Deduplication.Preserves Uuid On Retry 16016ms
Deduplication.Preserves Uuid And Timestamp On Retry 23014ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 16011ms
Deduplication.No Duplicate Events In Batch 10001ms
Deduplication.Different Events Have Different Uuids 10007ms
Compression.Sends Gzip When Enabled 10007ms
Batch Format.Uses Proper Batch Structure 10007ms
Batch Format.Flush With No Events Sends Nothing 5005ms
Batch Format.Multiple Events Batched Together 10005ms
Error Handling.Does Not Retry On 403 12009ms
Error Handling.Does Not Retry On 413 10006ms
Error Handling.Retries On 408 14015ms

Feature_Flags Tests

16/16 tests passed

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

@marandaneto marandaneto enabled auto-merge (squash) June 18, 2026 11:29
@marandaneto marandaneto merged commit 0301f76 into main Jun 18, 2026
31 checks passed
@marandaneto marandaneto deleted the fix/public-api-version-placeholder branch June 18, 2026 12:08
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.

2 participants