Skip to content

refactor: cleanup platform mocking#2730

Merged
denrase merged 23 commits into
v9from
refactor/cleanup-platform-mocking
Mar 11, 2025
Merged

refactor: cleanup platform mocking#2730
denrase merged 23 commits into
v9from
refactor/cleanup-platform-mocking

Conversation

@vaind

@vaind vaind commented Feb 18, 2025

Copy link
Copy Markdown
Contributor
  • refactor: cleanup platform mocking

📜 Description

part of #2646

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

@codecov

codecov Bot commented Feb 18, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 95.34884% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.60%. Comparing base (7f8043c) to head (1f9fff6).
Report is 1 commits behind head on v9.

Files with missing lines Patch % Lines
dart/lib/src/platform/_io_platform.dart 72.72% 3 Missing ⚠️
dart/lib/src/sentry_options.dart 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v9    #2730      +/-   ##
==========================================
+ Coverage   88.49%   88.60%   +0.10%     
==========================================
  Files         262      263       +1     
  Lines        8746     8760      +14     
==========================================
+ Hits         7740     7762      +22     
+ Misses       1006      998       -8     

☔ View full report in Codecov by Sentry.
📢 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.

@getsentry getsentry deleted a comment from github-actions Bot Feb 18, 2025
@ueman

ueman commented Feb 18, 2025

Copy link
Copy Markdown
Collaborator

Isn't the platform checker used to decide which native integration is called? So actually returning true for 'isMacOs' on web would cause the macos integrations to be called on web?

@vaind

vaind commented Feb 19, 2025

Copy link
Copy Markdown
Contributor Author

Isn't the platform checker used to decide which native integration is called? So actually returning true for 'isMacOs' on web would cause the macos integrations to be called on web?

I believe that was the case in the past but looking at how the code which calls hasNativeIntegration has evolved, it seems pretty useless now. Also, it's actually always true for the platforms we support:

  bool get hasNativeIntegration =>
      platform.isWeb ||
      platform.isAndroid ||
      platform.isIOS ||
      platform.isMacOS ||
      platform.isWindows ||
      platform.isLinux;
      ```

@vaind
vaind marked this pull request as ready for review February 19, 2025 10:52
@vaind
vaind marked this pull request as draft February 19, 2025 10:52
@vaind vaind changed the title refactor/cleanup platform mocking refactor: cleanup platform mocking Feb 19, 2025
@vaind

vaind commented Feb 19, 2025

Copy link
Copy Markdown
Contributor Author
Error: A value of type 'SentryTransaction Function(SentryTransaction)' can't be assigned to a variable of type 'FutureOr<SentryTransaction?> Function(SentryTransaction, Hint)?'.
 - 'SentryTransaction' is from 'package:sentry/src/protocol/sentry_transaction.dart' ('../dart/lib/src/protocol/sentry_transaction.dart').
 - 'Hint' is from 'package:sentry/src/hint.dart' ('../dart/lib/src/hint.dart').
      fixture.options.beforeSendTransaction = (transaction) {
                                              ^
Shuffling test order with --test-randomize-ordering-seed=3637785904

doesn't seem related to the changes in this PR

@buenaflor

Copy link
Copy Markdown
Contributor

we recently added hints to transactions, looks like flutter tests weren't updated

cc @denrase

@vaind
vaind marked this pull request as ready for review February 19, 2025 17:16
@denrase

denrase commented Feb 24, 2025

Copy link
Copy Markdown
Collaborator

@vaind picking this up now if its al right with you

@denrase denrase self-assigned this Feb 24, 2025
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • flutter/lib/src/screenshot/recorder.dart

@denrase

denrase commented Feb 25, 2025

Copy link
Copy Markdown
Collaborator

@vaind Still have left platform.supportsNativeIntegration as we still have fuchsia as a platform, but I'm not sure about this. Naming and also we can probably remove it, wdyt?

@vaind

vaind commented Feb 25, 2025

Copy link
Copy Markdown
Contributor Author

Fuchsia
I'd leave that in, the way it was (i.e. recognized but not supported.

supportsNativeIntegration

Yeah I didn't intend to remove this in the same PR, it's already big as it is.

@vaind vaind left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@denrase the PlatformChecker->RuntimeChecker as well as removing Platform from RuntimeChecker look good to me 👍

@denrase

denrase commented Feb 26, 2025

Copy link
Copy Markdown
Collaborator

@vaind Thank you!

@krystofwoldrich @stefanosiano Would be great if you could also do a review. 🙇‍♂️

Comment thread CHANGELOG.md Outdated
denrase added 2 commits March 3, 2025 15:11
# Conflicts:
#	flutter/test/replay/replay_native_test.dart
@denrase
denrase requested a review from krystofwoldrich March 3, 2025 14:21
@denrase
denrase force-pushed the refactor/cleanup-platform-mocking branch from 3bcf878 to 067b84c Compare March 3, 2025 15:11
@denrase

denrase commented Mar 4, 2025

Copy link
Copy Markdown
Collaborator

@vaind @krystofwoldrich This should be ready to merge if you want to do a final review.

@buenaflor buenaflor 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.

lgtm 👍

@denrase
denrase merged commit 342e82b into v9 Mar 11, 2025
@denrase
denrase deleted the refactor/cleanup-platform-mocking branch March 11, 2025 12:09
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.

5 participants