Repository navigation
feat(skills): throw typed errors from the skill loader - #1129
Merged
kalenkevich merged 1 commit intoOct 23, 2026
Merged
Conversation
Contributor
|
Hi @SHAI-KrishnaDobhal, Thank you for raising the PR, and thank you for your patience and understanding. We have reproduced the issue, checked the PR changes, and verified that all unit, integration, and build checks are passing. |
2 of 9 tasks
kalenkevich
approved these changes
Oct 23, 2026
Merged
OsamaAnsar
added a commit
to OsamaAnsar/adk-js
that referenced
this pull request
Oct 26, 2026
Resolve the conflict in core/src/skills/loader.ts with the typed errors from google#1129: keep the byte order mark and exact --- delimiter parsing, and throw InputValidationError from the two frontmatter checks. Assert the error class in the new error-path tests.
8 of 9 tasks
2 of 9 tasks
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.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
throw new Errorsites and adopt the typed-errors module (232 throws across 90 files) #8072. Or, if no issue exists, describe the change:
Problem:
core/src/skills/loader.tsthrows a bareErrorfor every failure, so callers can't tell a missing SKILL.md from malformed frontmatter or an unsafe zip without string-matchingerror.message. The typed errors from #583 exist but are unused here.Solution:
First Stage 2 slice of #807, scoped to
core/src/skills/. All 11 bare throws in the loader now use the existing typed errors. Messages are byte-identical; only the class changes.NotFoundError(2): SKILL.md missing from a skill directory or from a zipped skill.InputValidationError(9): frontmatter missing/unclosed/not a mapping, invalid YAML, schema failure, skill name not matching the directory, missing/invalid skill name, dangerous zip entry.Invalid YAML in frontmatterrewraps now keep the original error ascause. To allow that,InputValidationErroraccepts standardErrorOptionsas an optional second argument (backward compatible).@throwsJSDoc updated to name the new types.The Stage 1 inventory proposed a
SkillFormatErrorfor these sites. Until new types are agreed on #807, this uses the existingInputValidationError; switching later is a rename.Testing Plan
Unit Tests:
npx vitest run core/test/skills core/test/errors: 8 files, 111 passed, 1 skipped (pre-existingskipIf(win32)).Added: type assertions for
InputValidationError/NotFoundErrorfrom the loader, a check that the YAML parse error is kept ascause, and anInputValidationErrorcausetest. All existing message assertions pass unchanged.prettier --check,eslintandtsc --noEmitare clean.Manual End-to-End (E2E) Tests:
N/A. Library-internal error types only; covered by unit tests.
Checklist
Additional context
What a
catchblock sees changes: the thrown value is now anInputValidationError/NotFoundError(stillinstanceof Error), anderror.name/String(error)show the new class name. Code matching onerror.messageis unaffected.