validate: catch config GitHub rejects, before it is merged - #77
Closed
dev-milos wants to merge 1 commit into
Closed
Conversation
Two values pass validation today and are only rejected by GitHub during apply. Apply runs after merge, so the bad config is already on main and every later apply fails until someone pushes a fix. The plan a reviewer sees is clean, so there is no signal at review time. Team names now fold to the slug GitHub derives, not to lower case. Two names that differ only by a separator -- "Foo Bar" and "Foo-Bar" -- both slugify to foo-bar. GitHub does not reject the second, it appends a numeric suffix, and which team gets it depends on creation order. The configuration is keyed by name but imported and addressed by slug, so that suffix makes the import ID unpredictable. The existing rule already gave this rationale for case, it just did not apply it to the rest of the transformation. Case-only collisions keep their original message. A name that is only whitespace satisfied minLength=1 and reached GitHub, which answers 422 Name can't be blank. Topics were unconstrained. GitHub caps them at 20 per repository and requires each to start with a lowercase letter or digit, contain only lowercase letters, digits and hyphens, and be at most 50 characters -- all three confirmed against the API.
dev-milos
marked this pull request as draft
August 27, 2026 14:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while exercising the organisation features at a larger shape than the release was tested at.
Two kinds of value pass
validatetoday and are rejected only by GitHub, during apply. Apply runs after merge, so by the time the failure appears the config is already onmainand every later apply fails until someone pushes a fix. The plan a reviewer sees is clean, so review has no signal to act on.Team names now fold to the slug, not to lower case
Foo BarandFoo-Barboth slugify tofoo-bar. GitHub does not reject the second — it appends a numeric suffix, and which of the two receives it depends on creation order. The configuration is keyed by name but imported and addressed by slug:so an unpredictable suffix makes the import ID unpredictable. The existing rule already gave exactly this rationale — "names differing only in case produce the same GitHub team" — it just applied it to case alone rather than to the rest of the transformation. Case-only collisions keep their original message; separator collisions get one naming the derived slug.
Slug derivation was established against the API, not assumed: separators (space,
.,/,&) collapse to a single hyphen, underscores survive, Latin accents transliterate, surrounding whitespace is trimmed. Where a name folds to nothing — a fully non-Latin script — the check falls back to the previous behaviour rather than guessing, so it cannot reject a valid pair.A name that is only whitespace satisfied
minLength=1and reached GitHub, which answers422 Name can't be blank. Now rejected.Topics were unconstrained
The schema placed no limit on them. Confirmed against the API:
422 A repository cannot have more than 20 topics.422 must start with a lowercase letter or number …UpperCase,with.dot,topic with spaces4229livesEncoded as
maxItems: 20and^[a-z0-9][a-z0-9-]{0,49}$per item.Verification
go test ./...passes, existing cases unchangedvalidatewith the offending index named, instead of planning cleanvalidateandvalidate-orgboth run clean against the realgr-oss-developersconfiguration, including itsplatform_coreandrelease_engineeringteams — no false rejectionrepositories.gois one line: the file is notgofmt-clean onmain, so reformatting it would have buried the change in ~80 lines of realignment. The schema hook lives in its own file instead.