Skip to content

Flutter SDK should report platform as "dart" instead of "other" #3911

Description

@stephanie-anderson

Problem

The Flutter SDK currently reports platform = "other" in event payloads. This forces the server-side source code mapping system to use a secondary sdkName check (sdk.name == "sentry.dart.flutter") to identify Flutter events before applying Dart-specific path munging (stripping package: prefixes).

Every other platform that needs path munging dispatches purely on its platform field:

PLATFORM_FRAME_MUNGER = {
    "java":  SdkFrameMunger(java_frame_munger),                # platform only
    "cocoa": SdkFrameMunger(cocoa_frame_munger),               # platform only
    "other": SdkFrameMunger(flutter_frame_munger, True, {"sentry.dart.flutter"}),
}

The requires_sdk and supported_sdks fields on SdkFrameMunger exist solely because Flutter doesn't have its own platform value. Java and Cocoa don't need them.

Beyond the dispatch issue, path munging currently happens at read time — every consumer (stacktrace links, blame lookups, CODEOWNERS matching, source context) re-runs the same munging logic. The munged_filename_and_frames() function even does a deepcopy of all frames just to attach the result.

Proposal

Two complementary changes:

1. SDK: report platform = "dart" instead of "other"

This lets the server dispatch on platform alone, consistent with Java and Cocoa.

2. Server: normalize paths at ingestion time (Relay)

Move the platform-specific path munging from read time to write time. During event ingestion, apply the munger and store the normalized, repository-relative path on the frame. This way every downstream consumer just reads frame.filename without re-munging — no deepcopy, no platform awareness needed at the API layer.

After 90 days (max data retention), all pre-normalization events will have aged out and the read-time munging codepath can be removed entirely.

Server-side impact

This unblocks cleaning up the source code mapping APIs:

  • Eliminate the sdkName parameter from the stacktrace-link endpoint
  • Remove re-munging from every consumer (stacktrace links, blame, CODEOWNERS, source context)
  • Simplify the SdkFrameMunger dataclass (remove the requires_sdk / supported_sdks fields)

Relevant server-side files

  • src/sentry/utils/event_frames.py — munger registry and flutter_frame_munger()
  • src/sentry/issues/endpoints/project_stacktrace_link.py — endpoint accepting sdkName
  • src/sentry/issues/auto_source_code_config/code_mapping.pyconvert_stacktrace_frame_path_to_source_path()

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions