feat: Implement tier-aware repo limits (#94, #95)#100
Merged
DevanshuNEU merged 1 commit intoDec 13, 2025
Conversation
…el#95) ## Features - Add RepoValidator service to analyze repo size before indexing - Replace hardcoded cost_controller with tier-aware user_limits - Enforce repo count limits per tier (Free: 3, Pro: 20, Enterprise: unlimited) - Enforce repo size limits per tier (Free: 500 files, Pro: 5000, Enterprise: 50000) - Return detailed limit_check info for frontend upgrade prompts ## Security (Fail-Closed Design) - RepoAnalysis.success flag to detect analysis failures - Block indexing if analysis fails (prevents unknown-size repo indexing) - Validate repo_path is not empty/None/whitespace - Validate repo_path exists and is a directory - Skip symlinks during scan (prevent directory traversal) - MAX_FILE_SIZE_BYTES (10MB) limit prevents OOM on huge files - Propagate scan errors (permission denied, etc.) - don't silently undercount - Validate user_id before any operations - All three endpoints (add_repo, index, websocket) check analysis.success ## Error Handling - Sentry integration for all error paths - Structured logging with context - Detailed error messages for debugging Closes OpenCodeIntel#94, OpenCodeIntel#95
|
@DevanshuNEU is attempting to deploy a commit to the Dev's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
Summary
Implements tier-based repository count and size limits, replacing the old hardcoded
cost_controllerwith the newuser_limitsservice from #96.Changes
New Files
backend/services/repo_validator.py- Analyzes repo size (file count, estimated functions) before indexingModified Files
backend/routes/repos.py- Usesuser_limits+repo_validatorinstead ofcost_controllerbackend/dependencies.py- Addedrepo_validatorimportFeatures
Repo Count Limits (#95)
Repo Size Limits (#94)
Security (Fail-Closed Design)
error,success=Falseerror,success=Falseis_symlink()checkMAX_FILE_SIZE_BYTES = 10MBlimitanalysis.successcheck blocks indexingAPI Response Changes
POST /repos (add repository)
{ "repo_id": "...", "status": "added", "indexing_blocked": false, "analysis": { "file_count": 47, "estimated_functions": 1175, "sampled": false, "success": true }, "message": "Repository added successfully. Ready for indexing." }When blocked (403)
{ "allowed": false, "current": 3, "limit": 3, "tier": "free", "error_code": "REPO_LIMIT_REACHED", "message": "Repository limit reached (3/3). Upgrade to add more repositories." }Testing
Follow-up
Created #99 for cleanup items (remove unused cost_controller, add unit tests)
Closes #94
Closes #95