make parent if it doesn't exist for cached procedure#5680
Conversation
There was a problem hiding this comment.
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
CodSpeed Performance ReportMerging #5680 will not alter performanceComparing Summary
Footnotes |
No description provided.