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

odspDocumentDeltaConnection targetClientId check #22749

Merged
merged 12 commits into from
Oct 22, 2024

Conversation

WillieHabi
Copy link
Contributor

@WillieHabi WillieHabi commented Oct 8, 2024

ODSP driver reuses sockets for clients connected on the same node process. When signals are received on the shared socket, we must filter based on targetClientId property to make sure only the specified client receives the signal.

@github-actions github-actions bot added area: driver Driver related issues area: odsp-driver base: main PRs targeted against main branch labels Oct 8, 2024
@WillieHabi WillieHabi marked this pull request as draft October 8, 2024 19:58
@WillieHabi WillieHabi marked this pull request as ready for review October 8, 2024 20:32
@msfluid-bot
Copy link
Collaborator

msfluid-bot commented Oct 8, 2024

@fluid-example/bundle-size-tests: +476 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 459.8 KB 459.84 KB +35 Bytes
azureClient.js 556.94 KB 556.99 KB +49 Bytes
connectionState.js 724 Bytes 724 Bytes No change
containerRuntime.js 259.42 KB 259.43 KB +14 Bytes
fluidFramework.js 405.81 KB 405.82 KB +14 Bytes
loader.js 134.16 KB 134.18 KB +14 Bytes
map.js 42.46 KB 42.46 KB +7 Bytes
matrix.js 148.29 KB 148.29 KB +7 Bytes
odspClient.js 523.91 KB 523.95 KB +49 Bytes
odspDriver.js 97.84 KB 97.86 KB +21 Bytes
odspPrefetchSnapshot.js 42.81 KB 42.82 KB +14 Bytes
sharedString.js 164.48 KB 164.49 KB +7 Bytes
sharedTree.js 396.27 KB 396.28 KB +7 Bytes
Total Size 3.31 MB 3.31 MB +476 Bytes

Baseline commit: cf339a9

Generated by 🚫 dangerJS against 6b59bf1

@WillieHabi
Copy link
Contributor Author

Rearranged the documentId check as well as added an assert for when documentId is not defined but targetClientId is @jason-ha

Copy link
Contributor

@jason-ha jason-ha left a comment

Choose a reason for hiding this comment

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

@GaryWilber, does the assert added for when there is no documentId look correct? That no signal message in that case would have a targetClientId?

@GaryWilber
Copy link
Contributor

@GaryWilber, does the assert added for when there is no documentId look correct? That no signal message in that case would have a targetClientId?

The documentId param is always included so it should never hit that

@WillieHabi
Copy link
Contributor Author

WillieHabi commented Oct 14, 2024

@GaryWilber, does the assert added for when there is no documentId look correct? That no signal message in that case would have a targetClientId?

The documentId param is always included so it should never hit that

Ok thanks. Since documentId is always included, we should then assert that documentId is defined(?)

Was there an original reason why we continued to send signal when !documentId? @GaryWilber

@jason-ha
Copy link
Contributor

More tests are preferred in this PR. But if not then add a tech debt work item to follow up.
Coverage is needed for multiplexing on and off as well as multiple documents and especially targeted and not targeted signals.

@github-actions github-actions bot added the area: tests Tests to add, test infrastructure improvements, etc label Oct 18, 2024
Copy link
Collaborator

@msfluid-bot msfluid-bot left a comment

Choose a reason for hiding this comment

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

Code Coverage Summary

↓ packages.drivers.odsp-driver.src:
Line Coverage Change: No change    Branch Coverage Change: -0.29%
Metric NameBaseline coveragePR coverageCoverage Diff
Branch Coverage 85.72% 85.43% ↓ -0.29%
Line Coverage 74.93% 74.93% → No change

Baseline commit: cf339a9
Baseline build: 301282
Happy Coding!!

Code coverage comparison check passed!!

@WillieHabi WillieHabi merged commit c61fb60 into microsoft:main Oct 22, 2024
29 checks passed
const filteredMsgs = msgs.filter(
(m) => !m.targetClientId || m.targetClientId === this.clientId,
);

if (filteredMsgs.length > 0) {
listener(filteredMsgs, documentId);
listener(filteredMsgs.length === 1 ? filteredMsgs[0] : filteredMsgs, documentId);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this complication added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Signal layer compat tests fails without this, specifically the layer version combination where you have a very old loader and the most recent driver layer. Old loader doesn't handle batched signals (ISignalMessage[]) so only individual ISignalMessage's should be passed when there's one element for backcompat,

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: odsp-driver area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants