Skip to content

fix: report unreadable files with an actionable error message - #208

Merged
robingenz merged 2 commits into
mainfrom
fix/unreadable-file-error
Aug 20, 2026
Merged

fix: report unreadable files with an actionable error message#208
robingenz merged 2 commits into
mainfrom
fix/unreadable-file-error

Conversation

@robingenz

Copy link
Copy Markdown
Member

generateManifestJson() and the bundle upload loop enumerate a directory first and open every listed file afterwards. If a file vanishes or gets locked in between — e.g. a build still writing to dist, or a file sync client — the raw ENOENT surfaced as an unexpected crash and got reported to Sentry (CAPAWESOME-TEAM-CLI-1P).

readFileFromDirectory() now reads those files and turns EACCES, EBUSY, ENOENT and EPERM into a UserError that names the affected file and hints at the likely cause. Any other error still propagates unchanged.

Copilot AI lite review requested due to automatic review settings August 20, 2026 07:16
@robingenz robingenz added the bug/fix Something isn't working label Aug 20, 2026
@robingenz robingenz self-assigned this Aug 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves resiliency when reading bundle files by converting common filesystem read failures (e.g. deleted/locked files between directory enumeration and open) into a user-friendly UserError, and updates manifest generation + Live Updates upload to use the new helper.

Changes:

  • Add readFileFromDirectory() wrapper that converts EACCES, EBUSY, ENOENT, EPERM into an actionable UserError.
  • Use readFileFromDirectory() in generateManifestJson() and the Live Updates bundle upload loop.
  • Add initial unit tests for readFileFromDirectory().

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/utils/manifest.ts Switch manifest hashing to read files via readFileFromDirectory() for friendlier failures.
src/utils/file.ts Introduce readFileFromDirectory() and map common unreadable-file errors to UserError.
src/utils/file.test.ts Add unit tests around readFileFromDirectory() behavior.
src/commands/apps/liveupdates/upload.ts Use readFileFromDirectory() when reading files during upload.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/utils/file.ts
Comment thread src/utils/file.test.ts
@robingenz
robingenz merged commit cc18dee into main Aug 20, 2026
3 checks passed
@robingenz
robingenz deleted the fix/unreadable-file-error branch August 20, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug/fix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants