You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(automerge): warn when auto-merge has no CI, checks or delivery behind it - #78
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 thatautomerge::requestedwould 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, includingpaths/paths-ignorewith!patterns.workflow_runoff 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
rulesfield gives no warning.Evidence and cost. The design called for REST reads of
rules/branchesand the branch summary. Instead, required checks and reviews come fromRef.rules(active repository and organisation rulesets) andRef.refUpdateRule(classic protection, readable by non-admins), which are now fields on the inventory query the Count already runs, together withstatusCheckRollupfor 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).rateLimit{cost}, before and after). The response grows by about 600 bytes.github-actionsmanager doesn't select them. With the default managers that costs nothing extra. Withoutgithub-actions, it costs one blob read per workflow file, cold only, because blobs are cached by SHA and extraction by commit (extraction keyextract-v11). This is whyfixtures/engine/public-batch.jsongains 29 workflow blobs, recorded from the same commits; its test config doesn't selectgithub-actions.Config and report.
warnings.quietmaps 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 gainsrepositories[].tooling(rule,detail,branches,silenced). Write receipts include the callouts only when there are any, so existing receipts stay valid.Docs.
guide/auto-merge.mdgets a new section, andguide/dashboard.mdandguide/pull-requests.mdare updated. The configuration and report references are updated too. Departures has one short entry in the new format, and the compatibility table'sautomergerow now mentions the warnings.Not in this PR: T4 (
required-check-never-reported) and T5 (merge-without-check-access), as planned.