Make protected-file policy configurable and consistent for migration branches
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
调研方向
首先检查 install.md 和 workflows/crane.md,然后找到 issue 中提到的 installer 和 workflow prompt 测试。跟踪 create-pull-request 和 push-to-pull-request-branch 的受保护文件行为是如何配置的。选定的策略已记录并得到一致应用,且在没有分支 commit 的情况下,不将 fallback 输出视为成功的迭代,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Background
During the githubnext/apm Python-to-Go migration, Crane repeatedly needed to touch files that are commonly protected: go.mod, go.sum, workflow files, and other project configuration. With protected files set to fallback-to-issue, Crane could describe work in an issue but not push the actual migration commit. That caused false progress and stalled PR updates.
APM locally changed the Crane workflow so create-pull-request uses protected-files: allowed. The upstream lesson is broader: code migration frequently requires manifest, lockfile, or workflow changes, so protected-file behavior must be explicit, configurable, and consistent across both creating the PR and pushing later iteration commits.
Problem
The default upstream Crane workflow has create-pull-request protected files set to fallback-to-issue, while push-to-pull-request-branch also has its own protected-file behavior from safe outputs. This can create surprising behavior:
- First accepted iteration can fail to create a useful PR if protected files are touched.
- Later iterations can fail to push to the existing migration branch.
- Crane may write fallback issues that look like progress but do not update the PR branch.
- Migrations involving Go, Node, Python, Java, or Rust often need dependency manifest and lockfile edits.
For a migration tool, touching manifest and lock files is often not exceptional. It is part of the migration.
Proposed implementation
Make protected-file policy an explicit Crane installation or workflow configuration choice.
Possible design:
-
Add an installer prompt in
install.md:- Strict: protected files fall back to issue for maximum safety.
- Migration-friendly: protected files are allowed on Crane migration branches.
- Custom: user provides an allowlist or policy.
-
Apply the selected policy consistently to both:
create-pull-requestpush-to-pull-request-branch
-
Document when to use each mode:
- Use strict for repositories where agents must never touch manifests or workflow files without human intervention.
- Use migration-friendly when the migration target requires dependency, lockfile, build, or workflow updates.
-
If a protected-file fallback still happens, Crane should treat it as blocked or incomplete, not as an accepted migration iteration. It should tell the maintainer what policy or allowlist needs to change.
-
Consider per-migration override support in migration frontmatter, for example:
protected-files-policy: allowed
or
protected-files-policy: fallback-to-issue
Suggested test coverage
- Prompt or installer tests that verify the protected-file policy is described.
- Workflow prompt test that verifies the policy applies to both PR creation and PR branch pushes.
- If implemented in installer code, test that the selected policy is written into
workflows/crane.mdbeforegh aw compile.
Acceptance criteria
- A repository owner can choose strict or migration-friendly protected-file behavior during installation.
- The chosen behavior is applied consistently for initial PR creation and later PR updates.
- Crane does not mark protected-file fallback output as a successful accepted iteration unless a commit actually reached the migration branch.
- Documentation explains why migrations may need to touch manifest and lock files.
Provenance
This came from githubnext/apm, where the Python-to-Go migration needed dependency and workflow changes and protected-file fallback prevented Crane from generating new PR commits.
- 主要语言
- Python
- 星标
- 10
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
githubnext/crane 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 85/100
githubnext/crane#6 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
githubnext/crane#5 · 2 条评论 ·
-
documentation enhancement
难度 4/5 3-5 天 新手友好度 58/100
githubnext/crane#8 ·
-
Require shared accepted-iteration summaries for Crane PR updates可能已有人在做 @mrjf 于 130 天前认领。 未关闭enhancement
githubnext/crane#4 · 1 个 reaction · 已指派 2 人 ·