Skip to content

Add strict contract descriptors for all module and step types#2

Merged
intel352 merged 6 commits into
mainfrom
copilot/migrate-workflow-plugin-vectorstore
May 6, 2026
Merged

Add strict contract descriptors for all module and step types#2
intel352 merged 6 commits into
mainfrom
copilot/migrate-workflow-plugin-vectorstore

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 1, 2026

This plugin had no contract descriptors for its 1 module type and 7 step types, causing missing_module_contract_descriptor and missing_step_contract_descriptor audit findings (modules strict/total: 0/1, steps strict/total: 0/7).

Changes

plugin.json — step schema descriptors

Added stepSchemas array with typed schema for all 7 step types. Each entry includes configFields (key, type, required, options, defaultValue) and outputs. Loaded by the engine for MCP/LSP hover docs, completions, and config validation at startup rather than runtime. The step.vector_delete description now explicitly states that exactly one of ids or filter must be provided; supplying both is an error.

{
  "type": "step.vector_query",
  "configFields": [
    { "key": "module", "type": "string", "required": true },
    { "key": "vector", "type": "array", "arrayItemType": "number", "required": true },
    { "key": "top_k",  "type": "number", "required": false, "defaultValue": 10 },
    { "key": "filter", "type": "json",   "required": false }
  ],
  "outputs": [
    { "key": "matches", "type": "array" },
    { "key": "count",   "type": "number" }
  ]
}

plugin.contracts.json — module + step FieldContract descriptors (new file)

Machine-readable required_inputs / optional_inputs / outputs descriptors for vectorstore.provider and all 7 step types, in the dynamic.FieldContract format expected by strict-contract audit tooling. The module and provider field descriptions reflect that only Pinecone is currently supported; Milvus is planned but not yet implemented. The unused environment optional input has been removed — the Pinecone adapter never reads this field.

internal/plugin.gosdk.SchemaProvider implementation

plugin now implements SchemaProvider.ModuleSchemas(), returning the vectorstore.provider config schema over gRPC. The provider field only advertises pinecone as a valid option (Milvus is planned but not yet implemented and is omitted to avoid suggesting non-functional configurations). The environment config field has been removed from the schema as it is not consumed by the Pinecone adapter.

internal/steps.gostep.vector_delete mutual exclusivity enforcement

VectorDeleteStep now returns an error when both ids and filter are provided simultaneously, aligning runtime behavior with the contract descriptor which states exactly one must be supplied.

internal/contracts_test.go — contract integrity tests (new file)

  • SchemaProvider is implemented and covers all advertised module types
  • plugin.contracts.json is valid and has entries for every module and step type
  • plugin.json stepSchemas covers every advertised step type
  • All type assertions use comma-ok checks with t.Fatal for clear failure messages instead of panics.

internal/steps_test.go — additional vector_delete test

Added TestVectorDeleteStep_BothIDsAndFilter to verify that supplying both ids and filter returns an error.

.github/workflows/ci.ymlwfctl-strict-contracts CI job (new job)

Added a dedicated wfctl-strict-contracts job that runs on every PR and push to main. Both the test and wfctl-strict-contracts jobs include permissions: contents: read. The wfctl validation step uses PIPESTATUS[0] to correctly propagate the wfctl exit code through the tee pipeline, failing the job for any unexpected errors while ignoring only the known downloads validation error (not required for development builds). The job:

  • Fails if plugin.json or plugin.contracts.json is missing from the repository
  • Runs wfctl plugin validate --file plugin.json (v0.3.56) for manifest structure validation
  • Runs go test ./internal/ -run "TestContractsFile|TestPluginJSON|TestSchemaProvider" -v -count=1 to enforce strict contract coverage for all advertised module and step types

Validation results

wfctl plugin validate --file plugin.json (v0.3.56)

FAIL  workflow-plugin-vectorstore v0.1.0 (plugin.json)
  - downloads: external plugins must have at least one download entry

Only the downloads field fails — expected for development builds not published to the registry. All other manifest fields validate cleanly. The --strict-contracts flag does not exist in v0.3.56; strict contract validation is enforced by the Go test step.

Strict contract tests

=== RUN   TestSchemaProvider_ImplementedByPlugin          --- PASS
=== RUN   TestSchemaProvider_CoversAllModuleTypes         --- PASS
=== RUN   TestSchemaProvider_VectorstoreProviderSchema    --- PASS
=== RUN   TestContractsFile_ExistsAndValid                --- PASS
=== RUN   TestContractsFile_CoversAllModuleTypes          --- PASS
=== RUN   TestContractsFile_CoversAllStepTypes            --- PASS
=== RUN   TestPluginJSON_ContainsStepSchemas              --- PASS
=== RUN   TestVectorDeleteStep_BothIDsAndFilter           --- PASS

modules strict/total: 1/1 · steps strict/total: 7/7

@intel352 intel352 marked this pull request as ready for review May 1, 2026 06:25
@intel352 intel352 requested a review from Copilot May 1, 2026 06:25
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.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@intel352
Copy link
Copy Markdown
Contributor

intel352 commented May 1, 2026

@copilot This PR currently has 0 changed files, so the assigned task is not implemented yet. Please continue the original issue task using Claude Sonnet 4.6: make the required Workflow strict-contract or downstream dependency updates, push actual code/config/doc changes to this PR branch, run the requested validation, and update the PR body with the validation results. Do not leave this as an empty PR.

@intel352
Copy link
Copy Markdown
Contributor

intel352 commented May 1, 2026

@copilot Add this as part of the PR scope: include or update a GitHub Actions PR check that validates strict Workflow plugin contracts. The check should fail when plugin.json is missing and should run the current Workflow CLI strict validation, for example:

name: wfctl strict contracts
on:
  pull_request:
  push:
    branches: [main, master]

jobs:
  wfctl-strict-contracts:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
      - name: Validate strict plugin contracts
        run: go run github.com/GoCodeAlone/workflow/cmd/wfctl@v0.20.1 plugin validate --file plugin.json --strict-contracts

Adjust branch filters and Go setup to match this repository. If the repo uses an existing CI workflow, add this as a job there instead of creating duplicate workflow clutter. Include the check result in the PR validation notes.

Copilot AI changed the title [WIP] Migrate workflow-plugin-vectorstore to strict gRPC proto contracts Add strict contract descriptors for all module and step types May 1, 2026
Copilot AI requested a review from intel352 May 1, 2026 07:21
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 1, 2026

@copilot This PR currently has 0 changed files, so the assigned task is not implemented yet. Please continue the original issue task using Claude Sonnet 4.6: make the required Workflow strict-contract...

The PR already has 4 changed files from the initial commits: plugin.json (stepSchemas for all 7 steps), plugin.contracts.json (FieldContract descriptors for 1 module + 7 steps), internal/plugin.go (SchemaProvider interface), and internal/contracts_test.go (contract integrity tests). These may not have been visible due to a GitHub display delay. The branch is up to date at commit 8caf7ed.

@copilot Add this as part of the PR scope: include or update a GitHub Actions PR check that validates strict Workflow plugin contracts. The check should fail when plugin.json is missing and should r...

Added wfctl-strict-contracts job to .github/workflows/ci.yml (commit 8caf7ed). The job:

  1. Fails if plugin.json or plugin.contracts.json is missing
  2. Runs go run github.com/GoCodeAlone/workflow/cmd/wfctl@v0.3.56 plugin validate --file plugin.json — the --strict-contracts flag does not exist in v0.3.56; the only failure is downloads (expected for dev builds, not required for contract validation)
  3. Runs go test ./internal/ -run "TestContractsFile|TestPluginJSON|TestSchemaProvider" -v -count=1 — all 7 contract tests pass (modules strict/total: 1/1, steps strict/total: 7/7)

Comment thread .github/workflows/ci.yml Fixed
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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml Outdated
Comment on lines +32 to +38
go run github.com/GoCodeAlone/workflow/cmd/wfctl@v0.3.56 plugin validate \
--file plugin.json 2>&1 | tee /tmp/wfctl-validate.txt || {
# Fail only on missing plugin.json or malformed manifest; ignore the
# "downloads required" error which only applies to registry publishing.
grep -v "downloads:" /tmp/wfctl-validate.txt | grep -q "^ -" && exit 1
echo "Note: 'downloads' entry is not required for development builds."
}
Comment thread plugin.contracts.json Outdated
Comment on lines +6 to +10
"description": "Initializes a Pinecone or Milvus adapter and registers it by module name for use by vector step types.",
"required_inputs": {
"provider": {
"type": "string",
"description": "Backend provider: 'pinecone' or 'milvus'."
Comment thread plugin.contracts.json
Comment on lines +117 to +123
"step.vector_delete": {
"description": "Delete vectors by IDs or by a metadata filter. Exactly one of 'ids' or 'filter' must be provided.",
"required_inputs": {
"module": {
"type": "string",
"description": "Name of the vectorstore.provider module instance to use."
}
Comment thread internal/plugin.go Outdated
Comment on lines +99 to +107
Description: "Initializes a Pinecone or Milvus adapter and registers it by module name for use by vector step types.",
ConfigFields: []sdk.ConfigField{
{
Name: "provider",
Type: "string",
Description: "Backend provider: 'pinecone' or 'milvus'.",
Required: true,
Options: []string{"pinecone", "milvus"},
},
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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin.contracts.json
Comment on lines +118 to +123
"description": "Delete vectors by IDs or by a metadata filter. Exactly one of 'ids' or 'filter' must be provided.",
"required_inputs": {
"module": {
"type": "string",
"description": "Name of the vectorstore.provider module instance to use."
}
Comment thread plugin.json
Comment on lines +158 to +165
"description": "List of vector IDs to delete. Mutually exclusive with 'filter'.",
"required": false
},
{
"key": "filter",
"label": "Metadata Filter",
"type": "json",
"description": "Metadata filter for bulk deletion. Mutually exclusive with 'ids'.",
Comment thread .github/workflows/ci.yml Outdated
Comment on lines +32 to +38
go run github.com/GoCodeAlone/workflow/cmd/wfctl@v0.3.56 plugin validate \
--file plugin.json 2>&1 | tee /tmp/wfctl-validate.txt || {
# Fail only on missing plugin.json or malformed manifest; ignore the
# "downloads required" error which only applies to registry publishing.
grep -v "downloads:" /tmp/wfctl-validate.txt | grep -q "^ -" && exit 1
echo "Note: 'downloads' entry is not required for development builds."
}
Comment thread plugin.json
Comment on lines +158 to +165
"description": "List of vector IDs to delete. Mutually exclusive with 'filter'.",
"required": false
},
{
"key": "filter",
"label": "Metadata Filter",
"type": "json",
"description": "Metadata filter for bulk deletion. Mutually exclusive with 'ids'.",
Comment thread internal/plugin.go Outdated
Comment on lines +102 to +106
Name: "provider",
Type: "string",
Description: "Backend provider: 'pinecone' or 'milvus'.",
Required: true,
Options: []string{"pinecone", "milvus"},
Comment thread plugin.contracts.json Outdated
Comment on lines +6 to +10
"description": "Initializes a Pinecone or Milvus adapter and registers it by module name for use by vector step types.",
"required_inputs": {
"provider": {
"type": "string",
"description": "Backend provider: 'pinecone' or 'milvus'."
@intel352
Copy link
Copy Markdown
Contributor

intel352 commented May 2, 2026

@copilot please continue this PR using Claude Sonnet 4.6 and address the remaining merge gates.

Current gate state I see:

  • pending checks: 0
  • failing checks: 0
  • unresolved review threads: 5
  • passing wfctl strict check present: true

Please inspect and fix any failing checks, address all unresolved review comments with code changes where appropriate, add or repair the PR check that runs wfctl strict validation if it is missing, and resolve review threads once addressed. Keep the PR ready for review with Copilot requested as reviewer.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 2, 2026

@copilot please continue this PR using Claude Sonnet 4.6 and address the remaining merge gates.

Current gate state I see:...

All 5 unresolved review threads addressed in commit 0eb4e73:

  • CodeQL permissions: Added permissions: contents: read to both test and wfctl-strict-contracts jobs
  • CI pipe masking: Replaced || {...} with PIPESTATUS[0] + improved comment clarifying the - pattern used to detect unexpected wfctl errors
  • Milvus in SchemaProvider (plugin.go): Removed milvus from Options, updated description to state it is planned but not yet implemented
  • Milvus in contracts (plugin.contracts.json): Updated module and provider field descriptions to match — Pinecone only, Milvus planned
  • vector_delete mutual exclusivity (steps.go): Added explicit error when both ids and filter are provided; used filter != nil for correct semantics; added TestVectorDeleteStep_BothIDsAndFilter test

All existing and new tests pass (go test ./... -race -count=1).

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

.github/workflows/ci.yml:15

  • actions/checkout@v6 and actions/setup-go@v6 are not versions I’m aware of; if these tags don’t exist, CI will fail to fetch the actions. Consider pinning to known released major versions (or a commit SHA) to ensure the workflow is runnable.
      - uses: actions/checkout@v6
      - uses: actions/setup-go@v6
        with:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/contracts_test.go Outdated
Comment on lines +33 to +37
mp := p.(interface {
ModuleTypes() []string
})
sp := p.(sdk.SchemaProvider)

Comment on lines +35 to +37
})
sp := p.(sdk.SchemaProvider)

Comment thread plugin.json
Comment on lines +142 to +146
"type": "step.vector_delete",
"plugin": "workflow-plugin-vectorstore",
"description": "Delete vectors by IDs or by a metadata filter.",
"configFields": [
{
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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/plugin.go Outdated
Comment on lines +115 to +120
Name: "environment",
Type: "string",
Description: "Environment name (used by legacy Pinecone environments).",
Required: false,
},
{
Comment thread plugin.contracts.json Outdated
Comment on lines +18 to +21
"environment": {
"type": "string",
"description": "Environment name (used by legacy Pinecone environments)."
},
Comment thread plugin.json Outdated
{
"type": "step.vector_delete",
"plugin": "workflow-plugin-vectorstore",
"description": "Delete vectors by IDs or by a metadata filter.",
@intel352
Copy link
Copy Markdown
Contributor

intel352 commented May 6, 2026

@copilot apply changes based on the comments in this thread and #2 (review)

…on, remove unused environment field

Agent-Logs-Url: https://github.com/GoCodeAlone/workflow-plugin-vectorstore/sessions/fca30a86-34fe-4514-bc7b-50c047e15524

Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 6, 2026

@copilot apply changes based on the comments in this thread and https://github.com/G...

Applied in commit 75bdc38:

  • contracts_test.go (pullrequestreview-4215434505): Added comma-ok checks for all three unsafe type assertions (ModuleTypes(), sdk.SchemaProvider, StepTypes()). Each now calls t.Fatal with a descriptive message instead of panicking.
  • plugin.json (pullrequestreview-4215434505 + 4215624548): Updated step.vector_delete description to explicitly state "Exactly one of 'ids' or 'filter' must be provided; supplying both is an error."
  • plugin.go + plugin.contracts.json (pullrequestreview-4215624548): Removed the environment field from ModuleSchemas() config fields and from optional_inputs. The Pinecone adapter never reads cfg.Environment, so exposing it as a config option was misleading.

All tests pass (go test ./... -race -count=1), CodeQL clean.

@intel352 intel352 merged commit 135035d into main May 6, 2026
5 checks passed
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.

Migrate workflow-plugin-vectorstore to strict gRPC proto contracts

4 participants