fix(review): guard fix-handoff suggestion blocks against an embedded code fence - #6668
Conversation
…code fence (JSONbored#6632) `buildFixHandoffBlock` and `fixHandoffAggregateItem` in src/review/fix-handoff-render.ts splice a finding's suggestion text into a fenced code block without checking whether the suggestion itself contains a ``` sequence. A suggestion that demonstrates a fenced code example would close the outer fence early and break the rendered markdown. Add the same guard the sibling renderer inline-suggestion-anchor.ts's `safeSuggestionBlock` already uses -- skip the fenced block entirely when the suggestion contains ``` -- to BOTH call sites. The structured `suggestedChange` field (raw data, not a fenced block) is unchanged; only the markdown rendering is guarded. Extends test/unit/fix-handoff-render.test.ts with a regression for each function: a suggestion containing a ``` fence renders no fenced block (no stray ``` leaks into the output), while the existing present/absent/whitespace-only cases keep their behavior. Closes JSONbored#6632
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-16 18:23:33 UTC
Review summary Nits — 2 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6668 +/- ##
=======================================
Coverage 93.65% 93.65%
=======================================
Files 681 681
Lines 68086 68094 +8
Branches 18688 18695 +7
=======================================
+ Hits 63764 63772 +8
Misses 3347 3347
Partials 975 975
Flags with carried forward coverage won't be shown. Click here to find out more.
|
What
buildFixHandoffBlockandfixHandoffAggregateIteminsrc/review/fix-handoff-render.tssplice a finding's suggestion text into a fenced code block without checking whether the suggestion itself contains a```sequence. A suggestion demonstrating a fenced code example would close the outer fence early and break the rendered markdown.Resolves #6632.
Fix
Add the same guard the sibling renderer
src/review/inline-suggestion-anchor.ts'ssafeSuggestionBlockalready uses — skip the fenced block entirely when the suggestion contains```— to both call sites (buildFixHandoffBlockandfixHandoffAggregateItem). No third convention is invented.The structured
suggestedChangefield (raw data consumed programmatically, not a fenced block) is unchanged; only the markdown rendering is guarded, matching the precedent.Tests
test/unit/fix-handoff-render.test.tsgains a regression for each function: a suggestion containing a```fence renders no fenced block (no stray```leaks into the output), while the existing present/absent/whitespace-only cases keep their behavior. The new guard branch is covered.Locally green:
npx vitest run test/unit/fix-handoff-render.test.ts→ 22/22; eslint clean; the new branch is covered on the diff.