Skip to content

Quiet the expected ENOENT in image-cache script#658

Merged
narthur merged 1 commit into
masterfrom
fix/image-cache-noisy-enoent
May 13, 2026
Merged

Quiet the expected ENOENT in image-cache script#658
narthur merged 1 commit into
masterfrom
fix/image-cache-noisy-enoent

Conversation

@narthur

@narthur narthur commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • `scripts/image-cache.mjs` calls `readdirSync` on the astro asset cache folder; on a clean checkout (e.g. fresh Render build) that folder doesn't exist yet and `readdirSync` throws `ENOENT`.
  • The current `console.warn(e)` dumps the full Error object including stack trace, which makes build logs look like something failed even though the script catches and continues.
  • This PR treats `ENOENT` as the expected first-build case and logs a single info line; other error codes still log loudly so we don't hide a real problem.

Test plan

  • Manual: run with a missing folder → "image-cache: no astro cache yet at … skipping", exit 0
  • Manual: point at an existing non-directory file (`ENOTDIR`) → loud warning with the error, exit 0
  • CI green

🤖 Generated with Claude Code

readdirSync on the astro image cache folder throws ENOENT on a clean
checkout before astro has populated it. That's the normal first-build
case, so log a one-liner and move on instead of dumping the full Error
object. Other errors still warn loudly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dreeves dreeves temporarily deployed to fix/image-cache-noisy-enoent - beeblog PR #658 May 13, 2026 21:01 — with Render Destroyed
@narthur narthur marked this pull request as ready for review May 13, 2026 21:02
Copilot AI review requested due to automatic review settings May 13, 2026 21:02

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 reduces noise from the image cache script during clean builds by treating a missing Astro asset cache directory as an expected condition while preserving loud logging for other filesystem errors.

Changes:

  • Handles ENOENT from readdirSync with a concise informational message.
  • Keeps warning output for unexpected errors such as ENOTDIR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown
Contributor

Build Performance

-0.13s (-2.1%) average build time

Base (66f3a8d) Head (ed1dbc9)
Average 6.07s 5.94s
Runs 6.05,6.07,6.09 5.94,5.93,5.95

3 timed builds after one warm-up build per commit.

@github-actions

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

Accessibility Issues

Summary

No baseline issues found.

BaselineHead
00

Issue Breakdown

CodeBeforeAfterNet Change
View full breakdown

@narthur narthur merged commit 860def4 into master May 13, 2026
16 checks passed
@narthur narthur deleted the fix/image-cache-noisy-enoent branch May 13, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants