Context
src/review/fix-handoff-render.ts renders each finding's suggestion text into a fenced code block for AI-agent-ready fix handoff, in buildFixHandoffBlock (~line 54-61) and fixHandoffAggregateItem (~line 103-110):
const suggestionBlock = suggestedChange ? `\n\nSuggested change:\n\`\`\`\n${suggestedChange}\n\`\`\`` : "";
Neither function checks whether suggestion/suggestedChange itself contains a triple-backtick sequence before splicing it into the outer fence. The sibling renderer src/review/inline-suggestion-anchor.ts's safeSuggestionBlock already guards against exactly this hazard:
if (!suggestion || suggestion.includes("```")) return "";
fix-handoff-render.ts has no equivalent guard, so a finding whose suggestion text contains a fenced code example (e.g. a suggestion demonstrating "replace this code block with...") breaks the rendered markdown by closing the outer fence early.
Requirements
buildFixHandoffBlock and fixHandoffAggregateItem must not render suggestion/suggestedChange text unmodified into a fenced block when that text itself contains a ``` sequence.
- Follow the existing precedent in
src/review/inline-suggestion-anchor.ts's safeSuggestionBlock — either skip the suggestion block entirely when unsafe (matching that function's behavior), or escape/neutralize the embedded fence, whichever keeps behavior consistent between the two renderers. Do not invent a third distinct convention.
- The fix must apply to both call sites (
buildFixHandoffBlock and fixHandoffAggregateItem), not just one.
Deliverables
Test Coverage Requirements
This repo's Codecov patch gate is 99%+ patch coverage, hard, for src/**. The new guard branch and its test must both be covered.
Expected Outcome
A finding suggestion containing a fenced code example no longer breaks the rendered fix-handoff markdown block, in both buildFixHandoffBlock and fixHandoffAggregateItem.
Links & Resources
src/review/fix-handoff-render.ts (buildFixHandoffBlock ~line 54-61, fixHandoffAggregateItem ~line 103-110)
src/review/inline-suggestion-anchor.ts (safeSuggestionBlock, the precedent to follow)
test/unit/fix-handoff-render.test.ts
Context
src/review/fix-handoff-render.tsrenders each finding'ssuggestiontext into a fenced code block for AI-agent-ready fix handoff, inbuildFixHandoffBlock(~line 54-61) andfixHandoffAggregateItem(~line 103-110):Neither function checks whether
suggestion/suggestedChangeitself contains a triple-backtick sequence before splicing it into the outer fence. The sibling renderersrc/review/inline-suggestion-anchor.ts'ssafeSuggestionBlockalready guards against exactly this hazard:fix-handoff-render.tshas no equivalent guard, so a finding whose suggestion text contains a fenced code example (e.g. a suggestion demonstrating "replace this code block with...") breaks the rendered markdown by closing the outer fence early.Requirements
buildFixHandoffBlockandfixHandoffAggregateItemmust not rendersuggestion/suggestedChangetext unmodified into a fenced block when that text itself contains a```sequence.src/review/inline-suggestion-anchor.ts'ssafeSuggestionBlock— either skip the suggestion block entirely when unsafe (matching that function's behavior), or escape/neutralize the embedded fence, whichever keeps behavior consistent between the two renderers. Do not invent a third distinct convention.buildFixHandoffBlockandfixHandoffAggregateItem), not just one.Deliverables
buildFixHandoffBlockandfixHandoffAggregateIteminsrc/review/fix-handoff-render.tstest/unit/fix-handoff-render.test.tscovering a suggestion containing a```fence (existing tests only cover present/absent/whitespace-only suggestions)Test Coverage Requirements
This repo's Codecov patch gate is 99%+ patch coverage, hard, for
src/**. The new guard branch and its test must both be covered.Expected Outcome
A finding suggestion containing a fenced code example no longer breaks the rendered fix-handoff markdown block, in both
buildFixHandoffBlockandfixHandoffAggregateItem.Links & Resources
src/review/fix-handoff-render.ts(buildFixHandoffBlock~line 54-61,fixHandoffAggregateItem~line 103-110)src/review/inline-suggestion-anchor.ts(safeSuggestionBlock, the precedent to follow)test/unit/fix-handoff-render.test.ts