Skip to content

feat(automerge): warn when auto-merge has no CI, checks or delivery behind it - #78

Merged
sweepies merged 3 commits into
mainfrom
feat/tooling-warnings
Oct 30, 2026
Merged

sweepies merged 3 commits into
mainfrom
feat/tooling-warnings

Conversation

@sweepies

Copy link
Copy Markdown
Owner

Stacked on #76: review that first; this diff is only the tooling warnings. Both PR 1 and this one add sections to the dashboard ranking, so this branch builds on #76's branch.

A PR the Count is set to merge now carries a caution when the repository shows it lacks what that merge relies on, and the dashboard gets a Tooling warnings section, between Known vulnerabilities and the images section, that lists each warning with the open PRs it affects. The section disappears once the condition clears.

Rules (crates/update/src/tooling.rs), applied only to plans that automerge::requested would merge:

  • merge-without-ci: no workflow or CI file runs on pull requests, and no check or status has reported on the default branch's last 10 commits. The Count needs a passing check, so the PR stays open.
  • merge-without-required-checks: native auto-merge is allowed, and neither a ruleset nor classic protection requires a status check. The wording changes when a review is required instead.
  • security-merge-without-delivery: an advisory fix merges, and nothing runs when the default branch changes. Push workflows are checked against the PR's files, including paths/paths-ignore with ! patterns. workflow_run off a push workflow, schedule, Woodpecker push pipelines, other CI files (GitLab, CircleCI, Jenkins, Buildkite, Azure, Travis), Flux/Argo CD manifests and recent checks all count as delivery. When only tags or releases trigger a workflow, the caution says the fix ships with the next tagged release.

Unknown never warns. A workflow that won't parse, or one the extraction didn't fetch, makes CI and delivery unknown. Null or partial branch rules make required checks unknown. A missing history makes checks unknown. Unit tests cover each case, and an engine test shows that a null rules field gives no warning.

Evidence and cost. The design called for REST reads of rules/branches and the branch summary. Instead, required checks and reviews come from Ref.rules (active repository and organisation rulesets) and Ref.refUpdateRule (classic protection, readable by non-admins), which are now fields on the inventory query the Count already runs, together with statusCheckRollup for the default branch's last 10 commits. I checked these fields with a non-admin token against this repository, rust-lang/rust (rulesets, review only) and cli/cli (classic required contexts).

  • Requests: none added. The query's rate-limit cost stays at 3 points per page (measured with rateLimit{cost}, before and after). The response grows by about 600 bytes.
  • I also tried reading check rollups on the Count's open PR heads, as the design suggested. That raised the query cost from 3 to 5 points per page, and it only helps for CI that reports on PRs but never on the default branch, so I removed it.
  • Workflow and Woodpecker files are now fetched even when the github-actions manager doesn't select them. With the default managers that costs nothing extra. Without github-actions, it costs one blob read per workflow file, cold only, because blobs are cached by SHA and extraction by commit (extraction key extract-v11). This is why fixtures/engine/public-batch.json gains 29 workflow blobs, recorded from the same commits; its test config doesn't select github-actions.

Config and report. warnings.quiet maps a rule to a required reason. An empty reason or an unknown rule is rejected with a field path. A silenced warning stays off PRs and appears on the dashboard under "Silenced". The report gains repositories[].tooling (rule, detail, branches, silenced). Write receipts include the callouts only when there are any, so existing receipts stay valid.

Docs. guide/auto-merge.md gets a new section, and guide/dashboard.md and guide/pull-requests.md are updated. The configuration and report references are updated too. Departures has one short entry in the new format, and the compatibility table's automerge row now mentions the warnings.

Not in this PR: T4 (required-check-never-reported) and T5 (merge-without-check-access), as planned.

Open in Capy

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 347ac7c Commit Preview URL

Branch Preview URL
Oct 30 2026, 05:56 PM

@deepsource-io

deepsource-io Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 293fff0...347ac7c on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Rust Oct 30, 2026 5:54p.m. Review ↗
JavaScript Oct 30, 2026 5:54p.m. Review ↗
Shell Oct 30, 2026 5:54p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Comment thread crates/config/tests/config.rs Outdated
Comment on lines +425 to +426
text.chars()
.filter(|c| !c.is_whitespace() && *c != '│')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Called `.chars().filter(..)` when `.matches(..)` would suffice


Using .chars().filter(..) requires additional logic and complexity compared to using .matches(..)
Using matches(..) allows for much greater flexibility such as using Pattern trait bound types,
and matching string expressions directly.

"refUpdateRule":null
});
};
let cache = Cache::open(":memory:", Default::default()).await.unwrap();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using `T::default`, over trait function `Default::default()`


Calls to Default::default() are less readable than T::default().
Using the name of the type makes it easier for the reader to discern which type is being used.

Comment thread crates/update/src/dashboard.rs Outdated
.map(|n| format!("#{n}"))
.collect();
let open = if open.is_empty() {
String::new()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty call to `new()`


The new() function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default().

/// One caution per tooling warning on this PR, ahead of everything else.
fn tooling_section(callouts: &[crate::tooling::Callout]) -> String {
use crate::tooling::*;
let mut text = String::new();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty call to `new()`


The new() function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default().

Comment thread crates/update/src/receipts.rs Outdated
}
result.actor = actor.into();
result.merge_settings = crate::automerge::Settings::from_graphql(&data["repository"]);
result.default_branch = head.clone();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling `.clone()` for assignment to variable


Consider using .clone_from() instead of assigning the result of .clone().

clone_from() may perform better in some cases because some structs may have custom implementations of clone_from(), which improve performance by avoiding needless allocations.

(
p.to_string(),
crate::Blob {
sha: String::new(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty call to `new()`


The new() function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default().

lockfile_pending: false,
files: Vec::new(),
},
contents: Default::default(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using `T::default`, over trait function `Default::default()`


Calls to Default::default() are less readable than T::default().
Using the name of the type makes it easier for the reader to discern which type is being used.

},
contents: Default::default(),
identity: branch.into(),
fingerprint: String::new(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty call to `new()`


The new() function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default().

retry: false,
tree: None,
cached_pr: None,
input_fingerprint: String::new(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty call to `new()`


The new() function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default().

input_fingerprint: String::new(),
lock_jobs: Vec::new(),
lockfiles_ready: true,
deleted: Default::default(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using `T::default`, over trait function `Default::default()`


Calls to Default::default() are less readable than T::default().
Using the name of the type makes it easier for the reader to discern which type is being used.

@context7

context7 Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Docs7 for sweepies/count-patchula

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit 347ac7c

@sweepies
sweepies force-pushed the feat/image-advisories branch from f1d7c8a to 18a6bc3 Compare October 30, 2026 00:21
@sweepies
sweepies force-pushed the feat/tooling-warnings branch from 78dcde8 to 7e767d8 Compare October 30, 2026 00:23
@sweepies
sweepies force-pushed the feat/image-advisories branch from 18a6bc3 to c1d8463 Compare October 30, 2026 15:48
@sweepies
sweepies force-pushed the feat/tooling-warnings branch from 7e767d8 to 57ac8c3 Compare October 30, 2026 15:51

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 29 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread crates/update/src/tooling.rs Resolved
Comment thread crates/report/src/lib.rs Resolved
Comment thread crates/update/src/pull_requests.rs Resolved
Comment thread crates/update/src/tooling.rs Resolved
Comment thread crates/update/tests/dashboard.rs Resolved
Comment thread crates/update/src/dashboard.rs Resolved
Comment thread crates/update/src/pull_requests.rs Resolved
Comment thread crates/update/src/dashboard.rs Resolved
@sweepies
sweepies force-pushed the feat/tooling-warnings branch from 57ac8c3 to 9f5898a Compare October 30, 2026 17:33
.map(|n| format!("#{n}"))
.collect();
let open = if open.is_empty() {
String::new()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty call to `new()`


The new() function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default().

.map(|(_, v)| v)
}

fn workflow(path: &str, text: &str, branch: &str) -> Result<Workflow, ()> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`fn workflow` has a cyclomatic complexity of 42 with "very-high" risk


A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.

(
p.to_string(),
crate::Blob {
sha: String::new(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty call to `new()`


The new() function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default().

lockfile_pending: false,
files: Vec::new(),
},
contents: Default::default(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using `T::default`, over trait function `Default::default()`


Calls to Default::default() are less readable than T::default().
Using the name of the type makes it easier for the reader to discern which type is being used.

},
contents: Default::default(),
identity: branch.into(),
fingerprint: String::new(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty call to `new()`


The new() function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default().

retry: false,
tree: None,
cached_pr: None,
input_fingerprint: String::new(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty call to `new()`


The new() function is used to initialise an object with specific data.
If no arguments are passed, the behaviour is identical to default().

input_fingerprint: String::new(),
lock_jobs: Vec::new(),
lockfiles_ready: true,
deleted: Default::default(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using `T::default`, over trait function `Default::default()`


Calls to Default::default() are less readable than T::default().
Using the name of the type makes it easier for the reader to discern which type is being used.

@sweepies
sweepies deleted the branch feat/image-advisories October 30, 2026 17:53
@sweepies sweepies closed this Oct 30, 2026
…ehind it

Updates set to merge now carry a caution in the PR body, and the dashboard a
"Tooling warnings" section, when the repository shows positive evidence of:

- merge-without-ci: no workflow or CI file runs on pull requests and no check
  has reported on the default branch's last 10 commits;
- merge-without-required-checks: native auto-merge is allowed and no ruleset
  or classic protection requires a status check (worded for review-only);
- security-merge-without-delivery: an advisory fix merges and nothing runs
  when the default branch changes, per PR against push path filters (worded
  for tag-only releases).

Evidence comes from the workflows, Woodpecker pipelines, other CI files and
GitOps manifests in the tree, and from Ref.rules, Ref.refUpdateRule and the
last 10 commit rollups on the existing inventory query. Anything unreadable
is unknown and never warns. warnings.quiet silences a rule with a required
reason; the report gains repository tooling entries.
- A pull_request workflow counts as CI only when its branches include the
  default branch and its paths match a file the PR changes.
- Every YAML file is read to look for Flux and Argo CD manifests, up to 300
  that no manager reads; beyond that, or when one is missing, delivery is
  unknown and never warns.
- The CI warning, the tag-release caution and the dashboard intro say only
  what the evidence shows, and the CI wording follows native auto-merge.
- Silenced dashboard rows name the open PRs they affect.
- report.md marks `detail` and `silenced` optional and lists `native`.
The delivery warning needs every YAML file in the tree to find Flux and
Argo CD manifests. Skip those reads when no setting merges on its own or
the warning is silenced.
@sweepies sweepies reopened this Oct 30, 2026
@sweepies
sweepies changed the base branch from feat/image-advisories to main October 30, 2026 17:54
@sweepies
sweepies force-pushed the feat/tooling-warnings branch from f4c57f0 to 347ac7c Compare October 30, 2026 17:54
@sweepies
sweepies marked this pull request as ready for review October 30, 2026 18:05
@sweepies
sweepies merged commit debb743 into main Oct 30, 2026
17 checks passed
@sweepies
sweepies deleted the feat/tooling-warnings branch October 30, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant