Repository navigation
fix(capture): keep $release_id on minimized flag-called events - #1056
Draft
posthog[bot] wants to merge 1 commit into
Draft
posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The capture contract classifies $release_id as a static, low-cardinality runtime identity property in the sense of the feature-flag-called-tracker minimal-event allowlist, so a minimized $feature_flag_called event has to retain it when the SDK stamped it from POSTHOG_RELEASE_ID. The allowlist filter runs after the release-id stamp, so the property was being stripped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 3344ee8a-c997-4953-ac4c-01cddb3ebb96
Contributor
posthog-python Compliance ReportDate: 2026-10-13T06:10:47.834532+00:00 ✅ All Tests Passed!121/121 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Capture_Ai Tests✅ 5/5 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
This branch has not been deployed
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
Contract: capture — "Environment-sourced release identifier".
The spec states:
with the acceptance scenario "A minimized flag-called event keeps the release id (@server)".
The
sdk-specscompliance matrix for this SDK records the gap on the Capture row:The spec proposal that introduced the requirement notes PHP and Ruby already behave this way and that Python needs this follow-up.
Changes
"$release_id"to_MINIMAL_FLAG_CALLED_EVENT_PROPERTIESinposthog/client.py. The stamp in_enqueue()already runs before the allowlist filter, so no ordering change is needed.test_minimal_flag_called_events_keep_their_strict_allowlist(which asserted the old, non-compliant stripping) with coverage that the release id survives minimization while everything outside the allowlist — caller properties and super properties — is still stripped, plus a case where the env var is unset./flagsemits a minimized$feature_flag_calledcarrying$release_id.POSTHOG_RELEASE_IDin the minimization test mixin, so the exact-shape assertions no longer depend on whether the test runner happens to export the variable.Why this is backwards-compatible
Purely additive: one more key is allowed through an existing filter. Nothing is removed or renamed, no public API or signature changes, no default changes, and events that never had a release id are byte-identical.
$release_idonly appears whenPOSTHOG_RELEASE_IDis set — which already caused the property to appear on every other event this SDK sends.💚 How did you test it?
pytest posthog/test/test_release_id.py posthog/test/test_feature_flag_called_minimization.py— 48 passed.pytest posthog/test— 4582 passed, 6 skipped, 52 subtests passed. The 8 failures are pre-existing AI-provider integration tests that require liveOPENAI_API_KEYcredentials and are unrelated to this change.ruff check/ruff format --check,mypy --no-site-packages | mypy-baseline filter(no issues in 298 files),python -W error -c "import posthog", andmake public_api_check(snapshot up to date) all pass.Follow-up work
Not in scope here, tracked as separate gaps on the same Capture row: the SDK still has no dynamic runtime opt-out API distinct from the constructor-time
disabledswitch (being addressed in #1047).📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Fully autonomous
Produced by the scheduled SDK-compliance workflow, which reads the compliance matrices in
PostHog/sdk-specsand implements one well-scoped, backwards-compatible gap per run. This cell was picked over the other open gaps because the remediation is a single additive allowlist entry against an explicit SHALL with a named acceptance scenario, on a widely-used contract. No human directed the work; leaving it unassigned for the owning team to triage.Created with PostHog Desktop
🤖 Generated with Claude Code