fix(api): resolve compilation errors and complete backend hardening refactor#1021
Open
chidinma000 wants to merge 1 commit into
Open
fix(api): resolve compilation errors and complete backend hardening refactor#1021chidinma000 wants to merge 1 commit into
chidinma000 wants to merge 1 commit into
Conversation
|
@chidinma000 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Extracted body_redact, client_ip, and content_type from submodules into top-level modules; updated re-exports in audit and audit_middleware
Added PaginationQuery (with limit()/cursor() + Default) and PaginatedResponse to pagination.rs to satisfy handler usage
Rewrote compression.rs to use the correct tower-http predicate API — replaced Predicate::from_fn (non-existent) and NotForContentType::new(Vec) (wrong type) with a typed function pointer predicate
Fixed cache/mod.rs: moved clone() calls inside async closure captures to satisfy lifetime requirements; replaced mutable over_evicted binding with in-place discard; fixed hash computation to use stable string representation
Fixed handlers.rs: added missing status_code arg to three observe_request calls; fixed seven warm! macro invocations that called .map() on unawaited futures
Added newsletter_rate_limit_middleware and admin_rate_limit_middleware to rate_limit.rs
Added content_type_validation_middleware, request_size_validation_middleware, and request_validation_middleware to validation.rs
Fixed email/service.rs: replaced removed cache.manager field access with cache.get_connection().await
Fixed config.rs: corrected unwrap_or_else closures to accept the error argument (|_|)
Fixed main.rs: converted Box from config.validate() to anyhow::Error
Added fastrand and derive (sqlx) to Cargo.toml; switched testcontainers features to postgres
Test plan
cargo check --manifest-path services/api/Cargo.toml passes with zero errors
Existing unit tests pass (cargo test --manifest-path services/api/Cargo.toml)
Rate limiting middleware rejects requests above threshold with 429 Too Many Requests
Content-Type validation rejects non-JSON bodies on POST/PUT/PATCH with 415
Request size validation rejects bodies over 1 MB with 413
Cache warm-up endpoint completes without panicking
closes #970
closes #974
closes #979
closes #975