Skip to content

docs(labels): record sync scope and define an approved unknown-label sweep - #528

Merged
ss-o merged 2 commits into
mainfrom
docs/label-sync-scope
Aug 19, 2026
Merged

docs(labels): record sync scope and define an approved unknown-label sweep#528
ss-o merged 2 commits into
mainfrom
docs/label-sync-scope

Conversation

@ss-o

@ss-o ss-o commented Aug 19, 2026

Copy link
Copy Markdown
Member

Two gaps in runbooks/labels.md surfaced by the 2026-08-19 label audit.

1. Sync scope was never written down

labels-sync.rb --all-repos audits every repository the token can see, which is wider than what canonical sync actually targets. The result is that private and fork repositories report as drift forever and inflate org-wide totals.

Measured on 2026-08-19: 93 repositories audited, 86 active/public/non-fork. The other 7 accounted for 215 missing canonical labels and 116 legacy labels, all of it out of scope rather than regression.

This records the scope, names each exclusion with its reason, and states that a repository entering active public non-fork status enters scope at that point.

2. The bulk-delete prohibition had already been overridden

The runbook said "Do not delete unknown labels in bulk" with no exception path. A maintainer-approved sweep on 2026-08-19 deleted 1,390 unused unknown definitions across the 86 in-scope repositories, taking unknown labels from 1,483 to 93.

Rather than weaken the rule to match what happened, this keeps the prohibition as the default and documents the conditions an approved sweep must meet, so the next one is done safely instead of improvised:

  • approval given against figures measured at approval time;
  • usage read live from issues?state=all, never the search API, whose index lagged the May bulk changes badly enough to report 52 phantom items for a label attached to nothing;
  • deletion limited to definitions attached to zero items;
  • configuration-referenced labels preserved, verified by reading labeler.yml and stale/lock workflow inputs;
  • a restorable archive of every label definition before the first write;
  • a hand-verified pilot repository;
  • per-repository batching with per-operation logging;
  • a post-run re-derivation of every survivor.

It also states that sync_policy.delete_unknown_labels stays false, so an approved one-off never becomes the default.

Why condition 4 is load-bearing

Deleting a configuration-referenced label does not fail loudly. actions/labeler applies labels through the issues API, which creates a missing label rather than erroring, so the sweep quietly undoes itself on the next matching pull request. That is not hypothetical: it is why enhancement ✨ reappeared in z-shell/zi after #467 deleted it. Tracked separately in #527.

Verification

Documentation only, no executable change. Scope and figures were verified against live audit output rather than the earlier report; the sweep result was re-audited org-wide with every one of the 93 survivors re-derived as in-use or configuration-referenced, and zero unjustified leftovers.

Related: #467, #524, #527

ss-o added 2 commits August 19, 2026 01:41
The label runbook did not state which repositories canonical label sync
targets. `labels-sync.rb --all-repos` audits every repository the token can
see, which is wider than the sync scope, so private and fork repositories
report as drift indefinitely and inflate org-wide totals.

A 2026-08-19 audit measured 93 repositories, of which 86 are active, public,
and non-fork. The remaining 7 accounted for 215 missing canonical labels and
116 legacy labels, all of it expected rather than regression.

Record the scope, name the exclusions and the reason for each, and state that
a repository entering active public non-fork status enters scope at that
point.
The runbook prohibited bulk deletion of unknown labels outright, but a
maintainer-approved sweep on 2026-08-19 removed 1,390 unused unknown
definitions across 86 repositories. Guidance and practice now disagree, and an
absolute rule that has already been overridden once gives no guidance on how to
do it safely the next time.

Keep the prohibition as the default and add the conditions an approved sweep
must meet: live usage measured from the issues API rather than the lagging
search index, deletion limited to zero-item definitions, preservation of
configuration-referenced labels verified by reading labeler and stale
workflows, a restorable archive, a verified pilot, per-repository batching, and
a post-run re-derivation of every survivor.

State that sync_policy.delete_unknown_labels stays false, so an approved
one-off never becomes the default.
@ss-o
ss-o requested a review from a team as a code owner August 19, 2026 00:54
@ss-o
ss-o merged commit 6af5afd into main Aug 19, 2026
7 checks passed
@ss-o
ss-o deleted the docs/label-sync-scope branch August 19, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant