fix(sdk,core): make TrackingEvent.description optional end-to-end#1077
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Carriers can return events with null/missing descriptions (e.g. SmartKargo MDL events). The unified SDK model required `description` as a positional argument, so connectors hit `TrackingEvent.__init__() missing 1 required positional argument: 'description'` and the whole tracking response failed with a 500 even though the upstream call succeeded. Two coordinated changes so a null description from any carrier survives the full pipeline (SDK → server serializer → JSON response): - modules/sdk/karrio/core/models.py: default `description` to None on the unified TrackingEvent — aligns with every other field on the type. - modules/core/karrio/server/core/serializers.py: add allow_blank+allow_null to the DRF TrackingEvent.description field so the API serializer accepts and round-trips null descriptions, matching siblings (time, code, status). Django storage is unaffected — Tracking.events is a JSONField, no per-field constraints. GraphQL TrackingEventType already has description Optional[str].
Dan (danh91)
force-pushed
the
hotfix/tracking-event-description-optional
branch
from
April 29, 2026 03:56
77cb12e to
10009e2
Compare
Hotfix release for null description on tracking events. Lookups against carriers whose upstream omitted/nulled `description` on any single event returned a 500 with `TrackingEvent.__init__() missing 1 required positional argument: 'description'` because the unified SDK model required `description` as a positional and the DRF serializer didn't allow nulls. The SDK `models.TrackingEvent.description` now defaults to None and the DRF `TrackingEvent.description` field sets allow_blank=True, allow_null=True so a null description from any carrier survives the SDK → server → API JSON round-trip. Django storage (JSONField) and GraphQL (Optional[str]) were already permissive.
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.
Bug
Tracking calls against carriers whose upstream omitted (or nulled) the
descriptionfield on any single event returned500with:Reproduced in production against SmartKargo with request_log
29962— theMDLevent in the response has"description": null, which propagated through the carrier schema ase.description = None. Every connector that handsdescription=e.descriptionstraight into the unified model has the same exposure.Root Cause Audit
description: str— required positionalCharField(required=False)— missingallow_blank/allow_nullevents = JSONField(...)— no per-field constraints, finedescription: typing.Optional[str] = None— already fineFix
Two coordinated edits so a null description survives the SDK → server → API JSON round-trip:
Tests
No SDK test existed for
TrackingEventpreviously — adding one for a one-line attrs default would be ceremonial. Server-level: existing tracker tests round-tripeventsthrough the JSONField, and the serializer change just bringsdescriptionin line with siblings (time,code,status). Production smoke: the SmartKargo MDL payload from request_log29962is the regression to watch.