Skip to content

feat(skills): recover Detect-CopilotFollowUpPR.ps1 from unmerged PR#493

Merged
rjmurillo-bot merged 2 commits into
mainfrom
feat/recover-copilot-followup-detection
Dec 29, 2025
Merged

feat(skills): recover Detect-CopilotFollowUpPR.ps1 from unmerged PR#493
rjmurillo-bot merged 2 commits into
mainfrom
feat/recover-copilot-followup-detection

Conversation

@rjmurillo-bot

Copy link
Copy Markdown
Collaborator

Summary

Recovers the Copilot follow-up PR detection implementation that was incorrectly closed without merge in PRs #202/#203.

Root Cause: The triage bot closed those PRs claiming the content was "superseded" because the template pr-comment-responder.shared.md had inline bash examples. However, the actual PowerShell skill script (268 lines with structured JSON output, categorization logic, and tests) was never merged to main.

Specification References

Type Reference
Original PR #202, #203 (closed without merge)
Related Issues Reopens #238, Reopens #293
Source Branch origin/feat/pr-162-phase4

Changes

  • New Script: .claude/skills/github/scripts/pr/Detect-CopilotFollowUpPR.ps1

    • Detects Copilot follow-up PRs matching copilot/sub-pr-{N} pattern
    • Categorizes: DUPLICATE, LIKELY_DUPLICATE, POSSIBLE_SUPPLEMENTAL
    • Returns structured JSON with recommendations
    • Integrates with GitHubHelpers module (Resolve-RepoParams)
  • New Tests: tests/Detect-CopilotFollowUpPR.Tests.ps1

    • 12 Pester tests covering pattern matching, categorization, and output structure
    • All tests pass
  • Documentation: Updated .claude/skills/github/SKILL.md

    • Added to decision tree
    • Added to script reference table
    • Added quick example

Type of Change

  • New feature (non-breaking change adding functionality)
  • Bug fix (non-breaking change fixing an issue)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Testing

  • Pester tests pass (12/12)
  • Script has valid PowerShell syntax
  • Markdown lint passes

Agent Review

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated
  • Tests added

Related Issues

@github-actions

Copy link
Copy Markdown
Contributor

Spec-to-Implementation Validation

Warning

No spec references found

This PR does not reference any specifications (REQ-, DESIGN-, TASK-*, or linked issues).

How to add spec references

Add spec references to your PR description to enable traceability:

Method Example
Reference requirements Implements REQ-001
Link issues Closes #123
Reference spec files .agents/specs/requirements/...

Spec Requirement by PR Type:

PR Type Required?
Feature (feat:) ✅ Required
Bug fix (fix:) Optional
Refactor (refactor:) Optional
Documentation (docs:) Not required
Infrastructure (ci:, build:, chore:) Optional

See PR template for full guidance.


Powered by AI Spec Validator - Validation skipped - no specs found

@github-actions

Copy link
Copy Markdown
Contributor

PR Validation Report

Note

Status: PASS

Description Validation

Check Status
Description matches diff PASS

QA Validation

Check Status
Code changes detected True
QA report exists false

⚡ Warnings

  • QA report not found for code changes (recommended before merge)

Powered by PR Validation - View Workflow

@coderabbitai coderabbitai Bot requested a review from rjmurillo December 29, 2025 13:27
@github-actions

github-actions Bot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

AI Quality Gate Review

Tip

Final Verdict: PASS

Walkthrough

This PR was reviewed by six AI agents in parallel, analyzing different aspects of the changes:

  • Security Agent: Scans for vulnerabilities, secrets exposure, and security anti-patterns
  • QA Agent: Evaluates test coverage, error handling, and code quality
  • Analyst Agent: Assesses code quality, impact analysis, and maintainability
  • Architect Agent: Reviews design patterns, system boundaries, and architectural concerns
  • DevOps Agent: Evaluates CI/CD, build pipelines, and infrastructure changes
  • Roadmap Agent: Assesses strategic alignment, feature scope, and user value

Review Summary

Agent Verdict Category Status
Security PASS N/A
QA PASS N/A
Analyst PASS N/A
Architect PASS N/A
DevOps PASS N/A
Roadmap PASS N/A

💡 Quick Access: Click on individual agent jobs (e.g., "🔒 security Review", "🧪 qa Review") in the workflow run to see detailed findings and step summaries.

Analyst Review Details

Now I have enough context. Let me analyze the PR.

Code Quality Analysis: Detect-CopilotFollowUpPR.ps1

Code Quality Score

Criterion Score (1-5) Notes
Readability 4 Clear function names, good structure, verbose logging
Maintainability 4 Modular design with separate functions for each concern
Consistency 4 Follows existing patterns (GitHubHelpers, exit codes, param blocks)
Simplicity 4 Straightforward logic, appropriate abstraction level

Overall: 4/5

Impact Assessment

  • Scope: Isolated (new script and test file, minor doc update)
  • Risk Level: Low
  • Affected Components: .claude/skills/github/ directory only

Findings

Priority Category Finding Location
Low Consistency Uses $script:Owner/$script:Repo pattern vs local variables used in peer scripts Detect-CopilotFollowUpPR.ps1:47-48
Low Error handling ConvertFrom-Json in Get-OriginalPRCommits could silently fail without clear indication Detect-CopilotFollowUpPR.ps1:139
Low Test coverage Output structure tests validate key names exist but do not validate actual script output Detect-CopilotFollowUpPR.Tests.ps1:120-139

Recommendations

  1. The $script: scoping pattern is valid but differs from peer scripts like Get-PRContext.ps1 which use local variables. Consider aligning for consistency.
  2. The single jq filter improvement mentioned in the PR description (addressing Enhancement: Simplify jq pipeline in Get-CopilotAnnouncement #238) is correctly implemented at line 78.
  3. Test file correctly extracts functions via regex for unit testing without needing to mock the entire script.

Verdict

VERDICT: PASS
MESSAGE: Well-structured recovery of lost functionality. Follows existing patterns for GitHub skill scripts. No architectural violations or blocking issues. Minor consistency observations do not block merge.
Roadmap Review Details

Now I have full context on the product roadmap and project goals. Let me analyze the PR strategically.

Strategic Alignment Assessment

Criterion Rating Notes
Aligns with project goals Medium Supports GitHub skills infrastructure for agent workflows; does not directly advance v1.1 roadmap items
Priority appropriate Medium Tooling enhancement, not on critical path; recovered code vs. new development
User value clear Medium Enables Copilot follow-up PR detection; niche use case for maintainers
Investment justified High Code already existed; recovery effort minimal; 12 tests included

Feature Completeness

  • Scope Assessment: Right-sized
  • Ship Ready: Yes
  • MVP Complete: Yes
  • Enhancement Opportunities: Integration with pr-comment-responder agent for automated triage of follow-up PRs

Impact Analysis

Dimension Assessment Notes
User Value Medium Solves real problem (Copilot creating duplicate follow-up PRs) for maintainers
Business Impact Low Does not affect adoption metrics; internal tooling
Technical Leverage Medium Creates reusable detection pattern; structured JSON output enables automation
Competitive Position Neutral No competitive differentiation

Concerns

Priority Concern Recommendation
Low Feature targets Copilot agent behavior, which is P2 (maintenance-only) per roadmap Document that this skill supports GitHub workflows generally, not Copilot CLI platform
Low No integration with pr-comment-responder agent documented Future work: connect detection output to triage workflow

Recommendations

  1. Merge as-is. The code was previously developed and reviewed; recovery is lower risk than new development.
  2. Consider adding this to the pr-comment-responder decision tree in a follow-up PR to automate duplicate PR handling.
  3. The script addresses a real maintainer pain point (Copilot creating duplicate follow-up PRs) that affects repository hygiene.

Verdict

VERDICT: PASS
MESSAGE: Recovered feature fills GitHub skills gap. Code was previously developed with tests. Scope is appropriate for the problem. No strategic conflicts with roadmap priorities.
DevOps Review Details

Now let me check if there are any existing workflow files that might run the Pester tests, and verify the script path references are correct:

Good, the script and module exist. Now let me validate the PowerShell script syntax and run the tests to verify they pass:

I'm getting permission denied errors, but I can still review the files statically. Let me complete my DevOps review based on what I've examined:

Pipeline Impact Assessment

Area Impact Notes
Build None No changes to build configuration
Test Low Adds new Pester test file in tests/ directory
Deploy None No deployment changes
Cost None Tests run within existing Pester workflow

CI/CD Quality Checks

Check Status Location
YAML syntax valid N/A No workflow changes
Actions pinned N/A No workflow changes
Secrets secure N/A No secrets handling
Permissions minimal N/A No workflow changes
Shell scripts robust .claude/skills/github/scripts/pr/Detect-CopilotFollowUpPR.ps1

Findings

Severity Category Finding Location Fix
Low Shell Quality Uses 2>$null for error suppression without logging Detect-CopilotFollowUpPR.ps1:79,98,115,128,190 Acceptable pattern for optional API calls
Info Documentation Script path in test differs from production path tests/Detect-CopilotFollowUpPR.Tests.ps1:13 Test correctly uses relative path from tests/ to .claude/skills/

Template Assessment

  • PR Template: Adequate - PR follows established template
  • Issue Templates: N/A - No changes
  • Template Issues: None

Automation Opportunities

Opportunity Type Benefit Effort
None identified - - -

Recommendations

  1. The new PowerShell script follows existing project patterns (uses GitHubHelpers.psm1, structured JSON output, proper error handling).
  2. Tests are in the correct location (tests/) and follow Pester conventions.
  3. The pester-tests.yml workflow already includes tests/** and .claude/skills/** in testable paths, so these new files will be tested automatically.

Verdict

VERDICT: PASS
MESSAGE: No CI/CD or build changes. New PowerShell skill script and tests follow existing patterns. Pester workflow will automatically run the new tests.
Architect Review Details

Now I have sufficient context. Let me complete my architectural review.


Design Quality Assessment

Aspect Rating (1-5) Notes
Pattern Adherence 4 Follows ADR-005 (PowerShell-only), uses GitHubHelpers module correctly
Boundary Respect 5 Clean module import, proper separation of functions
Coupling 4 Good use of shared module; single script-scope variables for Owner/Repo
Cohesion 4 Each function has single responsibility
Extensibility 4 Categories extensible via switch statement; structured output

Overall Design Score: 4/5


Architectural Concerns

Severity Concern Location Recommendation
Low Script-scope variables Lines 44-46 Consider passing Owner/Repo through function params instead of $script:
Low Hardcoded bot username Line 75 Extract copilot-swe-agent[bot] to constant or parameter for testability
Low ConvertFrom-Json error handling Lines 203-211 Double-parsing risk in main detection; convert once and validate

Breaking Change Assessment

  • Breaking Changes: No
  • Impact Scope: None (new script)
  • Migration Required: No
  • Migration Path: N/A

Technical Debt Analysis

  • Debt Added: Low
  • Debt Reduced: N/A (new feature)
  • Net Impact: Neutral

ADR Assessment

  • ADR Required: No
  • Decisions Identified: None requiring ADR
  • Existing ADR: Aligns with ADR-005 (PowerShell-only), ADR-017 (output schema consistency)
  • Recommendation: N/A

The script follows established patterns. No new architectural decisions are introduced.


ADR Alignment Verification

ADR Status Notes
ADR-005 Aligns PowerShell script with Pester tests
ADR-017 Aligns Consistent output schema with all properties present
ADR-006 N/A Not a workflow file

Recommendations

  1. Minor: Extract bot username to a module constant in GitHubHelpers for reuse across scripts
  2. Minor: Test coverage looks comprehensive but integration testing would require API mocking

Verdict

VERDICT: PASS
MESSAGE: Design is sound. Follows ADR-005 (PowerShell-only) and ADR-017 (output schema). Clean separation of functions, proper module usage, appropriate exit codes. Minor style suggestions are non-blocking.
Security Review Details

Security Review: PR feat/skills/recover-detect-copilot-followup

PR Type Classification

File Category Security Scrutiny
.claude/skills/github/SKILL.md DOCS None required
.claude/skills/github/scripts/pr/Detect-CopilotFollowUpPR.ps1 CODE Full OWASP review
tests/Detect-CopilotFollowUpPR.Tests.ps1 CODE Full OWASP review

Findings

Severity Category Finding Location CWE
Low Input Validation $PRNumber parameter is typed as [int], providing basic validation. No additional sanitization needed for integer input. Detect-CopilotFollowUpPR.ps1:34 N/A

Analysis Summary

Reviewed Areas:

  1. Shell Injection (CWE-78): [PASS] All gh CLI calls use parameters that are either integer-typed ($PRNumber) or derived from Resolve-RepoParams. The $Owner and $Repo values are validated through the GitHubHelpers module. No user-controlled strings are passed directly to shell execution.

  2. Secret Detection: [PASS] No hardcoded credentials, API keys, or tokens detected. Script uses gh CLI which handles authentication via environment.

  3. Input Validation: [PASS] $PRNumber is typed as [int], preventing injection via that parameter. String parameters $Owner and $Repo are resolved through module function.

  4. Error Handling: [PASS] Uses 2>$null for stderr suppression and checks $LASTEXITCODE. Error messages do not leak sensitive data.

  5. Dependencies: [PASS] Only dependency is GitHubHelpers.psm1 (internal module). No external packages added.

  6. Test File: [PASS] Test file uses Invoke-Expression on extracted function content, but this is a controlled test pattern extracting from the known script path. No external input is evaluated.

Recommendations

None required. The code follows secure patterns:

  • Integer typing prevents injection on the primary parameter
  • Module-based parameter resolution for owner/repo
  • Proper exit code checking
  • No secrets or credentials in code

Verdict

VERDICT: PASS
MESSAGE: No security vulnerabilities detected. PowerShell script uses proper parameter typing, module-based validation, and secure gh CLI invocation patterns.
QA Review Details

Based on my review of the PR files and test structure, I can now provide the QA assessment.


VERDICT: PASS
MESSAGE: CODE PR with 284-line PowerShell script has 141-line test file covering pattern matching, categorization logic, and syntax validation.

PR TYPE: CODE
FILES:

  • CODE: .claude/skills/github/scripts/pr/Detect-CopilotFollowUpPR.ps1 (new, 284 lines)
  • CODE: tests/Detect-CopilotFollowUpPR.Tests.ps1 (new, 141 lines)
  • DOCS: .claude/skills/github/SKILL.md (documentation update)

EVIDENCE:

Area Status Evidence Files Checked
Unit tests Adequate tests/Detect-CopilotFollowUpPR.Tests.ps1 with 12 tests across 4 contexts Detect-CopilotFollowUpPR.ps1
Edge cases Covered Empty diff, whitespace-only diff, single file, multiple files tested (lines 71-119) Compare-DiffContent function
Error paths Partial API failures handled with 2>$null and $null checks; script uses $ErrorActionPreference = 'Stop' Script lines 41-42, 78-85, 98-102
Assertions Present 12 Should -Be assertions across tests Test file
Blocking issues 0 - -

Test Coverage Assessment:

Function Test Coverage Notes
Test-FollowUpPattern Tested 6 cases for valid/invalid patterns (lines 31-51)
Compare-DiffContent Tested 4 cases covering DUPLICATE, LIKELY_DUPLICATE, POSSIBLE_SUPPLEMENTAL (lines 70-119)
Get-CopilotAnnouncement Untested Requires mocking GitHub API
Get-FollowUpPRDiff Untested Requires mocking GitHub API
Get-OriginalPRCommits Untested Requires mocking GitHub API
Invoke-FollowUpDetection Untested Requires mocking GitHub API

Quality Concerns:

Severity Issue Location Evidence Required Fix
MEDIUM API-dependent functions lack mocked tests Lines 67-138, 175-278 Functions call gh api and gh pr without test mocks Add integration tests or mocked unit tests in follow-up
LOW Output structure tests are placeholder-like Lines 122-139 Tests verify keys exist but do not test actual output Improve with mock-based integration tests

Regression Risk Assessment:

  • Risk Level: Low. New script with no breaking changes to existing functionality.
  • Affected Components: .claude/skills/github/scripts/pr/ (new file only)
  • Breaking Changes: None. Additive changes only.
  • Required Testing: Pattern matching and categorization logic verified. Full integration requires authenticated gh CLI.

Test Quality Analysis:

  • Tests verify behavior via assertions on return values
  • Tests are isolated (no shared state between contexts)
  • Test names are descriptive: "Matches valid Copilot follow-up branch pattern", "Empty diff string returns DUPLICATE category"
  • Functions extracted from script content for isolated testing (clever pattern for testing internal functions)

Positive Observations:

  1. Script follows existing module patterns (imports GitHubHelpers.psm1)
  2. Uses Resolve-RepoParams for consistent repository inference
  3. Structured JSON output matches project conventions
  4. Documentation updated in SKILL.md with decision tree entry, script reference, and example

Run Details
Property Value
Run ID 20574495795
Triggered by pull_request on 493/merge
Commit 0676b1e3abdd8ca81f087f335b4fc2b5fb62bffc

Powered by AI Quality Gate - View Workflow

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request successfully recovers the Detect-CopilotFollowUpPR.ps1 script, along with its tests and documentation. The script's implementation is solid, but I've identified a few areas for improvement to align it with repository standards and enhance its robustness.

My review focuses on three main points:

  1. Style Guide Adherence: The script uses Write-Host for logging, which should be replaced with Write-Verbose and Write-Warning as per the repository's PowerShell standards.
  2. Code Quality: There's an opportunity to simplify the logic in the Compare-DiffContent function by consolidating checks for empty diffs and removing some redundant code, while also applying defensive PowerShell patterns.
  3. Test Quality: The Pester tests currently validate static data structures rather than executing the script's functions. They should be updated to properly test the implementation of the core logic.

These changes will improve the script's maintainability, correctness, and test coverage.

Comment thread .claude/skills/github/scripts/pr/Detect-CopilotFollowUpPR.ps1 Outdated
Comment thread .claude/skills/github/scripts/pr/Detect-CopilotFollowUpPR.ps1 Outdated
Comment thread tests/Detect-CopilotFollowUpPR.Tests.ps1 Outdated
Recovers Copilot follow-up PR detection implementation that was
incorrectly closed without merge in PRs #202/#203. The triage bot
mistakenly identified the content as "superseded" because the
template had inline bash examples, but the actual PowerShell
skill script was never delivered to main.

## Recovered Files
- Detect-CopilotFollowUpPR.ps1 (268 lines)
- Pester tests (12 tests, all pass)
- SKILL.md documentation updates

## Features
- Detects `copilot/sub-pr-{N}` branch pattern
- Categorizes: DUPLICATE, LIKELY_DUPLICATE, POSSIBLE_SUPPLEMENTAL
- Returns structured JSON with recommendations
- Integrates with GitHubHelpers module

## Improvements Over Original
- Uses Resolve-RepoParams for Owner/Repo inference
- Single jq filter in Get-CopilotAnnouncement (issue #238)
- Proper $LASTEXITCODE checking after gh commands
- Updated bot username to copilot-swe-agent[bot]

Reopens #238, Reopens #293

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rjmurillo-bot rjmurillo-bot force-pushed the feat/recover-copilot-followup-detection branch from eb5c414 to b060edc Compare December 29, 2025 13:29
@coderabbitai

coderabbitai Bot commented Dec 29, 2025

Copy link
Copy Markdown

Warning

Rate limit exceeded

@rjmurillo-bot has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 11 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b060edc and 4cd8971.

📒 Files selected for processing (2)
  • .claude/skills/github/scripts/pr/Detect-CopilotFollowUpPR.ps1
  • tests/Detect-CopilotFollowUpPR.Tests.ps1

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

This PR adds a new PowerShell script that detects Copilot-generated follow-up PRs, analyzes their relationship to original PRs, and recommends actions. The script includes helper functions for pattern detection, diff retrieval, and comparison logic plus comprehensive test coverage.

Changes

Cohort / File(s) Summary
Documentation
.claude/skills/github/SKILL.md
Registers new Detect-CopilotFollowUpPR.ps1 script in workflow docs, decision trees, and example invocations.
Core Implementation
.claude/skills/github/scripts/pr/Detect-CopilotFollowUpPR.ps1
New script with main workflow Invoke-FollowUpDetection and five helper functions: pattern detection, announcement fetching, diff retrieval, commit collection, and diff comparison. Returns JSON with categorization (DUPLICATE, LIKELY_DUPLICATE, POSSIBLE_SUPPLEMENTAL) and recommendations (CLOSE_AS_DUPLICATE, REVIEW_THEN_CLOSE, EVALUATE_FOR_MERGE, MANUAL_REVIEW).
Test Suite
tests/Detect-CopilotFollowUpPR.Tests.ps1
Pester test suite validating pattern matching, syntax, categorization logic for empty/single/multi-file scenarios, recommendation mapping, and output structure.

Sequence Diagram

sequenceDiagram
    actor User
    participant Script as Detect-CopilotFollowUpPR
    participant GH as GitHub API (gh CLI)
    participant Logic as Diff Analysis

    User->>Script: Invoke with PRNumber
    Script->>GH: Search for follow-up PRs<br/>(head ref: copilot/sub-pr-*)
    
    rect rgb(240, 248, 255)
    Note over Script,GH: If no follow-ups found
    GH-->>Script: Empty result
    Script-->>User: Return found=false
    end
    
    rect rgb(255, 248, 240)
    Note over Script,GH: If follow-ups found
    GH-->>Script: List of follow-up PRs
    
    loop For each follow-up PR
        Script->>GH: Fetch follow-up diff
        GH-->>Script: Unified diff
        Script->>GH: Fetch original PR commits
        GH-->>Script: Commit list
        Script->>Logic: Compare diffs
        Logic-->>Script: Similarity score +<br/>Category (DUPLICATE,<br/>LIKELY_DUPLICATE, etc.)
    end
    
    Script->>GH: Get Copilot announcement
    GH-->>Script: Announcement data
    
    Script->>Logic: Map category to<br/>recommendation
    Logic-->>Script: Recommendation<br/>(CLOSE, REVIEW,<br/>MERGE, MANUAL)
    
    Script-->>User: Return JSON with<br/>analysis + recommendation
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • rjmurillo

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title follows conventional commit format with 'feat' type and scope 'skills', clearly describing the main change of recovering the Detect-CopilotFollowUpPR.ps1 script.
Description check ✅ Passed Description is directly related to the changeset, detailing the recovered script, tests, and documentation updates with clear context on why recovery was needed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented Dec 29, 2025

Copy link
Copy Markdown

Caution

Review failed

Failed to post review comments

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds a new PowerShell script for detecting and analyzing Copilot follow-up PRs with helper functions for pattern matching, API calls, diff comparison, and categorization logic. Includes documentation update and comprehensive test coverage.

Changes

Cohort / File(s) Summary
Documentation
.claude/skills/github/SKILL.md
Added Detect-CopilotFollowUpPR.ps1 to decision tree, script reference table, and quick usage examples
Core Implementation
.claude/skills/github/scripts/pr/Detect-CopilotFollowUpPR.ps1
New script with six helper functions: Test-FollowUpPattern (branch pattern validation), Get-CopilotAnnouncement (GitHub API call), Get-FollowUpPRDiff (fetch unified diffs), Get-OriginalPRCommits (retrieve commits), Compare-DiffContent (similarity categorization), and Invoke-FollowUpDetection (orchestration). Includes error handling and JSON output
Test Suite
tests/Detect-CopilotFollowUpPR.Tests.ps1
Pester tests covering pattern matching, script validation, categorization logic (DUPLICATE, LIKELY_DUPLICATE, POSSIBLE_SUPPLEMENTAL), recommendation mapping, and output structure verification

Sequence Diagram

sequenceDiagram
    participant User
    participant Script as Detect-CopilotFollowUpPR
    participant GitHubAPI as GitHub API
    participant Analysis as Analysis Engine

    User->>Script: Invoke with PRNumber
    Script->>GitHubAPI: Search for PRs with head:copilot/sub-pr-{PRNumber}
    GitHubAPI-->>Script: Return follow-up PRs list
    
    Script->>GitHubAPI: Fetch Copilot announcement comment
    GitHubAPI-->>Script: Return announcement details
    
    loop For each follow-up PR
        Script->>GitHubAPI: Fetch unified diff
        GitHubAPI-->>Script: Return diff content
        
        Script->>GitHubAPI: Fetch original PR commits
        GitHubAPI-->>Script: Return commit list
        
        Script->>Analysis: Compare diff vs commits
        Analysis-->>Script: Return category<br/>(DUPLICATE, LIKELY_DUPLICATE, etc.)
    end
    
    Script->>Script: Map categories to recommendations
    Script-->>User: Output JSON with results<br/>and global recommendation
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • rjmurillo

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title follows conventional commit format with 'feat(skills):' prefix and clearly describes the main change: recovering a previously unmerged Copilot follow-up PR detection script.
Description check ✅ Passed Description is directly related to the changeset, detailing the recovered script, tests, documentation updates, and the reason for recovery with proper context and specifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/recover-copilot-followup-detection

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Dec 29, 2025
@rjmurillo-bot rjmurillo-bot enabled auto-merge (squash) December 29, 2025 13:49
…lowUpPR

Comment-ID: 2650973653
Comment-ID: 2650973655
Comment-ID: 2650973657

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This was referenced Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-skills Skills documentation and patterns enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants