Skip to content

fix(e2e): stabilize permanentDeleteUser when user is not soft-deleted#27594

Merged
siddhant1 merged 1 commit into1.12.6from
fix/1.12.6-permanent-delete-user-hard-delete-race
Apr 21, 2026
Merged

fix(e2e): stabilize permanentDeleteUser when user is not soft-deleted#27594
siddhant1 merged 1 commit into1.12.6from
fix/1.12.6-permanent-delete-user-hard-delete-race

Conversation

@siddhant1
Copy link
Copy Markdown
Member

Summary

UserCreationWithPersona.spec.tsCreate user with persona and verify on profile times out consistently in nightly on 1.12.6. Network trace shows the app firing DELETE /api/v1/users/{id}?hardDelete=false&recursive=false (soft delete) even though the test clicks the hard-delete radio — so the waitForResponse('...?hardDelete=true&...') never resolves and the 60s test timeout hits.

Why

DeleteWidgetModal uses destroyOnClose, so its Form remounts with empty state each time the modal opens. A useEffect([visible]) then seeds deleteType = SOFT_DELETE via form.setFieldsValue. If Playwright clicks [data-testid="hard-delete"] between the Form's mount-render and the effect running, the effect fires after the click and overwrites the selection back to SOFT_DELETE. On Confirm, the app calls deleteEntity(..., deleteType === HARD_DELETE) with false.

This only surfaces when permanentDeleteUser(…, isUserSoftDeleted=false) is used. Every other caller passes true, which triggers a waitForResponse('/api/v1/users?**include=non-deleted') on the show-deleted toggle before the modal ever opens, buying enough time for the effect to run. UserCreationWithPersona.spec.ts is the only caller that doesn't — hence the consistent failure there while Users / UserDetails / OnlineUsers / PersonaFlow etc. stay green.

Fix

Test-only change: before clicking hard-delete, wait for [data-testid="soft-delete"].ant-radio-wrapper-checked — the signal that setFieldsValue has finished seeding the form. The wait is gated on !isUserSoftDeleted because when the show-deleted toggle is on, the modal's allowSoftDelete=false so there's no soft-delete radio to wait for (and no race — the default is already HARD_DELETE).

Product-side fix (replace the effect with initialValues on the Form so the default is set synchronously on mount) belongs on main; this PR just unblocks 1.12.6 nightly without touching shipped code.

Test plan

  • Green CI on UserCreationWithPersona.spec.ts across multiple shards
  • Users.spec.ts, UserDetails.spec.ts, OnlineUsers.spec.ts, PersonaFlow.spec.ts, PersonaDeletionUserProfile.spec.ts still green (they hit the isUserSoftDeleted=true branch which is unchanged)

🤖 Generated with Claude Code

When called with isUserSoftDeleted=false, the DeleteWidgetModal opens
with soft-delete as the default and a post-mount setFieldsValue effect
seeds the form. A fast click on the hard-delete radio can land before
that effect runs and gets overwritten, making the app fire the
soft-delete API call instead of hard-delete — the test then waits
forever for a hardDelete=true response and times out.

Wait for the default soft-delete radio to be checked before switching,
so the click and the effect no longer race.

Surfaces consistently in UserCreationWithPersona.spec.ts which is the
only caller passing isUserSoftDeleted=false and does not gate on the
show-deleted toggle response beforehand.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@siddhant1 siddhant1 requested a review from a team as a code owner April 21, 2026 13:46
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 21, 2026

Code Review ✅ Approved

Updates permanentDeleteUser to handle non-soft-deleted states, stabilizing end-to-end test execution. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@siddhant1 siddhant1 merged commit 8a95878 into 1.12.6 Apr 21, 2026
31 of 36 checks passed
@siddhant1 siddhant1 deleted the fix/1.12.6-permanent-delete-user-hard-delete-race branch April 21, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants