fix(studio): ignore stale consumer progress responses - #4546
Open
X-LightYear wants to merge 1 commit into
Open
X-LightYear wants to merge 1 commit into
X-LightYear wants to merge 1 commit into
Conversation
RockteMQ-AI
approved these changes
Sep 18, 2026
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR fixes a race condition in the consumer progress diagnostic UI where stale async requests could overwrite newer diagnostic results. The fix uses a request ID pattern to track request ownership, preventing out-of-order completions from corrupting the UI state.
Verdict: APPROVED — Clean, minimal fix with excellent test coverage.
Review Notes
Correctness ✅
- The
progressRequestIdRefpattern correctly prevents stale responses from overwriting newer data - Both success and error paths check the request ID before updating state
- Consistent with the existing
groupRequestIdRefpattern in the same component
Performance ✅
- Minimal overhead: just a counter increment and comparison
- No unnecessary re-renders or state updates
Tests ✅
- The regression test
ConsumerPageDiagnosticsRace.test.tsxis well-structured - Uses deferred promises to deterministically control async timing
- Tests both the success path (stale response ignored) and error path (stale error ignored)
- Proper cleanup with
afterEach
Compatibility ✅
- No API changes, purely internal state management
- No breaking changes to component behavior
Suggestions
None — this is a solid fix. The request ID pattern is a standard approach for handling async race conditions in React.
Automated review by github-manager-bot
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.
Summary
Root cause
ConsumerPage.loadProgressallowed overlapping requests for the same diagnostic context to updateprogressByGroupin completion order.An older request could therefore complete after a newer "Re-diagnose" request and overwrite the newer result.
Fix
Track the latest progress request generation per existing
cacheKey.Only the request that still owns the latest generation is allowed to update progress or surface an error.
Testing
ConsumerPageDiagnosticsRace.test.tsx: 1 passedConsumerPage.test.tsx: 32 passednpm run build: passedFixes #4545