Skip to content

Keep TAGS.md topics within GitHub's rules so one bad tag cannot block the update - #226

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/ktsubuild-170-topic-limits
Oct 8, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
claude/ktsubuild-170-topic-limits

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #170

What changed

GitHubService replaces a repository's topics with a single PUT. GitHub rejects the whole set if there are more than 20 topics, or if any topic doesn't start with a letter or digit. When that happened the repository kept stale topics and the run only logged a warning. This follows the maintainer decision on the issue:

  • TagsParser.Parse now trims leading and trailing - from each topic and drops any topic that ends up empty. -foo becomes foo, and --- is removed.
  • After Distinct(), it keeps the first 20 topics (TagsParser.MaxTopics).
  • New overloads Parse(content, IBuildLogger?) and ParseAsync(path, IBuildLogger?, ct) log a warning that names the dropped topics. PipelineService passes its logger through. The existing overloads are unchanged and simply forward with no logger, so the public API stays binary-compatible.
  • A 422 on the topics PUT still doesn't fail the run.

Tests

Seven new TagsParserTests:

  • 25 tags parse to 20.
  • 22 tags log one warning that names tag21, tag22.
  • Exactly 20 tags log no warning.
  • Duplicates don't count toward the limit.
  • Leading and trailing hyphens are trimmed.
  • Topics made only of hyphens are dropped.
  • Every returned topic matches ^[a-z0-9][a-z0-9-]{0,49}$.

To check that the tests catch the bug, I removed the trim and the cap from the fixed code. Four of the new tests then failed: the limit test, both hyphen tests, and the regex guard. The full suite passes (771 tests). The local Sonar build reports nothing new in the changed files; its one PipelineService hit, S2325 at line 421, was already there.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CzB8uCZc7DWCamHvE3Qk4k


Generated by Claude Code

… the update

GitHub replaces a repository's topics in one PUT and rejects the whole set
when it holds more than 20 entries or a topic that does not start with a
letter or digit. TagsParser now trims leading and trailing hyphens, drops
topics left empty, and keeps the first 20, warning with the names of any it
drops. The 422 on the PUT stays non-fatal.

Fixes #170

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CzB8uCZc7DWCamHvE3Qk4k
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 7711d28 into main Oct 8, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the claude/ktsubuild-170-topic-limits branch October 8, 2026 04:46
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.

A TAGS.md with more than 20 topics, or a topic starting with '-', makes GitHub reject the whole topics update, and the failure is only a warning

2 participants