🧭 会话开始时只读检查分支是否落后 dev、是否包含线上版本 #61
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "codex/branch-freshness-check-20261027"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
目的
会话开始时自动提示:当前检出是否落后
origin/dev、是否包含 Fanyu 线上 api / annotation-processor / worker 正在运行的 build commit。避免在过期分支上读代码、诊断线上问题或继续开发(10-27 就发生过在落后 dev 364 个提交的分支上工作)。改动
scripts/local/branch-freshness.sh:只读脚本。更新远端跟踪引用,对比当前分支与origin/dev(领先/落后数),并用kubectl get deploy(6 秒超时,结果缓存 30 分钟)读取线上 build commit,检查当前分支是否包含。任何失败只降级为提示,始终以 0 退出,不阻断会话;不改分支、文件或集群。tests/release/test_branch_freshness.py:8 个用例(落后/领先、包含与不包含线上版本、无 kubeconfig、缓存、跳过开关等)。AGENTS.md:新增一条——开始读代码或改动前运行该脚本,提示过期时在基于线上版本的独立 worktree 中工作。.scratch/branch-freshness-check/work.md:任务卡。风险
仅工具与文档;不涉及 API、数据、交付格式或部署。
验证
python3 -m unittest discover -s tests/release -p 'test_branch_freshness.py':8 个通过。bash -n语法检查通过;本机会话启动时实际运行过,输出与git rev-list/kubectl只读结果一致。基于 dev
bc17d505(#60 合并后),共 2 个提交。🤖 Generated with Claude Code