-
Notifications
You must be signed in to change notification settings - Fork 532
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
odspDocumentDeltaConnection targetClientId check #22749
Conversation
⯅ @fluid-example/bundle-size-tests: +476 Bytes
Baseline commit: cf339a9 |
packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts
Outdated
Show resolved
Hide resolved
packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts
Outdated
Show resolved
Hide resolved
Rearranged the documentId check as well as added an assert for when documentId is not defined but targetClientId is @jason-ha |
packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts
Outdated
Show resolved
Hide resolved
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.
@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 |
More tests are preferred in this PR. But if not then add a tech debt work item to follow up. |
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.
Code Coverage Summary
↓ packages.drivers.odsp-driver.src:
Line Coverage Change: No change Branch Coverage Change: -0.29%
Metric Name | Baseline coverage | PR coverage | Coverage 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!!
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); | ||
} |
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 was this complication added?
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.
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,
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.