Repository navigation
fix(validation): report non-string YAML keys - #178
Conversation
Signed-off-by: Rio Yu <52408936+rioyu123@users.noreply.github.com>
rng1995
left a comment
There was a problem hiding this comment.
@rioyu123 Thank you for the contribution and the clear write-up!
The fix is correct for the paths it targets. On main, a rule or workflow frontmatter key such as 123:, true:, null: or 2026-01-01: raises TypeError: keywords must be strings, both at the top level and under metadata. At this head the same inputs are reported as validation errors (Field '123': Keys should be strings, Field 'metadata.123': Keys should be strings). Quoted string keys are still kept as extras, and non-mapping frontmatter is still rejected as before.
Eight of the nine new tests fail on main and all pass here; the quoted-key control passes on both. tests/validators (1,250 tests) and Ruff pass locally, and all 17 CI checks are green.
Inline:
- The same
TypeErroris still reachable from the SKILL.md andagent_plugin.yamlvalidators (P2). - Boolean and date keys get confusing field names in the new error (P3).
- The changelog now has a duplicate
### Fixedheading (P3).
Signed-off-by: Rio Yu <52408936+rioyu123@users.noreply.github.com>
|
Thanks for the thorough review, @rng1995. The SKILL.md and plugin manifest validators now use Boolean, null, and date keys now appear in a readable YAML form in error locations, including under All 1,288 validator tests pass, and lint and the package build succeed. The full-suite results, including two environment failures that also occur on the base commit, are in the updated PR description. |
rng1995
left a comment
There was a problem hiding this comment.
@rioyu123 Thank you for the quick turnaround, your patience through the review, and your contribution to SkillEvaluator!
I re-reviewed 294a413 (now at fa14c04 after the update from main). All four comments are addressed:
- SKILL.md and
agent_plugin.yaml:SchemaValidatorandPluginSchemaValidatornow callmodel_validate(). Top-level123:,true:,false:,null:,1.5:,2026-01-01:and datetime keys are reported as findings instead of raisingTypeError: keywords must be strings. - Nested skill
metadata:parse_metadatanow usesparse_nested_model, sometadata:keys such as123:,true:,null:and2026-01-01:reportField 'metadata.<key>': Keys should be strings.metadata: nulland normal metadata behave as before. - Readable key labels:
format_validation_location()renders boolean, null and date keys astrue,false,nulland2026-01-01, including undermetadata, in the rules, workflows, SKILL.md and plugin validators. - Changelog: the entry is now in the existing
### Fixedlist.
Validation:
- Valid and quoted-key inputs give identical findings on
mainand this branch. - Of the 51 new or updated validator tests, 40 fail on
mainand all pass here. tests/validatorspasses (1,288 tests) and Ruff is clean.- All 17 CI checks pass on
fa14c04.
Approved.
Conflicts: - validators/plugin_schema.py: keep this branch's structure (bundle manifest validation helper, findings cap, inventory imports) and apply #178's three changes: import format_validation_location, report the location with it, and validate the manifest with PluginManifest.model_validate(data) instead of PluginManifest(**data), including in this branch's _validate_bundle_manifest, so a non-string YAML key becomes an invalid_key finding instead of a TypeError. - tests/validators/test_plugin_schema.py: keep both sides' tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Conflicted files: - tests/validators/test_schema.py: import block only. Both sides added `import pytest`; kept it once, plus the PR's SkillFrontmatter import. Main's non-string-key tests (#178) and the PR's UTF-8 byte-limit tests are both kept. No semantic breaks found in cleanly merged files: the byte check in SkillFrontmatter.validate_description_content still runs under main's model_validate() path and format_validation_location() error reporting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
* fix(validation): report non-string rule and workflow keys Signed-off-by: Rio Yu <52408936+rioyu123@users.noreply.github.com> * fix(validation): cover remaining YAML keys and clarify errors Signed-off-by: Rio Yu <52408936+rioyu123@users.noreply.github.com> --------- Signed-off-by: Rio Yu <52408936+rioyu123@users.noreply.github.com> Co-authored-by: Narendran Raghavan <32655573+rng1995@users.noreply.github.com>
Conflicted files: - tests/validators/test_schema.py: import block only. Both sides added `import pytest`; kept it once, plus the PR's SkillFrontmatter import. Main's non-string-key tests (#178) and the PR's UTF-8 byte-limit tests are both kept. No semantic breaks found in cleanly merged files: the byte check in SkillFrontmatter.validate_description_content still runs under main's model_validate() path and format_validation_location() error reporting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
Summary
YAML keys can be numbers, booleans, nulls, or dates. Unpacking these mappings into model constructors raises
TypeError: keywords must be strings, bypassing normal validation reporting.Use Pydantic's
model_validate()for skill, rule, workflow, and plugin YAML validation, including nested frontmatter metadata. Invalid keys now produce findings instead of aborting validation. Boolean, null, and date keys are shown in a readable form, such asmetadata.trueor2026-01-01.Quoted keys are unchanged: skill, rule, and workflow frontmatter still accept string extras, and plugin manifests still reject unknown fields. Non-mapping input and other validation errors are handled as before. The changelog entry is in the existing Unreleased / Fixed section.
Regression coverage includes each YAML-backed validator, nested metadata, readable error locations, and quoted-key controls.
Verification
Linux Python 3.12, locked dependencies with all extras.
pytest -q tests/validators: 1,288 passed.make lintandmake build: passed.PYTEST_ADDOPTS=-n4 make test: 9,736 passed, 49 skipped, 2 failed. Both failures also occur on the unmodified pre-follow-up head686d579: managed-runtime command lookup finds the host's installed Codex binary, and a bridge test cannot bind port 18080. That baseline run had 9,697 passed, 49 skipped, and 3 failed, including one additional CLI-banner failure. The full suite is not entirely green in this environment; no new failing test was observed with the patch.I am familiar with the Contributing Guidelines
Added or updated focused tests
Updated documentation for user-visible changes (changelog)
Ran
make lintRan
make test(results and limitations above)Ran
make buildDid not add credentials, private datasets, or proprietary benchmark content
Release Impact
CHANGELOG.md