Skip to content

fix(walk): re-render when output directory is missing - #41

Merged
alindeman merged 2 commits into
chime:mainfrom
alindeman:walk-IP-174-rerender-missing-output
Sep 9, 2026
Merged

fix(walk): re-render when output directory is missing#41
alindeman merged 2 commits into
chime:mainfrom
alindeman:walk-IP-174-rerender-missing-output

Conversation

@alindeman

Copy link
Copy Markdown
Contributor

Summary

A cache hit in the walker only checked the stored hash, not whether the previously rendered output still exists on disk. If an app's hash matches but its output directory is gone (for example, deleted by a racing regeneration that rendered from a stale base), the walker skips rendering and recurses into the missing directory, where os.ReadDir aborts the entire run with open <dir>: no such file or directory.

Change

Stat the output directory before honoring a cache hit; if it is absent, treat the node as a cache miss and render it.

A missing output directory now heals on the next render instead of failing.

A cache hit only checked the stored hash, not whether the previously rendered output still existed. When an app's hash matched but its output directory was gone (e.g. deleted by a racing regeneration that rendered from a stale base), the walker skipped rendering and recursed into the missing directory, where os.ReadDir aborted the entire run with "open <dir>: no such file or directory".

EmptyManifest cannot catch this: a missing manifest.yaml is treated as "not empty" so that root and CopySource dirs are not force-rendered, so it returns false for a deleted output just as it does for those dirs.

Stat the output directory before honoring a cache hit and force a render when it is absent. Keying off directory existence rather than manifest.yaml leaves root and CopySource apps unaffected. Missing output now self-heals on the next render instead of failing the run.

JIRA: IP-174
@alindeman
alindeman marked this pull request as ready for review September 9, 2026 20:04
@alindeman
alindeman requested a review from a team as a code owner September 9, 2026 20:04
Comment thread main.go Outdated
pathMissing = true
}

if hashGenerated != hash || emptyManifest || pathMissing {

@jeffqichime jeffqichime Sep 9, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

os.Stat runs unconditionally before the if (waste resource), so it fires even when hashGenerated != hash || emptyManifest is already true, better guard the stat behind those conditions to skip the syscall on cache misses.

The check that the output directory still exists is only meaningful on a cache hit (hash matches and manifest non-empty). Compute the render decision first and stat the directory only when a render would otherwise be skipped, avoiding a syscall per node on the render path. Behavior is unchanged.

JIRA: IP-174
@alindeman
alindeman merged commit 123fc44 into chime:main Sep 9, 2026
2 checks passed
@alindeman
alindeman deleted the walk-IP-174-rerender-missing-output branch September 9, 2026 21:01
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