Skip to content

chore(android): spell out that the binding drops every IScopes method - #6018

Merged
jamescrosswell merged 1 commit into
mainfrom
chore/explicit-iscopes-binding-rule
Nov 26, 2026
Merged

jamescrosswell merged 1 commit into
mainfrom
chore/explicit-iscopes-binding-rule

Conversation

@ric-oliv

@ric-oliv ric-oliv commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

The IScopes rule in Metadata.xml now says what it does: it removes every method, not only the deprecated ones. The generated binding doesn't change. On both Android targets, api.xml.fixed and all generated sources are identical before and after.

The rule came from #4671. Its comment and its [@deprecated] predicate suggest it removes the 3 deprecated methods. But api.xml writes a deprecated attribute on every method, as "deprecated" or "not deprecated", so the predicate matches all 90 and the bound IScopes interface is empty. Nothing in the SDK uses its members.

The obvious fix, [@deprecated='deprecated'], breaks the build. Several remaining IScopes methods use types the binding doesn't have: IScope and ScopeCallback on main, and ProfileChunk, ProfilingTraceData and ISentryClient even after #6016. So the generator drops the whole interface, and with it IIntegration and every integration's register method. SentrySdk then fails to compile, because it registers integrations through IIntegration.

Binding IScopes properly, on top of #6016, would also need bindClient(ISentryClient) and 19 Java default methods removed. 18 of those are overloads that hit the same missing global:: bug this file already works around for ISpan.startChild. That leaves 65 bound methods for 75 to 78 KB more binding DLL, with no caller, so I left it out. Once #6016 lands, ScopesAdapter has the scope getters anyway.

#skip-changelog

The rule's comment and its [@deprecated] predicate suggested that only the deprecated IScopes
methods were removed. api.xml writes a deprecated attribute on every method, so the predicate
matched all 90, and the generated IScopes interface has no members. The SDK doesn't use them.

Narrowing the rule to the 3 deprecated methods breaks the build. IScopes also references the
profiling types removed further down, so the generator drops the whole interface, and with it
IIntegration and every integration's register method, which SentrySdk uses. Binding IScopes
properly would also need its ISentryClient member and 19 default-method overloads removed, for
about 75 KB more binding DLL and no caller.

So the path now selects every method, and the comment names the generator behavior. The
transformed API and all generated sources are identical before and after.

Refs #4671

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit c51d7e0.

Main concerns: public contract, reach.

Rules that block low also fired:

  • R6: build or release configuration changed: src/Sentry.Bindings.Android/Transforms/Metadata.xml

This label is a hint for reviewers, not an approval.

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to approve, with optional comments

This only changes a comment and a predicate. [@deprecated] already matches every IScopes method, because api.xml writes deprecated="not deprecated" on non-deprecated members (see the compareTo nodes earlier in this file). So the generated binding doesn't change, and the existing behaviour is now explicit.

  • Optional: src/Sentry.Bindings.Android/Transforms/Metadata.xml:110: the new comment gives BG8503 (unbound ProfileChunk/ProfilingTraceData) as the only reason. A reader could take it to mean that removing just those methods is enough. Consider adding one line saying that a partial binding also needs bindClient and the default-method overloads removed (the same global:: issue as the ISpan.startChild rule above). Also say that every method has @deprecated, so a [@deprecated] predicate can't narrow the removal. That stops someone from "fixing" it back to a narrower predicate.

This is an automated preliminary review.

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.15%. Comparing base (c74f16e) to head (c51d7e0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6018      +/-   ##
==========================================
+ Coverage   78.14%   78.15%   +0.01%     
==========================================
  Files         537      537              
  Lines       20077    20077              
  Branches     4041     4041              
==========================================
+ Hits        15689    15692       +3     
+ Misses       3544     3542       -2     
+ Partials      844      843       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ric-oliv
ric-oliv marked this pull request as ready for review November 25, 2026 15:08
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 25, 2026
@jamescrosswell
jamescrosswell merged commit 7161198 into main Nov 26, 2026
62 checks passed
@jamescrosswell
jamescrosswell deleted the chore/explicit-iscopes-binding-rule branch November 26, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants