validate-before-commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseValidate Before Commit
提交前验证
Do not declare a task done until the full validation sequence has passed.
Run these checks proactively — do not wait for the human to ask.
在完整验证流程通过前,不得宣布任务完成。
主动执行这些检查——无需等待人工指令。
Standard sequence
标准流程
bash
undefinedbash
undefined1. Linting, formatting, and basic static checks
1. 代码检查、格式化及基础静态检查
uv run pre-commit run --all-files
uv run pre-commit run --all-files
2. Type checking
2. 类型检查
uv run mypy <package_or_src_dir>
uv run mypy <package_or_src_dir>
3. Infrastructure plan (if Pulumi files were changed)
3. 基础设施规划(若Pulumi文件有变更)
pulumi preview --stack <stack-name>
undefinedpulumi preview --stack <stack-name>
undefinedRules
规则
- Run pre-commit before mypy; pre-commit may auto-fix formatting that would otherwise produce mypy noise.
- If pre-commit auto-fixes files, stage the changes and re-run pre-commit to confirm all hooks pass cleanly.
- mypy errors are blocking — do not leave type errors for the human to clean up.
- output must be reviewed: unexpected replacements or deletions are bugs, not acceptable side effects.
pulumi preview
- 在执行mypy之前先运行pre-commit;pre-commit可能会自动修复格式问题,否则这些问题会导致mypy产生无效报错。
- 如果pre-commit自动修复了文件,需暂存变更并重新运行pre-commit,确认所有钩子都能顺利通过。
- mypy错误属于阻塞性问题——不得将类型错误留给人工处理。
- 必须审查的输出:意外的替换或删除属于bug,而非可接受的副作用。
pulumi preview
For Dagster / dg changes
针对Dagster / dg变更
After modifying assets, sensors, or code location structure, also confirm the
workspace loads cleanly:
bash
dg check在修改资产、传感器或代码位置结构后,还需确认工作区能正常加载:
bash
dg checkInterpreting failures
故障排查
Read the full error output before proposing a fix. Do not apply a speculative
patch without understanding the root cause — iterating blindly on the same error
multiple times is worse than pausing to diagnose.
在提出修复方案前,请完整阅读错误输出。在未理解根本原因的情况下,不要尝试推测性补丁——盲目重复处理同一错误比暂停诊断更糟糕。