Skip to content

[access-github-usage] - Migrate GitHub usage providers to broker leases #1566

Description

@JoshuaRowePhantom

Part of #1512 and master #1505

Parent

Dependencies

Summary

Move the two GitHub usage providers from raw token delegates to one small typed lease adapter.

Current Limitation / Root Cause

GitHubCopilotUsageProvider and GitHubActionsUsageProvider still resolve raw GitHub token strings independently from repository and persistence consumers.

Affected Files

Path Change
Phantom.Workspaces/Services/UsageProviders/GitHubCopilotUsageProvider.cs Remove or update only the named bounded production surface.
Phantom.Workspaces/Services/UsageProviders/GitHubActionsUsageProvider.cs Remove or update only the named bounded production surface.
Phantom.Workspaces/Services/UsageProviders/GitHubCredentialUsageAdapter.cs Remove or update only the named bounded production surface.
Focused test file Add only the tests listed below.

Design / Fix

internal sealed class GitHubCredentialUsageAdapter
{
    public ValueTask<TResult> UseAsync<TResult>(
        GitHubCredentialPurpose purpose,
        Func<string, CancellationToken, ValueTask<TResult>> operation,
        CancellationToken cancellationToken);
}

Each refresh submits its own Usage-purpose request, bounds plaintext to the HTTP operation, and disposes the result.

Security and Privacy Invariants

  • No credential material, provider artifact, unsafe identifier, or raw provider output is introduced or copied during removal.
  • Replacement callers already use typed broker requests and caller-owned leases.
  • Removal fails the build if an undeclared production reference remains; it does not leave a fallback.

Exclusions

  • No unrelated provider, UI, persistence-format, or behavioral redesign.
  • No bridge, migration reader, or dual production path.

Commit Plan

Commit 1 — [access-github-usage] - Migrate GitHub usage providers to broker leases

Production types: GitHubCopilotUsageProvider, GitHubActionsUsageProvider, GitHubCredentialUsageAdapter.

Acceptance: one independently buildable commit affecting only the files above plus GitHubUsageProviderAccessTests.

Expected Tests

Test Name Class What It Verifies
GitHubCopilotUsageProvider_Refresh_UsesBrokerLease GitHubUsageProviderAccessTests Verifies the bounded cutover with no remaining production reference.
GitHubActionsUsageProvider_Refresh_UsesBrokerLease GitHubUsageProviderAccessTests Verifies the bounded cutover with no remaining production reference.
GitHubUsageProviders_DifferentUses_HaveDistinctPurposeFingerprints GitHubUsageProviderAccessTests Verifies the bounded cutover with no remaining production reference.

Activity

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

    diagnosedRoot cause identifiedenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions