fix: guard overlapping ImageGen picks with per-target sequence token (#5944) - #6076
Merged
Conversation
Owner
Author
|
Review-blocked: the mtplx local reviewer (effort low) returned no verdict — "No model configured for mtplx reviewer — set one on the Settings → Code Reviewers page." Code and tests are otherwise shippable (ImageGen.objectUrls 8/8, sibling ImageGen suites 9/9; new overlap tests verified to fail without the fix), so this PR stays open for human/CI review. Status recorded in the worktree-private review file. |
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
Fixes the blob-URL orphan when two init-image (or same-slot reference) picks overlap in the EXIF-normalization await: both continuations read the same stale preview ref and each mint a
URL.createObjectURL, but only the lastsetStatesurvives, leaving the loser's url unreachable from state, the clear path, and the unmount sweep.Per the issue decision, uses a per-target sequence token (
pickSeqRef:{ init, refs[]}), mirroring the existingstatusRequestTokenidiom in the same file. Each handler bumps its slot's counter and bails when superseded before callingcreateObjectURL, so a losing pick never mints at all. The init handler's follow-up dimension probe gets the same staleness guard so a superseded pick can't clobber width/height either.Closes #5944
Test plan
client/src/pages/ImageGen.objectUrls.test.jsx(itscreateImageBitmapdeferral harness already existed): two overlapping picks on the init image, and two overlapping picks on reference slot 0 — each asserts exactly one url is created, it belongs to the last pick (photo-2.jpg), it is the live (unrevoked) one, and it is the url rendered.npx vitest run src/pages/ImageGen.objectUrls.test.jsx— 8 passed.npx vitest run src/pages/ImageGen.probeGating.test.jsx src/pages/ImageGen.federatedTarget.test.jsx src/pages/ImageGen.flux2VenvShare.test.jsx— 9 passed.