Backend feature: upload validation, metrics, health, custom errors#302
Open
Devdave-0x wants to merge 7 commits into
Open
Backend feature: upload validation, metrics, health, custom errors#302Devdave-0x wants to merge 7 commits into
Devdave-0x wants to merge 7 commits into
Conversation
- Add domain error types: FileError, DatabaseError, CacheError, AuthError, ExternalServiceError - Implement unified AppError with From conversions for all domain types - Map each variant to appropriate HTTP status code and machine-readable code - Add ErrorResponse struct with optional details field - Include unit tests for display, status mapping, and conversions
- Add ValidationConfig with max_size and allowed MIME type set - Implement validate_upload() with size, file name, and MIME checks - Magic-byte sniffing to detect actual MIME and compare with declared type - sanitize_file_name() strips path traversal and null bytes - Unit tests covering valid uploads, size limit, MIME mismatch, path traversal
- Add Counter, Gauge, and Histogram primitives with label support - Implement MetricsRegistry with HTTP, error, cache, DB pool, and file upload metrics - render() produces valid Prometheus text exposition format (v0.0.4) - metrics_handler() Axum handler for GET /metrics - RequestTimer RAII guard records request duration on drop - Unit tests for all primitives and registry methods
|
@Devdave-0x 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.
Implements backend upload validation, Prometheus metrics collection, health check endpoints, and a unified custom error type hierarchy. Four commits included: #206, #210, #211, #212.
closes #206
closes #210
closes #211
closes #212