Repository navigation
π github: keep label descriptions within GitHub's 100-char cap - #15685
Conversation
origin/governor, origin/selfreport and has-open-pr descriptions exceeded GitHub's 100-character limit, so ensure-label PATCH/POST answered 422 and every CreateIssue dropped its origin/* label. Shorten the catalog entries and clamp (rune-safe) at every label create/edit call site. Closes #15683 Closes #15681 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
The three over-cap descriptions named in #15683 are fixed and the clamp is correct (rune-safe, exact-length preserved β read labels.go:22-30 and TestClampLabelDescription). One same-class case is still live, and it is the one the body's "every label create/edit call site" misses:
hive:unauthorized is 123 runes and is created unclamped β src/pkg/github/automerge/automerge_unauthorized.go:43 (constant) and :186-190 (CreateLabel with Description: gh.Ptr(unauthorizedLabelDescription)). Severity: medium.
Mechanism: that site treats any 422 as "label already exists" (:193), so on a repo where the label does not exist yet, GitHub answers 422 description is too long, unauthorizedLabelReady[repo] is set true, and AddLabelsToIssue at :198 auto-creates the label with no colour and no description. Because ready is cached per process, it is never retried β the same symptom #15683 describes for origin/governor, on the label that tells a maintainer the App lacks a permission. TestCatalogLabelDescriptionsFitGitHubCap cannot catch it because it only walks pkg/github's own catalogs (origin, escalation, stage family, has-open-pr, advisory); automerge is a different package.
Suggested: shorten the constant to β€ 100 and wrap that CreateLabel the same way. pkg/github/automerge already imports stagelabels, whose ClampLabelDescription/MaxLabelDescription (src/pkg/stagelabels/stagelabels.go:638-647) is the pre-existing helper the stage reconciler uses (automerge_stage_labels.go:1438,1452,1457) β worth noting the PR now has two clamps with slightly different truncation (ellipsis vs plain trim); consolidating on one is optional, but the two constants should at least stay equal.
Other remaining unclamped sites are all short literals today and not a problem: client.go:3162 (58 chars), advisory.go:214,608 (advisoryLabelDesc, 39), dashboard/api_acmm_eval.go:298.
Could not run go test in this pod (blocked for agents); CI is the verdict.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
The shortened descriptions and the clamp at the four pkg/github call sites are correct, but the PR body's claim that "every label create/edit clamps the description" does not hold on this head β one over-long description is left unclamped and untested.
Medium β src/pkg/github/automerge/automerge_unauthorized.go:43,186-190. unauthorizedLabelDescription is 123 runes (counted on 4d2adb4) and is passed straight to CreateLabel without clampLabelDescription / stagelabels.ClampLabelDescription. GitHub answers 422 description is too long; the handler at :191-197 treats any 422 as "already exists", marks the repo unauthorizedLabelReady, and AddLabelsToIssue at :199 then auto-creates hive:unauthorized uncoloured and description-less. So the exact symptom #15683 describes (422 β label provisioned wrong or dropped) survives for this label, and TestCatalogLabelDescriptionsFitGitHubCap cannot catch it because the constant lives in automerge, outside the catalog it enumerates. Fix: shorten the constant to β€100 runes (and/or wrap the call in stagelabels.ClampLabelDescription). The other unclamped sites I checked are fine: client.go:3162 (58 runes), advisory.go:24 (39 runes).
Low β duplicate helper. stagelabels.ClampLabelDescription and stagelabels.MaxLabelDescription = 100 already exist on v5 (src/pkg/stagelabels/stagelabels.go:638-647) and are what automerge_stage_labels.go:1438-1457 uses. This PR adds a second clamp (src/pkg/github/labels.go:18-29) and a second constant (src/crux/config/origin_labels.go:99, re-exported via config.GitHubLabelDescriptionMax). Two caps that must stay equal is the kind of drift the house style asks us to avoid; reusing the stagelabels one β or making it the single source for both β would be smaller. The ellipsis variant is a reasonable improvement if you want to keep it, but then the old one should delegate to it.
Everything else read against v5 checks out: ensureStageLabelFamily, ensureOriginLabel, ensureCreateIssueLabel and EnsureIssueLabel all clamp on both create and edit, the catalog test enumerates origin, escalation, stage and the six standalone labels, and the two shortened origin/* descriptions are 93 and 95 runes.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Summary
Every
CreateIssuewas loggingcould not ensure label, creating without it label=origin/governor β¦ 422 description is too long (maximum is 100 characters)and filing the issue without itsorigin/*provenance label.origin/governor(103),origin/selfreport(113) andhas-open-pr(111) descriptions to β€ 100 chars.GitHubLabelDescriptionMax = 100(crux/config, aliased in pkg/config) and a rune-safeclampLabelDescriptionapplied at every label create/edit call site (ensureOriginLabel,EnsureIssueLabel,ensureCreateIssueLabel, stage-label ensure).changelog.d/fixed-15683-label-description-length.md.Closes #15683
Closes #15681