Repository navigation
fix: exclude failed feature flag values and payloads - #156
Merged
Merged
Conversation
Contributor
posthog-unity Compliance ReportDate: 2026-11-12 14:21:00 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
marandaneto
marked this pull request as ready for review
November 12, 2026 12:13
Contributor
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 1aacbd5: 1 Should fix.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
ioannisj
approved these changes
Nov 13, 2026
ioannisj
left a comment
Contributor
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
One question, nothing blocking. identify now clears the cached and persisted flags on any distinct ID change, including the anonymous to identified login, and posthog-js and the identify spec only reload there. Worth confirming that's intended before merge.
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
Detailed feature flags marked
failed: truemust not expose placeholder values or payloads, or prevent boolean getters from honoring the caller's default. This implements sdk-specs #211 on Unity's existing flag surfaces, including the canonical failed-result rules and complete-response replacement rules.Flag values, payloads and diagnostics
evaluation_failed; response-wideerrors_while_computing_flagsremains independent and survives persistence. Tracking uses Unity's existing empty-string missing-response sentinel, not the caller's default.Identity-safe retention
The new errored-merge behavior exposed an existing lifecycle gap: neither identity path invalidated the old flag cache, allowing a parsed refresh for a new user to retain the previous user's targeted values and payloads.
Intentional difference from JS: Unity invalidates on anonymous-to-identified ID changes too; JS reloads while retaining prior cached values. The identify contract requires reload, not this extra wipe. This PR chooses strict distinct-ID-context isolation. An offline/failed login reload, or preload disabled without an explicit reload, therefore leaves getters using defaults and old persisted flags cleared across restart (subject to existing best-effort storage). A generation bump alone rejects late responses but still permits serving/merging old cached decisions. This intentionally changes Unity's earlier login retention.
No public API, cache schema, persisted identity fingerprint, per-user namespace or SDK dependency changes. The existing patch changeset covers the behavior changes.
Reproducible formatting
CSharpier 1.2.6 is pinned in the repository-local .NET tool manifest. Bootstrap and formatting restore/run that same tool rather than relying on a global installation; CONTRIBUTING documents this resolution. This preserves the verified formatter pin without unrelated source reformatting or a .NET SDK pin change.
💚 How did you test it?
Current signed and autoreviewed HEAD:
47848e248f69dcb46de86edb75209f04d394d390. Local verification used .NET SDK 9.0.121 and the existing Unity-stub source harness, not CI's 9.0.102 or a native Unity player.bin/test --filter FullyQualifiedName~IdentityInvalidation_FetchesCurrentIdentityBeforeSettlingCallbacksfirst failed all 4 paused-preload cases because Identify/Reset waiters completed before a current-identity request. The identical command passes after the fix, including anonymous-ID reuse and A-to-B-to-A transitions.bin/test: 592 passed, 3 existing explicit skips, 0 failed.bin/fmt --check: passed with pinned CSharpier 1.2.6. Only the two changed files were formatted.bin/build: C#9/netstandard2.1 stub build passed.bin/check-public-api: passed, unchanged snapshot.git diff --check: passed.autoreview --mode branch --base origin/mainon the exact signed HEAD above and base854e0c4e31ab22cb2609ee423a2823d599332aaawas clean, with TruffleHog clean and no accepted/actionable findings.Limits and unchanged contracts
📝 Checklist
🤖 Agent context
Autonomy: Human-driven (agent-assisted). Human DRI: @marandaneto. Pi implemented the approved fixes and ran the tests, source/test audit, and isolated autoreview listed above. Human review is required before merge. No shareable session link is available.