feat(cicd_rules): duplicate_cron_schedule (#362)#406
Merged
Conversation
Detect workflows whose on.schedule carries redundant cron triggers: 2+ entries on the same day-of-week field (consolidation artefact, e.g. three Monday crons), or a daily `* * *` entry strictly covering a day-specific entry at the same HH:MM. Advisory (medium); distinct intentional triggers are never auto-removed. - CicdRules.scan_duplicate_cron_schedules/1 (walks workflows) + pure CicdRules.check_duplicate_cron_schedules/2 - facade defdelegate, tests, CHANGELOG (md + adoc) entries - verified locally (Elixir 1.14): mix-format clean, zero-warning compile, real-module oracles from hypatia#331 (tests.yml subset, verify-proofs.yml three-Monday, security-policy.yml negative) https://claude.ai/code/session_01J8oLNn6MjKDRRUF65e2jLf
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Implements #362 — a
Hypatia.Rules.CicdRulesdetector,duplicate_cron_schedule, for the runner-waste / log-noise pattern where a workflow'son.schedulelists redundantcron:triggers. Two shapes (severity:medium, advisory):* * 1Monday crons inherited from a workflow consolidation).* * *entry and a day-specific entry at the sameHH:MM; the specific one is strictly covered by the daily one.Distinct intentional triggers (different
HH:MM, or differentif:gates on the same day) are not a strict subset and are only advisory under shape (1) — never auto-removed.How
CicdRules.scan_duplicate_cron_schedules/1— walks.github/workflows/*.{yml,yaml}(root + nested) and returns findings per file.CicdRules.check_duplicate_cron_schedules/2— pure(path, content) -> [finding]; ignores non-5-field cron lines and commented-out# - cron:lines.%{rule: :duplicate_cron_schedule, severity: :medium, file:, reason:, fix:, crons:}.Hypatia.Rulesfacadedefdelegate; CHANGELOG (md + adoc).Tests
test/rules/cicd_rules_duplicate_cron_test.exs— sensitivity (3-Monday + daily-subset) and specificity (different-time non-subset, single cron, commented-out lines), plus ascan_/1walk test. Oracles taken from the realhypatia#331fix (tests.yml,verify-proofs.yml) and hypatia's currentsecurity-policy.yml(correct negative).Verified at source (local Elixir 1.14 — mix deps can't be fetched in this session)
mix formatclean (formatter-normalized; delta isolated from 1.14↔1.17 version skew)elixirconcicd_rules.ex→ 0 warnings / 0 errorsCloses #362
Generated by Claude Code