Skip to content

chore(repos): audit rulesets for required checks from skipped jobs #7327

Backlog

Description

@devops-cli-service

Split from #7318.

Problem: devops repos onboard may have set a required check from a check run that was only skipped. The check name can come from a skipped reusable-workflow job or from a matrix leg. The bad required check blocks merges. Why deferred: The audit needs live access to each repository that onboard changed and to its ruleset. This issue cannot read those repositories from the source tree of devops-cli. Acceptance criteria: - For each repository that onboard changed, the audit lists each required check that no non-skipped check run reports. - The audit lists each required matrix leg name that has an aggregate check. - A person removes each listed check from the ruleset and records the result. - The audit lists no bad required check after the removals.

Proposed design

Problem statement

devops repos onboard could set a required check from a check run that only skipped, and the bad required check blocks merges. Row 10 of devops repos onboard --plan drops such a check only while a template pull request is open, because row 9 reads no check run once that pull request merged, so nothing lists the checks that the repositories onboard already changed still require. Add a read-only devops repos audit-required-checks that reads each target repository's effective required checks and the check runs of its default branch head, lists each bad check, and leaves the removal to a person.

Acceptance criteria

Requirement: Only skipped runs

The audit SHALL list each required check that only skipped check runs report.

Scenario: Required check has only skipped runs

  • WHEN the rules of the default branch require test and the default branch head holds only a test check run with conclusion skipped
  • THEN devops repos audit-required-checks --repo example-org/example-repo --json lists test with reason only-skipped and exits 1

Requirement: Missing required check

The audit SHALL list each required check that no check run of the default branch head reports.

Scenario: Required check has no run

  • WHEN the rules of the default branch require lint and the default branch head holds no lint check run
  • THEN the audit lists lint with reason missing and exits 1

Requirement: Pending run is not missing

The audit SHALL NOT list a required check that holds a check run which has not ended.

Scenario: Required check is still running

  • WHEN the rules of the default branch require lint and the default branch head holds a lint check run with status in_progress
  • THEN the audit lists no bad check and exits 0

Requirement: Matrix leg with aggregate

The audit SHALL list each required matrix leg name whose job check run ended success.

Scenario: Matrix leg has a passing aggregate run

  • WHEN the rules of the default branch require test (3.11) and the default branch head holds a test check run with conclusion success
  • THEN the audit lists test (3.11) with reason matrix-aggregate and exits 1

Requirement: Valid required check

The audit SHALL NOT list a required check when a check run with the same name reports a conclusion other than skipped.

Scenario: Required check has a success run

  • WHEN the rules of the default branch require build and the default branch head holds a build check run with conclusion success
  • THEN the audit lists no bad check and exits 0

Requirement: Repository selection

The audit SHALL audit each --repo argument, and SHALL audit the repositories of service.repos when no --repo is given.

Scenario: No repository argument

  • WHEN the operator runs devops repos audit-required-checks --json with service.repos set to example-org/example-repo
  • THEN the command audits example-org/example-repo and prints one result object for it

Requirement: No ruleset change

The audit command SHALL NOT change any repository ruleset.

Scenario: Audit finds a bad check

  • WHEN the operator runs devops repos audit-required-checks --repo example-org/example-repo on a repository with a bad check
  • THEN the command sends no ruleset update request and the ruleset stays the same

Requirement: Pending a person after the merge

A person SHALL remove each listed bad required check from the repository ruleset and record the result.

Scenario: Operator removes the listed checks

  • WHEN the audit after the merge lists a bad check for a repository
  • THEN the operator removes that check in the ruleset, records the result in a comment on the issue, and a later audit lists no bad check for that repository

Existing Tool Considered

No alternatives check has run. The open, maintained gidgethub 6.0.0 library covers the HTTP of each read (ADR 0006), and the project already holds the two reads: read_required_check_names for the required checks of a branch and read_check_runs for the check runs of a head. gidgethub and those readers lack the comparison, the matrix-leg match and the report, which the change builds: about 10k tokens to build and test, about 2k tokens a year to keep and fix, and about 2 hours elapsed.

Key questions

  • Which command name and group should hold the audit?: Add devops repos audit-required-checks under the existing repos group in src/devops_cli/commands/repos.py, beside onboard. (best practice) [sources: src/devops_cli/commands/repos.py:1064, docs/CLI_REFERENCE.md:63]
    • Chosen: devops repos audit-required-checks. It sits in the same group as repos onboard, whose row 10 builds the required checks that it audits.
    • Rejected: Extend devops repos onboard --plan instead of a new command. The archived design of fix(repos): onboard requires a skipped check name #7318 rejected a second command because ruleset_row already reads each ruleset, but row 9 reads no check run once the template pull request merged (src/devops_cli/github/onboard/template_pr.py:238), so row 10 lists no check for the repositories this issue names.
    • Rejected: devops audit required-checks. It creates a new command group for one read-only audit.
  • Which repositories should the audit read by default?: The audit reads each repository named by a repeated --repo argument. With no --repo, it reads the repositories of service.repos. (best practice) [sources: docs/CLI_REFERENCE.md:337, src/devops_cli/commands/repos.py:1050]
    • Chosen: Explicit --repo with service.repos default. devops roadmap inbox already reads each repository of service.repos, or the one that --repo names (docs/CLI_REFERENCE.md:337), and service.repos is the set that onboard changed.
    • Rejected: Explicit --repo only. The operator must repeat the full list and can omit a repository.
    • Rejected: Scan every repository of the account. It reads repositories that onboard did not change and needs wider permissions.
  • Which GitHub data should the audit compare with the required checks?: The audit reads the required check names that the rules of the default branch give, with the existing read_required_check_names (GET /repos/{repository}/rules/branches/{branch}), and the latest run of each check of the default branch head with read_check_runs. That is the same pair of reads that failed_required_checks makes for a pull request head, and the raw conclusion of each run is the item's state. (best practice) [sources: src/devops_cli/github/check_verdict.py:310, src/devops_cli/github/check_verdict.py:319, src/devops_cli/github/check_verdict.py:289, src/devops_cli/github/branch_update.py:141]
    • Chosen: Rules of the default branch and the check runs of its head. The rules endpoint applies each ruleset to the branch that merges, and the project already pairs it with a check-run read of a head (src/devops_cli/github/branch_update.py:141).
    • Rejected: The rulesets listing and one read per ruleset. It repeats the rule matching that rules/branches/<branch> does, and lists rulesets that do not apply to the default branch.
    • Rejected: The head of the newest template pull request, in any state. fix(repos): onboard requires checks of a merged template pull request #7476 records that a merged head can name a check that no workflow reports now (src/devops_cli/github/onboard/template_pr.py:240), so it lists names that are not bad.
  • Which required checks count as bad?: A required name is bad in three cases: every completed run of it on the head ended skipped (only-skipped); no run of it reports (missing); or it is a matrix leg whose job run ended success (matrix-aggregate). A name that holds a run which has not ended, or a run whose conclusion is not skipped, is not bad. (best practice) [sources: src/devops_cli/github/onboard/settings_rows.py:696, src/devops_cli/github/onboard/settings_rows.py:716, src/devops_cli/github/check_verdict.py:161, docs/repos/onboard.md:97]
    • Chosen: Skipped-only, missing, and a leg with a passing job. It states the defect of fix(repos): onboard requires a skipped check name #7318 in the two forms that row 10 drops (src/devops_cli/github/onboard/settings_rows.py:716), and adds the missing name that the issue body names.
    • Rejected: Only the names that row 10 drops with ; dropped. Row 10 keeps a name that no run reports, because the head of the template pull request does not contradict it (src/devops_cli/github/onboard/settings_rows.py:706); the default branch head does, and the issue body asks for it.
    • Rejected: Every required name that no run reports on the newest template pull request head. A merged head can hold the names of workflows that no longer run (src/devops_cli/github/onboard/template_pr.py:240).
  • How should the audit detect a matrix leg that has an aggregate check?: Reuse _check_base_name, which splits <job> (<values>) with _LEG_PATTERN at the last space before the parenthesised values, and mark the leg when a run of <job> ended success, the same rule that row 10 applies. (best practice) [sources: src/devops_cli/github/onboard/settings_rows.py:71, src/devops_cli/github/onboard/settings_rows.py:677, src/devops_cli/github/onboard/settings_rows.py:716, openspec/changes/archive/2026-11-27-7318-onboard-requires-a-skipped-check-name/design.md:7]
    • Chosen: Parse the name with _LEG_PATTERN and look for a success run of the job name. The project already parses the leg shape and drops a leg whose job ended success (src/devops_cli/github/onboard/settings_rows.py:716).
    • Rejected: A regular expression on the values. The values vary by job, shard 1 of 5 at .github/workflows/ci.yml:144 and run 1 of 3, so one pattern misses a name.
    • Rejected: Read the Actions jobs of each workflow run. It misses required checks of other apps and needs one read per run.
    • Rejected: Report every required name with parentheses. It lists valid checks whose job name holds parentheses.
  • What should the audit output and exit code be?: The audit prints a table by default and JSON with --json, through resolve_format and emit_serialized as the other commands of the group do. It exits 0 when it lists no bad check and 1 when it lists at least one. (best practice) [sources: src/devops_cli/commands/repos.py:1004, docs/CLI_REFERENCE.md:63]
    • Chosen: Table by default, --json, exit 1 on findings. A person reads the table, and a script can gate on the exit code.
    • Rejected: Table only, exit 0 always. No automation can tell whether the audit found a bad check.
    • Rejected: JSON only, exit 1 on findings. A person must parse JSON to read the report.
  • Who removes a bad required check from a ruleset?: A person removes each bad required check in the ruleset of the repository and records the result in a comment on the issue. The audit command changes no ruleset. [sources: docs/repos/onboard.md:97, SECURITY.md:114]
  • Which GitHub client should the audit use?: Use the process's GitHub session with gidgethub for each API call. Do not run bare gh. (best practice) [sources: docs/adr/0006-github-session-requests-go-through-gidgethub.md:11, AGENTS.md:13, openspec/specs/agent-instructions/spec.md:125]
    • Chosen: Existing GitHub session with gidgethub. ADR 0006 sends each REST request through gidgethub and keeps pacing, retries, paging and error classes in one place.
    • Rejected: Shell out to devops gh api. The audit reads each page of two listings and decodes them, which the session's paginate already does (docs/adr/0006-github-session-requests-go-through-gidgethub.md:11).
    • Rejected: New HTTP client. It duplicates an open, maintained library that the project uses.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/chore
    source/agent
    status/new
    value/medium
    effort/medium
    scope/repos
    on Nov 26, 2026
  2. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    ContributorAuthor
  3. changed the title [-]chore(repos): audit existing rulesets for required checks from skipped jobs[/-] [+]chore(repos): audit rulesets for required checks from skipped jobs[/+] on Nov 26, 2026
  4. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    ContributorAuthor

    The job shortened the title of this item. The summary had 61 characters, and the limit is 60. The type and the scope stay.

    • Before: chore(repos): audit existing rulesets for required checks from skipped jobs
    • Source of the summary: the background model
  5. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  6. dan-petty commented on Nov 30, 2026

    @dan-petty
    Owner

    The audit entries of dan-petty/devcontainer-features are handled by dan-petty/devcontainer-features#38 (issue dan-petty/devcontainer-features#37) and by the ruleset step that follows its merge.

    • Today the ruleset main of that repository requires the matrix job names test, test-scenarios and podman-host. Only a skipped run reports these names.
    • The pull request adds the check Feature tests, which gives one result of the test jobs.
    • Pending a person, after the merge: replace detect-changes, test, test-scenarios and podman-host with Feature tests in that ruleset.

    The entries stay until that step. This comment covers no other repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/repossource/agentstatus/newtype/chorevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions