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

feat(uaa-logging): Log UAA Parity data #3629

Merged
merged 14 commits into from
Sep 24, 2024
Merged

Conversation

JChan106
Copy link
Contributor

@JChan106 JChan106 commented Sep 1, 2024

No description provided.

@JChan106 JChan106 requested review from a team as code owners September 1, 2024 02:34
bfoxx1906

This comment was marked as outdated.

src/api/Feed.js Outdated

const parsedFeedItems = getParsedFileActivitiesResponse(response);
const parsedDataParity = { v2: sortedFeedItems, uaa: parsedFeedItems };
handleFeedItems(parsedFeedItems, { responseParity, parsedDataParity });
Copy link
Contributor

Choose a reason for hiding this comment

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

So we're not going to handle the feed items until all of the promises resolve? Will this double the time for the results to be shown to the user. Should the parity check not be an asynchronous process that will log an error message if the results from UAA are different from the results coming from the individual api calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, I updated the PR so that the UI is not blocked by both responses. Now the v2 calls will be async and will not be blocking and will be used only for logging.

@JChan106 JChan106 requested a review from a team as a code owner September 19, 2024 01:22
...data,
type: METRIC_TYPE_UAA_PARITY_METRIC,
});
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ do we want this return? Won't this prevent METRIC_TYPE_PREVIEW logging below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shouldn't be an issue since the METRIC_TYPE_PREVIEW would be a separate event. Ill change this to an if/else to make it more readable.

Copy link
Contributor

@tjuanitas tjuanitas left a comment

Choose a reason for hiding this comment

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

an approach that comes to mind is to leave Feed.js untouched and use the successCallback/errorCallback passed into feedItems to handle the logging. ActivitySidebar would need to call api.getFeedAPI twice with different values for shouldUseUAA. that way all of the logging logic could live together in one location instead of split between the api and the component

but approving because this looks to be short term until parity is verified and feature is GA

@@ -42,6 +42,7 @@ import {
ORIGIN_ACTIVITY_SIDEBAR,
SIDEBAR_VIEW_ACTIVITY,
TASK_COMPLETION_RULE_ALL,
METRIC_TYPE_UAA_PARITY_METRIC,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this list is alphasorted

@@ -550,6 +551,7 @@ class Feed extends Base {
shouldShowVersions?: boolean,
shouldUseUAA?: boolean,
} = {},
logAPIParity?: Function,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: function header definition

: Promise.resolve();
const annotationsPromise = shouldShowAnnotations
? this.fetchAnnotations(permissions, shouldShowReplies)
: Promise.resolve();
const commentsPromise = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: commentsPromise could be updated to match the ternary pattern of the others?

Comment on lines +629 to +640
const fetchV2FeedItems = async promises => {
return Promise.all(promises).then(
([versions: ?FileVersions, currentVersion: ?BoxItemVersion, ...feedItems]) => {
const versionsWithCurrent = currentVersion
? this.versionsAPI.addCurrentVersion(currentVersion, versions, this.file)
: undefined;
return sortFeedItems(versionsWithCurrent, ...feedItems);
},
);
};

const compareV2AndUaaFeedItems = async (uaaFeedItems, uaaResponse) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think you need async in either function since await is not being used

const compareV2AndUaaFeedItems = async (uaaFeedItems, uaaResponse) => {
fetchV2FeedItems(v2Promises).then(v2FeedItems => {
const transformedV2FeedItems = collapseFeedState(v2FeedItems);
const transformedUAAFeedItems = collapseFeedState(uaaFeedItems);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: inconsistency of uaa between this variable transformedUAAFeedItems and the function name compareV2AndUaaFeedItems

@@ -89,6 +89,7 @@ import type {
Tasks,
ThreadedComments as ThreadedCommentsType,
} from '../common/types/feed';
import { collapseFeedState } from '../elements/content-sidebar/activity-feed/activity-feed/activityFeedUtils';
Copy link
Contributor

Choose a reason for hiding this comment

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

i think it's odd for an api file to be importing from a component utility file

@JChan106 JChan106 removed the request for review from bfoxx1906 September 24, 2024 00:26
@mergify mergify bot merged commit 6cb5d8f into box:master Sep 24, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants