feat: adopt strict-contracts typed proto (closes #10)#11
Merged
Conversation
Update minEngineVersion in plugin.json to 0.51.7. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- proto/github/v1/github.proto: typed messages for 3 module types (git.webhook, github.app, github.runner_provider) and 17 step types - gen/github.pb.go: protoc-gen-go v1.36.11 generated bindings - internal/contracts.go: ContractRegistry() on githubPlugin; 20 STRICT_PROTO contract descriptors (3 modules + 17 steps) - internal/contracts_test.go: 4 passing tests (NonNil, AllModuleTypes, AllStepTypes, ContractCount) - plugin.contracts.json: 20 strict_proto contract entries - plugin.json: add contracts array with full workflow.plugin.github.v1.* type names - go.mod: promote google.golang.org/protobuf v1.36.11 to direct dependency - Makefile: add proto-gen target - .goreleaser.yaml: include plugin.contracts.json and LICENSE in release archives - .github/workflows/wfctl-validate.yml: strict-contracts CI gate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d by wfctl-validate.yml) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…y asset) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lugin validation) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces strict-contracts (STRICT_PROTO) support for the GitHub workflow plugin by adding a typed protobuf contract surface, registering those contract descriptors at runtime, and enforcing validation via CI.
Changes:
- Adds
proto/github/v1/github.protoplus generated Go bindings to define typed configs/inputs/outputs for all supported module and step types. - Implements
ContractRegistry()returning STRICT_PROTO descriptors for 3 modules + 17 steps, with tests ensuring coverage and expected counts. - Adds
plugin.contracts.json, wires contracts intoplugin.json, and introduces awfctl plugin validate --strict-contractsGitHub Actions gate.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| proto/github/v1/github.proto | Adds typed proto message definitions for module/step configs and step I/O. |
| gen/github.pb.go | Generated Go bindings for the new proto definitions. |
| internal/contracts.go | Implements ContractRegistry() and provides a registry containing descriptors/contracts. |
| internal/contracts_test.go | Tests contract registry non-nil behavior and coverage for all module/step types. |
| plugin.contracts.json | Declares STRICT_PROTO contract entries for modules and steps. |
| plugin.json | Raises min engine version and adds an embedded contracts list with proto type names. |
| Makefile | Adds a proto-gen target to regenerate protobuf bindings. |
| go.mod | Updates workflow dependency and adds protobuf as a direct dependency. |
| go.sum | Updates checksums for the dependency graph after module version bumps. |
| .goreleaser.yaml | Packages plugin.contracts.json and LICENSE in release archives. |
| .github/workflows/wfctl-validate.yml | Adds CI validation for strict contracts via wfctl. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // githubProtoPkg is the proto package prefix for all github typed messages. | ||
| const githubProtoPkg = "workflow.plugin.github.v1." | ||
|
|
||
| // Compile-time assertion: githubPlugin implements sdk.ContractProvider. |
Comment on lines
+34
to
40
| { | ||
| "os": "windows", | ||
| "arch": "amd64", | ||
| "url": "https://github.com/GoCodeAlone/workflow-plugin-github/releases/download/v1.0.1/workflow-plugin-github-windows-amd64.tar.gz" | ||
| } | ||
| ], | ||
| "moduleTypes": ["git.webhook", "github.app", "github.runner_provider"], |
Replace anonymous interface assertion with typed sdk.ContractProvider so any future SDK interface additions are caught at compile time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolve go.mod conflict from main merge: google.golang.org/protobuf v1.36.11 stays as a direct dependency (used directly by gen/github.pb.go). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
ContractRegistry(), and wfctl-validate CI gateplugin.jsonalready had all types declared; the audit JSON parser missedmoduleTypes/stepTypesat the top levelChanges
proto/github/v1/github.proto— typed messages for 3 module types (git.webhook,github.app,github.runner_provider) and 17 step types; Struct fields for free-form maps/payloads (inputs, variables, labels)gen/github.pb.go— protoc-gen-go v1.36.11 generated bindings;Makefileproto-gentarget addedinternal/contracts.go—ContractRegistry()ongithubPluginreturning 20 STRICT_PROTO descriptors (3 modules + 17 steps); compile-time interface assertioninternal/contracts_test.go— 4 tests: NonNil, AllModuleTypes, AllStepTypes (all 17), ContractCount (all passing)plugin.contracts.json— 20 strict_proto contract entriesplugin.json— addscontractsarray with fullworkflow.plugin.github.v1.*type namesgo.mod— promotesgoogle.golang.org/protobuf v1.36.11to direct dependency.goreleaser.yaml— addsplugin.contracts.jsonandLICENSEto release archives.github/workflows/wfctl-validate.yml— strict-contracts CI gate: checks file existence, derives wfctl version from go.mod, runswfctl plugin validate --strict-contractsTest plan
go test ./internal/... -run TestContractRegistry— 4/4 PASSgo build ./...— clean compileCloses #10
🤖 Generated with Claude Code