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

MNTOR-3863 and MNTOR-3840 - Fix user dashboard state for manual removal flag #5473

Merged
merged 6 commits into from
Jan 14, 2025

Conversation

codemist
Copy link
Collaborator

@codemist codemist commented Jan 9, 2025

References:

Jira: MNTOR-3853 and MNTOR-3840
Figma:

Description

This PR fixes a few things:

  • A valid dashboard state (so the top banner should have content, not a blank)
  • Toggling the flag on should show 3 data brokers with the removal under maintenance copy in the fixed tab
  • Increase the values in the chart and in the exposure card list description

Screenshot (if applicable)

Screen.Recording.2025-01-09.at.10.48.29.AM.mov

How to test

Checklist (Definition of Done)

  • Localization strings (if needed) have been added.
  • Commits in this PR are minimal and have descriptive commit messages.
  • I've added or updated the relevant sections in readme and/or code comments
  • I've added a unit test to test for potential regressions of this bug.
  • If this PR implements a feature flag or experimentation, the Ship Behind Feature Flag status in Jira has been set
  • Product Owner accepted the User Story (demo of functionality completed) or waived the privilege.
  • All acceptance criteria are met.
  • Jira ticket has been updated (if needed) to match changes made during the development process.
  • Jira ticket has been updated (if needed) with suggestions for QA when this PR is deployed to stage.

@codemist codemist requested review from Vinnl and flozia January 9, 2025 15:50
Copy link

github-actions bot commented Jan 9, 2025

Copy link
Collaborator

@Vinnl Vinnl left a comment

Choose a reason for hiding this comment

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

Possibly I'm misunderstanding, but I feel like there are quite a few places in our code where we call getDashboardSummary, that still do not take into account whether data brokers are under maintenance? For example, the monthly activity email, or the "Welcome to Plus" view?

@@ -96,6 +98,7 @@ export const dataClassKeyMap: Record<keyof DataPoints, string> = {
export function getDashboardSummary(
scannedResults: OnerepScanResultDataBrokerRow[],
subscriberBreaches: SubscriberBreach[],
enabledFeatureFlags?: FeatureFlagName[],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any reason to leave this optional? Feels like everywhere we use this function, we want to take feature flags into account as well to make sure that under-maintenance brokers aren't counted, right?

Suggested change
enabledFeatureFlags?: FeatureFlagName[],
enabledFeatureFlags: FeatureFlagName[],

Copy link
Collaborator Author

@codemist codemist Jan 13, 2025

Choose a reason for hiding this comment

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

@Vinnl I made it optional because we may remove the flag at some point, and it was tedious having to update all of the test files and also making changes to the function in actions.tsx was throwing an error for me.

Copy link
Collaborator Author

@codemist codemist Jan 13, 2025

Choose a reason for hiding this comment

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

This was the only part of the experience that was flagged by QA, I don't think it would show in the Welcome view, AFAIK a data broker wouldn't immediately be under removal_under_maintenance it would take some time to become such.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added it to those files anyways: 1dbc11f

I can request for QA to check out those views and verify that the calculations are accurate with the flag.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm OK, if we're not simply passing it everywhere, then we'd have to judge per call site whether it's necessary to consider under-maintenance status, so I manually visited all the call sites and found the following two that I think would also need updating?

  • ResolutionContainer seems to refer to dataBrokerInProgressDataPointsNum at least - I think for the "In progress" column here?
  • The Plus monthly activity email also shows how many items are in progress, so I think that also shouldn't keep listing brokers that are under maintenance as in progress.

Copy link
Collaborator Author

@codemist codemist Jan 14, 2025

Choose a reason for hiding this comment

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

Thanks for going through the trouble of visiting the call sites! I can ping QA to double check those touchpoints.

Added the flag to ResolutionContainer here: 2c60b47
and to Plus monthly activity email: cf67902

It's really tedious wrapping a feature flag around this feature precisely because it touches so many parts of the experience :\ This feature is relatively low risk though, since the altered part of the feature is wrapped behind the flag.

Comment on lines +213 to +218
const isRemovalUnderMaintenance =
r.broker_status === DataBrokerRemovalStatusMap.RemovalUnderMaintenance;

// The condition ensures that removal under maintenance is only considered when the flag is enabled.
/* c8 ignore next 3 */
const countRemovalUnderMaintenanceData =
Copy link
Collaborator

Choose a reason for hiding this comment

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

A bit of a nit I guess, but it took me a while to understand the logic below because of the countRemova... name, e.g. I read lines 222 and 223 as "if this scan result is in progress and we're counting brokers that are under maintenance, then increment the number of in progress data brokers"?

In the end, isn't a data broker under maintenance just not in progress? i.e. instead of this code and the additional ifs, couldn't we update line 205:

      const isInProgress =
        (r.status === RemovalStatusMap.OptOutInProgress ||
          r.status === RemovalStatusMap.WaitingForVerification) &&
-        !isManuallyResolved;
+        !isManuallyResolved && (
+          // TODO: MNTOR-3886 - Remove EnableRemovalUnderMaintenanceStep feature flag
+          !enabledFeatureFlags?.includes("EnableRemovalUnderMaintenanceStep") ||
+          r.broker_status !== DataBrokerRemovalStatusMap.RemovalUnderMaintenance
+        );

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Vinnl I think that the status of it could still read in_progress but the broker_status with removal_under_maintenance should ultimately take precedence in it's overall state (from the perspective of the user).

@codemist codemist requested a review from Vinnl January 13, 2025 13:27
Copy link
Collaborator

@Vinnl Vinnl left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! And sorry for the turnaround time

@codemist codemist merged commit b8f0bf1 into main Jan 14, 2025
17 checks passed
@codemist codemist deleted the mntor-3863-mntor-3840 branch January 14, 2025 13:41
Copy link

Cleanup completed - database 'blurts-server-pr-5473' destroyed, cloud run service 'blurts-server-pr-5473' destroyed

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