Skip to content

Add includeChangedFiles parameter to get_pull_request_by_id#1117

Open
lgpearson1771 wants to merge 2 commits intomicrosoft:mainfrom
lgpearson1771:feature/include-changed-files-in-get-pull-request
Open

Add includeChangedFiles parameter to get_pull_request_by_id#1117
lgpearson1771 wants to merge 2 commits intomicrosoft:mainfrom
lgpearson1771:feature/include-changed-files-in-get-pull-request

Conversation

@lgpearson1771
Copy link
Copy Markdown

Adds an optional includeChangedFiles parameter to the existing repo_get_pull_request_by_id tool. When set to true, it fetches the latest PR iteration and returns file-level change metadata (paths and change types) — no diffs, no file content.

GitHub Issue

Closes #958

Approach

Per @danhellem's feedback, this avoids tool bloat by extending the existing tool with a parameter rather than adding a new standalone tool.

Note: I was on vacation when the issue was closed — this PR implements the approved approach from the discussion.

Changes

  • src/tools/repositories.ts — Added includeChangedFiles param; fetches latest iteration and returns changedFilesSummary with change entries, file count, and pagination info
  • test/src/tools/repositories.test.ts — 7 new test cases: happy path, disabled/default, empty iterations, null iteration ID, API errors, and combo with includeLabels
  • docs/TOOLSET.md — Updated parameter docs

Associated Risks

Low risk — additive change behind an opt-in flag (default: false), no change to existing behavior

✅ PR Checklist

  • I have read the contribution guidelines
  • I have read the code of conduct guidelines
  • Title of the pull request is clear and informative
  • 👌 Code hygiene
  • 🔭 Telemetry added, updated, or N/A
  • 📄 Documentation added, updated, or N/A
  • 🛡️ Automated tests added, or N/A

🧪 How did you test it?

  • All 226 repository tests pass (npx jest --testPathPatterns="repositories")
  • 7 new tests cover: happy path, opt-out, default behavior, empty iterations, null iteration IDs, API error handling, and combined use with includeLabels

Add an optional includeChangedFiles boolean parameter to the existing
repo_get_pull_request_by_id tool. When set to true, fetches the PR
iteration changes and enriches the response with a changedFilesSummary
containing the list of changed files, file count, and pagination info.

Follows the established includeLabels pattern:
- Inner try/catch with console.warn on failure
- Graceful fallback with empty changedFilesSummary
- Both flags compose independently on the same response

Resolves microsoft#958

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lgpearson1771 lgpearson1771 requested a review from a team as a code owner April 7, 2026 18:22
@lgpearson1771
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Microsoft"

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@63f76d6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/tools/repositories.ts 82.35% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1117   +/-   ##
=======================================
  Coverage        ?   91.28%           
=======================================
  Files           ?       18           
  Lines           ?     1881           
  Branches        ?      422           
=======================================
  Hits            ?     1717           
  Misses          ?       56           
  Partials        ?      108           
Flag Coverage Δ
unittests 91.28% <82.35%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@danhellem danhellem requested a review from nikolapeja6 April 7, 2026 18:41
@danhellem danhellem added Do Not Merge ❌ do not merge this pull request Needs Review 👓 needs review by the product team labels Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do Not Merge ❌ do not merge this pull request Needs Review 👓 needs review by the product team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add lightweight tool to list changed files in a pull request

3 participants