Log unmapped API errors (#288) - #293
Draft
leynos wants to merge 1 commit into
Draft
Conversation
Record diagnostics for unexpected domain exceptions that become HTTP 500 responses, preserving safe structured context through the logging port. Document the request-level resource logging boundary and cover all three fallback mappers directly.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueWarning Your free Security trial is over. An organization admin can activate billing to continue. Comment |
Reviewer's GuideThe PR adds centralized, traceback-enabled logging to all API error mapper fallbacks that produce HTTP 500 responses, documents the deliberate request-level logging boundary, fixes Python 3 exception syntax, and verifies the behavior with focused regression tests. Sequence diagram for unmapped API error loggingsequenceDiagram
participant Handler as API handler
participant Mapper as Error mapper
participant Logger as Central logging port
participant Falcon as Falcon response
Handler->>Mapper: map_profile_template_error(exc, entity_id)
Mapper->>Logger: log_error(logger, message, ..., exc_info=True)
Mapper-->>Falcon: HTTPInternalServerError
Falcon-->>Handler: HTTP 500 response
Sequence diagram for mapped API error request boundarysequenceDiagram
participant Handler as API handler
participant Mapper as Error mapper
participant Falcon as Falcon response
participant RequestLog as Request-level logging
Handler->>Mapper: map_reference_error(exc, context)
Mapper-->>Falcon: mapped HTTP 400/404/409 response
Falcon-->>Handler: HTTP response
Handler->>RequestLog: defer request-level logging
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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
This branch closes #288 by logging every unmapped domain exception that becomes
an HTTP 500 response through the centrally managed logging port. It also fixes
the Python 3 exception-clause syntax in the serializer, documents the
request-level logging boundary, and adds direct regression coverage.
Closes #288.
Review walkthrough
Validation
make check-fmt: passed.make lint: passed; the dedicated runner intermittently lost the final Skylos child, so the identical foreground Skylos command also completed with exit code 0.make typecheck: passed.make test: passed, 1,230 passed and 3 skipped.make markdownlint: passed.make nixie: passed.coderabbit review --agent: two actionable maintainability findings were addressed; the final two refactoring suggestions were declined as they would obscure the intentionally distinct mapper contracts and conflict with the repository's meaningful-test-documentation guidance.References
Summary by Sourcery
Add diagnostic logging for unmapped API errors while preserving their internal-error responses.
Bug Fixes:
Enhancements:
Tests:
Chores: