fix(ok): refuse suggestion pickers inside code contexts (#3077) - #936
Merged
Conversation
* fix(ok): refuse suggestion pickers inside code contexts The slash, wiki-link and tag pickers gated only on source mode, so all three activated inside a fenced code block and inside an inline code span. Committing an item there destroyed the bytes the user had typed: the picker deletes its trigger range, so the query characters vanished out of the fence and the chip landed after it, and a slash command replaced the whole code block with the item's node, losing the fence delimiter and its info string. Every input-rule surface already refuses in code contexts, via the @tiptap/core input-rule runner. These three are bare ProseMirror plugins that bypass that runner. Give them the same predicate, from one shared module the GFM autolinker now reads too, so the surfaces cannot drift apart again. * test(ok): pin the code-context refusal in the typed-view corpus and ledger Four corpus scripts and four tier-1 stability obligations covering both admission paths, the code node and the code mark. Verified non-vacuous: with the fix stashed, every fence script destroys bytes through the executor's own key route. Also adds the changeset and refreshes the generated typed-view catalogs and reachability record. * test(ok): address review — fix stale comment, share the plugin-key helper The test header said gfm-autolink 're-implements' the code predicate, which this PR made untrue by pointing that file at the shared module. getSuggestionState was independently implemented in both suggestion gating suites. Plugin-key discovery is the part worth sharing: if the synthesized PluginKey suffix format changes, one file should have to learn about it. Moved to a .test-helper.ts alongside the enumeration the closure guard uses. * fix(ok): extend the picker refusal to raw MDX source, not just code Review surfaced jsxInline as the other literal-text region the predicate missed, and its slash case needs no typing at all: <Icon /> already contains a space-then-slash, so parking the caret before the > arms the menu, and the commit deletes that / out of the source, leaving <Icon >. Wiki-link and tag destroy bytes there by typing. Verified on the mounted editor before and after. The predicate now covers both kinds of region, and is renamed to say so: literal-text-context.ts / isInLiteralTextContext. A schema-enumerating test asserts the raw-source list still covers every non-code content:'text*' node, so a new one cannot ship unclassified. Corrects the corpus framing from the previous commit. Those cells are region coverage, not regression pins: measureRung compares a doc against its own re-serialization, so a destroyed-but-self-consistent doc still measures stable. Verified by disabling the gate — all four stayed green. The fixedBy receipts are dropped accordingly; the dom tier is the pin. The upstream input-rule runner tests spec.code only, so it stays blind to these nodes. That is a different seam and is left alone. * docs(ok): retire the last code-context wording from the picker comments The rename broadened the predicate; five comments still pointed readers at a module name that no longer exists. * docs(ok): describe the two raw-source nodes separately The shared parenthetical was true of jsxInline only. rawMdxFallback carries attrs and a NodeView, and that NodeView's contenteditable:false is the reason no picker path reaches it today - load-bearing context the collective description was hiding. GitOrigin-RevId: bc3fbe6f77d9a6fdba9b8abcb96a573ef29e1e6a
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.