Skip to content

feat!: dispatch repo listing by auth type#33

Merged
packet-mover merged 1 commit intomainfrom
feat/typed-auth-dispatch
Apr 19, 2026
Merged

feat!: dispatch repo listing by auth type#33
packet-mover merged 1 commit intomainfrom
feat/typed-auth-dispatch

Conversation

@packet-mover
Copy link
Copy Markdown
Contributor

Summary

  • Replace Config{Org, Token} with a sealed Auth interface (PATAuth or InstallationAuth)
  • Scan() type-switches on auth and picks the right listing endpoint
  • PATAuth/orgs/{Name}/repos with fallback to /users/{Name}/repos on 404 (fixes 404 on personal-account CLI use)
  • InstallationAuth/installation/repositories (fixes "Selected repositories" subset installs leaking public repos, and personal-account installs 404'ing)

Breaking change: Config is gone. Callers pass PATAuth or InstallationAuth. CLI in cmd/scanner already updated.

Test plan

  • TestListReposByAccount_FallsBackToUserOn404 — 404 triggers user fallback
  • TestListReposByAccount_500PassesThrough — non-404 errors are not masked by fallback
  • TestListReposByInstallation_{SinglePage,Pagination,APIError,RateLimit} — new installation-scoped listing path
  • TestScan_DispatchesByAuthType — public Scan() routes PATAuth → org endpoint and InstallationAuth → installation endpoint
  • All existing tests still pass

🤖 Generated with Claude Code

Replaces Config{Org, Token} with a sealed Auth interface:
PATAuth{Token, Name} for personal access tokens and
InstallationAuth{Token, Name} for GitHub App installation tokens.

Scan(ctx, auth, opts...) type-switches on the auth to pick the right
listing endpoint. PATAuth calls /orgs/{Name}/repos and falls back to
/users/{Name}/repos on 404, so CLI usage works for both org and user
accounts. InstallationAuth calls /installation/repositories, which is
explicitly installation-scoped and returns only the repos the app was
granted access to, fixing the bug where subset installs leaked other
public repos and personal-account installs 404'd entirely.

Breaking change: Config is removed. Callers must pass PATAuth or
InstallationAuth. cmd/scanner already updated to PATAuth.

GitHubClient interface gains ListReposByAccount and
ListReposByInstallation; ListRepos is removed.

Tests:
- TestListReposByAccount_FallsBackToUserOn404 covers the 404 -> user path
- TestListReposByAccount_500PassesThrough ensures non-404 errors do not
  trigger the fallback (preventing outage masking)
- TestListReposByInstallation_{SinglePage,Pagination,APIError,RateLimit}
- TestScan_DispatchesByAuthType exercises the public Scan() dispatch

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@packet-mover packet-mover changed the title Dispatch repo listing by auth type feat!: dispatch repo listing by auth type Apr 19, 2026
@packet-mover packet-mover merged commit 949fa1f into main Apr 19, 2026
2 of 3 checks passed
@packet-mover packet-mover deleted the feat/typed-auth-dispatch branch April 19, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant