Skip to content

docs: explain why tmp_files are intentionally not cleaned#450

Merged
leavesster merged 1 commit intomainfrom
docs/tmp-files-comment
Jan 31, 2026
Merged

docs: explain why tmp_files are intentionally not cleaned#450
leavesster merged 1 commit intomainfrom
docs/tmp-files-comment

Conversation

@leavesster
Copy link
Copy Markdown
Contributor

Summary

  • Adds detailed comment explaining why tmp_files are intentionally not cleaned
  • Prevents future maintainers from "fixing" this intentional behavior
  • Also adds type hint set[str] for clarity

Rationale

The temporary scriptlet files are NOT cleaned because:

  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

Test plan

  • pyright type check passes
  • Python syntax validation passes

Add detailed comment explaining the design decision to not clean
temporary scriptlet files, preventing future maintainers from
"fixing" this intentional behavior.
Copilot AI review requested due to automatic review settings January 30, 2026 16:03
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 30, 2026

Summary by CodeRabbit

发版说明

  • 重构
    • 改进内部代码质量和类型注释,增强代码可维护性。此次更新不包含用户可见的功能变化。

✏️ Tip: You can customize this high-level summary in your review settings.

概述

executor/python_executor/block.py 中的模块级变量 tmp_files 添加了类型注解,并增加了说明文档注释。将 tmp_files = set() 改为 tmp_files: set[str] = set(),仅涉及类型信息和文档注释的调整,不改变控制流。

变更

内聚体 / 文件 概要
类型注解与文档更新
executor/python_executor/block.py
tmp_files 变量添加显式的 set[str] 类型注解,并增加说明其用途和生命周期的描述注释。无运行时行为改变。

预估代码审查工作量

🎯 2 (简单) | ⏱️ ~8 分钟

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR标题采用了指定的格式 docs(<scope>): <subject>,其中"docs"为类型前缀,内容与PR的主要改动相关联,即添加解释性注释说明为何tmp_files不被清理。
Description check ✅ Passed PR描述详细说明了改动内容(添加注释和类型提示),并解释了设计原理,与changeset内容高度相关且信息充分。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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 the tmp_files variable

💡 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()
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

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+.

Copilot uses AI. Check for mistakes.
@leavesster leavesster merged commit c0429ca into main Jan 31, 2026
14 checks passed
@leavesster leavesster deleted the docs/tmp-files-comment branch January 31, 2026 03:36
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