Skip to content

feat(playground): Anonymous repository indexing (#125)#131

Merged
DevanshuNEU merged 5 commits into
mainfrom
feat/125-anonymous-indexing
Dec 26, 2025
Merged

feat(playground): Anonymous repository indexing (#125)#131
DevanshuNEU merged 5 commits into
mainfrom
feat/125-anonymous-indexing

Conversation

@DevanshuNEU

Copy link
Copy Markdown
Collaborator

Anonymous Repository Indexing

Summary

Implements anonymous repository indexing for the playground, allowing users to index any public GitHub repository without authentication.

Changes

New Endpoints

  • POST /playground/index - Start indexing a public GitHub repo

    • Validates GitHub URL and repo accessibility
    • Enforces 200 file limit (or partial=true for large repos)
    • Returns 202 Accepted with job_id for polling
  • GET /playground/index/{job_id} - Check indexing status

    • Returns progress during processing
    • Returns repo_id on completion for search access
    • Returns error details on failure

New Files

  • services/anonymous_indexer.py - Job manager and background indexing task
  • tests/test_anonymous_indexing.py - 37 tests for new functionality

Bug Fixes (discovered during implementation)

  • Fixed create_session() signature mismatch
  • Fixed JSON serialization in validation error handler
  • Added missing capture_http_exception to sentry module

API Flow

POST /playground/index {github_url: "https://github.com/user/repo"}
  → 202 {job_id: "idx_abc123", status: "queued"}

GET /playground/index/idx_abc123
  → {status: "processing", progress: {percent_complete: 45}}
  → {status: "completed", repo_id: "anon_idx_abc123"}

Testing

  • 176 tests passing
  • Lint clean on touched files

Checklist

  • POST /playground/index endpoint
  • GET /playground/index/{job_id} endpoint
  • Background indexing with Redis job tracking
  • Partial indexing for large repos
  • Session management
  • Comprehensive tests

Closes #125

Checkpoint 1: Request validation and session management

- Add IndexRepoRequest Pydantic model with github_url and branch
- Add POST /playground/index endpoint (returns 202)
- Session validation: get existing or create new session
- Check has_indexed_repo: return 409 if session already has active repo
- Handle expired repos: allow re-indexing if existing repo expired
- Reuse GitHub validation logic from validate-repo endpoint
- Validate: URL format, repo exists, is public, file count <= 200

Next: Add job management and background indexing task
- Add partial=true parameter to index first 200 files of large repos
- Fix create_session() call - generate token before creating session
- Fix JSON serialization in validation error handler
- Add missing capture_http_exception function to sentry module
- Add comprehensive tests for anonymous indexing (30 tests)

All 169 tests passing.
- Poll endpoint for job status (queued/cloning/processing/completed/failed)
- Returns progress with percent_complete during processing
- Returns repo_id on completion for search access
- Returns error details on failure
- Handles partial indexing info
- 7 new tests for status endpoint

Checkpoint 3 complete. 176 tests passing.
@vercel

vercel Bot commented Dec 26, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
opencodeintel Ignored Ignored Preview Dec 26, 2025 6:10am

Comment thread backend/routes/playground.py Fixed
CodeQL flagged information exposure through exception.
Return generic 'error' string instead of str(e) to avoid
leaking internal details. Detailed errors still logged server-side.
@DevanshuNEU DevanshuNEU merged commit 61c13c6 into main Dec 26, 2025
10 checks passed
@DevanshuNEU DevanshuNEU deleted the feat/125-anonymous-indexing branch January 5, 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.

feat(backend): Anonymous indexing endpoint

2 participants