Skip to content

fix: reject invalid repo names in provisioning before hitting GitHub - #38

Merged
avrabe merged 1 commit into
mainfrom
fix/repo-name-validation
May 1, 2026
Merged

fix: reject invalid repo names in provisioning before hitting GitHub#38
avrabe merged 1 commit into
mainfrom
fix/repo-name-validation

Conversation

@avrabe

@avrabe avrabe commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Fixes Bug #25 from docs/agent-fleet/bugs.md (wave-1 QA bug-hunter + Junior dev).

Tightens REPO_NAME_RE to match GitHub's actual acceptance rules: length ≤ 100, no leading ./-, not ./../empty, no .git suffix. Each rejection has a specific message.

  • 814 tests pass (+8)
  • eslint clean

🤖 Generated with Claude Code

## 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>
@avrabe
avrabe merged commit 1915929 into main May 1, 2026
5 checks passed
@avrabe
avrabe deleted the fix/repo-name-validation branch May 1, 2026 07:14
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.

1 participant