Skip to content

feat(review): multi-line suggestion blocks with range validation (#2141) - #4048

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
bohdansolovie:feat/inline-multiline-suggestion-2141-v2
Jul 7, 2026
Merged

feat(review): multi-line suggestion blocks with range validation (#2141)#4048
JSONbored merged 2 commits into
JSONbored:mainfrom
bohdansolovie:feat/inline-multiline-suggestion-2141-v2

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Summary

  • Add optional endLine to InlineFinding + parser; carry through composeInlineFindings
  • Extract pure inline-comment-range.ts to validate contiguous RIGHT-side ranges and downgrade to single-line when any line is un-commentable
  • Extend ReviewInlineComment / GitHub review payload with start_line/start_side; multi-line suggestions require every line in the range to be ADDED (feat(review): anchor-safety validation drops un-commentable suggested changes #2140 anchor-safety)

Fixes #2141

Test plan

  • inline-comment-range.test.ts — range parse, every-line check, anchor resolve/downgrade
  • inline-comments.test.ts — multi-line suggestion kept, partial-range downgrade, context-line suggestion stripped
  • inline-suggestion-anchor.test.ts — multi-line added vs context ranges
  • ai-review.test.ts — parser accepts/drops endLine, compose merge carries endLine
  • npx tsc -p tsconfig.json --noEmit passes locally
  • CI green including codecov/patch ≥99%

Made with Cursor

bohdansolovie and others added 2 commits July 7, 2026 15:41
…Nbored#2141)

Add optional endLine to inline findings, resolve multi-line GitHub anchors
when every RIGHT-side line in the range is commentable, and strip suggestions
when any line in the range is not added. Extract pure range logic to
inline-comment-range.ts with unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
…SONbored#2141)

Cover missing branches in rightLinesByPath, anchor downgrade paths,
composeInlineFindings endLine merge, and multi-line GitHub post payload.

Co-authored-by: Cursor <cursoragent@cursor.com>
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 7, 2026
@loopover-orb

loopover-orb Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-07 14:13:36 UTC

9 files · 1 AI reviewer · no blockers · readiness 100/100 · CI pending · blocked

⏸️ Suggested Action - Manual Review

Review summary
This PR adds optional multi-line `endLine` support to inline findings and a well-isolated `inline-comment-range.ts` module that validates contiguous RIGHT-side ranges, downgrading to a single-line anchor whenever any line in the range isn't commentable. The multi-line-anchor check (RIGHT-side lines, context+added) is correctly kept separate from the suggestion-block anchor-safety check (ADDED-only lines via `isSuggestionAnchorable`), so a range spanning a context line still gets a valid multi-line comment but has its ```suggestion block stripped — verified by tracing the mixed-range test against `addedLinesFromPatch`. `composeInlineFindings`'s `endLine: strong.endLine ?? weak.endLine` merge and `parseModelReview`'s inverted/equal-range rejection were both traced against their test cases and produce the expected results. The PR closes #2141, CI (including codecov/patch) is green, and test coverage exercises both arms of every new conditional I could verify.

Nits — 5 non-blocking
  • `selectInlineComments` in inline-comments.ts:119-135 now builds both `addedLines` and `rightLines` maps by iterating the file list twice per call — minor, but could be built once and passed to both helpers.
  • The external magic-number scan flagging `422` (inline-comment-range.ts:36) and `2141` (inline-comments.ts:65) is a false positive — those are a doc-comment HTTP status reference and issue number, not literals needing a named constant.
  • `rightLinesByPath` (inline-comment-range.ts) and `addedLinesByPath` (inline-suggestion-anchor.ts) are near-duplicate map-building helpers over the same file list — worth a shared helper if a third variant ever appears, but not worth doing now for two call sites.
  • Consider computing `addedLines`/`rightLines` once per `selectInlineComments` call via a single pass if this path ever becomes hot (currently bounded by PR file count, so not urgent).
  • The doc comment on `resolveInlineCommentAnchor` (inline-comment-range.ts:36) could drop the bare '422' reference or turn it into a linked constant name for clarity, though it's fine as prose.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2141
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 381 registered-repo PR(s), 221 merged, 7 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bohdansolovie; Gittensor profile; 381 PR(s), 7 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: bohdansolovie
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, C++, JavaScript
  • Official Gittensor activity: 381 PR(s), 7 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.58%. Comparing base (01ccdd0) to head (525c2c8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4048   +/-   ##
=======================================
  Coverage   93.58%   93.58%           
=======================================
  Files         382      383    +1     
  Lines       35538    35573   +35     
  Branches    13030    13045   +15     
=======================================
+ Hits        33257    33292   +35     
  Misses       1618     1618           
  Partials      663      663           
Files with missing lines Coverage Δ
src/github/pr-actions.ts 100.00% <ø> (ø)
src/review/inline-comment-range.ts 100.00% <100.00%> (ø)
src/review/inline-comments.ts 100.00% <100.00%> (ø)
src/review/inline-suggestion-anchor.ts 100.00% <100.00%> (ø)
src/services/ai-review.ts 96.54% <100.00%> (+0.03%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit 18bf3f4 into JSONbored:main Jul 7, 2026
6 checks passed
@loopover-orb loopover-orb Bot added gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. and removed gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Development

Successfully merging this pull request may close these issues.

feat(review): multi-line ```suggestion blocks via RIGHT-side range validation

2 participants