-
Notifications
You must be signed in to change notification settings - Fork 16
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
DBP: Restructure AgentManager and scheduler and add tests #2777
DBP: Restructure AgentManager and scheduler and add tests #2777
Conversation
…rokerProtectionQueueMode`. Add `DataBrokerDebugCommand` and associated protocol. Add initial set of tests.
…/cancellation, add tests & mocks
@@ -63,12 +68,6 @@ extension DefaultDataBrokerProtectionLoginItemInterface: DataBrokerProtectionLog | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the pixels that are pending
/* | ||
I wasn't able to import this mock from the background agent project, so I had to re-use it here. | ||
*/ | ||
private final class PrivacyConfigurationManagingMock: PrivacyConfigurationManaging { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since various things moved to the DBP package, we can remove this :D
|
||
public func runQueuedOperations(showWebView: Bool) { | ||
// TODO | ||
//scheduler.runQueuedOperations(showWebView: showWebView) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pending integration with outstanding PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, looks great overall @THISISDINOSAUR. Left a few very minor suggestions and a question.
func disableLoginItem() | ||
func enableLoginItem() | ||
protocol DataBrokerProtectionLoginItemInterface: DataBrokerProtectionAppToAgentInterface { | ||
func dataDeleted() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
import BrowserServicesKit | ||
import PixelKit | ||
|
||
// This is to avoid exposing all the dependancies outside of the DBP package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice solution 👍🏼
...okerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift
Outdated
Show resolved
Hide resolved
...okerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift
Outdated
Show resolved
Hide resolved
...Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionBackgroundActivityScheduler.swift
Outdated
Show resolved
Hide resolved
...okerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift
Show resolved
Hide resolved
…nd-scheduler # Conflicts: # DuckDuckGoDBPBackgroundAgent/DataBrokerProtectionAgentManager.swift # LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerOperation.swift # LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionQueueManager.swift # LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionScheduler.swift # LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionQueueManagerTests.swift # LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProtectionQueueModeTests.swift # LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/Mocks.swift
@aataraxiaa btw I've updated to integrate with your latest, and addressed all comments except for this one: #2777 (comment) (waiting to see what Juan says) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes look good @THISISDINOSAUR. Added a comment about strange behaviour I saw this morning when testing.
|
||
extension DataBrokerProtectionAgentManager: DataBrokerProtectionAgentAppEvents { | ||
|
||
public func profileSaved() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was just testing this again this morning, and something strange was happening in that this method was never called on a profile save action. I stepped through the chain of calls and it looked like the profileSaved
method of the login item was being called twice. I removed all background agents that were running, and made sure I was attached to the background process, but that didn’t solve it. Didn’t look further as I must be doing something strange. Maybe you could give it a try and let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@THISISDINOSAUR I’m seeing some issues when scanning. If you follow the steps you will see it:
- Start a scan
- Edit the profile while the scan is running (add a new name, for example)
- Something is happening there where the
profileSaved
in theDataBrokerProtectionAgentManager
is not being called, causing the new scans to never start.
It leaves the app in a weird state, because the scans were cancelled for some reason, but they never started again.
I think this is the same issue Pete ran into and was introduced in the merge, I'm not sure what's going in yet |
I figured it out, it actually happened when I added the tests, AgentManager wasn't being persisted in memory 🙄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recent changes LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worked for me 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Tested these scenarios:
- Scan from scratch
- Updating user profile after scan ended
- Updating user profile mid scan
1ddb5a4
into
feature/pir-stabilization
Task/Issue URL: https://app.asana.com/0/1199230911884351/1207338264132623/f Tech Design URL: https://app.asana.com/0/481882893211075/1207174884557414/f CC: **Description**: This PR has the effect of mergeing four different PRs into main: #2777 #2758 #2757 #2743 This covers significant changes to the XPC interface and how the main app uses it, the background manager, the scheduler, and the processor. See individual PRs for details. There's no code changes here that haven't been reviewed separately as part of those PRs, so it's up to you how you want to review it code wise. The more important step at this stage is manual testing. **Steps to test this PR**: 1. Because this is a fairly significant set of changes, we need to be as thorough as we can in testing DBP generally works and really try to break it. Because of this, I'm keen that anyone testing things of their own ways to break it before trying the steps below. 2. Edit/add profile data, and before scans finish, edit it again. Scans should start afresh, and you should see an interrupted pixel fire. Check that you don't get a scans completed notification 3. Edit/add profile data, and before scans finish, close the app, and reopen it. The same set of manual scans should still continue, and a blocked pixel should fire. 4. With profile data already existing but initial scans having finished, close the app and reopen it. Scheduled scans should run. 5. With profile data already existing, and with the app closed, launch the background agent, scheduled scans should run 6. Edit/add profile data, put the laptop to sleep/lock it/restart it, check that scans continue as expected. 7. Check that the background agent activity lines up with the UI, I.e. the progress bar and when we sent the scans completed notification is accurate <!-- Tagging instructions If this PR isn't ready to be merged for whatever reason it should be marked with the `DO NOT MERGE` label (particularly if it's a draft) If it's pending Product Review/PFR, please add the `Pending Product Review` label. If at any point it isn't actively being worked on/ready for review/otherwise moving forward (besides the above PR/PFR exception) strongly consider closing it (or not opening it in the first place). If you decide not to close it, make sure it's labelled to make it clear the PRs state and comment with more information. --> --- ###### Internal references: [Pull Request Review Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f) [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) [Pull Request Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f) --------- Co-authored-by: Pete Smith <[email protected]>
Task/Issue URL: https://app.asana.com/0/1199230911884351/1207175016813449/f
Tech Design URL:
CC:
Description:
Pixels are still outstanding
But everything else should be done now (integrating with Pete's latest PR etc)
Steps to test this PR:
Internal references:
Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation