test(e2e): fix permission write-race in environment-permission-test#7782
Closed
talissoncosta wants to merge 1 commit into
Closed
test(e2e): fix permission write-race in environment-permission-test#7782talissoncosta wants to merge 1 commit into
talissoncosta wants to merge 1 commit into
Conversation
setUserPermission toggled the permission and immediately closed the modal, so logout could abort the in-flight POST/PUT to /user-permissions/ and the grant never persisted — the next user then couldn't see the entity (flaky 'switch-environment-production' timeout in environment-permission-test). Await the save response before closing. Also add reloadUntilVisible for state that is only eventually consistent across a fresh navigation: the env list is fetched on navigation, so a just-granted VIEW_ENVIRONMENT needs a reload, not a longer wait on the same page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Docker builds report
|
Contributor
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Contributor
Visual Regression19 screenshots compared. See report for details. |
4 tasks
Contributor
Author
|
Superseded by #7785, which consolidates the E2E flakiness fixes into one branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
One of the intermittent E2E failures on the production deploy gate, distinct from the boot-loader deadlock (#7776) — here the app boots fine but
environment-permission-testtimes out waiting forswitch-environment-productionafter the permission to view it was just granted.Two changes:
setUserPermissionawaits the save. The helper toggled the permission switch and immediately closed the modal + logged out. The toggle saves async (POST/PUT to.../user-permissions/), so logout could abort the in-flight request and the grant never persisted — the next user then couldn't see the entity. The backend has no permission read-cache, so the lost write is the most likely cause. Now we await the/user-permissions/response before closing the modal.reloadUntilVisiblehelper. Belt-and-braces for the read side: the environment list is fetched once on navigation, so a just-grantedVIEW_ENVIRONMENTcan't appear by waiting on the same page — it needs a reload. Used for the 'User with permissions can see environment' assertion.How did you test this code?
environment-permission-testreproduced theswitch-environment-productiontimeout (app booted, env absent). Traced the grant to an un-awaited/user-permissions/POST insetUserPermission. Locally re-ran the spec against production with the fix; the grant now persists and the env appears. As a timing race against shared prod state, the real signal is the deploy-gate pass rate.Note: separate from the non-idempotent-seed failure (createEnvironment on a dirty seed) seen in project-permission-test — that's a teardown/seed-lifecycle issue, not addressed here.