ref: Make clone() internal and remove deprecated protocol clones - #3845
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⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Features
DependenciesFlutter
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.67%
=============================================
Files ? 338
Lines ? 12169
Branches ? 0
=============================================
Hits ? 10669
Misses ? 1500
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.
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>
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>
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.SentryFeatureFlag(s).copy()is renamed toclone()(review feedback) — thecopyname only existed to avoid clashing with the deprecated publicclone(), which this PR removes.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.Also carries two v10-branch CI unblockers that pre-date this PR (every v10 PR currently fails on them):
thread_info_integration_test.dartstill calledOnProcessSpan(span)with one argument after feat(logs): Add Hint to beforeSend for logs, metrics, and spans #3847 madehintrequired — the flutter test suite didn't compile (analyze + js/linux/macos jobs). The five call sites now passHint().diffMaxis raised to 1450 KiB, same pattern as enh: refactorinitto use JNI/FFI #3324 / feat: Implement strict trace continuation #3567.Fixes #3824