Skip to content

[jsweep] Clean add_reviewer.cjs#26371

Merged
pelikhan merged 1 commit intomainfrom
jsweep/clean-add-reviewer-c46b3f1988a287ef
Apr 15, 2026
Merged

[jsweep] Clean add_reviewer.cjs#26371
pelikhan merged 1 commit intomainfrom
jsweep/clean-add-reviewer-c46b3f1988a287ef

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

Improved type annotations and code consistency in actions/setup/js/add_reviewer.cjs.

Context Type

github-script — runs in GitHub Actions using github, core, and context globals.

Changes Made

Type Annotations Improved:

  • Added HandlerConfig, ResolvedTemporaryIds, and HandlerResult typedef imports from ./types/handler-factory
  • Added AddReviewerMessage typedef with specific field types (reviewers?: Array<string|null|undefined|false>, pull_request_number?: number|string)
  • Replaced generic {Object} JSDoc param types with proper specific references ({AddReviewerMessage}, {ResolvedTemporaryIds}, {Promise<HandlerResult>})

Consistency Improvement:

  • Added HANDLER_TYPE = "add_reviewer" constant, matching the pattern used in other handler files like add_labels.cjs, add_comment.cjs, etc.

Test Coverage

The file already had 20 comprehensive tests covering:

  • Happy path (adding reviewers, copilot-specific handling)
  • Filtering by allowed list and deduplication
  • Max count enforcement
  • Staged mode preview
  • Error handling (API errors, invalid PR numbers, missing context)
  • Edge cases (null/falsy reviewers, whitespace trimming, max trimming)

No new tests were needed — coverage was already excellent.

✅ Validation Checks

  • Formatting: npm run format:cjs ✓ (unchanged)
  • Linting: npm run lint:cjs ✓ (all files use Prettier code style)
  • Type checking: npm run typecheck ✓ (no errors)
  • Tests: npx vitest run add_reviewer.test.cjs ✓ (20/20 passed)

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • invalid.example.invalid

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "invalid.example.invalid"

See Network Configuration for more information.

Generated by jsweep - JavaScript Unbloater · ● 2.2M ·

  • expires on Apr 17, 2026, 4:52 AM UTC

- Add HandlerConfig, ResolvedTemporaryIds, and HandlerResult typedef imports
- Add AddReviewerMessage typedef with specific field types
- Add HANDLER_TYPE constant for consistency with other handler files
- Replace generic {Object} JSDoc param types with specific typed references

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review April 15, 2026 05:25
Copilot AI review requested due to automatic review settings April 15, 2026 05:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves JSDoc typing and consistency for the add_reviewer safe-output handler used in GitHub Actions github-script context.

Changes:

  • Imported additional handler-factory typedefs and replaced generic {Object} JSDoc types with specific typedefs.
  • Introduced an AddReviewerMessage typedef to better describe the handler’s expected message shape.
  • Added a HANDLER_TYPE = "add_reviewer" constant to match the pattern used by other handlers.
Show a summary per file
File Description
actions/setup/js/add_reviewer.cjs Refines JSDoc typedef usage for handler inputs/outputs and adds a handler type constant for consistency.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@github-actions github-actions Bot mentioned this pull request Apr 15, 2026
@pelikhan pelikhan merged commit 920a4e8 into main Apr 15, 2026
78 checks passed
@pelikhan pelikhan deleted the jsweep/clean-add-reviewer-c46b3f1988a287ef branch April 15, 2026 05:35
@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor Author

Hey @github-actions[bot] (and the core team that merged this 👋) — thanks for the add_reviewer.cjs cleanup! Tightening up the JSDoc types to use proper HandlerConfig, ResolvedTemporaryIds, HandlerResult, and the new AddReviewerMessage typedef makes this handler consistent with its siblings. The addition of HANDLER_TYPE = "add_reviewer" is a nice touch for pattern uniformity.

One minor note for future jsweep passes:

  • No test file changes — the diff touches only add_reviewer.cjs with no corresponding changes to the test file (add_reviewer.test.cjs). For a pure type-annotation and constant addition this is perfectly reasonable (the 20 existing tests still cover all runtime behaviour), but the contribution checker flags it mechanically since no test files appear in the diff.

If you'd like a coding agent to address this automatically in a future pass:

In actions/setup/js/add_reviewer.test.cjs, add or update the existing import/type-checking assertions to verify:
1. The exported HANDLER_TYPE constant equals the string "add_reviewer".
2. JSDoc typedef AddReviewerMessage is correctly shaped: reviewers is optional Array<string|null|undefined|false>, pull_request_number is optional number|string.
Keep changes minimal — a single describe block with two lightweight unit assertions is enough.

Generated by Contribution Check · ● 1.5M ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants