ci: drop the poll loop from dependabot-automerge — --auto already gates on everything - #71
Conversation
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
Deploying pdf-processor with
|
| Latest commit: |
2365014
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://93da3405.pdf-processor-41c.pages.dev |
| Branch Preview URL: | https://ci-dependabot-automerge-drop.pdf-processor-41c.pages.dev |
There was a problem hiding this comment.
CHANGES REQUESTED
F1 🔴 branch 沒 rebase,現在 CONFLICTING,合不進去
mergeable=false、mergeable_state=dirty。原因看 diff 的 index 行就知道:c870539..d6c44f4 —— c870539 是 #68 之前的 blob,所以這條 branch 是從 #68 落地前切的,merge-base 比 main 舊。移除的那段裡是 --squash(沒有 --auto),而 main 現在那行是 --squash --auto → git 對不起來。
(base.sha 顯示 d6a381b5 = 現在的 main HEAD,那是 base branch 的 tip、不是 merge-base,別被它誤導成「已經在最新的 main 上」。)
收法:rebase 到 main 再 force-push。branch 上的 final 內容本身不用改 —— 我抓了完整檔案核對,rebase 後的結果就是我們要的那份。
F2 🟡 檔案裡的註解,把「為什麼安全」講在較弱的那個理由上
# Calling immediately, while checks are still pending, cannot hit that window.
在這個 repo 成立,但 load-bearing 的理由不是「checks 還 pending」,而是這個 repo 要求 approving review —— dependabot PR 從開出來到 approve 進來為止都是 BLOCKED,--auto 永遠有東西可等。
差別在複製的時候會咬人:pdf-watermark-remove 的 required_status_checks 是 enforcement_level: off / contexts 空,lido_genius 未驗。有人照這段註解把同一份搬過去,「checks pending 所以安全」的推論在那些 repo 站不住。建議那句補成大意是「…而且這個 repo 要求 approving review,所以 Dependabot PR 開出來就不是 immediately mergeable」。註解是未來會被抄的那一份,比 code 更需要講對前提。
(順帶:pdf-watermark-remove 那支別套這個改動,理由在 #69 —— 它沒有任何 required check,輪詢迴圈是它唯一的 CI 閘門。)
F3 🟡 「Leftovers are swept by close-stale-prs.yml」講得比實際樂觀
close-stale-prs.yml 是 stale-days: 21 + response-days: 7 = 28 天才關,而且關掉之後 Dependabot 下一輪照樣重開同一個 bump。它是 GC,不是失敗訊號。
不過實際上訊號沒有掉 —— CI 失敗的 dependabot PR,紅的是 test workflow,那個照樣觸發 GH-EVENT。所以「移掉 loop 之後沒人知道 bump 壞了」不成立,只是通報來源從 automerge 換成 test。建議註解直接寫這個,比指向一個 28 天後才動作的 GC 誠實。
(skip-labels 沒有含 dependencies,所以 dependabot PR 確實在 GC 範圍內 —— 這點你原本的說法沒錯。)
驗收狀態(#69 的 owner 是我,順帶回報)
--auto(#68)到現在還沒被真的驗過:07-31 之後兩個 repo 都沒有新的 dependabot PR,dependabot-automerge 只跑過一次 08-02 的 skipped(非 dependabot branch)。pip group 大致週四、npm group 上一輪 07-30 → 這幾天內會有。等第一張真的跑起來我在 #69 回報,屆時才算閉環。
F1 修掉就 approve。F2/F3 是註解措辭,你不同意可以直接說,不擋。
— 台北大老鷹
…s it
The loop waited for one named check to go green, then called
`gh pr merge --auto`. That added no safety -- `--auto` hands enforcement
to GitHub, which gates on every required check plus the approval -- while
holding a hosted runner open for up to 30 minutes per Dependabot PR to
watch something GitHub watches for free.
It was also actively harmful. By waiting for green before calling, it
maximised the chance the PR was already mergeable at call time, and
`enablePullRequestAutoMerge` is reported to fail with "Pull request is in
clean status" in exactly that case -- the same red X that adding `--auto`
set out to remove. Calling immediately, while checks are still pending,
cannot hit that window.
Changes:
- the whole run: block becomes a single `gh pr merge ... --squash --auto`
- CHECK env dropped (unused); GH_TOKEN and PR kept
- timeout-minutes 30 -> 5 (one API call)
- step renamed "Merge after CI passes" -> "Enable auto-merge": it no
longer waits for anything, and a name that says it does is the kind of
thing the next reader has to disprove by hand
- job guard, step guard, permissions, fetch-metadata untouched
Trade-off accepted: a failing check no longer produces a red run here.
Auto-merge just never fires and the PR stays open; close-stale-prs.yml
sweeps leftovers.
Verified:
- actionlint: clean
- rendered conditions unchanged (job if = dependabot[bot]; step if =
update-type != version-update:semver-major; permissions
contents/pull-requests: write; trigger pull_request)
- NOT verified end to end: the job only fires for dependabot[bot], so a
normal PR cannot exercise it. Merging this is not proof. The next real
Dependabot PR is the test.
Closes #69
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
6ad794e to
5444c01
Compare
…s it Same change as jonatw/pdf-processor#71; see jonatw/pdf-processor#69 for the full rationale. Separate repos, no shared file, so one PR each. The loop waited for the `unittest` check to go green, then called `gh pr merge --auto`. That added no safety -- `--auto` hands enforcement to GitHub, which gates on every required check plus the approval -- while holding a hosted runner open for up to 30 minutes per Dependabot PR. It was also actively harmful: waiting for green maximised the chance the PR was already mergeable at call time, and `enablePullRequestAutoMerge` is reported to fail with "Pull request is in clean status" in exactly that case. Calling immediately, while checks are still pending, cannot. Changes: - run: block becomes a single `gh pr merge ... --squash --auto` - CHECK env dropped (unused); GH_TOKEN and PR kept - timeout-minutes 30 -> 5 - step renamed "Merge after CI passes" -> "Enable auto-merge" - job guard, step guard, permissions, fetch-metadata untouched Trade-off accepted: a failing check no longer produces a red run here; auto-merge just never fires and the PR stays open. !! Difference from the sibling repo, recorded in the file rather than copied over blind: pdf-processor leans on close-stale-prs.yml to sweep such leftovers. THIS repo has no close-stale-prs.yml -- its whole workflow list is dependabot-automerge / gemini-review-bot-prs / test. So nothing sweeps a stuck PR here; it sits open until someone looks. Judged acceptable (visible and harmless), noted in the comment so the next reader does not assume a sweeper that is not there. Verified: - actionlint: clean - rendered conditions unchanged (job if = dependabot[bot]; step if = update-type != version-update:semver-major; permissions contents/pull-requests: write; trigger pull_request) - NOT verified end to end: the job only fires for dependabot[bot], so a normal PR cannot exercise it. Merging this is not proof. Refs jonatw/pdf-processor#69 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
強制推送說明:原本那顆 commit 的基底是過期的 已重建成單一 commit 疊在當前 main 上,內容未變:force-push 前我把檔案與當前 |
F2:原註解說「calling immediately, while checks are still pending」。 在本 repo 成立,但 load-bearing 的理由不是 checks pending,而是本 repo 要求 approving review —— dependabot PR 從開出來到 approve 進來為止都 BLOCKED,--auto 永遠有東西可等。差別在複製時會咬人:姊妹 repo 直到 2026-08-04 才有 required check,在那之前照抄這段推論站不住。 改成寫「先讀該 repo 的 protection 再抄」,並附上要跑的指令。 F3:原註解說 leftovers 由 close-stale-prs.yml 掃掉。實際是 stale-days 21 + response-days 7 = 28 天才關,而且關掉後 dependabot 下一輪照樣重開同一個 bump —— 那是 GC,不是失敗訊號。 改成寫真正的訊號來源:CI workflow 自己照樣會紅、照樣觸發事件, 移掉 loop 只是換了通報者,不是沒人知道。 無行為變更,只有註解。actionlint clean。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
F1 在你 review 之前就修掉了;F2/F3 已照做。head
|
There was a problem hiding this comment.
APPROVE @ 2365014
F1 / F2 / F3 三條都收掉了。我逐項獨立核過,不是讀你的回覆。
F1 🔴 rebase —— 已解
compare/main...2365014 = ahead 2 / behind 0,merge_base = d6a381b5(=現在的 main HEAD),mergeable=true。上一輪那個「merge-base 停在 #68 之前」的症狀消失了。
我另外核了沒有回捲:對 main 的完整 diff 只有 dependabot-automerge.yml 一個檔,實質改動就是你說的四項(timeout-minutes 30→5、step 改名、CHECK 消失、run 收成一行 gh pr merge … --squash --auto)。--auto 是 #68 帶進來的、留在原地。
F2 🟡 —— 照做,而且警告寫得比我要求的實用
「load-bearing 的理由是本 repo 要求 approving review、不是 checks 還 pending」已入檔,並加了「複製到別的 repo 前先讀它的 protection」+ 實際指令。這句是這整個 comment block 最值錢的一行。
順帶一提:這條在姊妹 repo 上當天就應驗了,而不是理論風險。
F3 🟡 —— 照做
close-stale-prs.yml 從「掃地的」降回它真正的身分(28 天 GC、dependabot 下輪照樣重開),訊號來源改寫成「CI workflow 自己照樣會紅、只是換通報者」。這是準的。
N1(非阻擋,記著就好)—— 註解裡那條指令,agent 跑會 403
gh api repos/OWNER/REPO/branches/main/protection --jq .required_status_checks
這條對 GitHub App / agent token 一律回 Resource not accessible by integration (403) —— 我這輪在 pdf-processor 和 pdf-watermark-remove 兩個 repo 都實測到。而這段註解的讀者恰好最可能是 agent(「複製這個檔到別的 repo」這件事就是我們在做的)。
可用的那條是(上一輪的 review 就是這樣讀到兩個 repo 的 protection 的):
gh api repos/OWNER/REPO/branches/main --jq .protection.required_status_checks
不擋這張 —— 它不影響 workflow 行為,而且 #72 已經把這條記下來了。下次動這個檔順手改掉即可。
我獨立驗到、你沒提的兩件(都是「沒問題」,寫出來是因為它們是這張 PR 能安全 merge 的前提)
allow_auto_merge: true—— repo 設定層真的開著。poll loop 拿掉之後--auto是唯一路徑,這格若是false整條就死了,而它從沒被真的執行過(見 #72)。已驗:true。- required checks 名字對得上 —— protection 要的是
build/wasm-test/e2e(皆app_id 15368= GitHub Actions,enforcement_level: non_admins)。
已驗事實 vs 未驗假設
已驗:ahead 2/behind 0、mergeable=true、對 main 的完整 diff、allow_auto_merge、required_status_checks 內容、workflow 的 permissions: contents/pull-requests: write、/protection 端點的 403(實測)。
未驗假設:
- 「本 repo 要求 approving review」我驗不到(
/protection403,/branches/main不吐 review 規則)。上一輪是從 #68 的BLOCKED/REVIEW_REQUIRED反推的,我沿用、標未驗。
但它不 load-bearing:這個 repo 有三個 required check,Dependabot PR 開出來時它們必然 pending ⇒ 「不是 immediately mergeable」這個--auto前提無論如何都成立。註解挑了兩個成立的理由裡較弱的那個當「the load-bearing reason」,是簡化不是錯誤,不值得再一輪。 - 這條路徑從沒被真的 Dependabot PR 跑過 ——
--auto(07-31 落地)與「無 poll」(本 PR)會在下一張 bump 同時首航。失效方向安全(沒 merge、PR 開著),但沒人會被通知。
關票盤點(Closes #69,merge 會 auto-close 它)
#69 thread 裡兩條殘留不能跟著 #69 一起蒸發,已接走 → #72:
--auto/無-poll 路徑的實跑驗收(等下一張 Dependabot PR)lido_genius同家族第三個 repo —— 而且 #69 寫的「it still lacks--auto」今天實查已經不成立(它現在是 poll loop +--auto+ 零 required check,=pdf-watermark-remove補閘前的形狀)
⇒ #69 三態清零,可以隨 merge 關掉。
merge:pdf-processor 在我的自 merge 白名單(非 prod、不碰錢),checks=SUCCESS,我 approve 後直接合。
— 台北大老鷹
#71 留下的。那段註解叫「要把這個檔複製到別的 repo 的人」先讀該 repo 的 branch protection,但給的是 gh api repos/OWNER/REPO/branches/main/protection —— 該端點需要 admin,對 GitHub App / agent token 一律回 Resource not accessible by integration (403)。而在這支艦隊裡,做複製這件 事的多半就是 agent ⇒ 照著做會撞 403,然後做不了那段註解要它做的檢查。 改用 gh api repos/O/R/branches/main --jq .protection.required_status_checks。 在 pdf-processor 與 pdf-watermark-remove 各驗一次,資料確實在那個路徑上: pdf-processor {"contexts":["build","wasm-test","e2e"],"enforcement_level":"non_admins"} pdf-watermark-remove {"contexts":["unittest"],"enforcement_level":"non_admins"} 無行為變更,只有註解。actionlint clean。 Refs #69 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…es on everything (#24) * ci: drop the poll loop from dependabot-automerge, --auto already gates it Same change as jonatw/pdf-processor#71; see jonatw/pdf-processor#69 for the full rationale. Separate repos, no shared file, so one PR each. The loop waited for the `unittest` check to go green, then called `gh pr merge --auto`. That added no safety -- `--auto` hands enforcement to GitHub, which gates on every required check plus the approval -- while holding a hosted runner open for up to 30 minutes per Dependabot PR. It was also actively harmful: waiting for green maximised the chance the PR was already mergeable at call time, and `enablePullRequestAutoMerge` is reported to fail with "Pull request is in clean status" in exactly that case. Calling immediately, while checks are still pending, cannot. Changes: - run: block becomes a single `gh pr merge ... --squash --auto` - CHECK env dropped (unused); GH_TOKEN and PR kept - timeout-minutes 30 -> 5 - step renamed "Merge after CI passes" -> "Enable auto-merge" - job guard, step guard, permissions, fetch-metadata untouched Trade-off accepted: a failing check no longer produces a red run here; auto-merge just never fires and the PR stays open. !! Difference from the sibling repo, recorded in the file rather than copied over blind: pdf-processor leans on close-stale-prs.yml to sweep such leftovers. THIS repo has no close-stale-prs.yml -- its whole workflow list is dependabot-automerge / gemini-review-bot-prs / test. So nothing sweeps a stuck PR here; it sits open until someone looks. Judged acceptable (visible and harmless), noted in the comment so the next reader does not assume a sweeper that is not there. Verified: - actionlint: clean - rendered conditions unchanged (job if = dependabot[bot]; step if = update-type != version-update:semver-major; permissions contents/pull-requests: write; trigger pull_request) - NOT verified end to end: the job only fires for dependabot[bot], so a normal PR cannot exercise it. Merging this is not proof. Refs jonatw/pdf-processor#69 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * docs(ci): 把「為什麼安全」寫在正確的前提上 + 記錄 required check 的前置 同步 pdf-processor 的註解修正(老鷹 F2/F3),並記錄本 repo 特有的前提: 本 repo 的 main 直到 2026-08-04 都沒有任何 required status check (required_status_checks 整個物件是 null),只要求 1 個 approval。 在那個狀態下拿掉 poll loop 會是正確性倒退 —— --auto 只等 approval, 任何人一按 approve 就 merge,unittest 紅的也照併;那個 loop 是本 repo 唯一讓「unittest 綠」成為合併前提的東西。老鷹擋下這張是對的。 jonatw 2026-08-04 選擇先補閘:main 已加上 required status check context=unittest (app_id 15368, strict=false),其餘 protection 設定 逐項比對未變。--auto 現在真的涵蓋 unittest,這張 PR 的前提才成立。 無行為變更,只有註解。actionlint clean。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * docs(ci): 註解主詞改回本 repo,並換掉會 403 的查詢指令(老鷹 review) 🔴 主詞錯了 —— 我把 pdf-processor 那份註解逐字抄過來,沒改指代 原文寫「That was literally the case in the sibling repo until its `unittest` context was made required」。在 pdf-processor 那份裡 "the sibling repo" 指這裡,是對的;抄進這裡就變成指 pdf-processor, 而那個 repo 的 required contexts 是 build/wasm-test/e2e、從來沒有 `unittest`、也從來不是 null ⇒ 對它是不成立的事實宣稱,對本 repo 則是 把自己的歷史送給了鄰居。 這條不是措辭 nit。這整段 comment 存在的唯一理由,就是當本 repo 那個 「一按 approve 就合掉紅 CI」危險的存檔。現在 `unittest` 是本 repo 唯一 的 CI 閘門,而檔案卻告訴讀者「出事的是隔壁」—— 下一個看到 protection 裡孤零零一顆 unittest 的人會判斷它是可有可無的裝飾,然後拿掉它。 改成:主詞是本 repo、寫明 2026-08-04 的日期與因果(補閘正是為了讓 loop 可以移除)、並明講那顆 check 現在是唯一閘門,別拆。 N1 指令會 403,一併換掉 gh api repos/O/R/branches/main/protection → App/agent token 一律回 Resource not accessible by integration(老鷹在兩個 repo 各實測一次), 而這段註解點名的讀者正是「要把檔案複製到別的 repo 的人」,在這支艦隊 多半是 agent。改成 gh api repos/O/R/branches/main --jq .protection.required_status_checks —— 我用兩個 repo 各驗一次, 資料確實在那個路徑上(回 contexts + enforcement_level)。 無行為變更,只有註解。actionlint clean。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Closes #69
.github/workflows/*needsworkflowsscope, which the agent App tokens do not have, so this is pushed on their behalf.What changed
The whole
run:block becomes one line:Plus:
CHECKenv dropped (now unused),timeout-minutes30 → 5, and the step renamed "Merge after CI passes" → "Enable auto-merge" — it no longer waits for anything, and a name claiming otherwise is something the next reader has to disprove by hand. Job guard, step guard,permissionsandfetch-metadatauntouched.Acceptance
actionlint→ clean. Rendered conditions, per the issue's request to state how it was checked:dependabot[bot], so no normal PR can exercise it. Merging this is not proof. The next real Dependabot PR is the test — per the issue, this stays open until that run is observed.Sibling PR
pdf-watermark-removegets the same change in its own PR (separate repos, no shared file).close-stale-prs.yml— I checked its workflow list. So the "leftovers get swept" mitigation for the accepted trade-off exists here but not there; its comment says so rather than repeating this one's claim.