Skip to content

fix(repos): onboard row 10 hides which ruleset key differs #7445

Done

Description

@dan-petty

Problem

When row 10 of devops repos onboard finds a difference in a ruleset, its change line is ruleset <name>: required checks <list>. The line names only the required checks, also when the required checks match and another key differs. The other rows give one line for each differing key (change_lines). So a person cannot see from --plan which part of the ruleset row 10 writes.

Evidence

On 2026-11-27, devops repos onboard dan-petty/homelab --plan --only 10 (origin/main) gave 10. Ruleset: pending and ruleset main: required checks K8s, Lint, PR title / Semantic PR title. The live ruleset main already requires these three checks. The difference is that the live ruleset has no code_scanning rule and no code_quality rule, which the baseline and the github/repository.yaml of homelab hold. The output does not name these rules.

Done when

  • A pending or applied row 10 names each differing key of the ruleset, such as each rule type that it adds, and names the required checks only when they differ. A test fails on the base.

Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches found no tool that diffs a live GitHub ruleset against a baseline and names each differing rule key; gh ruleset view only prints one ruleset and PyGithub only models rules, so the fix belongs in the project's own change_lines.

Lacks:

  • No baseline comparison of a live ruleset against a declared one
  • No per-key diff naming added or missing rule types
  • No integration with the onboard plan output format

Proposed design

Problem statement

Row 10 of devops repos onboard writes one change line for a ruleset and names only the required checks. The line names the checks also when the checks match and another key, such as a rule type, differs. A person cannot see from --plan which part of the ruleset row 10 writes. The other rows give one line for each differing key. The fix makes row 10 do the same. Change 7497 deletes this code when the OpenTofu migration lands, so the fix reuses the existing helper and stays small.

Acceptance criteria

Requirement: Each differing rule type named

Row 10 SHALL name each rule type that the ruleset difference adds or removes in the change line of the plan.

Scenario: The baseline adds code_scanning and code_quality

  • WHEN the live main ruleset has no code_scanning rule and no code_quality rule and the baseline holds both
  • THEN the plan of row 10 holds a change line that names code_scanning and a change line that names code_quality

Requirement: Matching required checks unnamed

Row 10 SHALL name the required checks only when the required checks differ.

Scenario: The required checks match

  • WHEN the live ruleset requires the same three checks as the baseline and only a rule type differs
  • THEN no change line of row 10 holds the required check names and one change line names the differing rule type

Requirement: Differing required checks named

Row 10 SHALL name the required checks when the required checks differ.

Scenario: The baseline adds a required check

  • WHEN the live ruleset requires K8s and Lint and the baseline requires K8s, Lint and PR title
  • THEN the change line of row 10 names PR title

Requirement: Applied row names the same keys

Row 10 SHALL write the same per-key change lines in the applied output as in the plan.

Scenario: Apply writes the ruleset

  • WHEN row 10 applies a ruleset whose rule types differ from the live ruleset
  • THEN the applied output holds the same per-key change lines that the plan gave

Requirement: Test fails on the base

The new test of row 10 MUST fail on the base commit and pass on the change.

Scenario: Fail-to-pass proof

  • WHEN uv run devops ci fail-to-pass --base origin/main runs the new test
  • THEN the command reports the new test as failed on the base and passed on the change

Existing Tool Considered

The alternatives check of 2026-11-27 in the issue body gives the verdict none and names no tool: gh ruleset view prints one ruleset and PyGithub only models rules, so neither compares a live ruleset with a baseline. The block in the issue body lists what the check covers and lacks. The change builds no new formatter: it reuses change_lines of src/devops_cli/github/onboard/model.py:206, which the other rows already use, and adds one test. The written cost is an estimated 4,000 tokens and 2 hours of elapsed time. A new ruleset diff engine would take days.

Key questions

  • Which helper gives one line for each differing settings key?: change_lines at src/devops_cli/github/onboard/model.py:206 gives one line for each differing key of a settings diff. src/devops_cli/github/onboard/settings_rows.py calls it for the other rows. Row 10 writes its own line, so that line names only the required checks. [sources: src/devops_cli/github/onboard/model.py:206, src/devops_cli/github/onboard/settings_rows.py]
  • How does row 10 name each differing ruleset key?: Row 10 passes the ruleset difference to change_lines and prints its lines, as the other rows do. The required checks appear only when the required checks differ. (best practice) [sources: src/devops_cli/github/onboard/model.py:206, src/devops_cli/github/onboard/settings_rows.py, tests/github/onboard/test_onboard_ruleset_merge.py]
    • Chosen: Reuse change_lines for the ruleset difference. The helper already gives one line for each differing key, so the change adds no new formatter.
    • Rejected: Write a ruleset-specific diff formatter. It duplicates change_lines and adds code to keep.
    • Rejected: Print the live ruleset and the baseline whole. The difference is lost in long output, so the row hides the key again.
  • What does the OpenTofu migration do to this code?: Task 3.3 of change 7497 deletes change_lines, ruleset_merge.py and the main part of row 10 when the migration lands, as ADR 0041 decides. The fix adds no new engine, so the migration deletes it with that code. [sources: openspec/changes/7497-onboard-settings-opentofu/tasks.md:33, openspec/changes/7497-onboard-settings-opentofu/proposal.md:55, docs/adr/0041-opentofu-holds-the-repository-settings.md:14]
  • Does this item still deliver a fix before the migration lands?: Build the fix now with the existing helper. The migration is not delivered, and the misleading line costs a person time at each --plan today. Change 7497 then deletes the fix with the engine that it deletes. (best practice) [sources: docs/adr/0041-opentofu-holds-the-repository-settings.md:14, openspec/changes/7497-onboard-settings-opentofu/tasks.md:33]
    • Chosen: Build the small fix now. The output misleads a person today, and the fix is a few lines and one test.
    • Rejected: Close the item as not planned. The migration is not delivered, so the misleading line stays for an unknown time.
  • Where does the test of the new change lines go?: Extend tests/github/onboard/test_onboard_ruleset_merge.py, which already builds a live ruleset with a code_scanning rule and a baseline ruleset. (best practice) [sources: tests/github/onboard/test_onboard_ruleset_merge.py:80, tests/support/github_repository.py:291, tests/support/github_repository.py:298]
    • Chosen: Extend tests/github/onboard/test_onboard_ruleset_merge.py. The file already holds the live and baseline ruleset fakes that the test needs.
    • Rejected: Add a new test file. It duplicates the fakes of tests/support/github_repository.py.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    on Nov 27, 2026
  2. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor
  3. added
    status/new
    value/medium
    effort/low
    scope/repos
    priority/p2-medium
    on Nov 27, 2026
  4. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (8)

    Tools considered:

    Searches run:

    • python library compare GitHub repository rulesets rules required checks, results: 5
    • GitHub rulesets diff tool show which rule differs, results: 5
    • terraform github_repository_ruleset plan shows changes, results: 5
    • github ruleset diff cli compare rules bypass actors code_scanning, results: 5
    • gh ruleset view command GitHub CLI, results: 5
    • githubkit rulesets API models python, results: 5
    • "ruleset" "code_scanning" "code_quality" GitHub API rules list, results: 5
    • compare two GitHub rulesets and list differences, results: 5

    Sources:

  5. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  6. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 28, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  9. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 00:41 UTC

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/lowpriority/p2-mediumscope/repossource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions