fix(wfctl): accept provider contract descriptor arrays#865
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes wfctl plugin validate-contract so it can parse plugin.contracts.json when it is a top-level JSON array (provider-style descriptors like {id,path,schema}), matching the already-supported “contracts as array” parsing behavior and preventing publish gate failures.
Changes:
- Update contract-descriptor parsing to accept either a JSON array of descriptors or the structured
{ descriptorSetRef, contracts: [...] }file shape. - Reuse a shared byte-level parser for both inline
plugin.jsoncontractsandplugin.contracts.jsonfile parsing. - Add a regression test ensuring provider descriptor arrays are ignored (rather than treated as an invalid strict-contract descriptor file).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/wfctl/plugin_audit.go | Makes plugin.contracts.json parsing accept either array or object shapes by routing through a shared parser. |
| cmd/wfctl/plugin_validate_contract_test.go | Adds regression coverage for provider-style descriptor arrays so validate-contract --for-publish no longer fails on that shape. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
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
Fixes #862.
wfctl plugin validate-contractnow accepts provider contract descriptor arrays inplugin.contracts.json, matching the already-tolerated inlineplugin.json.contractsarray shape. This keeps strict Workflow plugin contract descriptors supported while ignoring provider descriptor entries such as{id,path,schema}instead of failing the release gate.Verification
GOWORK=off go test ./cmd/wfctl -run TestRunPluginValidateContract_ProviderDescriptorArrayIsIgnoredByStrictContracts -count=1GOWORK=off go run ./cmd/wfctl plugin validate-contract --for-publish --tag v0.1.8 ../../../workflow-plugin-product-captureGOWORK=off go test ./cmd/wfctl -count=1Regression Proof
With the production parser fix reverted and the new test left in place:
With the fix restored: