Skip to content

Fix race condition in test_prompt_webhook_with_mixed_events#18859

Merged
harupy merged 3 commits intomlflow:masterfrom
harupy:fix-webhook-test-race-condition
Nov 17, 2025
Merged

Fix race condition in test_prompt_webhook_with_mixed_events#18859
harupy merged 3 commits intomlflow:masterfrom
harupy:fix-webhook-test-race-condition

Conversation

@harupy
Copy link
Member

@harupy harupy commented Nov 17, 2025

Related Issues/PRs

Fixes flaky test failure from https://github.com/mlflow/mlflow/actions/runs/19416355823/job/55545319550?pr=18858

What changes are proposed in this pull request?

Fix a race condition in the test_prompt_webhook_with_mixed_events test where webhooks were being delivered out of order, causing intermittent test failures.

The test was assuming webhooks would arrive in sequential order, but webhook processing is asynchronous. The failure manifested as:

AssertionError: assert {'description...t/model', ...} == {'description...', 'tags': {}}
Differing items:
{'description': None} != {'description': 'Prompt description'}
{'name': 'regular_model'} != {'name': 'test_prompt_mixed'}

The fix sorts both expected and actual webhook payloads before comparison, making the test order-independent while still verifying all expected webhooks are delivered.

How is this PR tested?

  • Existing unit/integration tests

Verified that test_prompt_webhook_with_mixed_events and all other webhook tests pass consistently.

Does this PR require documentation update?

  • No. You can skip the rest of this section.

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.

How should the PR be classified in the release notes? Choose one:

  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section

Should this PR be included in the next patch release?

  • No (this PR will be included in the next minor release)

🤖 Generated with Claude Code

@github-actions github-actions bot added v3.6.1 rn/none List under Small Changes in Changelogs. labels Nov 17, 2025
The test was failing due to a race condition where webhooks were being
delivered out of order. The test assumed webhooks would arrive in the
exact sequential order they were triggered, but webhook processing is
asynchronous.

Failed CI job: https://github.com/mlflow/mlflow/actions/runs/19416355823/job/55545319550?pr=18858

Error message:
AssertionError: assert {'description...t/model', ...} == {'description...', 'tags': {}}
Differing items:
{'description': None} != {'description': 'Prompt description'}
{'name': 'regular_model'} != {'name': 'test_prompt_mixed'}

The fix sorts both the expected and actual webhook payloads before
comparison, making the test order-independent while still verifying
all expected webhooks are delivered correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
@harupy harupy force-pushed the fix-webhook-test-race-condition branch from 403f090 to af1a01d Compare November 17, 2025 03:29
@harupy harupy added the team-review Trigger a team review request label Nov 17, 2025
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
@harupy harupy changed the title Fix race condition in test_prompt_webhook_with_mixed_events Fix race condition in test_prompt_webhook_with_mixed_events Nov 17, 2025
Copy link
Collaborator

@serena-ruan serena-ruan left a comment

Choose a reason for hiding this comment

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

LGTM!

@harupy harupy enabled auto-merge November 17, 2025 03:49
@harupy harupy added this pull request to the merge queue Nov 17, 2025
Merged via the queue into mlflow:master with commit c52bd16 Nov 17, 2025
42 checks passed
@harupy harupy deleted the fix-webhook-test-race-condition branch November 17, 2025 04:34
mprahl pushed a commit to opendatahub-io/mlflow that referenced this pull request Nov 21, 2025
…#18859)

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Tian-Sky-Lan pushed a commit to Tian-Sky-Lan/mlflow that referenced this pull request Nov 24, 2025
…#18859)

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: Tian Lan <sky.blue266000@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rn/none List under Small Changes in Changelogs. team-review Trigger a team review request v3.6.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants