fix(jira): preserve escaped emphasis delimiters in jira_to_markdown - #1614
Merged
sooperset merged 1 commit intoAug 24, 2026
Merged
Conversation
Contributor
|
Merged, thanks @barrygfox. The focused regex change and regression cases preserve escaped Jira identifiers while keeping real emphasis conversion intact. |
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.
Problem
JiraPreprocessor.jira_to_markdown()pairs emphasis delimiters positionally with([*_])(.*?)\1, ignoring wiki escape markers. Stored content containing escaped intraword underscores is rewritten on every read-back:QUALITY\_GATES\_LLM\_ENABLEDQUALITY\*GATES\*LLM\_ENABLEDEach round-trip through any read tool rewrites
\_to\*, silently corrupting content for MCP clients and any agent that treats the response as ground truth. Tracked by #1610.Solution
Delimiters preceded by a backslash are wiki escapes written by this module's own
markdown_to_jira(intraword\_protection), not markup. The pairing regex now rejects escaped delimiters via negative lookbehind, so they can neither open nor close a span:r"(?<!\\)([*_])(.*?)(?<!\\)\1"Changes
src/mcp_atlassian/preprocessing/jira.py(?<!\\)lookbehinds on open/close delimitertests/unit/preprocessing/test_preprocessing.pytest_jira_to_markdownadditions — escaped\_/\*sequences survive conversion unchanged; unescaped emphasis still convertsWhat Does Not Change
*bold*→**bold**,_italic_→*italic*)markdown_to_jira) untouchedBreaking Changes
None.
Regression Tests
Fails before the fix (
tests/unit/preprocessing/test_preprocessing.py::test_jira_to_markdown, against436b37e):Result: FAIL before, PASS after this commit.
Test Plan
pytest tests/unit/preprocessing/ -q— 173 passedpytest tests/unit -q— full suite green on the combined stackFixes #1610