Repository navigation
feat: implement wire contract for Git provider with operations and types - #13
Merged
Merged
Conversation
- Added wire.go to define operations and their handling for the Git provider. - Introduced required and optional operation wrappers for better management of provider methods. - Created wiretypes.go to list all request, response, and event types for contract testing. - Added wireshape_test.go to validate JSON shapes against a golden file for consistency. - Implemented check-mutants.sh script to ensure known-bad providers are caught by the conformance suite.
…ance, and new request validation
…nch implementations
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 Go plugin SDK: the contract a Paca plugin implements to adapt one source-control platform (GitHub, GitLab, Gitea, …) to Paca's platform-neutral Git integration. Core owns everything that is not platform-specific (webhook endpoint and inbox, trigger routing, actor policy, agent runs, audit, MCP tools, UI); a provider only answers the platform-specific questions.Design:
docs/ai-agent/git-agent-workflow.mdin the Paca repo (§5 SPI, §4 vocabulary and events).What's included
Contract (
gitprovider/)provider.go— the requiredProviderinterface (identity setup, repositories, webhooks, credentials, reads, writes) and the optional interfaces gated byCapabilities: thread resolution, file read, code search, labels, reviewer requests, assignees, merge, check re-run, reactions, webhook management, identity deletion, access grants (granting an identity access to one more account/organization).types.go— neutral vocabulary: repositories, change requests, threads, comments, checks, normalized events (withaddressed[]decided by the provider), permissions, capabilities, setup steps.errors.go— the closed error-code set (not_found,forbidden,conflict,rate_limited,validation,unsupported,transient, …) so core can retry and back off uniformly.doc.go— how to write a provider.Wire contract
wire.go— the operation table (22 required, 14 optional) and the wrappers that decode a request, call the interface and encode anEnvelope. Optional operations are only served when their capability is declared.wiretypes.go— every request, response and event type, for contract testing.serve/—serve.Register(ctx, provider)mounts the operations as internal-onlyPOST /_git/<op>routes, so authors never write routes.testdata/wire-shapes.golden.json+wireshape_test.go— golden JSON shapes. Core keeps a synced copy of the types (scripts/sync-git-spi.shin the Paca repo), and this test catches any drift.Reference provider and conformance
fakeprovider/— an in-memory reference provider (and test harness), used as documentation by example and as core's integration-test double.conformance/— a suite any provider runs against recorded webhook fixtures and a fake backend. It checks, among other things: signature verification, error classification, no secrets in errors or events, honest capabilities in both directions (a declared capability must be implemented and vice versa), ephemeral credentials carry an expiry, truncation is reported, event ids are deterministic, merge honours the expected head SHA, and access-grant states are single-use and bound to the user.fakeprovider/mutants_test.go+scripts/check-mutants.sh— 11 deliberately broken providers; the suite must fail every one. The script exits non-zero if any survives, so a weakened check is noticed.Testing
Both pass locally (all 11 mutants caught).
Notes for review
com.paca.github) in the Paca repo, which passes this conformance suite against a fake GitHub.