Skip to content

feat: adopt strict-contracts typed proto (closes #10)#11

Merged
intel352 merged 8 commits into
mainfrom
feat/issue-10-strict-contracts
May 14, 2026
Merged

feat: adopt strict-contracts typed proto (closes #10)#11
intel352 merged 8 commits into
mainfrom
feat/issue-10-strict-contracts

Conversation

@intel352
Copy link
Copy Markdown
Contributor

Summary

  • Adds typed strict-contracts compliance to workflow-plugin-github, closing issue chore: adopt strict-contracts (plugin.contracts.json + proto definitions) #10
  • Adds proto message definitions for all 3 module types and all 17 step types, generated Go bindings, ContractRegistry(), and wfctl-validate CI gate
  • Corrects the issue's misleading "0 types in plugin.json" claim — plugin.json already had all types declared; the audit JSON parser missed moduleTypes/stepTypes at the top level

Changes

  • 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; Makefile proto-gen target added
  • internal/contracts.goContractRegistry() on githubPlugin returning 20 STRICT_PROTO descriptors (3 modules + 17 steps); compile-time interface assertion
  • internal/contracts_test.go — 4 tests: NonNil, AllModuleTypes, AllStepTypes (all 17), ContractCount (all passing)
  • plugin.contracts.json — 20 strict_proto contract entries
  • plugin.json — adds contracts array with full workflow.plugin.github.v1.* type names
  • go.mod — promotes google.golang.org/protobuf v1.36.11 to direct dependency
  • .goreleaser.yaml — adds plugin.contracts.json and LICENSE to release archives
  • .github/workflows/wfctl-validate.yml — strict-contracts CI gate: checks file existence, derives wfctl version from go.mod, runs wfctl plugin validate --strict-contracts

Test plan

  • go test ./internal/... -run TestContractRegistry — 4/4 PASS
  • go build ./... — clean compile
  • CI: wfctl-validate.yml gate passes on push

Closes #10

🤖 Generated with Claude Code

intel352 and others added 2 commits May 13, 2026 11:43
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>
intel352 and others added 4 commits May 13, 2026 20:39
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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.proto plus 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 into plugin.json, and introduces a wfctl plugin validate --strict-contracts GitHub 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.

Comment thread internal/contracts.go
// 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 thread plugin.json
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"],
intel352 and others added 2 commits May 13, 2026 20:51
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>
@intel352 intel352 merged commit 082d2d1 into main May 14, 2026
2 checks passed
@intel352 intel352 deleted the feat/issue-10-strict-contracts branch May 14, 2026 00:57
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.

chore: adopt strict-contracts (plugin.contracts.json + proto definitions)

2 participants