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

enable single commit summary via supportedFeatures in routerlicious #21060

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

pragya91
Copy link
Contributor

@pragya91 pragya91 commented May 13, 2024

Enable single-commit summaries via summarizeProtocolTree policy flag in IDocumentServicePolicies - which for routerlicious will be set when enable_single_commit_summary flag is provided in the supportedFeatures property bag in IConnected. This change is particularly aimed at enabling slow rollouts of FRS clients on the single-commit summary flow.

  1. updated routerlicious-driver's documentService to check the supported features and set the 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.
  2. Updated containerStorageAdapter to always initialize ProtocolTreeStorageService.
  3. 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.
  4. Renamed forceEnableSummarizeProtocolTree to shouldSummarizeProtocolTree.

AB#7864

@github-actions github-actions bot added area: driver Driver related issues area: loader Loader related issues area: odsp-driver public api change Changes to a public API base: main PRs targeted against main branch labels May 13, 2024
@pragya91 pragya91 requested review from vladsud, jatgarg and a team May 13, 2024 18:37
@github-actions github-actions bot removed area: odsp-driver area: driver Driver related issues labels May 13, 2024
@msfluid-bot
Copy link
Collaborator

msfluid-bot commented May 13, 2024

@fluid-example/bundle-size-tests: +508 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 453.34 KB 453.34 KB No change
azureClient.js 552.55 KB 552.83 KB +284 Bytes
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 257.02 KB 257.02 KB No change
fluidFramework.js 359.88 KB 359.88 KB No change
loader.js 134.36 KB 134.46 KB +112 Bytes
map.js 41.53 KB 41.53 KB No change
matrix.js 143.75 KB 143.75 KB No change
odspClient.js 520.91 KB 521.02 KB +112 Bytes
odspDriver.js 97.3 KB 97.3 KB No change
odspPrefetchSnapshot.js 42.16 KB 42.16 KB No change
sharedString.js 160.27 KB 160.27 KB No change
sharedTree.js 359.86 KB 359.86 KB No change
Total Size 3.2 MB 3.2 MB +508 Bytes

Baseline commit: 7cba8d9

Generated by 🚫 dangerJS against bd7b408

@github-actions github-actions bot added area: driver Driver related issues area: tests Tests to add, test infrastructure improvements, etc labels May 15, 2024
@pragya91 pragya91 force-pushed the praggarg/single-commit-in-supported-features branch from 670a325 to 12773d1 Compare May 17, 2024 21:02
@github-actions github-actions bot removed the public api change Changes to a public API label May 17, 2024
@pragya91 pragya91 marked this pull request as ready for review May 20, 2024 16:46
@pragya91 pragya91 changed the title Praggarg/single commit in supported features enable single commit summary via supportedFeatures in routerlicious May 22, 2024
@pragya91 pragya91 force-pushed the praggarg/single-commit-in-supported-features branch from 24441cd to 1b2d3db Compare May 22, 2024 17:10
@github-actions github-actions bot added public api change Changes to a public API and removed area: tests Tests to add, test infrastructure improvements, etc public api change Changes to a public API labels May 22, 2024
@pragya91 pragya91 force-pushed the praggarg/single-commit-in-supported-features branch from 1ae289a to 7390334 Compare May 23, 2024 18:06
}
// 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(
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@pragya91 pragya91 requested a review from a team May 28, 2024 20:20
@@ -100,6 +103,10 @@ export class DocumentService

private documentStorageService: DocumentStorageService | undefined;

public get policies(): IDocumentServicePolicies | undefined {
return this._policies ?? {};
Copy link
Contributor

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
Copy link
Contributor

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 (
Copy link
Contributor

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,
Copy link
Contributor

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(
Copy link
Contributor

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);
Copy link
Contributor

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()

  1. Maintains the status-quo if supportedFeatures keeps returning same result
  2. Can reset policy if supportedFeatures changes its flags (on second reconnect)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: driver Driver related issues area: loader Loader related issues base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants