fix(skills): don't conflate fs errors with binary/not-found in skill reads#336
Merged
Conversation
…reads (#2203) * fix(skills): don't conflate fs errors with binary/not-found in skill reads Two post-merge review findings from PR #1662: - readSkillBundledFiles returned text=null for BOTH binary/oversize files AND genuine IO errors (EACCES/EIO/EISDIR). The cross-scope move treats a null-text file as binary, SKIPS it, then deletes the source — so a read error became silent data loss. It now throws on a real IO error (only binary/oversize and a vanished ENOENT file stay null), which fails GET /api/skill and aborts the move before any delete. +test (guarded for root, which bypasses perms). - skill-restore's ls-tree catch mapped every git failure to version-not-found (HTTP 404), so a git I/O error / corrupt repo was masked as a stale-version 404. It now classifies a bad-object/revision as version-not-found (404) and any other git failure as io-error (500), matching the sibling git-show catch. * test+refactor(skills): pin the git not-found/io-error boundary, align catch Addresses the two review suggestions on this PR: - Extract the ls-tree error classifier to an exported isGitObjectNotFound() so the load-bearing 404-vs-500 regex is single-sourced and unit-tested (a bad object/revision stays 404; corrupt-repo / missing-binary / EACCES → 500). - Align the sibling git-show catch to the safe e instanceof Error ? e.message : String(e) extraction so a non-Error rejection can't surface as 'undefined'. * style: single-quote the test fixture strings (biome format) --------- GitOrigin-RevId: 5a50169587c6e470a9b5a1b321b24f32245bca57
Contributor
There was a problem hiding this comment.
Automated approval from agents-private public-mirror-sync (run: https://github.com/inkeep/agents-private/actions/runs/28267000246). Source of truth is the monorepo; direct edits on inkeep/open-knowledge are overwritten on next sync.
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.
No description provided.