Repository navigation
fix(id-web): clamp stale image-upload insert position (#1379) - #3203
Conversation
…failures distinctly (#1379)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 29 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Salvage note (protocol §8) — duplicate PR #3202 closed in favour of this PR, which is the one bound to queue task 4661 (parked against this PR @2eff04340). The two diffs were compared in full (not just file lists): both touch only — repo-worker-code, lane A |
Fixes #1379. Stacked on #3194 (base branch
queue/1312-1323-paste-order) — it restructures the same completion handler for #1323 ordering; this PR will be retargeted tomainonce #3194 merges.Problem
When the placeholder decoration was deleted while an upload was in flight, the completion handler fell back to the captured
insertPosand inserted unconditionally. If the document had shrunk past that position,insertthrewRangeErrorand the successfully uploaded image was silently lost (on main the shared.catchalso mislogs it as "Upload failed"; on #3194's restructure it became an unhandled rejection).Fix (per triage task 1345's decided policy)
Math.min(pos, doc.content.size), floored at 0), then resolve throughinsertPointso the image lands at a position where it actually fits; the placeholder-found position is still preferred as today.[image-upload] Insertion failed for …— never as an upload failure, never as an unhandled rejection — and the placeholder is still removed.Tests
bunx vitest run src/image-upload.test.ts— 46/46 pass (including the id(web): multi-image paste/drop inserts images in upload-completion order, not clipboard order #1323 ordering tests from the base branch).Queue task 4661.
Need help on this PR? Tag
@codesmith-botwith what you need.