fix(api): frontmatter validation errors are actionable (#649)#672
Merged
chronoai-shining merged 1 commit intoMay 21, 2026
Merged
Conversation
The Free / ZIP upload page already shows clear messages for most
validation failures (version semver, tag regex, env-var UPPER_SNAKE
rule), but the `tag`, `runtime`, `tool-list`, `runtime-env-var`, and
`runtime-dependency` ITEM schemas surfaced as bare `Invalid input:
expected string, received null` when an author hit common YAML traps:
- `tag: - ` (empty list-item dash) → YAML parses as `null`
- `version: 0.1` (unquoted) → YAML parses as a number (this one was
already handled in an earlier pass; pinned with a test so it
can't regress)
Each item schema in `shared/schemas/skillFrontmatter.ts` now carries
a Zod 4 `error: (issue) => ...` callback that intercepts
`invalid_type` with a sentence including a concrete shape example,
e.g.:
- tag → `tag: [my-tag]`
- runtime → `runtime: [python]`
- runtime-env-var → `runtime-env-var: [OPENAI_API_KEY]`
- tool-list → `tool-list: [Bash, Read]`
- runtime-dependency → `runtime-dependency: [requests==2.31]`
Existing min / max / regex messages still fire for non-null shape
failures so uppercase tags etc. keep their current friendly text.
Pinned with skillFrontmatter.test.ts — 8 assertions covering
version-quoting, null-tag, uppercase-tag (regex preservation), null
env-var, null runtime, null tool, null dependency, and a happy-path
round trip. Full ornn-api: 805/805 tests pass, typecheck clean.
Closes #649.
This was referenced May 22, 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
The Free / ZIP upload page already shows clear actionable messages for most validation failures (
versionsemver, tag regex, env-var UPPER_SNAKE rule), but thetag,runtime,tool-list,runtime-env-var, andruntime-dependencyitem schemas surfaced as bareInvalid input: expected string, received nullwhen an author hit common YAML traps:tag: -(empty list-item dash) → YAML parses asnullversion: 0.1(unquoted) → YAML parses as a number (this one was already handled in an earlier pass; pinned with a test here so it can't regress)Fix
Each item schema gets a Zod 4
error: (issue) => ...callback that interceptsinvalid_typewith a sentence including a concrete shape example (tag: [my-tag],runtime: [python],runtime-env-var: [OPENAI_API_KEY], etc.). Existingmin/max/regexmessages still fire for non-null shape failures.Test plan
skillFrontmatter.test.ts— 8 assertions (version quoting, null tag, uppercase tag (regex preservation), null env-var, null runtime, null tool, null dep, happy-path)bun test— 805/805 pass; typecheck cleanversion: 0.1and ZIP withtag: [-]— both now show actionable messagesCloses #649.