Skip to content

feat: Add 250-character limit validation for username input with comprehensive feedback#4

Draft
kertal with Copilot wants to merge 3 commits into
experiment-github-agentfrom
copilot/fix-bf8b167e-52c6-4527-95fa-cc9d5da4eefc
Draft

feat: Add 250-character limit validation for username input with comprehensive feedback#4
kertal with Copilot wants to merge 3 commits into
experiment-github-agentfrom
copilot/fix-bf8b167e-52c6-4527-95fa-cc9d5da4eefc

Conversation

Copilot AI commented Aug 10, 2025

Copy link
Copy Markdown
Contributor

Problem

Users could enter or share links with excessively long username lists that could cause performance issues and API rate limiting. The application lacked validation to prevent username combinations exceeding reasonable character limits.

Solution

This PR implements a comprehensive 250-character limit validation system that works across all username input scenarios:

✅ Manual Entry Validation

When users manually type usernames that exceed 250 characters total, they receive immediate feedback:

Username list is too long (312 characters). Please limit the combined usernames to 250 characters.

✅ URL Restoration Validation

When users access shared links with excessive username parameters, validation errors are displayed and search operations are prevented:

// Example URL that would trigger validation
/git-vegas/?username=verylongusername1,verylongusername2,verylongusername3...

✅ Search Operation Protection

The validation is integrated into the core search flow, ensuring that:

  • validateSearchParams() checks username character limits before API calls
  • validateUsernameList() provides accurate character counts in error messages
  • URL parameter processing shows validation errors for shared links

Technical Implementation

Core Validation (src/utils.ts)

  • Enhanced validateUsernameList() to count total character length of all usernames
  • Provides precise character count feedback (e.g., "252 characters" when limit exceeded)

Search Integration (src/utils/githubSearch.ts)

  • Updated validateSearchParams() to use username validation
  • Ensures character limits are enforced before expensive API operations

URL Handling (src/hooks/useGitHubFormState.ts)

  • Enhanced URL parameter processing to display validation errors
  • Users see clear feedback when accessing invalid shared links

Testing

Added comprehensive test coverage including:

  • Exact 250-character boundary testing (valid case)
  • 251+ character testing (invalid cases)
  • URL restoration scenarios with both valid and invalid character limits
  • Integration tests ensuring validation works across all entry points

User Experience

  • Clear feedback: Users see exactly how many characters they've used
  • Prevention: Invalid operations are blocked before API calls
  • Consistency: Same validation applies to manual entry and URL restoration
  • Accessibility: Error messages are descriptive and actionable

This ensures better performance, prevents API abuse, and provides a consistent user experience across all username input methods.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/users/urluser
    • Triggering command: node (vitest 1) (http block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 10, 2025

Copy link
Copy Markdown

Deploying git-vegas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 834d0ea
Status: ✅  Deploy successful!
Preview URL: https://b6f6429f.git-vegas.pages.dev
Branch Preview URL: https://copilot-fix-bf8b167e-52c6-45.git-vegas.pages.dev

View logs

Copilot AI and others added 2 commits August 10, 2025 20:40
Co-authored-by: kertal <463851+kertal@users.noreply.github.com>
Co-authored-by: kertal <463851+kertal@users.noreply.github.com>
Copilot AI changed the title [WIP] Enforce 250-character limit for usernames in link and input with feedback feat: Add 250-character limit validation for username input with comprehensive feedback Aug 10, 2025
Copilot AI requested a review from kertal August 10, 2025 20:49
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.

2 participants