-
Notifications
You must be signed in to change notification settings - Fork 517
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
enable single commit summary via supportedFeatures in routerlicious #21060
base: main
Are you sure you want to change the base?
enable single commit summary via supportedFeatures in routerlicious #21060
Conversation
packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts
Outdated
Show resolved
Hide resolved
packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts
Outdated
Show resolved
Hide resolved
packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts
Outdated
Show resolved
Hide resolved
packages/loader/container-loader/src/containerStorageAdapter.ts
Outdated
Show resolved
Hide resolved
packages/service-clients/azure-client/api-report/azure-client.api.md
Outdated
Show resolved
Hide resolved
packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts
Outdated
Show resolved
Hide resolved
packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts
Outdated
Show resolved
Hide resolved
⯅ @fluid-example/bundle-size-tests: +508 Bytes
Baseline commit: 7cba8d9 |
670a325
to
12773d1
Compare
24441cd
to
1b2d3db
Compare
1ae289a
to
7390334
Compare
} | ||
// A storage service wrapper which intercept calls to uploadSummaryWithContext and ensure they include | ||
// the protocol summary, provided single-commit summary is enabled. | ||
this._storageService = new ProtocolTreeStorageService( |
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.
Why are we inverting the logic here? I think we should only wrap inside the ProtocolTreeStorageService if we want to summarize protocol tree and not check inside the ProtocolTreeStorageService if it is enabled or not.
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 new change is implemented so that we query for the service policies when needed. This is will give drivers enough time to establish socket connection, so that the connection's supportedFeatures can be used if needed. Just like in this PR.
@@ -100,6 +103,10 @@ export class DocumentService | |||
|
|||
private documentStorageService: DocumentStorageService | undefined; | |||
|
|||
public get policies(): IDocumentServicePolicies | undefined { | |||
return this._policies ?? {}; |
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.
not clear why you do ?? {} if return type allows undefined
@@ -281,6 +288,14 @@ export class DocumentService | |||
// Retry with new token on authorization error; otherwise, allow container layer to handle. | |||
try { | |||
const connection = await connect(); | |||
if ( | |||
(connection as R11sDocumentDeltaConnection).details.supportedFeatures |
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 cast is not great. Anything we can do to make it more type-safe?
@@ -281,6 +288,14 @@ export class DocumentService | |||
// Retry with new token on authorization error; otherwise, allow container layer to handle. | |||
try { | |||
const connection = await connect(); | |||
if ( |
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.
I'd suggest to always update policy, on every connection. I.e. allow true -> false transitions - service might want to pull back the flight.
// A storage service wrapper which intercept calls to uploadSummaryWithContext and ensure they include | ||
// the protocol summary, provided single-commit summary is enabled. | ||
this._storageService = new ProtocolTreeStorageService( | ||
retriableStorage, |
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.
It looks like a bug (that your code is fixing), but worth doing some more digging to make sure we are not missing something (and not changing behavior that we do not understand):
The code before did not use retriableStorage
if this.summarizeProtocolTree === false.
Now we use it all the time.
It looks correct, but raising to make sure we do proper due dilligence here.
); | ||
if (this.shouldSummarizeProtocolTree()) { | ||
this.logger.sendTelemetryEvent({ eventName: "summarizeProtocolTreeEnabled" }); | ||
return this.internalStorageService.uploadSummaryWithContext( |
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.
if you move logging call into addProtocolSummaryIfMissing(), then this code can be much simpler:
return this.internalStorageService.uploadSummaryWithContext(
this.shouldSummarizeProtocolTree() ? this.addProtocolSummaryIfMissing(summary) : summary,
context);
const stubbedDeltaConnectionCreate = stub(R11sDocumentDeltaConnection, "create").callsFake( | ||
async () => deltaConnection as R11sDocumentDeltaConnection, | ||
); | ||
await documentService.connectToDeltaStream(client); |
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.
Would be useful to test that calling connectToDeltaStream()
- Maintains the status-quo if supportedFeatures keeps returning same result
- Can reset policy if supportedFeatures changes its flags (on second reconnect)
Enable single-commit summaries via
summarizeProtocolTree
policy flag inIDocumentServicePolicies
- which for routerlicious will be set whenenable_single_commit_summary
flag is provided in thesupportedFeatures
property bag in IConnected. This change is particularly aimed at enabling slow rollouts of FRS clients on the single-commit summary flow.summarizeProtocolTree
driver policy. Container uses this flag to check whether or not the protocol tree should be added to the summary before sending the summary.containerStorageAdapter
to always initializeProtocolTreeStorageService
.ProtocolTreeStorageService
uses a callback to check whether it should upload protocoltree with summary or not. This is done to ensure we are using the most updated value of driver policy which will be set correctly only when the delta connection is established.forceEnableSummarizeProtocolTree
toshouldSummarizeProtocolTree
.AB#7864