Repository navigation
feat: enhance capabilities structure with KindProfile and profile met… - #14
Merged
Merged
Conversation
…hod for identity kinds
…th improved validation and fallback logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Git provider SPI (
gitprovider.v1) to the SDK, so a plugin can adapt one source-control platform (GitHub, GitLab, Bitbucket, Gitea, …) to Paca's platform-neutral Git integration, together with the test suite that proves a provider is safe for core to drive. It also carries the SDK runtime changes the first-party Git providers need.Git provider SPI (
gitprovider/)Provider(identity setup, repository resolution, webhook verification and normalisation, credentials, reads, writes) plus optional interfaces core only calls when the matching capability flag is set: thread resolution, file read, code search, labels, reviewers, assignees, merge, check re-runs, reactions, webhook management, identity deletion, access grants and branch management (GetBranch,CreateBranch, with idempotency support).wire.go/servemount every operation as an internalPOST /_git/:oproute, answerunsupportedfor what a provider does not implement, and survive malformed bodies.types.go/errors.go, a closed set of error codes, andtestdata/wire-shapes.golden.json, a golden file both this SDK and Paca core assert their copies of the types against (core syncs withscripts/sync-git-spi.sh).Capabilities.Kinds []KindProfileandCapabilities.Profile(kind). A platform with more than one way to connect (GitHub: an App, or a personal access token) refines the provider-wideCredentialModel,WebhookScopeandAccessGrantsper identity kind; the kinds listed are also the ones a user can choose between when setting a connection up (core then sendsParams["kind"]).Profilefalls back to the provider-wide values, so providers that list no kinds are unchanged. The addition is additive on the wire (kinds,omitempty).Conformance suite and fake provider
gitprovider/conformance: the suite a provider runs against a fake backend of its own platform. It checks capability honesty in both directions, webhook verification and deterministic event ids, error classification, secret hygiene, paging, truncation, UTF-8 safety, write validation and idempotency, emulated batch review, branch semantics and access grants. It validatesKinds(each kind is declared, no duplicates, valid models and scopes, a kind that needs grants needs the capability) and judges credentials and webhook management by the fixture identity's kind (Fixtures.IdentityKind), so a provider with an App and a token is not held to the token's rules for the App.gitprovider/fakeprovider: a reference provider that passes in full, with variants for ephemeral and static platforms.scripts/check-mutants.sh: mutation check that the suite fails known-bad providers.SDK runtime
ProjectIDin the request context and error reporting.Compatibility
spi_versionhas a different major version thangitprovider.v1; theKindsfield is a minor, additive change.plugin-sdk-goreleased and theirgo.modbumped; until then Paca's first-party GitHub and GitLab plugins build against it with a localreplace.Test plan
go vet ./...andgo test ./...(including the golden wire-shape test and the fake provider's full conformance run)TestCapabilitiesProfile: a kind with a profile uses it, a kind without one falls back to the provider-wide valuesscripts/check-mutants.sh: every mutant is caught🤖 Generated with Claude Code