XS✔ ◾ Fix Small Bugs and Remove Test Mock Artifact#783
XS✔ ◾ Fix Small Bugs and Remove Test Mock Artifact#783muiriswoulfe wants to merge 15 commits intomainfrom
Conversation
PR Metrics✔ Thanks for keeping your pull request small.
Metrics computed by PR Metrics. Add it to your Azure DevOps and GitHub PRs! |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
This parameter has no effect on GitHub because GitHub issue/review comments have no Active/Closed thread status. It only applies to Azure DevOps, where it is already defined in task.json.
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
There was a problem hiding this comment.
Pull request overview
This PR improves robustness and diagnostics across the PR Metrics task (GitHub Action + Azure DevOps task) by tightening error handling, input parsing, and diff parsing, while also cleaning up a test-only artifact in metrics parsing.
Changes:
- Add safer operational guards (HTTP timeouts/status checks, binary diff handling, non-
Errorthrows handling). - Improve security/diagnostics (error-property redaction, clearer 404 messaging, stricter access-token presence checks).
- Remove a test mock artifact from
CodeMetricsparsing and update/extend unit tests accordingly.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/task/src/wrappers/httpWrapper.ts | Adds request timeout + response.ok validation for diff downloads. |
| src/task/src/utilities/constants.ts | Introduces a shared HTTP timeout constant. |
| src/task/src/utilities/logger.ts | Adds sensitive-field redaction + safe serialization for error logging. |
| src/task/src/repos/tokenManager.ts | Allows retry by only marking invocation after successful token acquisition. |
| src/task/src/repos/gitHubReposInvoker.ts | Rejects empty tokens; relaxes Link header parsing for pagination. |
| src/task/src/repos/azureReposInvoker.ts | Rejects empty tokens. |
| src/task/src/repos/baseReposInvoker.ts | Splits 404 handling from 401/403 with a distinct message. |
| src/task/src/pullRequests/pullRequest.ts | Fixes GitHub PR detection when GITHUB_BASE_REF is undefined. |
| src/task/src/pullRequestMetrics.ts | Handles non-Error thrown values when failing the task. |
| src/task/src/metrics/inputs.ts | Trims per-line values for patterns/extensions inputs. |
| src/task/src/metrics/codeMetrics.ts | Removes mock-only output stripping and updates error message text accordingly. |
| src/task/src/git/octokitGitDiffParser.ts | Skips renamed binary files; simplifies diff splitting via .map(). |
| action.yml | Adds always-close-comment input definition for the GitHub Action. |
| src/task/tests/utilities/logger.spec.ts | Adds tests for redaction and non-serializable error properties. |
| src/task/tests/repos/gitHubReposInvoker.spec.ts | Updates assertions for new 404 error messaging behavior. |
| src/task/tests/repos/azureReposInvoker.spec.ts | Updates assertions for new 404 error messaging behavior. |
| src/task/tests/pullRequestMetrics.spec.ts | Adds coverage for non-Error thrown values. |
| src/task/tests/metrics/codeMetrics.spec.ts | Updates test data to match removal of mock artifact stripping. |
| src/task/tests/git/octokitGitDiffParser.spec.ts | Adds coverage for renamed binary file handling. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Use a JSON replacer to redact nested sensitive properties (e.g. request.headers.authorization) during serialization, not just top-level property names.
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Summary