Skip to content

feat(error-tracking): send in-app rules for server-side reclassification - #983

Closed
marandaneto wants to merge 1 commit into
mainfrom
feat/in-app-rules-for-server
Closed

marandaneto wants to merge 1 commit into
mainfrom
feat/in-app-rules-for-server

Conversation

@marandaneto

@marandaneto marandaneto commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

💡 Motivation and Context

On minified (R8/ProGuard) builds, inAppIncludes and inAppExcludes are matched against obfuscated class names, so they rarely match. After deobfuscation the server only promotes frames under the applicationId, so:

  • an exclude such as com.myapp.vendored is overridden and those frames still show as in-app
  • an include outside the applicationId, such as a shared library module, is never applied

This PR sends the configured rules with the exception so the server can apply them again to the deobfuscated class names:

  • $exception_in_app_includes
  • $exception_in_app_excludes

They are only sent when frames carry a map_id, which means releaseIdentifier is set. Without one there is no deobfuscation, so the SDK's classification is final.

Server-side counterpart: PostHog/posthog#136364. This PR has no effect until that one ships, and the server ignores these properties until then.

💚 How did you test it?

  • New ThrowableCoercerTest cases: the rules are sent when a map_id is present, and left out when there is no map_id or no rules.
  • Ran spotlessCheck, :posthog:apiCheck and the ThrowableCoercerTest and PostHogTest suites locally. Did not test end to end against a minified app.

📝 Checklist

  • All commits are signed (see Commit signing)
  • 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 pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Pi coding agent with Claude Opus. The human chose sending the rules over two alternatives: a per-frame "excluded" marker, which fixes excludes only, and sending no value for unknown frames, which the server reads as true. No sdk-specs spec covers in-app classification.

@github-actions

Copy link
Copy Markdown
Contributor

posthog-android Compliance Report

Date: 2026-11-16 11:44:18 UTC
Duration: 117885ms

✅ All Tests Passed!

46/46 tests passed


Capture Tests

✅ 29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 280ms
Format Validation.Event Has Uuid ✅ 27ms
Format Validation.Event Has Lib Properties ✅ 27ms
Format Validation.Distinct Id Is String ✅ 18ms
Format Validation.Token Is Present ✅ 21ms
Format Validation.Custom Properties Preserved ✅ 21ms
Format Validation.Event Has Timestamp ✅ 18ms
Retry Behavior.Retries On 503 ✅ 7021ms
Retry Behavior.Does Not Retry On 400 ✅ 4018ms
Retry Behavior.Does Not Retry On 401 ✅ 4020ms
Retry Behavior.Respects Retry After Header ✅ 7020ms
Retry Behavior.Implements Backoff ✅ 17028ms
Retry Behavior.Retries On 500 ✅ 7013ms
Retry Behavior.Retries On 502 ✅ 7013ms
Retry Behavior.Retries On 504 ✅ 7014ms
Retry Behavior.Max Retries Respected ✅ 17029ms
Deduplication.Generates Unique Uuids ✅ 27ms
Deduplication.Preserves Uuid On Retry ✅ 7013ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 12021ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7012ms
Deduplication.No Duplicate Events In Batch ✅ 26ms
Deduplication.Different Events Have Different Uuids ✅ 18ms
Compression.Sends Gzip When Enabled ✅ 15ms
Batch Format.Uses Proper Batch Structure ✅ 16ms
Batch Format.Flush With No Events Sends Nothing ✅ 11ms
Batch Format.Multiple Events Batched Together ✅ 23ms
Error Handling.Does Not Retry On 403 ✅ 4017ms
Error Handling.Does Not Retry On 413 ✅ 4014ms
Error Handling.Retries On 408 ✅ 5019ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 24ms
Request Payload.Flags Request Uses V2 Query Param ✅ 16ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 19ms
Request Payload.Flags Request Omits Authorization Header ✅ 17ms
Request Payload.Token In Flags Body Matches Init ✅ 23ms
Request Payload.Groups Round Trip ✅ 16ms
Request Payload.Groups Default To Empty Object ✅ 16ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 17ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 18ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 14ms
Request Lifecycle.No Flags Request On Init Alone ✅ 8ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 16ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 26ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 14ms
Retry Behavior.Retries Flags On 502 ✅ 314ms
Retry Behavior.Retries Flags On 504 ✅ 314ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 16ms

@marandaneto

Copy link
Copy Markdown
Member Author

Tracking issue with a longer-term alternative (in-app rules stored on the release at ProGuard upload): PostHog/posthog#136478

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