docs: explain why tmp_files are intentionally not cleaned#450
docs: explain why tmp_files are intentionally not cleaned#450leavesster merged 1 commit intomainfrom
Conversation
Add detailed comment explaining the design decision to not clean temporary scriptlet files, preventing future maintainers from "fixing" this intentional behavior.
Summary by CodeRabbit发版说明
✏️ Tip: You can customize this high-level summary in your review settings. 概述为 变更
预估代码审查工作量🎯 2 (简单) | ⏱️ ~8 分钟 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive documentation explaining why temporary scriptlet files (tmp_files) are intentionally not cleaned up, along with a type hint for clarity.
Changes:
- Added detailed multi-line comment explaining the rationale for not cleaning temporary files
- Added type hint
set[str]to thetmp_filesvariable
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # 1. Preserves source mapping for debugging (stack traces show actual code) | ||
| # 2. Scoped to block's .scriptlets directory, cleaned with workspace | ||
| # 3. Cleaning during execution could break running imports | ||
| tmp_files: set[str] = set() |
There was a problem hiding this comment.
The type hint set[str] uses the modern Python 3.9+ syntax, but this file consistently uses the older typing module style (e.g., Optional[str] on lines 18-20, 24, and 39). For consistency within this file, consider using Set[str] from the typing module instead, which would match the existing pattern. However, both forms are functionally equivalent and correct for Python 3.9+.
Summary
tmp_filesare intentionally not cleanedset[str]for clarityRationale
The temporary scriptlet files are NOT cleaned because:
.scriptletsdirectory, cleaned with workspaceTest plan