Skip to content

fix: guard overlapping ImageGen picks with per-target sequence token (#5944) - #6076

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-5944
Sep 3, 2026
Merged

fix: guard overlapping ImageGen picks with per-target sequence token (#5944)#6076
atomantic merged 1 commit into
mainfrom
claim/issue-5944

Conversation

@atomantic

Copy link
Copy Markdown
Owner

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 last setState survives, 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 existing statusRequestToken idiom in the same file. Each handler bumps its slot's counter and bails when superseded before calling createObjectURL, 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

  • Extended client/src/pages/ImageGen.objectUrls.test.jsx (its createImageBitmap deferral 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.
  • Verified both new tests fail without the fix (2 failed / 6 passed) and pass with it.
  • 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.
  • Local reviewer (mtplx, low) was unavailable — no model configured for that backend — so shipping with self-review + tests; reviewer status recorded as review-blocked.

@atomantic

Copy link
Copy Markdown
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.

@atomantic
atomantic merged commit 6e11649 into main Sep 3, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-5944 branch September 3, 2026 15:34
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.

ImageGen orphans a blob URL when two init-image picks overlap

1 participant