fix: reject invalid repo names in provisioning before hitting GitHub - #38
Merged
Conversation
## Why `REPO_NAME_RE = /^[a-zA-Z0-9._-]+$/` accepted names that GitHub itself rejects: leading `.`, leading `-`, names ending in `.git`, lone `.` or `..`, or strings over 100 chars (GitHub's hard limit). Result: validation passes locally, the bot enqueues a `provision-repo` task, the GitHub call 422s, the user sees a generic "❌ Failed to create repository: ..." comment and has to re-file the form. Wasted task, wasted GitHub call, terrible UX. ## What Tighten validation in `src/provisioning.js`: - Length cap at 100 chars - Reject leading `.` or `-` - Reject the reserved `.` and `..` bare names - Reject names ending in `.git` - Reject empty/whitespace-only after trim Each rejection emits a specific user-readable message rather than the generic "Invalid repository name". ## Source Wave-1 QA bug-hunter and Junior dev both flagged this as Bug #25 in `docs/agent-fleet/bugs.md`. ## Test plan - [x] 814 tests pass (was 806; +8 covering each new rejection path plus a "well-formed name with allowed punctuation" sanity case) - [x] eslint clean ## Risk & rollout - Risk: low. Only tightens validation; no name that previously succeeded at GitHub now fails locally. - Rollout: self-update on merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Fixes Bug #25 from
docs/agent-fleet/bugs.md(wave-1 QA bug-hunter + Junior dev).Tightens
REPO_NAME_REto match GitHub's actual acceptance rules: length ≤ 100, no leading./-, not./../empty, no.gitsuffix. Each rejection has a specific message.🤖 Generated with Claude Code