Skip to content

fix(ktor): [Ktor 3.6 2] Preserve Ktor 3.0 runtime compatibility - #6517

Open
adinauer wants to merge 1 commit into
dependabot/gradle/ktorClient-3.6.1from
fix/ktor-inline-attribute-key
Open

adinauer wants to merge 1 commit into
dependabot/gradle/ktorClient-3.6.1from
fix/ktor-inline-attribute-key

Conversation

@adinauer

@adinauer adinauer commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Ktor 3.6)


📜 Description

Construct the Ktor client plugin's attribute keys with explicit TypeInfo values instead of using Ktor's inline AttributeKey factory.

💡 Motivation and Context

When compiled against Ktor 3.6.1, the inline factory embeds a call to a new three-argument TypeInfo constructor. Running those compiled SDK classes with older Ktor 3.x versions then fails with NoSuchMethodError.

The explicit construction uses the stable two-argument TypeInfo constructor and preserves runtime compatibility with Ktor 3.0.0 through 3.6.1.

💚 How did you test it?

  • Ran ./gradlew spotlessApply updateKotlinAbi
  • Ran all 32 SentryKtorClientPluginTest tests after compiling once against Ktor 3.6.1 and replacing only the Ktor runtime dependencies with 3.0.0, 3.1.3, 3.2.3, 3.3.3, 3.4.3, 3.5.1, and 3.6.1; all passed
  • Ran ./gradlew :sentry-ktor-client:checkKotlinAbi
  • Verified with javap that the compiled plugin calls TypeInfo(KClass, KType) and does not reference TypeInfo(KClass, boolean, KType)

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

None.

#skip-changelog

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

Avoid inlining Ktor 3.6's AttributeKey factory. The inlined code
references a TypeInfo constructor unavailable in older Ktor 3.x
runtimes.

Construct TypeInfo explicitly through its stable two-argument
constructor instead.
@adinauer
adinauer marked this pull request as ready for review November 9, 2026 13:18
@adinauer
adinauer requested a review from a team as a code owner November 9, 2026 13:18
@adinauer
adinauer requested review from markushi and runningcode and removed request for a team November 9, 2026 13:18
@sentry

sentry Bot commented Nov 9, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.63.0 (1) release

⚙️ sentry-android Build Distribution Settings

This branch has not been deployed

No deployments
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