fix(open-knowledge): inline-image source-fallback targets wrong PM range (#2505)#778
Merged
Conversation
…nge (#2505) * wip: claim QA-005 inline-image source-fallback range fix * test(open-knowledge): RED tests pinning inline-image source-fallback range contract * fix(open-knowledge): resolve inline-image source-fallback to the image node range Two chained defects in the clipboard serializer made the inline-image source-fallback swap the paragraph's leading text run instead of the image atom on cross-app copy: 1. findDescriptorRoot's data-clipboard-inline-leaf opt-out skipped the annotated NodeViewWrapper but kept climbing, and tiptap's outer .react-renderer span around the same node view matched as a descriptor. The opt-out now neutralizes the node view's whole wrapper stack: a .react-renderer that is the direct parent of an opted-out wrapper is skipped too. Genuine enclosing descriptors interpose their own NodeViewWrapper, so they still match. 2. The descriptor branch fed an element-only parent.children index to posAtDOM, whose offset argument counts childNodes. Any descriptor with a non-element preceding sibling was misaddressed. The offset is now computed over parent.childNodes. Test reconciliation: fixture (f) now models the real production topology (outer .react-renderer.node-image present); test (g) models a genuinely nested descriptor with its own NodeViewWrapper and pins that it still matches. The wrapDescriptor test double is memoized so wrapper identity is stable like real DOM. Also adds the clipboard-relative-url-source-fallback e2e file to the fixed test:e2e CI subset so this deterministic failure class is CI-visible from now on. * review: changeset, comment cleanup, mark-adjacent e2e pin Local review follow-ups for the inline-image source-fallback fix: - Add a patch changeset for the user-visible clipboard behavior change. - Strip process-history narration from test comments per the comment discipline convention; keep the topology and contract substance. - Model the genuine mid-paragraph descriptor fixture on mathInline, the inline descriptor that actually sits between text nodes, instead of a block JsxComponent that never has text siblings. - Extend the ImageInlineZoomView doc comment to mirror the whole-stack neutralization semantics now documented in findDescriptorRoot. - Add a QA-005b e2e pinning the mark-adjacent case behaviorally: verified failing against the pre-fix serializer (fallback span carried the duplicated bold text run) and passing with the fix, marks intact. * review: fix stale fake-DOM comment to cite the fixed identity-sensitive operations * test: make the walker mock delegate to the real implementation Bun's mock.module registry is process-global and never truly un-mocks (oven-sh/bun#12823), and a restore factory built from a namespace spread can observe the already-mocked namespace, so the previous afterAll restore leaked the capture stub to later test files on some runner file orders. CI caught clipboard-line-structure.test.ts receiving an empty fragment from the stub while the same suite passed locally under a different readdir order. The registered mock now delegates to the real walkLiveDomToInlineStyledFragment (reference captured before the mock, immune to in-place namespace mutation) except inside an explicit capture window scoped to captureEnv, so it is behavior-transparent to every other file in the process and needs no restore at all. GitOrigin-RevId: 7cf367e847cec90179c48146ced6e5fd9d7a8169
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.
Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.