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

Fix for SharedTree op named idAllocation #21867

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/tools/fetch-tool/src/fluidAnalyzeMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,8 @@ function processOp(
type: string;
};
const address = envelope.address;
type = `${type}/${innerContent.type}`;
switch (innerContent.type) {
type = `${type}/${innerContent?.type}`;
Copy link
Member

Choose a reason for hiding this comment

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

Looking this over, all this code only applies to FluidDataStoreOp. I'd pull the other 3 to their own case chunk and have it do nothing or whatever makes sense.

You'll be able to remove several as's (e.g. as IEnvelope on line 600) this way too, because the types express the type of contents

Copy link
Member

Choose a reason for hiding this comment

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

And revert the addition of ?

switch (innerContent?.type) {
case DataStoreMessageType.Attach: {
const attachMessage = innerContent.content as IAttachMessage;
let objectType = attachMessage.type;
Expand All @@ -620,13 +620,13 @@ function processOp(
}
case DataStoreMessageType.ChannelOp:
default: {
const innerEnvelope = innerContent.content as IEnvelope;
const innerContent2 = innerEnvelope.contents as {
const innerEnvelope = innerContent?.content as IEnvelope;
const innerContent2 = innerEnvelope?.contents as {
type?: string;
value?: any;
};

const objectId = getObjectId(address, innerEnvelope.address);
const objectId = getObjectId(address, innerEnvelope?.address);
incr(objectStats, objectId, totalMsgSize, opCount);
let objectType = dataType.get(objectId);
if (objectType === undefined) {
Expand All @@ -637,9 +637,9 @@ function processOp(
incr(dataTypeStats, objectType, totalMsgSize, opCount);
recorded = true;

let subType = innerContent2.type;
let subType = innerContent2?.type;
if (
innerContent2.type === "set" &&
innerContent2?.type === "set" &&
typeof innerContent2.value === "object" &&
innerContent2.value !== null
) {
Expand Down
Loading