Skip to content

fix(repos): onboard cannot remove a required check #7489

Not planned

Description

@dan-petty

Problem

Row 10 of devops repos onboard writes the union of the live required checks, the baseline and the github/repository.yaml of the repository (#7446). No source can remove a live check. So when a pull request deletes or renames a job that the ruleset main requires, the check never reports again and each later pull request stays BLOCKED, until a person edits the ruleset by hand (devops gh refuses ruleset writes from an agent).

Evidence (2026-11-27)

Expected

The repository declares its required checks in git, and an agent run of onboard brings the ruleset to that declaration, removals included. For example: the required checks rule of github/repository.yaml is the whole list (a check that it does not name and that the baseline does not name leaves the ruleset), or row 10 drops a live check that reported on none of the heads of the last N merged pull requests. A pull request that deletes a required job then also changes github/repository.yaml, and the run after the merge applies it.

Done when

  • A test: a live ruleset that requires a check that the declaration no longer names, and --confirm: row 10 removes it and names it after ; dropped. The test fails on main.
  • The docs of row 10 say how a repository removes a required check.

Source

Source: dan-petty/infra#235

Proposed design

Problem statement

devops repos onboard writes the union of the live required checks, the baseline and github/repository.yaml, so no source removes a live check. A pull request that deletes or renames a required job leaves the ruleset main waiting on a check that never reports, and each later pull request stays BLOCKED until a person edits the ruleset. The owner rejected more custom code in the command and named the OpenTofu provider integrations/github instead. The provider cannot yet declare the code_quality rule of main (upstream integrations/terraform-provider-github#3664 is open), so the change waits for that fix and for the OpenTofu stacks that live in dan-petty/infra and dan-petty/homelab.

Acceptance criteria

Requirement: Onboard sends no ruleset write

devops repos onboard MUST NOT send a request that creates or updates a repository ruleset.

Scenario: A confirmed run against a live ruleset

  • WHEN a test runs the settings rows of devops repos onboard with --confirm against a fake GitHub whose ruleset main requires a check that the declaration does not name
  • THEN the write routes ruleset-create and ruleset-update run for no repository, and row 10 names the OpenTofu configuration as the owner of the required checks

Requirement: Record moves the ruleset to OpenTofu

The change MUST record a new ADR that supersedes ADR 0035 and amends ADR 0026 decision 7, so the OpenTofu configuration owns the ruleset main.

Scenario: The decision records check

  • WHEN a test runs uv run devops ci test tests/invariants/test_adr_records.py
  • THEN the command exits 0, ADR 0035 holds status: superseded with a superseded-by link, and the new record names the OpenTofu ruleset

Requirement: Ruleset declared in OpenTofu

The OpenTofu configuration MUST declare the ruleset main and its required status checks with the github_repository_ruleset resource of provider integrations/github.

Scenario: Validate the root stack

  • WHEN a person runs tofu validate in tf/github/dan-petty of dan-petty/homelab
  • THEN the command prints Success! The configuration is valid. and exits 0

Requirement: One list holds the required checks

The required status checks of the ruleset MUST come from one list variable, so a check that the list omits is not required.

Scenario: Plan a removal

  • WHEN a person removes one check name from the list variable and runs tofu plan in the root stack
  • THEN the plan shows one update of github_repository_ruleset.main that removes that check, and no other resource change

Requirement: Help states how to remove a check

The help text of devops repos onboard MUST state that the OpenTofu configuration owns the required checks and how a repository removes one.

Scenario: Read the help of the command

  • WHEN a test runs devops repos onboard --help
  • THEN the output states that the OpenTofu configuration declares the required checks and that a removal is a change of the list variable and an apply

Requirement: Row 10 docs state how to remove a check

The row 10 page MUST name the OpenTofu configuration as the owner of the required checks and the list variable as the place of a removal.

Scenario: Check the row 10 page

  • WHEN a person runs uv run devops ci --check --only docs
  • THEN the command exits 0, and docs/repos/onboard.md row 10 names the list variable and the owner's tofu apply as the removal step

Requirement: Pending a person after the merge

The owner MUST apply the OpenTofu configuration after the merge, so the ruleset drops each check that the declaration no longer names.

Scenario: Plan and apply the removal

  • WHEN the owner removes the stale check name from the list variable and runs tofu plan and then tofu apply in the root module
  • THEN the plan shows one update of github_repository_ruleset.main that removes that check, the apply succeeds, and the ruleset requires only the declared checks

Existing Tool Considered

The open, maintained tool is the OpenTofu provider integrations/github (MIT, pinned 6.13.0 with OpenTofu 1.13.9): github_repository_ruleset declares the ruleset main and its required status checks, and github_repository_environment, github_issue_label and github_repository declare the other settings. It lacks the code_quality rule of a ruleset (integrations/terraform-provider-github#3664 is open), so it cannot yet declare the main ruleset that the baseline keeps, and it has no reader for github/repository.yaml, so the values move to HCL and the owner applies the plan (ADR 0026 decision 3). No alternatives check has run on this issue.

Key questions

  • How does the declaration hold the required checks?: One list variable of check names feeds the required-status-checks rule of the github_repository_ruleset resource of main. The resource sets the whole list, so a name that the list omits leaves the ruleset at the next apply. One resource for each check would need a resource deletion for a removal and would make the plan order unstable. (best practice) [sources: openspec/changes/archive/2026-11-27-7423-onboard-repo-required-checks/proposal.md:41]
    • Chosen: One list variable. A removal is one line of the variable and the plan shows it, because the resource sets the whole list from that value.
    • Rejected: One resource for each check. A removal needs the deletion of a resource, and the order of the checks is not stable in the plan.
  • Which tool declares the required checks of the ruleset, removals included?: The OpenTofu provider integrations/github with github_repository_ruleset, once upstream integrations/terraform-provider-github#3664 closes. The provider plans each change, removals included, and its state finds drift, but it cannot hold the code_quality rule of main today, so the change waits. (best practice) [sources: AGENTS.md:9, docs/adr/0026-github-settings-are-opentofu-code-the-owner-applies.md:20, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:27, openspec/changes/archive/2026-11-27-7423-onboard-repo-required-checks/proposal.md:41]
    • Chosen: OpenTofu provider integrations/github. AGENTS.md rule 3 puts an open tool before custom code, and ADR 0026 makes GitHub settings OpenTofu code that the owner applies.
    • Rejected: Row 10 drops a check that no head reports. The owner rejected more custom code in this command; that change was about 40k tokens and 2 hours (openspec/changes/archive/2026-11-27-7423-onboard-repo-required-checks/proposal.md:41).
    • Rejected: devops gh writes the ruleset. devops gh refuses ruleset writes from an agent (SECURITY.md:58), so a person would still edit the ruleset by hand.
  • Can the provider declare the ruleset main today?: No. The provider cannot hold the code_quality rule of the main ruleset, and upstream integrations/terraform-provider-github#3664 is open, so a resource that held main would drop that rule. [sources: docs/adr/0026-github-settings-are-opentofu-code-the-owner-applies.md:20, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:14, openspec/changes/archive/2026-11-22-6782-adr-repository-settings/proposal.md:34]
  • Where does the OpenTofu configuration of the GitHub settings live?: The shared module lives in dan-petty/infra as tf/modules/github-repository, and the root stacks live in dan-petty/homelab as tf/github/dan-petty and tf/github/retric-ai. This repository has no tf/ tree, so the declaration is not a file of this repository. [sources: docs/adr/0032-infrastructure-templates-live-in-four-homes.md:69, docs/adr/0026-github-settings-are-opentofu-code-the-owner-applies.md:27, openspec/changes/archive/2026-11-22-6679-deploy-cloud-on-infra-modules/proposal.md:26]
  • How does the change record that the provider owns the ruleset?: A new ADR supersedes ADR 0035 and amends ADR 0026 decision 7. ADR 0035 decision 2 says no OpenTofu resource writes a setting that the command owns, and its decision 7 gives the main ruleset to the command; a body that contradicts the code is superseded, and an agent never edits the body of an accepted record. (best practice) [sources: docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:49, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:67, docs/adr/README.md:69, docs/adr/README.md:50]
    • Chosen: A new ADR supersedes ADR 0035. The record's body contradicts the new code, and the rules of docs/adr/README.md say that the next change supersedes it.
    • Rejected: Amend ADR 0035 in place. An agent never edits the body of an accepted record, and the body contradicts the code.
    • Rejected: Write no record. The code would contradict ADR 0035 decisions 2 and 7, and the alternatives check reads the records in force.
  • Does devops repos onboard keep the write of the ruleset?: No. Row 10 stops each ruleset write and names the OpenTofu configuration as the owner of the required checks. The owner applies the ruleset change, and the new ADR records the move. (best practice) [sources: AGENTS.md:21, docs/adr/0026-github-settings-are-opentofu-code-the-owner-applies.md:35, src/devops_cli/github/onboard/settings_rows.py:773]
    • Chosen: Remove the ruleset write from onboard. One source of truth. AGENTS.md gives repository settings to a person, who applies the OpenTofu change.
    • Rejected: Keep the write and warn. Two writers of one ruleset. A later onboard run would add a removed check back.
  • How does a repository remove a required check after this change?: The repository removes the check name from the list variable of the OpenTofu configuration, and the owner runs tofu plan and then tofu apply. The help of row 10 and docs/repos/onboard.md state this. (best practice) [sources: AGENTS.md:21, docs/adr/0026-github-settings-are-opentofu-code-the-owner-applies.md:35]
    • Chosen: Change the OpenTofu variable and apply. The declaration is the whole list, so the plan shows the removal before the owner applies it.
    • Rejected: Ask an agent to edit the ruleset. devops gh refuses ruleset writes from an agent (SECURITY.md:58), and AGENTS.md gives repository settings to a person.
  • Does this change move the other settings rows of onboard to OpenTofu?: No. This change moves the ruleset only, because a stale required check blocks a merge. The environments, labels and repository rows follow in a later item of the same migration. (best practice) [sources: AGENTS.md:7, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:40]
    • Chosen: Move the ruleset only. One pull request delivers the defect fix with its test and its docs, and the other rows block no merge today.
    • Rejected: Move every settings row at once. The change would hold four migrations and their tests, and it would exceed one pull request.

Fit

Needs splitting into 3 items:

  1. devops-cli: stop row 10 writing the ruleset, add the test that no ruleset write happens, supersede ADR 0035, and update the help and row 10 docs.
  2. dan-petty/infra: add the ruleset main and its required-status-checks list to the shared module tf/modules/github-repository.
  3. dan-petty/homelab: declare the ruleset main in tf/github/dan-petty and tf/github/retric-ai from the list variable, and plan the removal.

Suspected block

Upstream integrations/terraform-provider-github#3664: the provider cannot hold the code_quality rule of the ruleset main, so the ruleset stays with devops repos onboard until a provider release carries the rule.

Dependencies

None.

Activity

  1. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor
    • Priority: PRs stay BLOCKED until a person edits the ruleset by hand, which blocks merges and adds manual work.
    • Related: fix(repos): onboard ignores the repo's own required checks #7423, which asks for a different change. Both target row 10 and github/repository.yaml required checks, but #7423 added the ability to read and add checks from the repo file, while this candidate asks for the ability to remove checks not in the declaration.
  2. added
    type/bug
    source/agent
    status/new
    effort/medium
    value/high
    scope/repos
    priority/p1-high
    on Nov 28, 2026
  3. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor

    Closed as not planned: the owner rejects more custom code where an open tool solves the problem (2026-11-27). The removal gap exists because devops repos onboard reimplements repository settings as code (rulesets, environments, labels, the github/repository.yaml schema). The OpenTofu provider integrations/github (github_repository_ruleset, github_repository_environment, github_issue_label, github_repository) declares the same settings; tofu plan shows each change, removals included, and the state finds drift. The replacement of the settings rows of onboard by that provider is the item to plan instead.

  4. removed
    status/new
    on Nov 28, 2026
  5. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: a person splits the item, or replies in a comment or edits the body to keep one item. See Fit in the section Proposed design of the body.

  6. added a commit that references this issue on Nov 28, 2026
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/p1-highscope/repossource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions