Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cleanup platform mocking #2730

Open
wants to merge 19 commits into
base: v9
Choose a base branch
from

Conversation

vaind
Copy link
Collaborator

@vaind vaind commented Feb 18, 2025

  • 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

Copy link

codecov bot commented Feb 18, 2025

Codecov Report

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

Project coverage is 88.61%. Comparing base (bb29ef9) to head (d70dc31).

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.61%   +0.12%     
==========================================
  Files         262      263       +1     
  Lines        8750     8765      +15     
==========================================
+ Hits         7743     7767      +24     
+ Misses       1007      998       -9     

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

@getsentry getsentry deleted a comment from github-actions bot Feb 18, 2025
@ueman
Copy link
Collaborator

ueman commented Feb 18, 2025

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
Copy link
Collaborator Author

vaind commented Feb 19, 2025

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
Copy link
Collaborator Author

vaind commented Feb 19, 2025

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
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
Copy link
Collaborator

denrase commented Feb 24, 2025

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

@denrase denrase self-assigned this Feb 24, 2025
Copy link
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

@@ -23,7 +23,10 @@
- Responses are attached to the `Hint` object, which can be read in `beforeSend`/`beforeSendTransaction` callbacks via `hint.response`.
- For now, only the `dio` integration is supported.
- Enable privacy masking for screenshots by default ([#2728](https://github.com/getsentry/sentry-dart/pull/2728))

- Cleanup platform mocking ([#2730](https://github.com/getsentry/sentry-dart/pull/2730))
Copy link
Contributor

Choose a reason for hiding this comment

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

  • 🚫 The changelog entry seems to be part of an already released section ## 9.0.0.
    Consider moving the entry to the ## Unreleased section, please.

@denrase
Copy link
Collaborator

denrase commented Feb 25, 2025

@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
Copy link
Collaborator Author

vaind commented Feb 25, 2025

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.

Copy link
Collaborator Author

@vaind vaind left a comment

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
Copy link
Collaborator

denrase commented Feb 26, 2025

@vaind Thank you!

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

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.

4 participants