Skip to content

πŸ› github: keep label descriptions within GitHub's 100-char cap - #15685

Merged
clubanderson merged 1 commit into
v5from
fix/label-desc-len
Oct 30, 2026
Merged

clubanderson merged 1 commit into
v5from
fix/label-desc-len

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Summary

Every CreateIssue was logging could not ensure label, creating without it label=origin/governor … 422 description is too long (maximum is 100 characters) and filing the issue without its origin/* provenance label.

  • Shorten origin/governor (103), origin/selfreport (113) and has-open-pr (111) descriptions to ≀ 100 chars.
  • Add GitHubLabelDescriptionMax = 100 (crux/config, aliased in pkg/config) and a rune-safe clampLabelDescription applied at every label create/edit call site (ensureOriginLabel, EnsureIssueLabel, ensureCreateIssueLabel, stage-label ensure).
  • Tests: every catalog label description (origin, escalation, stage family, standalone constants) fits the cap; clamp trims, preserves exact-length input and cuts multibyte input on a rune boundary.
  • Changelog fragment changelog.d/fixed-15683-label-description-length.md.

Closes #15683
Closes #15681

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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign danathar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#15680 πŸ› review: one backlog issue per finding; carried-over notes never refile same files src/pkg/github/issue_request_watcher.go
#15668 πŸ› Lead 090 merge-gate action is Approve and let hive merge same files src/pkg/github/client.go
#15673 πŸ› issues the hive files carry the filing agent in the title same files src/pkg/github/issue_request_watcher.go

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@clubanderson
clubanderson merged commit a733683 into v5 Oct 30, 2026
77 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/label-desc-len branch October 30, 2026 04:55
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

1 participant