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

Azure E2E: Add read client signal and audience tests #20042

Merged
merged 20 commits into from
Apr 26, 2024

Conversation

znewton
Copy link
Contributor

@znewton znewton commented Mar 8, 2024

Description

Azure Fluid Relay is planning work to begin officially supporting Signals. Part of that work is also making sure that Audience management works correctly for Read-only clients.

This PR adds 4 new Azure E2E tests.

Also, it adds a fix in Nexus Lambda to update the Connection messages Client mode to read/write depending on Claims scopes.

Reviewer Guidance

A couple of the new tests involve semi-complicated (in a testing sense) scenarios. I know tests are supposed to test 1 thing and then have another test to test another thing, however, each of these tests creates a new Container, so adding too many tests can become costly when running frequently against production environments. Open to feedback on alternative ways to handle this self-imposed limitation.

@znewton znewton requested a review from sashasimic March 8, 2024 21:43
@github-actions github-actions bot added dependencies Pull requests that update a dependency file base: main PRs targeted against main branch labels Mar 8, 2024
@znewton znewton requested a review from scottn12 March 8, 2024 21:43
scottn12
scottn12 previously approved these changes Mar 11, 2024
Copy link
Contributor

@scottn12 scottn12 left a comment

Choose a reason for hiding this comment

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

Looks mostly good to me! Left a few clarification questions/nits before you merge 🙂

@github-actions github-actions bot added the area: loader Loader related issues label Mar 15, 2024
@znewton znewton requested a review from scottn12 March 15, 2024 22:47
@znewton znewton dismissed scottn12’s stale review March 15, 2024 22:47

I've pushed more changes

@znewton
Copy link
Contributor Author

znewton commented Mar 20, 2024

Need to see if I can "force read" via server changes based on token scopes rather than the client config change.

@github-actions github-actions bot added the area: server Server related issues (routerlicious) label Mar 21, 2024
@github-actions github-actions bot removed the area: loader Loader related issues label Mar 21, 2024
znewton added a commit that referenced this pull request Mar 27, 2024
## Description

When a client joins with AzureClient, it will always try to join in
`write` even if it only has `read` permissions according to its token
claims. On the server (Nexus Lambda), we handle that correctly by
creating a read-scoped connection. However, the server would incorrectly
handle client details and send connection info like this:

```js
socket.emit("connect_document_success", { /* ... */, mode: "read");
// ...
socket.emitToRoom(
    "tenantId/documentId",
    "signal",
    { 
       /* ... join signal message ...*/,
       client: { /* ... */, mode: "write"
    });
```

I'm not sure about the specifics of what's happening on the client, but
when testing read client Audience and Signals usage in #20042, I
realized that the read client audience is not working appropriately
without this change. My understanding is it's because Audience is trying
to use Quorum (Join Ops) instead of Join Signals because the Join Signal
client details said `{ mode: "write" }` even though Connection details
said `{ mode: "read" }`
@github-actions github-actions bot removed the area: server Server related issues (routerlicious) label Apr 10, 2024
Copy link
Contributor

@scottn12 scottn12 left a comment

Choose a reason for hiding this comment

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

LGTM!

@znewton znewton merged commit 4d3d615 into microsoft:main Apr 26, 2024
30 checks passed
@znewton znewton deleted the azure/signal-audience-reader-tests branch April 26, 2024 22:10
scottn12 added a commit that referenced this pull request Apr 29, 2024
… tests (#20903)

## Description

This PR fixes the tinylicious port being used and disables tests that
fail with local-service from
#20042. These tests were
causing pipeline failures, so they are being disabled while we look for
a fix.
znewton added a commit to znewton/FluidFramework that referenced this pull request May 16, 2024
## Description

When a client joins with AzureClient, it will always try to join in
`write` even if it only has `read` permissions according to its token
claims. On the server (Nexus Lambda), we handle that correctly by
creating a read-scoped connection. However, the server would incorrectly
handle client details and send connection info like this:

```js
socket.emit("connect_document_success", { /* ... */, mode: "read");
// ...
socket.emitToRoom(
    "tenantId/documentId",
    "signal",
    { 
       /* ... join signal message ...*/,
       client: { /* ... */, mode: "write"
    });
```

I'm not sure about the specifics of what's happening on the client, but
when testing read client Audience and Signals usage in microsoft#20042, I
realized that the read client audience is not working appropriately
without this change. My understanding is it's because Audience is trying
to use Quorum (Join Ops) instead of Join Signals because the Join Signal
client details said `{ mode: "write" }` even though Connection details
said `{ mode: "read" }`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base: main PRs targeted against main branch dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants