- Replace nested if-let statements with let-chain pattern for VmRSS memory parsing in /proc/self/status
- Replace nested if-let statements with let-chain pattern for Redis used_memory parsing
- Wrap std::env::set_var calls in unsafe blocks in validation_tests.rs for MAX_BYTES_LIMIT and MAX_AMOUNT_LIMIT
- Replace nested if-let statements with let-chain pattern for Redis RPS parsing
- Update module reference from monitoring to monitoring_impl in monitoring.rs
- Change Rust edition from "2026" to "2024" in workspace Cargo.toml
- Remove duplicate expect_used lint rule from workspace lints
- Prefix unused account variable with underscore in calculate_usage_cost
- Split CARGO_MANIFEST_DIR assignment into separate variable in run_migrations
- Clone plan_id before moving plan in add_rating_plan handler
- Replace expect() with unwrap() in governor
- Add module-level documentation to lib.rs with usage example
- Document Claims and AuthConfig structs with examples in auth.rs
- Add ChargingEngine struct documentation with initialization example
- Document ChargingRule, SubscriberAccount, AccountStatus, UsageEvent, UsageType, and RatingPlan with examples in types.rs
- Add CircuitState, CircuitBreakerError, and CircuitBreaker documentation with examples in circuit_breaker.rs
- Change Redis key prefix from "block:" to "blocked:" in unblock_user for consistency
- Replace is_some() check with if let pattern in block_user to avoid unused variable
- Add existence check before attempting to delete blocked user key in unblock_user
- Use if let pattern for blocked status check in unblock_user
- Return Ok(()) silently if user is not blocked instead of attempting deletion
- Set applied_rules capacity to 6 (maximum number of charging rules that can be applied)
- Set keys capacity to 100 in get_usage_history and get_all_accounts (matches SCAN batch size)
- Add comments explaining capacity choices for each Vec initialization
- Change AuthConfig::from_env() return type from Self to Result<Self, String>
- Remove default JWT_SECRET fallback, require environment variable to be set
- Add validation requiring JWT_SECRET to be at least 32 characters for security
- Replace expect() with ok_or_else in create_token timestamp calculation
- Replace expect() with map_err in DATABASE_URL environment variable loading
- Remove unused _account variable in calculate_usage_cost
- Replace HashMap::with_capacity with HashMap::new and use iterator chain in get_all_plans
- Add std::process::Command import and set current_dir to repo root in run_migrations
- Add comment explaining directory change to locate migrations folder
- Replace expect() with unwrap_or_else providing fallback JSON in SubscriberAccount and UsageEvent
- Add thiserror::Error derive to ChargingError enum
- Replace manual fmt::Display implementation with #[error] attributes on each variant
- Remove manual std::error::Error implementation (provided by thiserror)
- Remove std::fmt import as it's no longer needed
- Maintain same error message formats and functionality
- Remove clone() from rating plan parameter in add_rating_plan call
- Remove clone() calls from ChargingEngineClient and EbpfManager initialization
- Remove clone() from Redis client Arc wrapping
- Remove clone() calls from PacketGatewayConfig field assignments
- Replace expect() with proper error handling using map_err and anyhow in health check server
- Remove clone() from IP string in session data collection
- Add cargo-audit metadata section with placeholder for ignored advisories
- Forbid unsafe_code at workspace level
- Enable all and pedantic clippy warnings
- Deny unwrap_used, expect_used, and panic to enforce error handling
- Add thiserror dependency to charging-engine for improved error handling
- Add std::process::Command import for running external commands
- Implement run_migrations function to execute goose postgres migrations
- Call run_migrations in RatingPlansRepo::connect before returning repository instance
- Update function comments to reflect automatic migration execution on startup
- Add error handling and output capture for migration failures
- Add tracing log for successful migration
- Remove CREATE TABLE IF NOT EXISTS query for rating_plans table from connect() method
- Update comment to reference migration system (make db-migrate) instead of inline schema creation
- Add note that rating_plans table is created by 000001_init_rating_plans.up.sql migration
- Remove sqlx::query execution and error mapping for schema creation
- Keep database connection pool and circuit breaker initialization
- Remove duplicate CreditManager and RatingPlansRepo imports from engine.rs
- Add circuit_breaker module to main.rs imports
- Comment out rate_limit module in lib.rs
- Update rate_limit.rs imports to use GovernorConfig and GovernorLayer directly
- Change GovernorConfigBuilder to GovernorConfig::builder() and update config initialization
- Update GovernorLayer::new() to take config reference
- Remove thiserror 2.0.18 dependency from Cargo.toml
- Comment out CircuitBreakerError import and all circuit breaker execute calls in credit_management.rs
- Comment out redis_circuit_breaker and postgres_circuit_breaker fields in ChargingEngine struct
- Comment out circuit breaker initialization code in engine.rs
- Comment out circuit_breaker field and initialization in RatingPlansRepo
- Remove circuit breaker
- Change create_rate_limiter return type from InMemoryState/DefaultClock to StateInformationMiddleware with QuantaClock
- Add StateInformationMiddleware import from governor::middleware
- Add Arc import from std::sync
- Remove explicit key_extractor field from GovernorLayer initialization
- Upgrade tower_governor from 0.4.2 to 0.8.0 and add governor 0.10.4 dependency
- Add thiserror 2.0.18 for error handling
- Update dev dependencies: tokio-test to 0.4.5, mockall to 0.14.0, serial_test to 3.4.0
- Add Copy trait to CircuitState enum
- Add Clone derive to CircuitBreaker struct
- Add error trait bounds to CircuitBreakerError generic type
- Update create_rate_limiter return type to use explicit generic parameters
- Fix Go
- Add ENFORCE_AUTH environment variable with true default to auth middleware
- Add early return when ENFORCE_AUTH=false for development/testing bypass
- Replace development comment with UNAUTHORIZED status code when no valid authentication found
- Move authentication bypass logic from end of function to environment-based check at start
- Add rate_limit module to lib.rs exports
- Add create_rate_limiter function with SmartIpKeyExtractor for IP-based limiting
- Add RATE_LIMIT_RPS environment variable with 10 requests/second default
- Add RATE_LIMIT_BURST environment variable with 20 burst size default
- Add RateLimitResponse struct with TOO_MANY_REQUESTS status code
- Add GovernorLayer with per_second quota and burst_size configuration to router
- Add CircuitState enum with Closed, Open, and HalfOpen states
- Add CircuitBreakerError enum wrapping Open state and inner errors
- Add CircuitBreaker struct with failure_count, failure_threshold, timeout, and last_failure_time fields
- Add execute method with async operation wrapper and state-based error handling
- Add check_state method with automatic Open to HalfOpen transition after timeout
- Add on_success method
- Add rounding to monthly fee conversion to cents to prevent precision loss
- Replace direct subtraction with saturating_sub to prevent i64 underflow
- Add fee_cents variable for clearer monthly fee calculation in billing cycle
- Add current balance retrieval before credit increment operation
- Add checked_add validation to prevent u64 overflow when adding credits
- Add InvalidInput error return when credit addition would cause overflow
- Add overflow check between get and incr operations on Redis credit key
- Add api_keys field to AuthConfig struct
- Parse API_KEYS environment variable as comma-separated list in from_env
- Add validate_api_key method to AuthConfig for key verification
- Add X-API-Key header check in auth_middleware before JWT validation
- Update comments to clarify development/testing mode for unauthenticated requests
- Add auth module import to main.rs
- Add AuthConfig initialization from environment in main function
- Add auth_config field to AppState struct
- Add auth_middleware layer to protected routes
- Move health check, credit check, deduct, balance, and usage recording to public routes (no auth required for packet-gateway integration)
- Move add credit, subscriber management, rating plans, monitoring, and engine
- Add Claims struct with sub and exp fields for JWT payload
- Add AuthConfig struct with secret field loaded from JWT_SECRET environment variable
- Add create_token function generating 24-hour expiration tokens
- Add validate_token function for JWT verification
- Add auth_middleware for Axum with Authorization header Bearer token validation
- Allow unauthenticated requests temporarily for packet-gateway integration
- Add credit_management_tests.rs with tests for SubscriberAccount, UsageEvent, UsageType, AccountStatus, and integer arithmetic operations
- Add error_tests.rs with tests for ChargingError Display implementation, cloning, and log_error function
- Add rating_billing_tests.rs with tests for ChargingRule variants, as_str conversion, billing period parsing, timestamp filtering, and cost calculations
- Add validation_tests.rs with tests for validate_bytes, validate
- Add DatabaseError(String) variant to ChargingError enum
- Add DatabaseError case to log_error helper with error-level logging
- Add DatabaseError Display implementation
- Refactor IntoResponse to use generic error messages instead of detailed strings
- Add detail field to error responses containing full error message via to_string()
- Change RedisConnection status code from INTERNAL_SERVER_ERROR to SERVICE_UNAVAILABLE
- Replace RedisOperation error variant with DatabaseError in new/get/list_map/add/remove methods
- Update 5 map_err calls to use DatabaseError for SQLx operation failures
- Replace float division with integer arithmetic in calculate_usage_cost for data/voice conversions
- Add checked_add overflow protection for usage accumulation in apply_charging_rules and process_usage
- Replace String-based charging rules with ChargingRule enum variants
- Add Datelike import and implement billing period filtering in generate_invoice
- Replace blocking KEYS command with SCAN cursor iteration
- Replace unwrap_or(0) with map_err for get operation in deduct_credit
- Replace unwrap_or(0) with ? operator in check_credit
- Add RedisOperation error mapping for current_balance retrieval
- Remove dead_code attributes from get_balance/add_credit/start/stop/uptime/rating plan methods in credit_management and engine
- Remove dead_code attributes from calculate_usage_cost in rating_billing
- Remove dead_code attributes from get/list_map/deactivate methods in rating_plans_repo and row_to_plan function
- Remove dead_code attributes from get_performance_metrics/start_background_sync in monitoring modules
- Add POST /v1/usage/calculate-cost endpoint to calculate usage cost for events
- Add POST /v1/usage/rate endpoint to rate usage events
- Add POST /v1/usage/process endpoint for full rating and billing processing
- Add GET /v1/invoice/:imsi/:period endpoint to generate invoices for billing periods
- Add list_map call to list_rating_plans handler for internal lookups
- Add session_id validation to all usage endpoints using validate_session_id helper