Repository navigation
Redact unexpected errors and harden the request contract - #1
Merged
Merged
Conversation
- Unexpected errors were logged with logger.exception: message, traceback and
concrete path, which can quote notification content and context values.
They are now one redacted line (class, request id, method, route pattern),
with X-Request-Id on the 500, Django's duplicate record suppressed, and an
optional VINTASEND_UNHANDLED_ERROR_HANDLER checked at startup.
- Request bodies follow the contract's media-type rule, and malformed JSON is
answered in the error envelope instead of Ninja's bare {"detail": ...}.
- Every 400 carries details.issues.
- hasMore means the next page has a row.
- FORBIDDEN (403) is a new code, declared on every authenticated route.
- openapi.yaml is byte-identical to vintasend-ts-api's again, and a test pins
the routes' declared statuses to it; the test client fails any test that
receives a 4xx its route does not declare.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 9, 2026
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
Brings this implementation back in line with the shared contract in
vintasend-ts-api, and stops logging whole errors.Logging (PHI)
Unexpected errors were logged with
logger.exception: the message, the traceback and the concrete path, any of which can quote notification content, recipients or context values. They are now one redacted line: the error class, a request id, the method and the route pattern. This matches the templates management API.X-Request-Id.django.requestrecord is suppressed.VINTASEND_UNHANDLED_ERROR_HANDLER(optional, may beasync) takes over reporting for an error tracker with its own scrubbing. If it raises, the redacted line is logged instead.manage.py checkwhen that handler cannot be imported.Contract
application/json(orapplication/*+json) must carry a valid JSON object. A request declaring no media type or another one counts as an omitted body when empty, and is a 400 otherwise. Malformed JSON is answered in the error envelope, no longer as Ninja's bare{"detail": …}.details.issues.hasMoremeans the next page has a row.FORBIDDEN(403): new code, declared on every authenticated route. This server does not produce it yet.openapi.yamlis byte-identical tovintasend-ts-api's again; it had drifted.Tests
test_contract.pypins every route's declared statuses toopenapi.yaml.Testing
Release
Behaviour change for clients sending bodies without
Content-Type: application/json, and for deployments relying on tracebacks in the logs; see the 3.3.0 release notes in thevintasendrepository.Related PRs
Python
TypeScript
Python: merge the two API PRs, then the release notes. TypeScript: merge the package PRs, then vintasoftware/vintasend-ts#15, then run the release.
🤖 Generated with Claude Code