Skip to content

chore(github): delete the labels that nothing writes #5503

Done

Description

@dan-petty

Problem or Motivation

D4 of the approved pipeline split design (owner approval 2026-11-13, tracker #5482) adds no new label and removes the labels that nothing writes. The repository holds these labels, and no code, workflow or issue form writes them: review/ai-reviewed, review/approved, review/changes-requested, documentation, duplicate, good first issue, help wanted, invalid, question and wontfix. .github/labels.yml does not hold them, and the label sync never deletes a label.

The issue forms write bug, enhancement and triage (.github/ISSUE_TEMPLATE/bug_report.yml and feature_request.yml), so these labels stay.

Proposed Solution & Architectural Design

  • Add a removed list to .github/labels.yml with the 10 labels above.
  • The label sync (sync_labels in src/devops_cli/commands/gh.py) deletes each label of the removed list that the repository holds. --dry-run prints the deletes and makes no request.
  • A test fails when a label of the removed list is also a desired label, or when an issue form writes it.
  • Run the sync from a worktree at origin/main after the merge.

Target Subsystem

GitHub labels (.github/labels.yml, src/devops_cli/github/labels.py, src/devops_cli/commands/gh.py).

Acceptance Criteria

  • Test first: with a fake GitHub that holds wontfix, the sync deletes it, and keeps bug. The test fails on the base.
  • A test: a label in the removed list and in an issue form fails the check.
  • A test: --dry-run sends 0 requests.
  • Live proof: after the merge, the sync runs against devops-cli. A comment on this issue gives the deleted labels and the label count before and after.

Existing Tool Considered

The label sync of devops and the GitHub labels REST API cover the need. Build: 50,000 to 100,000 agent tokens and 0.25 day.

Related

Tracker #5482, Phase 2. #5235 (the roadmap-state record states the D4 rule).

Source: #5482

Alternatives check of 2026-11-17: not-applicable.
Class: chore, no search.
Tool: none found.

Proposed design

Problem statement

The repository holds ten labels that no code, workflow or issue form writes. The label sync adds and updates labels but never deletes one. The change adds a removed list to the label specification, deletes each removed label that the repository holds, and refuses a removed label that is still desired or written by an issue form.

Acceptance criteria

Requirement: Removed labels in the label file

The label specification SHALL hold a removed list with the ten labels that nothing writes.

Scenario: Dry-run lists the removed labels

  • WHEN uv run devops gh label sync --dry-run runs in the repository
  • THEN the plan lists review/ai-reviewed, review/approved, review/changes-requested, documentation, duplicate, good first issue, help wanted, invalid, question and wontfix.

Requirement: Delete test fails on the base

The delete test MUST fail on the base commit.

Scenario: The test fails before the sync change

  • WHEN the delete test runs on the base commit
  • THEN the test fails because the sync sends no delete request for wontfix.

Requirement: Delete a held removed label

The label sync SHALL delete each removed label that the repository holds.

Scenario: The sync deletes wontfix and keeps bug

  • WHEN a fake GitHub holds wontfix and bug, the removed list holds wontfix, and the desired labels hold bug
  • THEN the sync sends one delete request for wontfix and sends no delete request for bug.

Requirement: Refuse a removed label that is desired

The label sync MUST refuse a removed label that the desired labels also hold.

Scenario: A desired and removed conflict stops the sync

  • WHEN a fixture holds wontfix in both the desired list and the removed list
  • THEN the sync raises ValidationError and sends no request.

Requirement: Refuse a removed label in an issue form

The label sync MUST refuse a removed label that an issue form writes.

Scenario: An issue form conflict stops the sync

  • WHEN a fixture issue form writes wontfix and the removed list holds wontfix
  • THEN the sync raises ValidationError and sends no request.

Requirement: Dry-run sends no request

The label sync with --dry-run MUST send no request.

Scenario: A dry-run records zero requests

  • WHEN a test calls sync_labels with --dry-run and a fake client
  • THEN the fake client records zero requests and the output lists the removed labels.

Requirement: Live deletion proof

The merged sync SHALL delete the ten labels from devops-cli and report the counts.

Scenario: Run the sync after merge

  • WHEN uv run devops gh label sync --repo dan-petty/devops-cli runs after the merge
  • THEN the command deletes the ten labels, prints the label count before and after, and a comment on the issue records the deleted labels and the counts.

Existing Tool Considered

The alternatives check of 2026-11-17 recorded not-applicable for this chore and found no tool. The change uses the existing devops gh label sync command and the GitHub labels REST API; the issue estimates 50,000 to 100,000 agent tokens and 0.25 day to build.

Key questions

  • How does .github/labels.yml hold the removed labels and keep the desired labels?: Change .github/labels.yml to a mapping with labels: and removed:. Update load_label_specs to return both lists. sync_labels passes the removed list to the sync. (best practice) [sources: .github/labels.yml, src/devops_cli/commands/gh.py, src/devops_cli/github/labels.py]
    • Chosen: Mapping with labels and removed in .github/labels.yml. The issue asks for one label file. The loader changes in one module. The file stays the single source of the labels.
    • Rejected: Separate .github/labels-removed.yml file. It splits the label specification into two files and does not follow the issue text.
  • What does --dry-run print when it makes no request?: It prints a planned delete for each label in the removed list. The live run deletes only the labels that the repository holds. The dry-run sends no request. (best practice) [sources: src/devops_cli/commands/gh.py, src/devops_cli/github/labels.py]
    • Chosen: Print all removed labels as planned deletes. The dry-run makes no request, so it cannot read the remote labels. The plan shows the full removal set.
    • Rejected: Read the remote labels in the dry-run. It breaks the zero-request rule of the issue.
  • Where does the sync refuse a removed label that is desired or written by an issue form?: Add a pure function validate_removed_labels(removed, desired, issue_form_labels) in src/devops_cli/github/labels.py. sync_labels calls it before any request. The function raises ValidationError on a conflict. A unit test passes fixture lists. (best practice) [sources: src/devops_cli/github/labels.py, src/devops_cli/commands/gh.py, .github/ISSUE_TEMPLATE/bug_report.yml, .github/ISSUE_TEMPLATE/feature_request.yml]
    • Chosen: Validate in the sync before any request. A conflict stops the run before a delete. One function serves the command and the test.
    • Rejected: Validate only in a test. A future issue form could add a removed label and the sync would delete it.
  • How does the sync delete a label?: Extend sync_repository_labels to delete each removed label by name through the GitHub client that the module already uses. The sync sends one delete request for each held removed label. (best practice) [sources: src/devops_cli/github/labels.py, src/devops_cli/commands/gh.py]
    • Chosen: Use the existing GitHub client in src/devops_cli/github/labels.py. The label sync already uses this client, so the delete path needs no new transport.
    • Rejected: Call gh label delete with run_gh directly. It adds a second request path and skips the client.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/chore
    scope/github
    status/new
    value/low
    effort/low
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p3-low
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Class: chore. The check makes no search and no model call for an item of this class.

    Tool: none found

    Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.

  6. added
    status/ready
    and removed
    status/new
    on Nov 20, 2026
  7. devops-cli-service commented on Nov 20, 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/agent
    status/in-progress
    and removed
    status/ready
    on Nov 28, 2026
  9. added
    status/in-review
    and removed
    status/in-progress
    on Nov 28, 2026
  10. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  11. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-28 17:56 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/p3-lowscope/githubsource/agenttype/chorevalue/low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions