fix(wfctl): validate resolves local plugin.json manifests (#756)#757
Merged
Conversation
wfctl validate previously required referenced plugin types to already be installed in the active plugin registry. Scenario/sample apps that bundle or sit beside plugin sources (e.g. workflow-compute-scenarios) could not be validated from a clean checkout — `compute.provider_catalog` and similar declared module types were reported as unknown. This change makes validate manifest-aware in two complementary ways: * `--plugin-manifest <path>`: repeatable. Accepts a plugin.json file, a directory containing one, or a directory of plugin subdirs. The declared module/step/trigger/workflow/resource types and step schemas are registered before validation. Missing paths surface as errors so typos don't silently degrade to a half-loaded validation context. * Auto-resolution of `requires.plugins[]`: each declared plugin name is searched at `<cfgDir>/<name>/plugin.json`, `<cfgDir>/plugins/<name>/plugin.json`, and `<cfgDir>/providers/<name>/plugin.json`, walking up to three parent directories. Hidden, underscored, vendor/node_modules/_worktrees dirs are skipped. `--no-resolve-plugins` opts out. Implementation extracts the shared manifest-parsing path in `schema.LoadPluginTypesFromDir` into a reusable `registerPluginManifestTypes` helper and adds the corresponding single-manifest entry points (`LoadPluginTypesFromManifest`, `LoadPluginStepSchemasFromManifest`). No config schema changes. Verified against the issue's reproduction: the edge-risk-workflow scenario now passes with zero flags, auto-resolving compute, edge-compute, and edge-risk plugins from their checked-out locations. Refs #756
Codecov Report❌ Patch coverage is 📢 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
Closes #756.
wfctl validatepreviously required referenced plugin types to already be installed in the active plugin registry. Scenario/sample apps that bundle or sit beside plugin sources (e.g.workflow-compute-scenarios) could not be validated from a clean checkout —compute.provider_catalogand similar declared module types were reported as unknown.This change makes validate manifest-aware in two complementary ways:
--plugin-manifest <path>(repeatable): accepts aplugin.jsonfile, a directory containing one, or a directory of plugin subdirs. Declared types and step schemas are registered before validation. Missing paths surface as errors so typos don't silently degrade to a half-loaded validation context.requires.plugins[]: each declared plugin name is searched at<cfgDir>/<name>/plugin.json,<cfgDir>/plugins/<name>/plugin.json, and<cfgDir>/providers/<name>/plugin.json, walking up to three parent directories. Hidden / underscored /vendor/node_modules/_worktreesdirs are skipped.--no-resolve-pluginsopts out.Schema package extracts the shared manifest-parsing path in
LoadPluginTypesFromDirinto a reusableregisterPluginManifestTypeshelper and adds the corresponding single-manifest entry points (LoadPluginTypesFromManifest,LoadPluginStepSchemasFromManifest). No config-schema changes, so lockfile / install / migrate surfaces remain untouched.Reproduction (verified)
Against the issue's
workflow-compute-scenariossample, before fix:After fix, zero flags:
Test plan
cmd/wfctl/validate_local_manifests_test.gocovering: baseline failure pin,--plugin-manifestpointing at file/dir, repeatable flag, missing-path error, sibling auto-resolve,providers/subdir auto-resolve, workspace-sibling layout auto-resolvego test ./cmd/wfctl/ ./schema/ -count=1greengo test ./... -count=1green (no regressions across full suite)gofmtcleanFiles
cmd/wfctl/validate.go— add--plugin-manifestflag,--no-resolve-plugins, thread autoResolve intovalidateFilecmd/wfctl/validate_plugin_manifests.go(new) —loadPluginManifestPathandautoResolveRequiredPluginshelperscmd/wfctl/validate_local_manifests_test.go(new) — full test coverageschema/schema.go— extractregisterPluginManifestTypes; addLoadPluginTypesFromManifestschema/step_schema.go— extractregisterPluginManifestStepSchemas; addLoadPluginStepSchemasFromManifestdocs/WFCTL.md— document new flags and auto-resolutionlegacy_aws_types_removed_test.go,legacy_do_types_removed_test.go,main_test.go) — updatevalidateFilecallers for the new arg🤖 Generated with Claude Code