fix(VIOL-0066): validate-udfs surfaces agent name/filename mismatch#769
Merged
Conversation
The validate-udfs command loaded workflow configs via ConfigManager.load_configs() alone, skipping the agent-name identity stage the canonical loader runs right after it. A workflow whose name: field did not equal its filename stem passed validate-udfs with a clean exit 0 while run and inspect rejected it — a validator false-pass. validate() now calls ConfigManager.validate_agent_name() immediately after load_configs(), mirroring the loader's stage order. A mismatch is returned as a structured name_mismatch result and rendered by a dedicated handler that names both the actual name: value and the expected filename stem, then exits 1. A ConfigurationError that is not a filename mismatch (no identifiable name) is re-raised so it surfaces through the command's existing error path rather than the name-mismatch handler.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
validate-udfsloaded workflow configs throughConfigManager.load_configs()alone, skipping the agent-name identity stage the canonical loader runs immediately after it (load_configsthenvalidate_agent_name). A workflow whosename:field did not equal its filename stem — e.g.name: real_namesaved aswrong.yml— passedvalidate-udfswith a clean exit 0, whilerunandinspectrejected it. The one command whose job is to catch problems gave a false all-clear.Fix
ValidateUDFsCommand.validate()now callsConfigManager.validate_agent_name()right afterload_configs(), mirroring the canonical loader's stage order (fail fast on identity before UDF-reference validation).name_mismatchresult and rendered by_handle_name_mismatch_error, consistent with the command's existing structured error types. The message names both the actualname:value and the expected filename stem, and the command exits 1.ConfigurationErrorthat is not a filename mismatch (a config with no identifiable name, whose context lacks the mismatch keys) is re-raised so it surfaces through the command's existing generic error path instead of being mislabeled as a name mismatch.Reuses the shared check — no new YAML key, config, or dependency.
run/inspectand the matched-name case are unchanged.Verification
RED then GREEN, TDD:
tests/unit/validation/test_validate_udfs_name_check.pydriving the real CLI viaCliRunner.real_nameandwrong).tests/validation/ tests/cli/ tests/unit/validation/ tests/unit/config/ tests/unit/workflow/test_config_pipeline_stage.py— 1316 passed.ruff check agent_actions testsclean;ruff format --checkclean.Follow-up (not this scope)
If a future command loads a workflow YAML without going through the canonical loader, it must call
validate_agent_name()too — the canonical loader is the place that guarantees it forrun/inspect.