Skip to content

feat(labels): add gated apply-mode pilot#425

Merged
ss-o merged 1 commit into
mainfrom
feat/label-sync-apply-mode-pilot
May 23, 2026
Merged

feat(labels): add gated apply-mode pilot#425
ss-o merged 1 commit into
mainfrom
feat/label-sync-apply-mode-pilot

Conversation

@ss-o
Copy link
Copy Markdown
Member

@ss-o ss-o commented May 23, 2026

Summary

  • add gated --apply / --confirm-apply mode for canonical label create/update operations
  • reject org-wide apply during the pilot
  • preserve legacy and unknown labels; no deletion or issue/PR migration
  • add a smoke test harness for refusal paths and apply-preview JSON
  • document apply-mode pilot guardrails in the labels runbook

Safety model

Default behavior remains read-only.

Confirmed apply is intentionally constrained:

  • requires explicit --repo values
  • rejects --all-repos --apply
  • requires --confirm-apply
  • is limited to a temporary pilot allowlist unless --allow-non-pilot-repo is explicitly passed after maintainer approval
  • only creates missing canonical labels and updates canonical label metadata
  • does not delete labels
  • does not migrate labels on issues or pull requests

Test Plan

  • ruby -c scripts/labels-dry-run.rb
  • scripts/test-labels-dry-run.sh
  • scripts/labels-dry-run.rb --repo z-shell/.github --include-clean
  • scripts/labels-dry-run.rb --repo z-shell/.github --json | ruby -rjson -e 'data=JSON.parse($stdin.read); abort unless data["mode"]=="dry-run"; abort unless data["repos_scanned"]==1'
  • scripts/labels-dry-run.rb --repo z-shell/.github --apply --include-clean
  • scripts/labels-dry-run.rb --repo z-shell/.github --apply --json | ruby -rjson -e 'data=JSON.parse($stdin.read); abort unless data["mode"]=="apply-preview"; abort if data["confirmed"]'
  • scripts/labels-dry-run.rb --repo z-shell/zi --apply --json
  • refusal checks for:
    • --all-repos --apply
    • --all-repos --apply --confirm-apply
    • --repo z-shell/zi --apply --confirm-apply
    • --repo z-shell/.github --confirm-apply

Refs #411.

@ss-o ss-o requested a review from a team as a code owner May 23, 2026 01:17
Copilot AI review requested due to automatic review settings May 23, 2026 01:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the existing label audit tooling by adding a tightly gated --apply / --confirm-apply pilot mode to create/update canonical labels only, while keeping default behavior read-only and documenting the operational guardrails.

Changes:

  • Add gated apply-preview and confirmed-apply modes to scripts/labels-dry-run.rb, including pilot allowlist enforcement and JSON/Markdown mode metadata.
  • Add a shell smoke-test harness to validate refusal paths and apply-preview JSON output.
  • Update the labels runbook to document the apply-mode pilot constraints and example commands.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
scripts/test-labels-dry-run.sh Adds a smoke-test script covering refusal paths and apply-preview JSON mode.
scripts/labels-dry-run.rb Introduces apply-preview/confirmed apply support with pilot guardrails and planned operations output.
runbooks/labels.md Documents apply-mode pilot guardrails and provides preview/confirmed command examples.

Comment thread scripts/labels-dry-run.rb Outdated
Comment thread scripts/labels-dry-run.rb Outdated
Comment thread scripts/test-labels-dry-run.sh
@ss-o ss-o force-pushed the feat/label-sync-apply-mode-pilot branch from 6b77dc4 to 8f0de09 Compare May 23, 2026 01:29
Copy link
Copy Markdown
Contributor

Copilot AI commented May 23, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/z-shell/.github/labels
    • Triggering command: /usr/bin/gh gh api repos/z-shell/.github/labels?per_page=100 --paginate --jq .[] (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of ss-o May 23, 2026 01:36
@ss-o ss-o merged commit f4886d6 into main May 23, 2026
5 checks passed
@ss-o ss-o deleted the feat/label-sync-apply-mode-pilot branch May 23, 2026 02:08
@ss-o ss-o moved this to Done in z-shell — Org-wide May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants