Skip to content

Require line boundaries for code fence matching - #582

Open
Fire162 wants to merge 2 commits into
google:mainfrom
Fire162:fix-fenced-code-backticks
Open

Fire162 wants to merge 2 commits into
google:mainfrom
Fire162:fix-fenced-code-backticks

Conversation

@Fire162

@Fire162 Fire162 commented Oct 23, 2026

Copy link
Copy Markdown

Description

The fence regex matched triple backticks anywhere inside a line. When extractions contain markdown snippets or code fences, FormatHandler was splitting on backticks inside JSON string values, leading to FormatParseError: Multiple fenced blocks found.

This updates _FENCE_RE to require line boundaries (^ and $) for opening and closing fences so backticks inside values do not trigger premature fence boundaries.

Fixes #581

Bug fix

How Has This Been Tested?

Ran unit tests and added a regression test covering JSON and YAML roundtrips with embedded code fences:

pytest tests/format_handler_test.py tests/resolver_test.py

Checklist:

  • I have read and acknowledged Google's Open Source Code of conduct.
  • I have read the Contributing page, and I either signed the Google Individual CLA or am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have made any needed documentation changes, or noted in the linked issue(s) that documentation elsewhere needs updating.
  • I have added tests, or I have ensured existing tests cover the changes
  • I have followed Google's Python Style Guide and ran pylint over the affected code.

Fenced code regex previously matched backticks anywhere within a line,
causing extractions containing markdown blocks to be prematurely split
and rejected as multiple fenced blocks.
@github-actions github-actions Bot added the size/XS Pull request with less than 50 lines changed label Oct 23, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Branch Update Required

Your branch is 1 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

⚠️ Branch Update Required

Your branch is 7 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

@github-actions

Copy link
Copy Markdown

⚠️ Branch Update Required

Your branch is 12 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

1 similar comment
@github-actions

Copy link
Copy Markdown

⚠️ Branch Update Required

Your branch is 12 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

@github-actions

Copy link
Copy Markdown

⚠️ Branch Update Required

Your branch is 23 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Pull request with less than 50 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: fenced JSON parsing rejects triple backticks inside extraction strings

1 participant