Skip to content

refactor(github): extract the connection probe into an internal helper #2674

Closed

Description

@thetechgy

Describe the feature

Move the nested Invoke-ConnectionProbe function out of Connect-MtGitHub and into its own internal GitHub service helper. This follows Merill's optional suggestion on #2633.

The changes should cover the following:

  • For the helper: Add one function in its own file under powershell/internal/services/github/, using an approved verb and a GitHub-specific name. Pass the request URI, authentication headers and connection used for rate-limit tracking as explicit parameters.
  • For the connection probes: Route the existing token identity, organization, membership and administration probes through the helper. Preserve the current response and error handling, 30-second connection and operation timeouts, and rate-limit checks before requests and after responses or errors.
  • For session state: Continue using the same connection object across the probes and carry its cooldown state into the established session.

Impact and importance

This makes the probe's dependencies explicit and keeps the shared request handling in the service directory, consistent with Maester's repository layout. The connection behavior and public API should stay the same.

Alternatives you've considered

Leaving the function nested retains the current behavior. Extracting it is a small follow-up to the merged transport work and can be reviewed independently.

Validation

  • Run the affected connection and rate-limit unit tests with Pester 5.7.1. Verify successful connection, blocking probe failures and non-blocking administration-probe failures, including retained cooldown state.
  • Adjust or add focused coverage where needed to verify the helper receives the headers and shared connection state.
  • Run changed-file PSScriptAnalyzer, module build/output validation and ./powershell/tests/pester.ps1 before pushing. Report any baseline or environment failures separately.

Additional context

#2633 is merged. The GraphQL description clarification from the same review has already been added; this issue tracks the helper extraction.

Implementation and validation are still pending.

Activity

  1. thetechgy commented on Nov 4, 2026

    @thetechgy
    ContributorAuthor

    I'll take care of this this week

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions