Skip to content

feat(review): anchor-safety validation drops un-commentable suggested changes - #3839

Closed
jimcody1995 wants to merge 2 commits into
JSONbored:mainfrom
jimcody1995:feat/inline-suggestion-anchor-safety-2140
Closed

feat(review): anchor-safety validation drops un-commentable suggested changes#3839
jimcody1995 wants to merge 2 commits into
JSONbored:mainfrom
jimcody1995:feat/inline-suggestion-anchor-safety-2140

Conversation

@jimcody1995

Copy link
Copy Markdown
Contributor

Summary

Fixes #2140

Validation

  • npx vitest run test/unit/inline-comments.test.ts — 39 passed
  • Local v8 coverage on inline-comments.ts: 100% statements/branches/lines

Conflict avoidance

Only src/review/inline-comments.ts + tests. No file overlap with open PRs #3823#3836.

Made with Cursor

jimcody1995 and others added 2 commits July 6, 2026 15:54
Add addedLinesFromPatch and only render GitHub suggested-change blocks when
the finding anchor is an ADDED (+) diff line. Plain inline comments still
work on context lines; files without a patch never emit suggestions.

Fixes JSONbored#2140

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@jimcody1995
jimcody1995 requested a review from JSONbored as a code owner July 6, 2026 14:11
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.41%. Comparing base (ca6a6d7) to head (3cdced9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3839   +/-   ##
=======================================
  Coverage   93.41%   93.41%           
=======================================
  Files         326      326           
  Lines       32855    32873   +18     
  Branches    12035    12040    +5     
=======================================
+ Hits        30691    30709   +18     
  Misses       1530     1530           
  Partials      634      634           
Files with missing lines Coverage Δ
src/review/inline-comments.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 6, 2026
@loopover-orb

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - reject/close recommended

Review updated: 2026-07-06 14:20:21 UTC

2 files · 1 AI reviewer · 1 blocker · readiness 100/100 · CI green · clean

🛑 Suggested Action - Reject/Close

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.

Review summary
The diff adds addedLinesFromPatch, a duplicate of the existing rightSideLinesFromPatch that only tracks '+' lines, and uses it to gate whether a finding's suggestion block is rendered — suggestions now only appear when the finding's anchor line is an actual added line, while the plain comment still renders on context lines. The wiring is correct: selectInlineComments now computes suggestionAnchorable per (path, line) and threads it into formatInlineBody in place of the raw suggestionsEnabled flag, and files with no patch are already excluded via the pre-existing validLines check, which addedLinesByPath naturally inherits. Tests exercise the new function directly plus the context-line/added-line/no-patch paths end-to-end, matching the stated 100% patch coverage claim.

Nits — 5 non-blocking
  • src/review/inline-comments.ts: addedLinesFromPatch duplicates rightSideLinesFromPatch's hunk-walking loop almost verbatim (differing only in the '+' vs '+'/' ' marker check); consider deriving one from the other or sharing a single line-classifying helper to avoid two copies drifting apart.
  • src/review/inline-comments.ts:158-159: naming addedLinesByPath alongside rightLinesByPath is a little easy to conflate at a glance — a short inline comment at the addedLinesByPath.set call reminding readers it's the added-only subset would help future readers scanning quickly.
  • The '422' mentioned in the new JSDoc (line ~69) is only in a comment, not a code literal, so it doesn't need a named constant — the external brief's flag on this is not actionable.
  • Consider factoring rightSideLinesFromPatch and addedLinesFromPatch into a single internal line-walker that returns both sets in one pass, since selectInlineComments always needs both together and currently parses each patch twice.
  • The formatInlineBody parameter name 'suggestionsEnabled' now sometimes receives 'suggestionAnchorable' from selectInlineComments — a rename (e.g. to renderSuggestion) at the call site/parameter would make the semantic shift clearer to future readers.

Why this is blocked

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
Linked issue ✅ Linked #2140
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: 132 registered-repo PR(s), 90 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jimcody1995; Gittensor profile; 132 PR(s), 0 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: jimcody1995
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, JavaScript
  • Official Gittensor activity: 132 PR(s), 0 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

@loopover-orb

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (Linked issue overlaps another open PR; duplicate of another open PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 6, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(review): anchor-safety validation drops un-commentable suggested changes

1 participant