Skip to content

fix(repos): onboard lowers a stricter ruleset #7326

Done

Description

@dan-petty

Problem

Row 10 of devops repos onboard replaces the live main ruleset with the baseline of dan-petty/infra. It keeps only the required check names of the live ruleset. Each other live setting that is stricter than the baseline is lowered, with no warning that names it.

Evidence

On 2026-11-26 at 15:51 UTC the main ruleset of dan-petty/devops-cli changed (ruleset history):

  • the code_coverage rule (minimum 90, maximum drop 5) was removed
  • code_quality severity went from warnings to errors
  • the CodeQL thresholds went from errors_and_warnings and medium_or_higher to errors and high_or_higher
  • required_review_thread_resolution went from true to false

The owner decision of 2026-11-23 on #6784 keeps row 10 of devops-cli pending until #6876, which is open. AGENTS.md rule 5 lets only the owner lower a threshold.

Done when

  • Row 10 never removes a live rule and never lowers a live threshold. It names each live setting that is stricter than the baseline, and a person lowers it by hand if they want to. A test fails on the base.

Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: Searches found settings-sync apps (safe-settings, repository-settings) and terraform-provider-github, but each enforces a baseline as-is, so it would still remove live rules and lower thresholds instead of naming the stricter live settings.

Lacks:

  • No comparison that flags live rules stricter than a baseline
  • Removes live rules and lowers thresholds when applied
  • No report naming each setting a person must lower
  • Provider cannot hold the code_quality ruleset rule (ADR 0035)

Proposed design

Problem statement

Row 10 of devops repos onboard writes the baseline main ruleset over the live ruleset. It keeps only the live required check names, so it removes each other live rule and lowers each stricter live threshold with no warning. AGENTS.md rule 5 lets only the owner lower a threshold. On 2026-11-26 the row lowered the main ruleset of dan-petty/devops-cli, and a person restored it. Row 10 must keep each live rule and stricter threshold, name each kept setting, and still add each baseline rule and required check.

Acceptance criteria

Requirement: Live rule kept

The ruleset merge of devops repos onboard SHALL keep each live ruleset rule that the baseline ruleset does not hold.

Scenario: Live coverage rule kept

  • WHEN The live main ruleset holds the code_coverage rule with minimum_coverage 90 and the baseline does not hold that rule.
  • THEN The merged ruleset body holds the code_coverage rule with minimum_coverage 90.

Requirement: Live numeric threshold kept

The ruleset merge SHALL keep a live numeric threshold that is stricter than the baseline threshold.

Scenario: Higher coverage minimum kept

  • WHEN The live code_coverage rule has minimum_coverage set to 90 and the baseline has minimum_coverage set to 80.
  • THEN The merged ruleset body holds minimum_coverage set to 90.

Requirement: Code quality severity kept

The ruleset merge SHALL keep the live code_quality severity when it admits more findings than the baseline severity.

Scenario: Warnings kept over errors

  • WHEN The live code_quality rule has severity set to warnings and the baseline has errors.
  • THEN The merged ruleset body holds severity set to warnings.

Requirement: CodeQL threshold kept

The ruleset merge SHALL keep a live code_scanning tool threshold that admits more alerts than the baseline threshold.

Scenario: Medium threshold kept over high

  • WHEN The live code_scanning rule holds a CodeQL tool with security_alerts_threshold set to medium_or_higher and the baseline holds high_or_higher.
  • THEN The merged ruleset body holds the CodeQL tool with security_alerts_threshold set to medium_or_higher.

Requirement: Live boolean kept

The ruleset merge SHALL keep a live boolean parameter that is true when the baseline value of the parameter is false.

Scenario: Review thread resolution kept

  • WHEN The live pull_request rule has required_review_thread_resolution set to true and the baseline has false.
  • THEN The merged ruleset body holds required_review_thread_resolution set to true.

Requirement: Unranked setting kept

The ruleset merge SHALL keep a live parameter that its comparison table does not rank, and SHALL name the rule and the parameter in one warning line.

Scenario: A new rule parameter stays

  • WHEN The live main ruleset holds a rule parameter that the comparison table does not rank and the baseline does not hold it.
  • THEN The merged ruleset body holds the live parameter, and the output holds one warning line that names the rule and the parameter.

Requirement: Stricter setting named

The ruleset merge SHALL write one warning line that names the rule and the parameter of each live setting that it keeps because the setting is stricter than the baseline.

Scenario: Warning names the coverage rule

  • WHEN The live main ruleset holds the code_coverage rule with minimum_coverage 90 and the baseline does not hold it.
  • THEN The output holds one warning line that names code_coverage and minimum_coverage, and the command exits 0.

Requirement: Baseline addition applied

The ruleset merge SHALL add each baseline rule and each baseline required check that the live ruleset lacks.

Scenario: Baseline required check added

  • WHEN The baseline main ruleset requires the check lint and the live ruleset does not require it.
  • THEN The merged ruleset body requires the check lint.

Requirement: No warning for equal settings

The ruleset merge SHALL write no warning line when the live ruleset holds no setting that is stricter than the baseline.

Scenario: Equal ruleset gives no warning

  • WHEN The live main ruleset equals the baseline ruleset.
  • THEN The output holds no warning line, the row is present, and the run sends no ruleset write.

Existing Tool Considered

No open, maintained tool covers the need. The alternatives check of 2026-11-26 in the issue body gives the verdict none and names no tool; its block lists safe-settings, repository-settings and terraform-provider-github, and each enforces a baseline as-is, so it removes live rules and lowers thresholds instead of naming the stricter live settings. The change builds the comparison in row 10: about 50k tokens to write the comparison and its tests, about 10k tokens per later fix, about 5k tokens a year to keep it, and about 4 hours elapsed.

Key questions

  • Which ADR makes devops repos onboard the owner of the main ruleset?: ADR 0035, decision 7. The command manages the main ruleset of each repository, with the code_quality rule, and does not wait for the OpenTofu provider. [sources: docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:40, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:67]
  • How does the sync tell which of two values of one rule parameter is stricter?: It ranks each value by the set of findings or reviews that the value admits. It uses one fixed table for each rule type, and an unknown parameter keeps the live value. A larger minimum is stricter and a smaller maximum is stricter. true is stricter than false. (best practice) [sources: AGENTS.md:11, docs/adr/0012-releases-are-derived-by-release-please-from-trunk-and-milestones-are-planning-buckets.md:96, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:43, openspec/specs/repos-onboard/spec.md:168, src/devops_cli/github/onboard/settings_rows.py:647]
    • Chosen: Fixed rank table for each rule type, unknown keeps live. The GitHub names do not order the values, so a table gives the correct order for each rule; an unknown parameter keeps the live value, so a new GitHub parameter is never lowered.
    • Rejected: Text comparison of the two values. It puts high_or_higher above medium_or_higher, so it lowers the live threshold.
    • Rejected: Keep the whole live ruleset when it differs. It also keeps a live value that is weaker than the baseline, so the baseline never raises it.
  • What does row 10 do when it finds a live setting that is stricter than the baseline?: It keeps the setting in the merged ruleset body. It writes one warning line that names the rule and the parameter. It exits 0. A person may lower the setting by hand. (best practice) [sources: AGENTS.md:11, AGENTS.md:21, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:43, src/devops_cli/github/onboard/settings_rows.py:673]
    • Chosen: Keep and warn, then continue. The row still applies the baseline, and the owner keeps the choice to lower the threshold.
    • Rejected: Stop with a nonzero exit. It blocks the other rows of onboard and applies no baseline.
    • Rejected: Warn and write the baseline value. It still lowers the live threshold, which AGENTS.md rule 5 forbids.
  • Does the sync add a baseline rule or required check that the live ruleset lacks?: Yes. The sync adds each baseline rule and each baseline required check. A live rule stays, and a live parameter keeps the stricter value. The sync removes no live rule. (best practice) [sources: docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:43, openspec/specs/repos-onboard/spec.md:168, src/devops_cli/github/onboard/settings_rows.py:621]
    • Chosen: Union with the stricter value. It raises a weak live rule and never lowers a strict one.
    • Rejected: The live ruleset wins on each difference. It never applies a new baseline rule.
    • Rejected: The baseline wins on each difference. It lowers each stricter live rule, which is the defect.
  • Does this change wait for feat(repos): answer the coverage question of the template #6876?: No. The change fixes the code of row 10 and needs no live write. The owner decision of 2026-11-23 on chore(repos): bring the 7 existing repositories to the baseline #6784 holds the run of row 10 on dan-petty/devops-cli until feat(repos): answer the coverage question of the template #6876; that hold covers the live repository, not this code change. The change is built and tested offline. (best practice) [sources: AGENTS.md:7, AGENTS.md:21, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:40, src/devops_cli/github/onboard/settings_rows.py:647]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

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

    @dan-petty
    OwnerAuthor
    • Priority: The bug already lowered CodeQL thresholds and removed a coverage rule on a live repository, degrading security posture.
  3. added
    effort/medium
    value/high
    scope/repos
    priority/p1-high
    on Nov 26, 2026
  4. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    The main ruleset of dan-petty/devops-cli was restored on 2026-11-26 at 18:24 UTC to its version of 2026-10-23, by a person. It requires 3 checks again and holds the coverage rule.

  5. devops-cli-service commented on Nov 26, 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 (10)

    Tools considered:

    Searches run:

    • github safe-settings rulesets branch protection sync, results: 5
    • GitHub rulesets as code tool detect drift stricter settings, results: 5
    • tool compare GitHub repository ruleset baseline report differences without applying, results: 5
    • terraform-provider-github rulesets resource, results: 5
    • safe-settings github app repository settings as code, results: 5
    • github safe-settings, results: 5
    • probot settings repository settings sync branch protection, results: 5
    • safe-settings rulesets configuration yaml repository rules, results: 5
    • gh ruleset check command GitHub CLI, results: 5
    • branch protection drift detection open source tool, results: 5

    Sources:

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

    @devops-cli-service
    Contributor

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

  8. added
    owner/service
    on Nov 27, 2026
  9. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Plan state: branch fix/7326-onboard-lowers-a-stricter-ruleset, draft pull request #7481. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.

    The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:

    1. Merge the live ruleset into the baseline in a new module: 35303 tokens
    2. Keep the live ruleset and name each kept setting in row 10: 34342 tokens
    3. State the new row 10 behavior in the onboard document: 16501 tokens

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • major other at tasks (1): The merge applies the unranked-parameter rule to the required checks rule too, so it keeps the live required_status_checks list and drops the baseline checks. The plan's own feasibility says the merge leaves that rule to the existing code, and the added requirement says the merged body adds the baseline check. Evidence: "and for each rule that both hold it keeps each live parameter that the baseline lacks, each live parameter that the rank table orders above the baseline value, and each live parameter that the table does not rank"
    • minor false_premise at proposal (feasibility): The feasibility says the read of test_an_onboarded_repository_plans_no_change showed onboard_github.state.rulesets[0], but that test body uses only _onboarded, _run, render_report and _row(report, 16); state.rulesets[0] appears in the earlier confirmed-run test. Evidence: "showed the fixture onboard_github, the helper _onboarded and the state onboard_github.state.rulesets[0]"
    • minor false_premise at tasks (2): The plan says the absence assertion in test_an_onboarded_repository_plans_no_change exercises an equal ruleset, but _onboarded leaves the live ruleset with the required check PR title / Semantic PR title, so the test does not set up the scenario's WHEN. Evidence: "Add the same absence assertion to test_an_onboarded_repository_plans_no_change, so an equal ruleset gives no warning line"
    • minor contrived_test at tasks (2): The new row test asserts onboard_github.writes() is empty, but _run defaults to a plan run, which sends no write at all, so that assertion passes whatever the row would do in a confirmed run. Evidence: "def _run(harness: OnboardHarness, *, confirm: bool = False, **options: Any) -> OnboardReport:"
    • major spec_delta_wrong at spec repos-onboard (Row 10 keeps each live rule and each stricter live threshold): The requirement first promises to keep each rule of the live ruleset and then exempts the required checks rule from the merge. The merge leaves that rule exactly as the baseline body holds it, and _with_required_checks adds only check entries, so a live required checks rule that neither the baseline nor the repository file holds is removed, and the issue forbids removing a live rule. Evidence: "The required checks rule SHALL stay outside that merge, and it SHALL hold each check of the live ruleset, of the baseline, of the repository file and of the reported checks."
    • minor other at tasks (2): The test that group 2 describes says it requires a live check with _declare_checks, but that helper writes the github/repository.yaml of the default branch, not the live ruleset. The test therefore sets up a different WHEN than the scenario, and the declared check is a difference, so the row is pending and the scenario's present part is not asserted. Evidence: "then require a live check with _declare_checks that the baseline lacks and assert that the merged body holds it with no warning line"
    • minor false_premise at proposal (feasibility): The plan says no module of the onboard package merges a live ruleset with the baseline, but _with_required_checks takes the live ruleset and merges its required checks into the baseline body, as the same feasibility list states. The premise that no such merge exists is contradicted by the module the plan quotes. Evidence: "so no module of the onboard package merges a live ruleset with the baseline."
    • major spec_delta_wrong at spec repos-onboard (Row 10 keeps each live required check): The added requirement keeps every live parameter of the required checks rule, but the plan runs _with_required_checks after the merge and that function lets the repository file win each parameter it sets, as the existing requirement "The ruleset requires the reported and the declared checks" and its confirmed-run scenario require. The delta modifies neither requirement, so the new text contradicts the planned code and the base spec. Evidence: "Row 10 SHALL keep each required check of the live ruleset and each live parameter of the required checks rule."
    • major spec_delta_wrong at spec repos-onboard (Row 10 keeps each live required check): The revised text still keeps every live parameter of the required checks rule that the file does not set, but the other added requirement Row 10 keeps each live rule and stricter threshold and the planned merge write the baseline value where the live value is weaker. For a weaker live parameter of that rule that the file leaves unset, the two added requirements give opposite results, so the delta contradicts itself and the code. Evidence: "It SHALL keep each live parameter of the required checks rule that the required checks rule of the settings file of the default branch does not set, and that file SHALL win for each parameter that it sets."
    • minor false_premise at proposal (feasibility): The plan says the docs verify needs the failure class lint, but verification_class gives a class only to the test, lint and typecheck rows of devops ci; the docs row names no class. Evidence: "such as devops docs check, has no class: its failure still gets a repair turn, and its message names no class."
    • minor contrived_test at tasks (2): The test appends Extra to the live required checks rule and then asserts that the merged body requires it, but the live ruleset already requires Extra, so the merge gives no difference and the row sends no write. The test has no merged body to read and can only assert the live state that it just set, which passes whatever the code does. Evidence: "then append the check Extra to the required_status_checks parameters of the same live ruleset, run row 10 again, and assert that the merged body requires it and that render_report(report) holds no warning line that names the required checks rule"
    • minor false_premise at design (decisions): The decision says search_code found no file for the settings path and that baseline.py holds the one copy of the name, but the path is in many files, and the row tests hold their own copy in _SETTINGS_FILE, which the plan itself cites. Evidence: "search_code for that path listed no file of the staged tree"
    • minor contrived_test at tasks (2): The row test asserts that the merged body requires Extra, but it runs a plan over a live ruleset that the test itself just set, so no body is written and the assertion passes whatever the merge does. Evidence: "assert that the merged body requires it and that render_report(report) holds no warning line that names the required checks rule"
    • minor other at tasks (2): The task says to run row 10 and assert the written body, but _run defaults to a plan, where the row is pending and writes nothing; the task does not say the run is a confirm. Evidence: "run row 10, and assert that the written body sets it to false"
  10. 4 remaining items

  11. added
    status/in-progress
    on Nov 27, 2026
  12. added
    status/in-review
    and removed
    status/in-progress
    on Nov 28, 2026
  13. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    The draft pull request #7481 holds the final title and body. In mode on of roadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.

    Spend: 115 model requests, 13461266 input tokens, 74883 output tokens.

  14. removed
    owner/service
    on Nov 28, 2026
  15. removed
    status/in-review
    on Nov 28, 2026
  16. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-28 02:40 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/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