Skip to content

ref: Make clone() internal and remove deprecated protocol clones - #3845

Merged
buenaflor merged 5 commits into
v10-branchfrom
ref/make-clone-internal
Jul 6, 2026
Merged

ref: Make clone() internal and remove deprecated protocol clones#3845
buenaflor merged 5 commits into
v10-branchfrom
ref/make-clone-internal

Conversation

@buenaflor

@buenaflor buenaflor commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Two related clone() cleanups for v10:

  • Hub/Scope/NoOpHub/HubAdapter/Sentry.clone() are now @internal. They exist only for SDK-internal scope/hub duplication; no user or cross-package code calls them.
  • The protocol clone() methods (Contexts and its device/os/app/browser/culture/gpu/runtime/response/trace/feedback/flags children) are removed. They were already @Deprecated, and formed a dead subtree — only called from within Contexts.clone(), which itself had no remaining callers. The alias-only "clone context" test is dropped.
  • SentryFeatureFlag(s).copy() is renamed to clone() (review feedback) — the copy name only existed to avoid clashing with the deprecated public clone(), which this PR removes.

Part of the v10 cleanup (#3487).

Breaking change: deprecated protocol clone() is removed (migration: assign directly / use copyWith where still present); Hub/Scope.clone() become @internal — low impact, direct calls were rare.

Also carries two v10-branch CI unblockers that pre-date this PR (every v10 PR currently fails on them):

Fixes #3824

clone() on Hub, Scope, NoOpHub, HubAdapter and Sentry is intended
for SDK-internal use only, so mark it @internal.

The protocol clone() methods (Contexts and its children) were already
@deprecated and formed a dead subtree with no remaining callers, so
remove them along with the alias-only clone context test.

BREAKING CHANGE: The deprecated clone() on protocol classes is removed,
and clone() on Hub/Scope is now @internal.

Fixes GH-3824
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Features

  • (flutter) Support SwiftPM on Flutter 3.44+ by buenaflor in #3784
  • (telemetry) Align span attributes with Sentry Conventions by buenaflor in #3805
  • Add feature flags to hub span by denrase in #3806

Dependencies

Flutter

  • Bump jni to 1.0.0 and jnigen to 0.16.0 in v10 by buenaflor in #3765
  • Bump sentry-cocoa to 9.17.1 in v10 by buenaflor in #3764

Internal Changes

  • (feedback) Remove deprecated SentryFeedbackWidget by buenaflor in #3844
  • (file) Remove file.async attributes from instrumentation by buenaflor in #3841
  • (logs) Remove deprecated SentryLogAttribute by buenaflor in #3843
  • Make clone() internal and remove deprecated protocol clones by buenaflor in #3845
  • Make clone() internal and remove deprecated protocol clones by buenaflor in #3845

🤖 This preview updates automatically when you update the PR.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (v10-branch@48a1579). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/dart/lib/src/hub.dart 0.00% 1 Missing ⚠️
packages/dart/lib/src/hub_adapter.dart 0.00% 1 Missing ⚠️
packages/dart/lib/src/noop_hub.dart 0.00% 1 Missing ⚠️
packages/dart/lib/src/sentry.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             v10-branch    #3845   +/-   ##
=============================================
  Coverage              ?   87.67%           
=============================================
  Files                 ?      338           
  Lines                 ?    12169           
  Branches              ?        0           
=============================================
  Hits                  ?    10669           
  Misses                ?     1500           
  Partials              ?        0           
Flag Coverage Δ
sentry 87.77% <42.85%> (?)
sentry_dio 97.73% <ø> (?)
sentry_drift 93.57% <ø> (?)
sentry_file 64.45% <ø> (?)
sentry_firebase_remote_config 100.00% <ø> (?)
sentry_flutter 91.61% <ø> (?)
sentry_grpc 99.09% <ø> (?)
sentry_hive 77.48% <ø> (?)
sentry_isar 74.37% <ø> (?)
sentry_link 21.50% <ø> (?)
sentry_logging 97.01% <ø> (?)
sentry_sqflite 88.81% <ø> (?)
sentry_supabase 97.27% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@buenaflor
buenaflor marked this pull request as ready for review July 1, 2026 15:10
@buenaflor
buenaflor requested a review from denrase as a code owner July 1, 2026 15:10
Copilot AI review requested due to automatic review settings July 1, 2026 15:10

Copilot AI 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.

Pull request overview

This PR performs v10 cleanup of clone() usage by restricting hub/scope cloning APIs to SDK-internal use and removing deprecated protocol clone() methods that no longer have callers.

Changes:

  • Mark Hub.clone(), Scope.clone(), NoOpHub.clone(), HubAdapter.clone(), and Sentry.clone() as @internal.
  • Remove deprecated protocol clone() methods for Contexts and its child protocol types.
  • Remove the now-obsolete clone context unit test.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/dart/test/contexts_test.dart Drops the clone()-focused test that no longer applies after protocol clone removals.
packages/dart/lib/src/sentry.dart Marks Sentry.clone() as @internal.
packages/dart/lib/src/scope.dart Marks Scope.clone() as @internal.
packages/dart/lib/src/protocol/sentry_trace_context.dart Removes deprecated SentryTraceContext.clone().
packages/dart/lib/src/protocol/sentry_runtime.dart Removes deprecated SentryRuntime.clone().
packages/dart/lib/src/protocol/sentry_response.dart Removes deprecated SentryResponse.clone().
packages/dart/lib/src/protocol/sentry_operating_system.dart Removes deprecated SentryOperatingSystem.clone().
packages/dart/lib/src/protocol/sentry_gpu.dart Removes deprecated SentryGpu.clone().
packages/dart/lib/src/protocol/sentry_feedback.dart Removes deprecated SentryFeedback.clone().
packages/dart/lib/src/protocol/sentry_feature_flags.dart Removes deprecated SentryFeatureFlags.clone().
packages/dart/lib/src/protocol/sentry_feature_flag.dart Removes deprecated SentryFeatureFlag.clone().
packages/dart/lib/src/protocol/sentry_device.dart Removes deprecated SentryDevice.clone().
packages/dart/lib/src/protocol/sentry_culture.dart Removes deprecated SentryCulture.clone().
packages/dart/lib/src/protocol/sentry_browser.dart Removes deprecated SentryBrowser.clone().
packages/dart/lib/src/protocol/sentry_app.dart Removes deprecated SentryApp.clone().
packages/dart/lib/src/protocol/contexts.dart Removes deprecated Contexts.clone() implementation.
packages/dart/lib/src/noop_hub.dart Marks NoOpHub.clone() as @internal.
packages/dart/lib/src/hub.dart Marks Hub.clone() as @internal.
packages/dart/lib/src/hub_adapter.dart Marks HubAdapter.clone() as @internal.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/dart/lib/src/protocol/sentry_feature_flag.dart
Align internal naming with Hub.clone() and Scope.clone(). The copy
name existed only to avoid clashing with the deprecated public clone()
API, which this branch removes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@buenaflor buenaflor changed the title ref!: Make clone() internal and remove deprecated protocol clones ref: Make clone() internal and remove deprecated protocol clones Jul 6, 2026
buenaflor and others added 2 commits July 6, 2026 13:25
PR #3847 added a required hint parameter to OnProcessSpan but missed
the five call sites in thread_info_integration_test.dart, which landed
in parallel. This breaks compilation of the flutter test suite and the
analyze gate on v10-branch, failing CI for every PR based on it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The v10 feature work pushed the with-Sentry APK size diff to ~1409 KiB,
past the 1350 KiB budget, failing the SDK metrics job on v10-branch and
every PR based on it. Raise diffMax to 1450 KiB, following the same
pattern as #3324 and #3567.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@buenaflor
buenaflor merged commit 48735cc into v10-branch Jul 6, 2026
164 of 167 checks passed
@buenaflor
buenaflor deleted the ref/make-clone-internal branch July 6, 2026 14:07
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.

3 participants