Merged
Conversation
- Remove unused HANDLER_TYPE constant (dead code) - Add 3 edge case tests: undefined reviewers, copilot-only reviewer, default config Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Removes dead code from the add_reviewer safe-output handler and strengthens its test suite with additional edge-case coverage.
Changes:
- Removed unused
HANDLER_TYPEconstant fromactions/setup/js/add_reviewer.cjs. - Added 3 edge-case tests for undefined reviewers, copilot-only reviewer behavior, and default config behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| actions/setup/js/add_reviewer.cjs | Removes an unused constant to reduce dead code. |
| actions/setup/js/add_reviewer.test.cjs | Adds tests to cover omitted reviewers, copilot-only path, and default handler config behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Contributor
|
@copilot add tests |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Added 5 more edge case tests in 0785686 (15 → 20 total):
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cleaned
add_reviewer.cjsas part of the daily jsweep unbloat process.Context: github-script (uses
core,github,contextglobals)Changes
Source:
add_reviewer.cjsHANDLER_TYPEconstant — declared asconst HANDLER_TYPE = "add_reviewer"but never referenced anywhere in the file or exported. Pure dead code.Tests:
add_reviewer.test.cjs"should handle undefined reviewers as empty array"— verifies themessage.reviewers || []fallback whenreviewersis omitted from the message"should add only copilot when copilot is the only reviewer"— verifies the code path whereotherReviewers.length === 0(first API call is skipped, only copilot API call is made)"should use default config values when no options provided"— verifies thatmain({})uses defaults (all reviewers allowed, max=10)"should return error for invalid pull_request_number"— verifies NaN handling when pull_request_number is a non-numeric string, null, or alphanumeric value"should filter out copilot when not in allowed list"— verifies copilot is removed byprocessItemswhen not present in the allowed list"should sanitize null and falsy values in reviewers array"— verifiessanitizeItemsstrips null/undefined/false/empty-string/whitespace-only entries and trims names"should trim reviewer list to maxCount within a single message"— verifiesprocessItemshard-limits the reviewer count per call"should count staged calls toward max processedCount"— verifiesprocessedCount++fires before the staged-mode early return, consuming the max budgetValidation ✅
All four checks passed:
npm run format:cjs✓npm run lint:cjs✓npm run typecheck✓npm run test:js✓ — 20/20 add_reviewer tests pass (19 pre-existing failures in unrelated files)📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.