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

Pixel retrying #3358

Merged
merged 47 commits into from
Oct 18, 2024
Merged

Pixel retrying #3358

merged 47 commits into from
Oct 18, 2024

Conversation

samsymons
Copy link
Contributor

@samsymons samsymons commented Sep 13, 2024

Task/Issue URL: https://app.asana.com/0/72649045549333/1208300963176861/f
Tech Design URL:
CC:

Description:

This PR adds pixel retrying behavior for a small set of pixels.

Steps to test this PR:

  1. To test this, we should either fire real pixels by disabling dryRun mode or simulate a failed error call by adding an error to Pixel.swift#240 - adjust the following steps based on which path you take (i.e., enabling Airplane Mode to test real pixel call failures, or removing the fake error and rebuilding)
  2. Sign into a Privacy Pro account, easiest way to get one is here; once you have it then open the Privacy Pro settings and follow the "I have an account" flow
  3. Enable and start the VPN by opening the VPN UI
  4. Check that you see log entries that say "Saving persistent pixel" followed by m_netp_controller_start_attempt and m_netp_controller_start_success pixels (note: even if you're offline, it's expected to see the success pixel, as the success pixel only reports the request we send to the OS to start the VPN, which is not affected by connectivity)
  5. Now put your device back into a state that lets it send pixels (disable Airplane Mode, or remove the hardcoded pixel send error) and wait 60 seconds
  6. Background and foreground the app and check that the pixels have been retried; look for Persistent pixel retrying in the logs and then search for the pixel names (m_netp_controller_start_attempt, m_netp_controller_start_success )

Definition of Done (Internal Only):

Copy Testing:

  • Use of correct apostrophes in new copy, ie rather than '

Orientation Testing:

  • Portrait
  • Landscape

Device Testing:

  • iPhone SE (1st Gen)
  • iPhone 8
  • iPhone X
  • iPhone 14 Pro
  • iPad

OS Testing:

  • iOS 15
  • iOS 16
  • iOS 17

Theme Testing:

  • Light theme
  • Dark theme

Internal references:

Software Engineering Expectations
Technical Design Template

Copy link

github-actions bot commented Sep 13, 2024

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against 7a52ab0

* main:
  Remove VPN feature flag checks (#3334)
  Add Marketplace Postback handling (#3357)
  SKAD4 crash fix (#3361)
  Enroll all internal users in experiment && Update BSK (#3359)
  update for macOS: visited links (#3353)
@samsymons samsymons marked this pull request as ready for review September 16, 2024 04:12
error: nil,
includedParameters: [.appVersion, .atb],
withAdditionalParameters: [:],
onComplete: { _ in })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error handling here could be improved by sending a write failure pixel

@github-actions github-actions bot added the stale label Sep 24, 2024
…torage` usage.

Still to do: update PersistentPixel to use a simple dispatch queue for access control, we shouldn't need the lock any more.
This queue uses a date check to prevent duplicate calls from triggering duplicate processing events. If two events are queued one after the other, the second one will return early because of this check.
# By bwaresiak
# Via GitHub
* main:
  Improve unit tests reliability (#3430)

# Conflicts:
#	Core/PixelFiring.swift
#	DuckDuckGoTests/MockPixelFiring.swift
Tests do not yet pass, this will be fixed in the next commit.
* main:
  Release 7.141.0-0 (#3435)
  Add error handling to contrainer removal (#3424)
  Prevent autofill prompt crash for edge case where a context menu is also visible on screen (#3417)
Core/PersistentPixel.swift Outdated Show resolved Hide resolved
Core/PersistentPixel.swift Show resolved Hide resolved
Core/PersistentPixel.swift Outdated Show resolved Hide resolved
Core/PersistentPixelStoring.swift Show resolved Hide resolved
Core/PersistentPixel.swift Outdated Show resolved Hide resolved
Core/PersistentPixelStoring.swift Outdated Show resolved Hide resolved
* main:
  Add Events Firing for Phishing Detection Settings: Point to BSK (#3423)
  DuckPlayer: Temporary Fix for Watch In Youtube (#3437)
  Add 'Open in New Tab' support for DuckPlayer (#3431)
  update BSK dependency (#3434)
* main:
  Remove `SubscriptionFeatureAvailability` from `AppDependencyProvider` (#3447)
  Release 7.141.0-2 (#3451)
  Do not notify the FE on experiment activation (#3450)
  point to bsk branch (#3444)
  bump bsk for content blocker rules fix (#3445)
  speculative fix for set bars visibility crashes (#3442)
  Release 7.141.0-1 (#3443)
  Fix browsing menu bottom offset when bar location set to bottom (#3440)
  Properly handle responses that should trigger download action (#3407)
Comment on lines -355 to -359
stub { request in
request.url?.absoluteString.contains(Pixel.Event.forgetAllPressedBrowsing.name + "_d") == true
} response: { _ in
return HTTPStubsResponse(data: Data(), statusCode: 200, headers: nil)
}
Copy link
Contributor Author

@samsymons samsymons Oct 18, 2024

Choose a reason for hiding this comment

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

The stubs in this test file weren't actually being used this entire time, since each test is using a mock pixel sender – as a result, these tests were not really testing anything. I've changed them to instead look at the pixel names sent to the mock.

These base functions are not themselves thread-safe, but are always expected to run on the `fileAccessQueue`. A dispatch precondition has been added to ensure this. The reason for not making the base functions thread-safe is that some operations expect to call both of them in a single operation.
Copy link
Collaborator

@bwaresiak bwaresiak left a comment

Choose a reason for hiding this comment

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

Great job Sam, left one more comment around some warnings, but overall it's approved :)

Core/PersistentPixel.swift Outdated Show resolved Hide resolved
* main:
  Remove `voiceSearchHelper` from `AppDependencyProvider` (#3452)
  Update AutoClearSettingsViewController to use DI for app settings (#3448)
  Bump BSK (#3441)
@samsymons samsymons merged commit 3932989 into main Oct 18, 2024
13 checks passed
@samsymons samsymons deleted the sam/persistent-pixels branch October 18, 2024 22:07
samsymons added a commit that referenced this pull request Oct 21, 2024
# By Daniel Bernal (4) and others
# Via Daniel Bernal (1) and others
* main:
  Pixel retrying (#3358)
  Remove `voiceSearchHelper` from `AppDependencyProvider` (#3452)
  Update AutoClearSettingsViewController to use DI for app settings (#3448)
  Bump BSK (#3441)
  Remove `SubscriptionFeatureAvailability` from `AppDependencyProvider` (#3447)
  Release 7.141.0-2 (#3451)
  Do not notify the FE on experiment activation (#3450)
  point to bsk branch (#3444)
  bump bsk for content blocker rules fix (#3445)
  speculative fix for set bars visibility crashes (#3442)
  Release 7.141.0-1 (#3443)
  Fix browsing menu bottom offset when bar location set to bottom (#3440)
  Properly handle responses that should trigger download action (#3407)
  Add Events Firing for Phishing Detection Settings: Point to BSK (#3423)
  DuckPlayer: Temporary Fix for Watch In Youtube (#3437)
  Add 'Open in New Tab' support for DuckPlayer (#3431)
  update BSK dependency (#3434)
  Release 7.141.0-0 (#3435)
  Add error handling to contrainer removal (#3424)
  Prevent autofill prompt crash for edge case where a context menu is also visible on screen (#3417)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
samsymons added a commit that referenced this pull request Oct 21, 2024
# By Dominik Kapusta (1) and others
# Via GitHub
* main:
  Update fastlane to 2.225.0 (#3462)
  Enable credentials import promo for all users (#3427)
  Pixel retrying (#3358)

# Conflicts:
#	DuckDuckGoTests/MockDependencyProvider.swift
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.

2 participants