-
Notifications
You must be signed in to change notification settings - Fork 31
Include action id and type in scan error pixels #2219
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
Adds action id and action type context to scan error pixels for both macOS and iOS, enabling richer diagnostics when PIR scans fail.
- Introduces new pixel definitions including action metadata.
- Extends scanError pixel payload and updates calculators, runners, mocks, and tests accordingly.
- Adds test coverage validating presence and defaulting of action context.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
macOS/PixelDefinitions/pixels/data_broker_protection.json5 | Adds macOS scan error pixel definition with action_id and action_type parameters. |
iOS/PixelDefinitions/pixels/data_broker_protection.json5 | Adds iOS scan error pixel definition with action_id and action_type parameters. |
DataBrokerRunCustomJSONViewModel.swift | Updates FakeStageDurationCalculator API to new setLastAction signature. |
RunDBPDebugModeViewController.swift | Updates iOS fake calculator to new setLastAction signature. |
DataBrokerProtectionStageDurationCalculatorTests.swift | Adjusts pattern matches for added scanError payload fields and adds new tests for action context. |
BrokerProfileOptOutSubJobTests.swift | Updates test to use new setLastAction API. |
Mocks.swift | Updates mock to track action id/type with new API. |
DataBrokerProtectionStageDurationCalculator.swift | Adds actionType storage and includes action id/type in scanError pixel emission. |
DataBrokerProtectionSharedPixels.swift | Extends scanError case and payload dictionary with action id/type. |
SubJobWebRunner.swift | Sets last action before running each action (now potentially duplicated). |
BrokerProfileScanSubJobWebRunner.swift | Adds explicit setLastAction call before runNextAction (duplicate). |
BrokerProfileOptOutSubJobWebRunner.swift | Replaces setLastActionId with setLastAction (duplicate with runNextAction). |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
||
let shouldContinue = self.shouldRunNextStep() | ||
if let action = actionsHandler?.nextAction(), shouldContinue { | ||
stageCalculator.setLastAction(action) |
Copilot
AI
Oct 16, 2025
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.
setLastAction(action) is called here and runNextAction(action) also calls stageCalculator.setLastAction(action), resulting in duplicate state updates. Remove one of the calls (prefer keeping it inside runNextAction for a single point of responsibility) to avoid redundant work and keep logic centralized.
stageCalculator.setLastAction(action) |
Copilot uses AI. Check for mistakes.
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.
Leaving it here alone would be similar to how opt-out runner does, but there’s no harm in setting this twice. No strong opinion tho.
stageCalculator.setLastAction(action) | ||
|
||
switch action { |
Copilot
AI
Oct 16, 2025
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.
runNextAction sets the last action directly, but callers (e.g., BrokerProfileScanSubJobWebRunner and BrokerProfileOptOutSubJobWebRunner) also invoke setLastAction before calling runNextAction, causing duplicate calls. Consider removing this call from either the callers or here (keeping it only inside runNextAction is clearer and prevents drift).
Copilot uses AI. Check for mistakes.
let shouldContinue = self.shouldRunNextStep() | ||
if let action = actionsHandler?.nextAction(), shouldContinue { | ||
stageCalculator.setLastActionId(action.id) | ||
stageCalculator.setLastAction(action) |
Copilot
AI
Oct 16, 2025
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.
Duplicate setting of last action: runNextAction(action) also invokes stageCalculator.setLastAction(action). Remove one of the invocations to avoid redundant state assignments and keep behavior centralized.
stageCalculator.setLastAction(action) |
Copilot uses AI. Check for mistakes.
Privacy Review task: https://app.asana.com/0/69071770703008/1211655752169607 |
Task/Issue URL: https://app.asana.com/1/137249556945/project/1205591970852438/task/1210937517613810?focus=true
Tech Design URL:
CC: @THISISDINOSAUR
Description
Adds action id and action type to pixels
Testing Steps
m_mac_dbp_search_stage_main_status_error
pixel logs (don’t use the Debug tool)Expect something like this:
Impact and Risks
Low
What could go wrong?
Note
Enriches scan error pixels with
action_id
andaction_type
, updates stage tracking to accept fullAction
, and propagates this through runners, tests, mocks, and pixel definitions.DataBrokerProtectionSharedPixels.scanError
to includeactionId
andactionType
; update params mapping to emitaction_id
andaction_type
.m_ios_dbp_search_stage_main_status_error
andm_mac_dbp_search_stage_main_status_error
with action context.StageDurationCalculator.setLastActionId(_:)
withsetLastAction(_:)
;DataBrokerProtectionStageDurationCalculator
now tracksactionID
andactionType
and includes them inscanError
(defaults tounknown
).stageCalculator.setLastAction(action)
when selecting/processing actions inBrokerProfileOptOutSubJobWebRunner
,BrokerProfileScanSubJobWebRunner
, andSubJobWebRunner.runNextAction
.scanError
shape and added action context; adjust mocks/protocols tosetLastAction(_:)
and captureactionID
/actionType
.StageDurationCalculator
API.Written by Cursor Bugbot for commit 93000f4. This will update automatically on new commits. Configure here.