ReferenceOperations & Edge Cases

Operations & Edge Cases

This page documents how the analyzer behaves under real GitHub API constraints and imperfect repository conditions.

API Call Budget

Each repository analysis requires approximately five to six GitHub API calls:

  1. GET /repos/{owner}/{repo}
  2. GET /repos/{owner}/{repo}/contributors?per_page=1
  3. GET /repos/{owner}/{repo}/commits?since=…&per_page=1
  4. GET /repos/{owner}/{repo}/languages
  5. GET /repos/{owner}/{repo}/git/trees/{branch}?recursive=1
  6. GET /repos/{owner}/{repo}/contents/package.json when needed for JavaScript repositories

Rate Limit Strategy

TierMechanismResponsibility
1Octokit throttlingRetries once with backoff when rate-limited
2Proactive budget checkStops early when remaining quota is too low
3UI rate-limit indicatorShows remaining requests and reset timing
ModeLimitApproximate repos per hour
No token60 requests per hourAbout 10
With token5000 requests per hourAbout 830

Cache Behavior

The cache is an in-memory Map with a 10-minute TTL keyed by normalized owner/repo values.

  • Good fit for repeated analysis in a single process
  • Resets on server restart or serverless cold start
  • Kept intentionally simple to avoid introducing storage dependencies

Edge Cases

ScenarioBehavior
Private repositoryReturns a per-repo access denied error while other repos continue
Missing repositoryReturns a repository not found error
Empty repositoryMetrics default near zero and the result trends Beginner
Huge repo over 100k filesGit Tree truncation leads to file count estimation
Invalid URLRejected by client validation and server sanitization
Non-GitHub URLRejected before analysis proceeds
No recent commitsActivity still uses the other four metrics
Rate limit exhaustedReturns 429 with reset time
Network timeoutClient request times out and surfaces a user-facing error
Partial sub-fetch failureFailed sub-metrics default safely so one issue does not drop the whole batch

Large Repository Handling

When the tree API reports truncated: true, the file count is estimated as:

estimatedFileCount=returnedCount×1.5\mathrm{estimatedFileCount} = \mathrm{returnedCount} \times 1.5

This is deliberately conservative. The score is still usable, but it should be understood as an approximation.

Failure Isolation

The analyzer is designed so one bad repository should not poison the entire batch. That is why per-repository failures are returned alongside successful analyses rather than aborting the whole request.