ref!: Make clone() internal and remove deprecated protocol clones#3845
ref!: Make clone() internal and remove deprecated protocol clones#3845buenaflor wants to merge 1 commit into
Conversation
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>
Semver Impact of This PR🔴 Major (breaking changes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Breaking Changes
Features
Fixes
DependenciesDeps
Internal Changes
🤖 This preview updates automatically when you update the PR. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v10-branch #3845 +/- ##
=============================================
Coverage ? 87.43%
=============================================
Files ? 337
Lines ? 12114
Branches ? 0
=============================================
Hits ? 10592
Misses ? 1522
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
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(), andSentry.clone()as@internal. - Remove deprecated protocol
clone()methods forContextsand its child protocol types. - Remove the now-obsolete
clone contextunit 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.
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.clone()methods (Contextsand itsdevice/os/app/browser/culture/gpu/runtime/response/trace/feedback/flagschildren) are removed. They were already@Deprecated, and formed a dead subtree — only called from withinContexts.clone(), which itself had no remaining callers. The alias-only "clone context" test is dropped.Part of the v10 cleanup (#3487).
Breaking change: deprecated protocol
clone()is removed (migration: assign directly / usecopyWithwhere still present);Hub/Scope.clone()become@internal— low impact, direct calls were rare.Fixes #3824