Skip to content

make parent if it doesn't exist for cached procedure#5680

Merged
adhami3310 merged 1 commit into
mainfrom
write-parent-if-it-doesn't-exist-for-cached-procedure
Aug 6, 2025
Merged

make parent if it doesn't exist for cached procedure#5680
adhami3310 merged 1 commit into
mainfrom
write-parent-if-it-doesn't-exist-for-cached-procedure

Conversation

@adhami3310

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps greptile-apps Bot 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.

Greptile Summary

This PR adds defensive directory creation logic to the _write_cached_procedure_file function in reflex/utils/decorator.py. The change ensures that parent directories are automatically created before attempting to write cache files by adding cache_file.parent.mkdir(parents=True, exist_ok=True) at line 79.

The cached_procedure decorator is used throughout the Reflex framework to cache expensive operations like Node.js installations, package checks, and other build prerequisites on disk. Previously, this functionality would fail with a FileNotFoundError if the cache directory didn't exist, which could happen on fresh installations or after cleaning build artifacts. This change makes the caching system more robust by ensuring the necessary directory structure exists before performing file operations.

The modification integrates seamlessly with the existing caching infrastructure without changing the decorator's API or behavior - it simply prevents crashes when cache directories are missing while maintaining the same caching semantics.

Confidence score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects a simple, well-established defensive programming practice with no complex logic changes
  • No files require special attention

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@codspeed-hq

codspeed-hq Bot commented Aug 5, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #5680 will not alter performance

Comparing write-parent-if-it-doesn't-exist-for-cached-procedure (1e49e0f) with main (8357d5a)1

Summary

✅ 8 untouched benchmarks

Footnotes

  1. No successful run was found on main (604c868) during the generation of this report, so 8357d5a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@adhami3310 adhami3310 merged commit c55d760 into main Aug 6, 2025
41 checks passed
@adhami3310 adhami3310 deleted the write-parent-if-it-doesn't-exist-for-cached-procedure branch August 6, 2025 17:19
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.

2 participants