Skip to content

Add rate limiting, retry logic, and error handling infrastructure#6

Merged
hyperpolymath merged 1 commit intomainfrom
claude/analyze-repo-improvements-cJLX5
Apr 9, 2026
Merged

Add rate limiting, retry logic, and error handling infrastructure#6
hyperpolymath merged 1 commit intomainfrom
claude/analyze-repo-improvements-cJLX5

Conversation

@JoshuaJewell
Copy link
Copy Markdown
Owner

Summary

This PR introduces critical infrastructure for production-ready feedback submission: per-platform rate limiting with token bucket algorithm, exponential backoff retry logic with jitter, structured error types, and comprehensive audit logging. Also includes network verification improvements and test coverage for new modules.

Key Changes

Core Infrastructure

  • Rate Limiter (rate_limiter.ex): GenServer-backed token bucket rate limiting per platform using ETS for concurrent access. Configurable max requests, time windows, and cooldowns. Prevents AI agents from accidentally spamming platforms.
  • Retry Logic (retry.ex): Exponential backoff with jitter for transient failures. Distinguishes retryable errors (network, 5xx) from non-retryable ones (auth, validation, 4xx).
  • Structured Errors (error.ex): Replaces generic error tuples with specific exception types: AuthenticationError, RateLimitError, NetworkError, ValidationError, PlatformError, DuplicateError. Provides actionable error information for AI agents.
  • Audit Logging (audit_log.ex): JSON-lines audit trail with session tracking, event classification, and sensitive field sanitization. Logs submissions, network checks, deduplication, and credential rotation.

Network Verification Enhancements

  • Certificate Transparency: Implemented real CT log queries via crt.sh API instead of stub
  • RPKI Validation: Added Cloudflare RPKI API integration for route origin validation
  • BGP Origin Verification: Implemented ASN lookup and RPKI validity checking
  • ASN Lookup: Team Cymru DNS-based ASN resolution for IP addresses

Channel Improvements

  • Enhanced error classification in GitHub, GitLab, Bitbucket, Codeberg, and Bugzilla channels
  • Structured error responses instead of generic error maps
  • Better handling of authentication and rate limit responses

Testing & CI

  • Comprehensive unit tests for rate limiter, retry logic, credentials, and audit logging
  • Integration tests for channel adapters with credential validation
  • GitHub Actions CI workflow for Elixir (test + Dialyzer on multiple OTP versions)
  • Test coverage for error handling and edge cases

Documentation & Project Updates

  • Added CONTRIBUTING.adoc with language policy, setup instructions, and development guidelines
  • Updated Zig FFI to use concrete feedback_o_tron_* function names instead of templates
  • Updated project state to version 1.0.0 and production status
  • Fixed template placeholders in Zig test suite and build configuration

Integration

  • Integrated RateLimiter and Retry into Submitter for production-ready submission flow
  • Added RateLimiter to application supervision tree
  • Proper error propagation through submission pipeline

Notable Implementation Details

  • ETS-backed rate limiting: Public read concurrency for fast checks without lock contention
  • Atomic acquire operation: Check and record in single GenServer call to prevent race conditions
  • Jitter in backoff: Prevents thundering herd when multiple agents retry simultaneously
  • Sensitive field sanitization: Audit logs automatically strip tokens, passwords, and API keys
  • Per-platform configuration: Each platform has independent rate limits and cooldowns tuned to API characteristics
  • Retryable error classification: Network errors and 5xx responses retry; auth/validation errors fail fast

https://claude.ai/code/session_01CdyQBqSt5j3WRoveJWKyip

…etry, BGP/RPKI, tests, CI

- Complete NetworkVerifier BGP/RPKI checks via Team Cymru DNS and Cloudflare RPKI API
- Implement Certificate Transparency lookup via crt.sh
- Complete Zig FFI bridge: replace template placeholders, add feedback-specific ops
  (compute_hash, generate_id, validate_https), update version to 1.0.0
- Add structured error types (AuthenticationError, RateLimitError, NetworkError,
  ValidationError, PlatformError, DuplicateError) replacing generic error tuples
- Add per-platform RateLimiter with token bucket algorithm and configurable limits
- Add Retry module with exponential backoff, jitter, and retryable error classification
- Integrate RateLimiter and Retry into Submitter
- Update all channel adapters (GitHub, GitLab, Bitbucket, Codeberg, Bugzilla) to
  return structured errors
- Add comprehensive test suite: credentials, audit_log, rate_limiter, retry,
  channel registry, integration tests for all channel adapters
- Add Elixir CI pipeline: multi-version matrix, format check, dialyzer
- Synchronize STATE.a2ml to v1.0.0 production status
- Add CONTRIBUTING.adoc with language policy, dev guidelines, architecture overview

https://claude.ai/code/session_01CdyQBqSt5j3WRoveJWKyip
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@hyperpolymath hyperpolymath merged commit 9b57b45 into main Apr 9, 2026
18 of 25 checks passed
@hyperpolymath hyperpolymath deleted the claude/analyze-repo-improvements-cJLX5 branch April 9, 2026 21:16
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.

3 participants