Skip to content

Commit 5ec3aea

Browse files
committed
ci: a Dependabot minor or patch update of the dependency files merges without a review (ADR-1126)
The resolver computes a risk tier from the change: Dependabot author and signed commits, only semver-minor or semver-patch update types, only uv.lock or pyproject.toml. Such a PR merges on green required checks; every other PR keeps the verdict gate of ADR-1121. Follows the change-based risk tiers of https://claude.dev/blog/solving-code-review-at-anthropic/. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYsWnKSjpX4oNV19PCF
1 parent 695e851 commit 5ec3aea

6 files changed

Lines changed: 254 additions & 1 deletion

‎.github/workflows/pipeline-post-merge.yml‎

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,47 @@ jobs:
356356
require(max(verdicts)[1] == "approve", "merge held: Claude review verdict is block")
357357
358358
359+
# Files a low-risk dependency update may touch (ADR-1126). Anything else, a
360+
# workflow file first of all, keeps the PR on the reviewed path.
361+
# source: .github/dependabot.yml, uv ecosystem: "declared in pyproject.toml
362+
# and locked in uv.lock, the only dependency file".
363+
LOW_RISK_FILES = frozenset({"uv.lock", "pyproject.toml"})
364+
# source: the `update-type` values Dependabot writes in its commit message,
365+
# https://github.com/dependabot/fetch-metadata#outputs
366+
LOW_RISK_UPDATES = frozenset(
367+
{"version-update:semver-minor", "version-update:semver-patch"}
368+
)
369+
370+
371+
def _is_low_risk(pr, repository, api):
372+
"""True for a Dependabot minor or patch update of the dependency files.
373+
374+
The tier comes from the change, not from a label or a title (ADR-1126): the
375+
PR and each of its commits are Dependabot's (GitHub verified signature),
376+
every update it declares is minor or patch, and it touches nothing outside
377+
LOW_RISK_FILES. Such a PR merges on green required checks without a review.
378+
"""
379+
user = pr.get("user") or {}
380+
if user.get("login") != "dependabot[bot]" or user.get("type") != "Bot":
381+
return False
382+
path = f"/repos/{repository}/pulls/{pr['number']}"
383+
commits = list(api.records(path + "/commits"))
384+
updates = []
385+
for commit in commits:
386+
detail = commit.get("commit") or {}
387+
signed = (detail.get("verification") or {}).get("verified") is True
388+
author = (commit.get("author") or {}).get("login")
389+
if author != "dependabot[bot]" or not signed:
390+
return False
391+
updates += re.findall(
392+
r"^\s*update-type: (\S+)\s*$", detail.get("message") or "", re.M
393+
)
394+
if not updates or not set(updates) <= LOW_RISK_UPDATES:
395+
return False
396+
files = [row.get("filename") for row in api.records(path + "/files")]
397+
return bool(files) and set(files) <= LOW_RISK_FILES
398+
399+
359400
def _merge_open_pr(pr, merge_path, head, api, repository):
360401
require(
361402
pr.get("state") == "open" and pr.get("draft") is False,
@@ -369,7 +410,10 @@ jobs:
369410
),
370411
"PR label holds merge",
371412
)
372-
_review_approves(pr["number"], head, repository, api)
413+
if _is_low_risk(pr, repository, api):
414+
print("post-merge: low-risk dependency update, no review required")
415+
else:
416+
_review_approves(pr["number"], head, repository, api)
373417
result = api.request(
374418
"PUT",
375419
merge_path,

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ adheres to [Semantic Versioning](https://semver.org/).
119119

120120
### Changed
121121

122+
- A Dependabot minor or patch update that touches only `uv.lock` or `pyproject.toml`
123+
merges on green required checks without a Claude verdict (ADR-1126, amends
124+
ADR-1121). Major updates, workflow or Dockerfile updates and every other pull
125+
request keep the reviewed path.
122126
- The post-merge engine closes the issues a resolver-merged PR names with a closing
123127
keyword (`close-issues` job, `issues: write` only). GitHub ignores those keywords when
124128
the merge is made with the workflow's `GITHUB_TOKEN`: all 8 resolver merges with
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!-- Generated by Cortex wiki_reindex from wiki/adr/cortex/1126-a-dependabot-minor-or-patch-update-of-the-dependency-files-merges-without-a-review.md; ADR-1126. Read-only mirror: edit the canonical wiki page. -->
2+
3+
---
4+
created: 2026-11-09T22:30:00Z
5+
kind: adr
6+
number: 1126
7+
status: accepted
8+
tags: [ci, review, merge, dependabot, risk-tier, amends-adr-1121]
9+
title: A Dependabot minor or patch update of the dependency files merges without a review
10+
---
11+
# ADR-1126: A Dependabot minor or patch update of the dependency files merges without a review
12+
13+
## Status
14+
15+
accepted. Amends ADR-1121 (the Claude review verdict decides the merge): one class of change no longer needs a verdict.
16+
17+
## Context
18+
19+
ADR-1121 makes the resolver of `pipeline-post-merge.yml` merge a pull request only on a `Verdict: approve` bound to the review run of its head. `claude-review.yml` does not review a pull request whose actor is `dependabot[bot]` (GitHub gives those runs no secrets). So no Dependabot pull request could ever merge without the owner: on 2026-11-09, #931, #933, #934, #935 and #949 were green, mergeable and held, the oldest for two days.
20+
21+
Anthropic describes the same problem and its answer in "Solving code review at Anthropic" (https://claude.dev/blog/solving-code-review-at-anthropic/): a risk tier is set from the change, not from the author's word; a low-risk change needs no human once the automated and security checks pass; some paths, CI workflow files among them, always need a person.
22+
23+
## Decision
24+
25+
1. The resolver computes a tier from the change itself. A pull request is low risk when all of these hold:
26+
- its author is `dependabot[bot]`, and every commit is authored by `dependabot[bot]` with a signature GitHub verified;
27+
- every `update-type` its commit messages declare is `version-update:semver-minor` or `version-update:semver-patch`, and there is at least one;
28+
- every file it changes is `uv.lock` or `pyproject.toml`.
29+
2. A low-risk pull request merges without a Claude verdict. Everything else of the merge path is unchanged: the `Pipeline` run of the head succeeded, the branch protection still requires `merge` and `CodeQL`, and a `hold` or `do-not-merge` label or a "do not merge" title still holds it.
30+
3. Any other pull request keeps ADR-1121. That includes a Dependabot major update, a Dependabot update of a workflow or a Dockerfile, and a Dependabot branch someone else pushed to.
31+
4. The rule lives in the resolver, which runs from `main` through `workflow_run`: a pull request cannot change its own tier.
32+
33+
## Consequences
34+
35+
Positive: minor and patch dependency updates no longer wait for the owner; the supply-chain gate stays where it was (required tests on three OS, CodeQL, the lock diff only).
36+
37+
Negative: a minor or patch release that breaks behaviour the tests do not cover reaches main unreviewed. Reverts and incidents after such merges are the guardrail to watch; if they appear, the tier is narrowed here.
38+
39+
Tests: `tests_py/scripts/test_ci_low_risk_tier.py` (each condition alone refuses the tier; a low-risk pull request merges with no review run; any other is held with "no Claude review ran on this head"; a hold label still holds).
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
"""A Dependabot minor or patch update of the dependency files merges without a
2+
review; every other change keeps the reviewed path (ADR-1126)."""
3+
4+
from pathlib import Path
5+
import textwrap
6+
import unittest
7+
8+
ROOT = Path(__file__).resolve().parents[2]
9+
REPO = "cdeust/Cortex"
10+
HEAD = "a" * 40
11+
MINOR = "version-update:semver-minor"
12+
PATCH = "version-update:semver-patch"
13+
MAJOR = "version-update:semver-major"
14+
15+
16+
def resolver():
17+
text = (ROOT / ".github/workflows/pipeline-post-merge.yml").read_text()
18+
source = text.split(" python3 - <<'PY'\n", 1)[1].split(
19+
"\n PY", 1
20+
)[0]
21+
namespace = {"__name__": "resolver_test"}
22+
exec(compile(textwrap.dedent(source), "trusted_resolver", "exec"), namespace)
23+
return namespace
24+
25+
26+
def commit(updates=(PATCH,), author="dependabot[bot]", verified=True):
27+
lines = "".join(f"- dependency-name: x\n update-type: {u}\n" for u in updates)
28+
return {
29+
"author": {"login": author},
30+
"commit": {
31+
"message": f"deps: bump x\n\n---\nupdated-dependencies:\n{lines}...\n",
32+
"verification": {"verified": verified},
33+
},
34+
}
35+
36+
37+
def pull(login="dependabot[bot]", kind="Bot"):
38+
return {
39+
"number": 7,
40+
"state": "open",
41+
"draft": False,
42+
"title": "deps: bump x",
43+
"labels": [],
44+
"user": {"login": login, "type": kind},
45+
}
46+
47+
48+
class FakeApi:
49+
def __init__(self, commits, files):
50+
self.commits, self.files, self.puts = commits, files, []
51+
52+
def records(self, path, key=None):
53+
if path.endswith("/commits"):
54+
return self.commits
55+
if path.endswith("/files"):
56+
return [{"filename": name} for name in self.files]
57+
return [] # no review run, no comment: the reviewed path holds
58+
59+
def request(self, method, path, body=None):
60+
self.puts.append((method, path, body))
61+
return {"merged": True, "sha": "c" * 40}
62+
63+
64+
class LowRiskTierTests(unittest.TestCase):
65+
def low(self, commits=None, files=("uv.lock",), pr=None):
66+
api = FakeApi([commit()] if commits is None else commits, files)
67+
return resolver()["_is_low_risk"](pr or pull(), REPO, api)
68+
69+
def test_a_dependabot_patch_of_the_lock_is_low_risk(self):
70+
self.assertTrue(self.low())
71+
72+
def test_a_grouped_minor_and_patch_update_is_low_risk(self):
73+
self.assertTrue(self.low([commit((MINOR, PATCH, PATCH))]))
74+
self.assertTrue(self.low(files=("uv.lock", "pyproject.toml")))
75+
76+
def test_a_major_update_is_not(self):
77+
self.assertFalse(self.low([commit((MAJOR,))]))
78+
self.assertFalse(self.low([commit((PATCH, MAJOR))]))
79+
80+
def test_an_update_type_it_does_not_know_is_not(self):
81+
self.assertFalse(self.low([commit(("version-update:semver-minorx",))]))
82+
self.assertFalse(self.low([commit(())]))
83+
self.assertFalse(self.low([]))
84+
85+
def test_a_workflow_or_any_other_file_is_not(self):
86+
self.assertFalse(self.low(files=(".github/workflows/scorecard.yml",)))
87+
self.assertFalse(self.low(files=("uv.lock", "mcp_server/server.py")))
88+
self.assertFalse(self.low(files=()))
89+
90+
def test_another_author_or_an_unsigned_commit_is_not(self):
91+
self.assertFalse(self.low(pr=pull(login="cdeust", kind="User")))
92+
self.assertFalse(self.low(pr=pull(kind="User")))
93+
self.assertFalse(self.low([commit(), commit(author="cdeust")]))
94+
self.assertFalse(self.low([commit(verified=False)]))
95+
96+
def test_a_low_risk_pr_merges_without_a_review(self):
97+
api = FakeApi([commit()], ("uv.lock",))
98+
merge = resolver()["_merge_open_pr"]
99+
self.assertEqual(merge(pull(), "/merge", HEAD, api, REPO), "c" * 40)
100+
self.assertEqual(
101+
api.puts, [("PUT", "/merge", {"sha": HEAD, "merge_method": "squash"})]
102+
)
103+
104+
def test_any_other_pr_still_needs_the_review(self):
105+
ns = resolver()
106+
for api in (
107+
FakeApi([commit((MAJOR,))], ("uv.lock",)),
108+
FakeApi([commit()], (".github/workflows/pipeline.yml",)),
109+
):
110+
with self.assertRaises(ns["PostMergeError"]) as caught:
111+
ns["_merge_open_pr"](pull(), "/merge", HEAD, api, REPO)
112+
self.assertIn("no Claude review ran", str(caught.exception))
113+
self.assertEqual(api.puts, [])
114+
115+
def test_a_hold_label_still_holds_a_low_risk_pr(self):
116+
ns = resolver()
117+
pr = {**pull(), "labels": [{"name": "hold"}]}
118+
api = FakeApi([commit()], ("uv.lock",))
119+
with self.assertRaises(ns["PostMergeError"]):
120+
ns["_merge_open_pr"](pr, "/merge", HEAD, api, REPO)
121+
self.assertEqual(api.puts, [])
122+
123+
124+
if __name__ == "__main__":
125+
unittest.main()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
created: 2026-11-09T22:30:00Z
3+
kind: adr
4+
number: 1126
5+
status: accepted
6+
tags: [ci, review, merge, dependabot, risk-tier, amends-adr-1121]
7+
title: A Dependabot minor or patch update of the dependency files merges without a review
8+
---
9+
# ADR-1126: A Dependabot minor or patch update of the dependency files merges without a review
10+
11+
## Status
12+
13+
accepted. Amends ADR-1121 (the Claude review verdict decides the merge): one class of change no longer needs a verdict.
14+
15+
## Context
16+
17+
ADR-1121 makes the resolver of `pipeline-post-merge.yml` merge a pull request only on a `Verdict: approve` bound to the review run of its head. `claude-review.yml` does not review a pull request whose actor is `dependabot[bot]` (GitHub gives those runs no secrets). So no Dependabot pull request could ever merge without the owner: on 2026-11-09, #931, #933, #934, #935 and #949 were green, mergeable and held, the oldest for two days.
18+
19+
Anthropic describes the same problem and its answer in "Solving code review at Anthropic" (https://claude.dev/blog/solving-code-review-at-anthropic/): a risk tier is set from the change, not from the author's word; a low-risk change needs no human once the automated and security checks pass; some paths, CI workflow files among them, always need a person.
20+
21+
## Decision
22+
23+
1. The resolver computes a tier from the change itself. A pull request is low risk when all of these hold:
24+
- its author is `dependabot[bot]`, and every commit is authored by `dependabot[bot]` with a signature GitHub verified;
25+
- every `update-type` its commit messages declare is `version-update:semver-minor` or `version-update:semver-patch`, and there is at least one;
26+
- every file it changes is `uv.lock` or `pyproject.toml`.
27+
2. A low-risk pull request merges without a Claude verdict. Everything else of the merge path is unchanged: the `Pipeline` run of the head succeeded, the branch protection still requires `merge` and `CodeQL`, and a `hold` or `do-not-merge` label or a "do not merge" title still holds it.
28+
3. Any other pull request keeps ADR-1121. That includes a Dependabot major update, a Dependabot update of a workflow or a Dockerfile, and a Dependabot branch someone else pushed to.
29+
4. The rule lives in the resolver, which runs from `main` through `workflow_run`: a pull request cannot change its own tier.
30+
31+
## Consequences
32+
33+
Positive: minor and patch dependency updates no longer wait for the owner; the supply-chain gate stays where it was (required tests on three OS, CodeQL, the lock diff only).
34+
35+
Negative: a minor or patch release that breaks behaviour the tests do not cover reaches main unreviewed. Reverts and incidents after such merges are the guardrail to watch; if they appear, the tier is narrowed here.
36+
37+
Tests: `tests_py/scripts/test_ci_low_risk_tier.py` (each condition alone refuses the tier; a low-risk pull request merges with no review run; any other is held with "no Claude review ran on this head"; a hold label still holds).

‎wiki/manifest.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3671,6 +3671,10 @@
36713671
"ADR-1125": {
36723672
"mirror": "ADR-1125-a-cancelled-tool-call-s-worker-runs-to-completion-inside-its-admission-slot.md",
36733673
"path": "adr/cortex/1125-a-cancelled-tool-call-s-worker-runs-to-completion-inside-its-admission-slot.md"
3674+
},
3675+
"ADR-1126": {
3676+
"mirror": "ADR-1126-a-dependabot-minor-or-patch-update-of-the-dependency-files-merges-without-a-review.md",
3677+
"path": "adr/cortex/1126-a-dependabot-minor-or-patch-update-of-the-dependency-files-merges-without-a-review.md"
36743678
}
36753679
},
36763680
"project": "cortex",

0 commit comments

Comments
 (0)