Repository navigation
[ISSUE #14997] fix(skill): keep SKILL.md indent and validate version - #15155
Merged
KomachiSion merged 1 commit intoMay 14, 2026
Merged
Conversation
…ersion When updating a YAML frontmatter field on upload/download round trip, SkillRequestUtil#updateFrontmatterField now preserves the original line's leading whitespace, so nested keys such as metadata.version are no longer promoted to a top-level key (which previously corrupted the SKILL.md structure reported in alibaba#14997). Additionally, SkillOperationServiceImpl#resolveUploadVersion now rejects version values that are not x.y.z or vN from any source (SKILL.md frontmatter, _meta.json, or the targetVersion request parameter). This closes the gap where invalid values like "latest" sourced from frontmatter could silently land in storage while the same value supplied via targetVersion was already rejected by resolveSpecifiedDraftVersion. Assisted-by: Claude Code
|
Thanks for your this PR. 🙏 感谢您提交的PR。 🙏 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
KomachiSion
approved these changes
May 14, 2026
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.
Please do not create a Pull Request without creating an issue first.
What is the purpose of the change
Fix issue #14997: after uploading a SKILL.md with YAML frontmatter and downloading it back, nested keys lose their indentation and get promoted to top-level keys (e.g.
metadata.versionbecomes a top-levelversion), breaking the YAML hierarchy. While investigating, also close a related inconsistency in the upload path: version values sourced from the SKILL.md frontmatter, the bundled_meta.json, or thetargetVersionrequest parameter were never format-checked, so non-semver values likelatestcould silently land in storage — even though the same value supplied throughresolveSpecifiedDraftVersionwas already rejected.Brief changelog
SkillRequestUtil#updateFrontmatterFieldnow preserves the matched line's leading whitespace when rewriting, so nested keys are no longer promoted to top-level.SkillOperationServiceImpl#resolveUploadVersioncalls a newvalidateUploadVersionFormathelper before returning at every source (frontmatterversion,metadata.version,_meta.json,targetVersion).NacosApiException(INVALID_PARAM, PARAMETER_VALIDATE_ERROR); the error message identifies the source (SKILL.md frontmatter/_meta.json/targetVersion parameter) and includes the offending value.SkillRequestUtilTestcovering nested indent preservation, nested value update, and top-level regression guard; 2 inSkillOperationServiceImplTestcovering invalid frontmatter and invalidtargetVersionrejection). Corrected the existingtestUploadSkillFromZipUsesFrontmatterMetadataVersionto use a valid1.0.0instead of the malformed1.0.Verifying this change
mvn -pl ai test -Dtest=SkillRequestUtilTest— 28 tests pass (25 existing + 3 new)mvn -pl ai test -Dtest=SkillOperationServiceImplTest— 66 tests pass (64 existing + 2 new)mvn -pl ai spotless:check checkstyle:check— passFollow this checklist to help us incorporate your contribution quickly and easily:
[ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.mvn -B clean package apache-rat:check spotbugs:check -DskipTeststo make sure basic checks pass. Runmvn clean install -DskipITsto make sure unit-test pass. Runmvn clean test-compile failsafe:integration-testto make sure integration-test pass.