Skip to content

feat: enhance capabilities structure with KindProfile and profile met… - #14

Merged
pikann merged 2 commits into
masterfrom
feature/enhance-capabilities-structure
Oct 28, 2026
Merged

pikann merged 2 commits into
masterfrom
feature/enhance-capabilities-structure

Conversation

@pikann

@pikann pikann commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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/)

  • Contract: 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 layer: wire.go / serve mount every operation as an internal POST /_git/:op route, answer unsupported for what a provider does not implement, and survive malformed bodies.
  • Wire contract: types in types.go / errors.go, a closed set of error codes, and testdata/wire-shapes.golden.json, a golden file both this SDK and Paca core assert their copies of the types against (core syncs with scripts/sync-git-spi.sh).
  • Per-kind capability profiles: Capabilities.Kinds []KindProfile and Capabilities.Profile(kind). A platform with more than one way to connect (GitHub: an App, or a personal access token) refines the provider-wide CredentialModel, WebhookScope and AccessGrants per identity kind; the kinds listed are also the ones a user can choose between when setting a connection up (core then sends Params["kind"]). Profile falls 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 validates Kinds (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

  • Cache backend with TTL.
  • Condition/Action automation node registration and dispatch, with ProjectID in the request context and error reporting.
  • Custom host calls and branding information for WASM plugins.
  • WASM memory management for TinyGo (allocator reset after each request).
  • README updates and the Apache-2.0 license.

Compatibility

  • Core refuses a provider whose reported spi_version has a different major version than gitprovider.v1; the Kinds field is a minor, additive change.
  • Plugins that depend on this release need plugin-sdk-go released and their go.mod bumped; until then Paca's first-party GitHub and GitLab plugins build against it with a local replace.

Test plan

  • go vet ./... and go 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 values
  • The GitHub provider (App and token kinds) and the GitLab provider pass against this SDK
  • scripts/check-mutants.sh: every mutant is caught

🤖 Generated with Claude Code

@pikann
pikann merged commit a3c2dd5 into master Oct 28, 2026
4 checks passed
@pikann
pikann deleted the feature/enhance-capabilities-structure branch October 28, 2026 08:07
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