Skip to content

feat: emit error-tracking stack frames in canonical bottom-up order#467

Merged
cat-ph merged 7 commits into
mainfrom
cat/canonical-frame-order
Jul 23, 2026
Merged

feat: emit error-tracking stack frames in canonical bottom-up order#467
cat-ph merged 7 commits into
mainfrom
cat/canonical-frame-order

Conversation

@cat-ph

@cat-ph cat-ph commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Problem

The Dart error-tracking processor emitted $exception_list[].stacktrace.frames innermost-first. PostHog's canonical cross-SDK wire order is bottom-up: frames[0] is the outermost/entry-point frame and the last frame is the crash site.

Android adopted the canonical order in posthog-android 3.56.0. Apple-native exceptions already use it.

Part of cross-SDK stack-frame-order standardization: PostHog/sdk-specs#11

Changes

  • Reverse parsed Dart frames after existing top-frame filtering.
  • Keep async-gap frames correctly positioned.
  • Cover the primary exception and every cause through the shared parser.
  • Add/update Dart regression tests for entry-point-first, crash-site-last ordering.
  • Raise Flutter's Android SDK floor from 3.55.0 to 3.56.0 so Flutter's Dart and native Android paths agree.
  • Add a minor changeset.

Rollout coordination

Target Flutter cutoff/version: 5.33.0.

  1. Merge and deploy feat(cymbal): set posthog-flutter wire-order cutoff posthog#72962 first.
  2. Then merge and release this PR.

#495 also carries a minor changeset. If that PR releases first, this release becomes 5.34.0 and the Cymbal cutoff must be updated to 5.34.0 before deployment.

Known limitation: already-published Flutter 5.32.1 accepts a dynamic Android dependency range, so a fresh 5.32.1 Android build may resolve posthog-android 3.56.0 while still reporting Flutter 5.32.1. A Flutter-version cutoff cannot distinguish that dependency-resolution case; this PR prevents it for 5.33.0+ by fixing the Android floor.

Tests

  • Original PR suite: flutter test (189 tests)
  • Fresh CI: Dart tests (including web), formatting, analysis/public API, Android build/unit tests, Apple builds, web build, and publish dry-run

Dart stack frames were emitted innermost-first (crash site first). Reverse
the parsed frames so the wire order is bottom-up: frames[0] is the
outermost/entry-point frame and the last frame is the crash site, matching
PostHog's canonical cross-SDK format. Applies to the primary exception and
every cause in the chain. Native (Android/iOS) crash paths are unaffected.
@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "feat: emit error-tracking stack frames i..." | Re-trigger Greptile

Comment thread .changeset/canonical-stack-frame-order.md
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-07-22 19:11:59 UTC
Duration: 96636ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 126ms
Format Validation.Event Has Uuid 116ms
Format Validation.Event Has Lib Properties 114ms
Format Validation.Distinct Id Is String 112ms
Format Validation.Token Is Present 112ms
Format Validation.Custom Properties Preserved 113ms
Format Validation.Event Has Timestamp 112ms
Retry Behavior.Retries On 503 5323ms
Retry Behavior.Does Not Retry On 400 2117ms
Retry Behavior.Does Not Retry On 401 2117ms
Retry Behavior.Respects Retry After Header 8121ms
Retry Behavior.Implements Backoff 15426ms
Retry Behavior.Retries On 500 5224ms
Retry Behavior.Retries On 502 5222ms
Retry Behavior.Retries On 504 5223ms
Retry Behavior.Max Retries Respected 15442ms
Deduplication.Generates Unique Uuids 124ms
Deduplication.Preserves Uuid On Retry 5222ms
Deduplication.Preserves Uuid And Timestamp On Retry 10333ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5228ms
Deduplication.No Duplicate Events In Batch 124ms
Deduplication.Different Events Have Different Uuids 111ms
Compression.Sends Gzip When Enabled 112ms
Batch Format.Uses Proper Batch Structure 110ms
Batch Format.Flush With No Events Sends Nothing 105ms
Batch Format.Multiple Events Batched Together 117ms
Error Handling.Does Not Retry On 403 2114ms
Error Handling.Does Not Retry On 413 2116ms
Error Handling.Retries On 408 5223ms

Feature_Flags Tests

16/16 tests passed

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

@github-actions

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@github-actions github-actions Bot added the stale label Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

@cat-ph cat-ph removed the stale label Jul 22, 2026
@cat-ph
cat-ph marked this pull request as ready for review July 22, 2026 19:08
@cat-ph
cat-ph requested a review from a team as a code owner July 22, 2026 19:08
@cat-ph
cat-ph requested review from a team, ablaszkiewicz and hpouillot July 22, 2026 19:08
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Reviews (2): Last reviewed commit: "chore(android): restore existing JVM tar..." | Re-trigger Greptile

@cat-ph
cat-ph merged commit 34dde19 into main Jul 23, 2026
28 checks passed
@cat-ph
cat-ph deleted the cat/canonical-frame-order branch July 23, 2026 16:59
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