Skip to content

fix(ok): refuse suggestion pickers inside code contexts (#3077) - #936

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Jul 31, 2026
Merged

fix(ok): refuse suggestion pickers inside code contexts (#3077)#936
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown
Contributor

Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.

* 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
@inkeep-oss-sync
inkeep-oss-sync Bot merged commit 35d1975 into main Jul 31, 2026
@inkeep-oss-sync
inkeep-oss-sync Bot deleted the copybara/sync branch July 31, 2026 04:04
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.

1 participant