fix(android): preserve manually set releaseIdentifier - #661
Conversation
|
|
||
| @Test | ||
| fun `uses fallback when meta properties do not contain map id`() { | ||
| mockMetaProperties("some.other.property=value") |
There was a problem hiding this comment.
this is actually a more important case I saw in prod, tens of thousands of frames per week here at a first/quick look (although some could be older versions who don't have a releaseIdentifier in the first place).
the first one with manual releaseIdentifier isn't as common
|
Reviews (1): Last reviewed commit: "fix(android): preserve manually set rele..." | Re-trigger Greptile |
|
will check, i remember testing this so quite surprise its a bug, maybe a regression |
|
Was it a regression? Your memory is correct:
So it was a regression during development of PR #316, likely after you tested it. Strictly speaking, it was broken in |
💡 Motivation and Context
PostHogMetaPropertiesApplier.applyToConfighad an inverted guard: the comment said "if releaseIdentifier is already set, we don't need to do anything", but the condition overwrote a manually configuredreleaseIdentifierwith the auto-generated fallback (applicationId@versionName+versionCode). Anyone settingreleaseIdentifierinPostHogAndroidConfig(as documented) lost it on init, breaking proguard symbolication due to the map-id mismatch.This fixes the precedence to:
releaseIdentifieris preserved (the asset read is skipped entirely).posthog-meta.propertiesis used when present.releaseIdentifiernull.💚 How did you test it?
PostHogMetaPropertiesApplierTestcovering all five paths (preserve manual value, use meta map-id, fallback on missing file / missing key / read error)../gradlew testDebugUnitTest) andspotlessCheckpass.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file