Skip to content

fix(api): resolve compilation errors and complete backend hardening refactor#1021

Open
chidinma000 wants to merge 1 commit into
solutions-plug:mainfrom
chidinma000:added
Open

fix(api): resolve compilation errors and complete backend hardening refactor#1021
chidinma000 wants to merge 1 commit into
solutions-plug:mainfrom
chidinma000:added

Conversation

@chidinma000

Copy link
Copy Markdown
Contributor

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

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant