Skip to content

feat(review): View diff links in changed-files summary (#2157)#3922

Merged
loopover-orb[bot] merged 3 commits into
JSONbored:mainfrom
bohdansolovie:feat/changed-files-view-diff-links-2157
Jul 7, 2026
Merged

feat(review): View diff links in changed-files summary (#2157)#3922
loopover-orb[bot] merged 3 commits into
JSONbored:mainfrom
bohdansolovie:feat/changed-files-view-diff-links-2157

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Summary

  • Add pure changed-files-diff-link.ts to build public-safe GitHub Files-tab #diff-… anchors from repo-relative paths (SHA-256)
  • When changedFilesSummaryContext is present, render one row per changed file with a View diff link; without context, keep the existing grouped category table byte-identical (feat(review): render changed-files summary as a collapsible table in the unified comment #2145)
  • Wire repoFullName + pullNumber from the unified-comment publish path in processors.ts

Fixes #2157

Test plan

  • changed-files-diff-link.test.ts — anchor hash, URL validation, invalid inputs
  • changed-files-summary-collapsible.test.ts — per-file links, em-dash fallbacks, path escaping, category sort
  • queue.test.ts — end-to-end unified comment posts per-file View diff links when review.changed_files_summary is on
  • npx tsc -p tsconfig.json --noEmit passes locally
  • CI green including codecov/patch ≥99%

Made with Cursor

bohdansolovie and others added 3 commits July 7, 2026 08:45
…#2157)

Extract GitHub Files-tab diff-anchor URL building into a pure module,
render per-file rows with public-safe View diff links when repo context
is available, and keep the grouped category table when context is absent.

Co-authored-by: Cursor <cursoragent@cursor.com>
)

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

Repair the broken collapsible test block and exercise em-dash fallbacks
for unanchorable paths and invalid repo context, category sort ordering,
and greater-than path escaping.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bohdansolovie
bohdansolovie requested a review from JSONbored as a code owner July 7, 2026 06:46
@bohdansolovie
bohdansolovie marked this pull request as draft July 7, 2026 06:46
@superagent-security

Copy link
Copy Markdown
Contributor

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

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 7, 2026
@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 (c433e59) to head (deb21f2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3922   +/-   ##
=======================================
  Coverage   93.58%   93.58%           
=======================================
  Files         358      359    +1     
  Lines       34342    34364   +22     
  Branches    12570    12576    +6     
=======================================
+ Hits        32138    32160   +22     
  Misses       1580     1580           
  Partials      624      624           
Files with missing lines Coverage Δ
src/queue/processors.ts 94.54% <ø> (ø)
src/review/changed-files-diff-link.ts 100.00% <100.00%> (ø)
src/review/unified-comment-bridge.ts 99.51% <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.

@loopover-orb

loopover-orb Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-07 06:57:49 UTC

6 files · 1 AI reviewer · no blockers · readiness 96/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds per-file 'View diff' links to the changed-files summary table, gated on an optional context param (repoFullName/pullNumber) so the existing grouped-by-category table stays byte-identical when context is absent — verified by the diff's own regression test. The diff-link builder is pure and defensively validates repo name format, PR number, and path before returning a URL, falling back to null/— rather than emitting a malformed link. The anchor hash matches GitHub's actual SHA-256-of-path Files-tab anchor scheme (confirmed against the test's known hash for 'src/app.ts'), and wiring into processors.ts/queue.test.ts is complete end-to-end.

Nits — 5 non-blocking
  • src/review/unified-comment-bridge.ts:459-465 — markdownChangedFilePath escapes a backtick in the path as `\`` before wrapping the whole value in single backticks, but CommonMark code spans do not process backslash escapes, so a path containing a backtick will prematurely close the code span and can garble that table row; the file already has the correct pattern nearby (`safeMarkdownFence` in src/review/review-grounding.ts, which picks a longer backtick-run delimiter) that could be reused here instead.
  • src/review/unified-comment-bridge.ts:501 — the per-file table header's last column is an empty string (`| File | Added | Removed | |`); consider labeling it (e.g. `| Diff |`) for readability.
  • src/review/changed-files-diff-link.ts — `githubPrFileDiffAnchor` hashes the trimmed path but the displayed path in the table is untrimmed, so a path with incidental leading/trailing whitespace would show a mismatch between the visible cell text and the anchor target (very unlikely to occur in real GitHub file paths, but worth a comment noting the intentional asymmetry).
  • Reuse the existing `safeMarkdownFence`-style backtick-run-counting approach from src/review/review-grounding.ts for markdownChangedFilePath to make code-span escaping correct for adversarial filenames.
  • Consider labeling the empty diff-link column header for clarity.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2157
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 (draft PR; 1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 371 registered-repo PR(s), 213 merged, 7 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bohdansolovie; Gittensor profile; 371 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: not available
  • Official Gittensor activity: 371 PR(s), 7 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Mark ready when done.
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

@bohdansolovie
bohdansolovie marked this pull request as ready for review July 7, 2026 06:56

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 1ce4364 into JSONbored:main Jul 7, 2026
8 checks passed
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): render 'view diff' anchor links per file in the changed-files summary

1 participant