feat(oci/skills): add sentinel errors for packager failure classification#95
Merged
feat(oci/skills): add sentinel errors for packager failure classification#95
Conversation
JAORMX
approved these changes
Apr 27, 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.
Summary
oci/skills(ErrInvalidSkillDir,ErrSkillMDMissing,ErrInvalidFrontmatter,ErrTooManyFiles,ErrSkillTooLarge,ErrInvalidSkillFile) so callers can classify packaging failures witherrors.Isinstead of brittle string matchingvalidateSkillDir,readSkillDirectory,parseFrontmatter,collectSkillFiles, andvalidateSkillFilewith%wto the matching sentinel; original human-readable messages are preserved so existing string-based assertions and downstream UX strings keep workingtar.go/gzip.go/registry.gosize and structure limits remain internal/transport concerns and can be promoted to sentinels later if a consumer needs to disambiguate them. Nohttperrmapping is added inside the package; HTTP semantics belong in the consumer's handler layerTest plan
taskpasses (lint + tests green, race detector enabled)TestPackager_Package_SentinelErrors: table-drivenerrors.Iscoverage for missing/invalid dir, path traversal, missing SKILL.md, the four frontmatter failure modes (no opening delim, no closing delim, oversize, invalid YAML), missing name, and symlinked file/directoryTestCollectSkillFiles_ExceedsMaxFilesextended withassert.ErrorIs(t, err, ErrTooManyFiles)TestCollectSkillFiles_ExceedsMaxSize: streams just overmaxSkillTotalSizeto disk and assertsErrSkillTooLargeassert.Contains(t, err.Error(), ...)assertions kept untouched and still pass — message text is unchanged