Skip to content

feat(git): resolve a single app installation by id on the credential broker - #128

Merged
Pomdapis merged 1 commit into
mainfrom
feat/git-broker-by-id
Jul 24, 2026
Merged

feat(git): resolve a single app installation by id on the credential broker#128
Pomdapis merged 1 commit into
mainfrom
feat/git-broker-by-id

Conversation

@Pomdapis

Copy link
Copy Markdown
Contributor

What

Adds ResolveAppInstallationByIdAsync(installationId, appKey?, ct) to IGitCredentialBroker — an O(1) point lookup of a single platform-app installation by its provider-side id, alongside the existing account-probe (ResolveAppInstallationAsync) and full-list (ListAppInstallationsAsync) methods.

Why

The Nexus setup-complete verifier confirms an app installation by listing every installation of the platform app and filtering client-side — O(N) per connect, and it grows with every customer that installs the app. When the caller already holds an installation id and only needs to confirm it still belongs to the app, a by-id lookup is the right primitive.

How

  • GitHub adapter: GET /app/installations/{installation_id} with the App JWT (same style as ResolveAppInstallationAsync/ListAppInstallationsAsync). A 404 maps to a new Git.InstallationNotFound error; other statuses (401/429/5xx) propagate unchanged. The 404→InstallationNotFound routing goes through a new GitRestErrorContext.ForInstallation(id), mirroring how ForRepository/ForNamespace already tell the error mapper what a 404 means.
  • New error: GitErrors.InstallationNotFound(string installationId)Error.NotFound, code Git.InstallationNotFound (sibling of RepositoryNotFound/NamespaceNotFound).
  • Stubs/testing: InMemoryGitServer (lookup seeded installations by id; miss → InstallationNotFound) and NullGitServer (Git.NotConfigured, like every other method) implement the new method.

Tests

  • Adapter (WireMock): 200 → info mapped incl. account login/type/suspended, user-account variant, 404 → Git.InstallationNotFound, unknown app key → Git.NotConfigured.
  • InMemory: seeded hit + miss.
  • GitErrors factory test + NullGitServer not-configured assertion.
  • Coverage: Compendium.Abstractions.Git 100% line, Compendium.Adapters.GitHub 93.3% line (both ≥90%).

Claude-Session: https://claude.ai/code/session_01VFDn7gCH7vdvT4eoNhsMLr

…broker

Add ResolveAppInstallationByIdAsync to IGitCredentialBroker: an O(1) point
lookup of a single platform-app installation by its provider-side id.

The Nexus setup-complete verifier currently confirms an installation by
listing every installation of the app and filtering client-side — O(N) per
connect. This gives it a direct by-id lookup instead.

- GitHub adapter: GET /app/installations/{id} with the App JWT; a 404 maps
  to the new Git.InstallationNotFound error (Error.NotFound), routed via a
  GitRestErrorContext.ForInstallation so other statuses still propagate.
- InMemoryGitServer + NullGitServer implement the new method.
- New GitErrors.InstallationNotFound(installationId) factory.

Claude-Session: https://claude.ai/code/session_01VFDn7gCH7vdvT4eoNhsMLr
@Pomdapis
Pomdapis merged commit b9e39f1 into main Jul 24, 2026
5 checks passed
@Pomdapis
Pomdapis deleted the feat/git-broker-by-id branch July 24, 2026 12:25
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