Skip to content

canadapost: normalize tracking status mapping for padded event ids#970

Open
HansDaigle wants to merge 5565 commits intokarrioapi:mainfrom
HansDaigle:fix/canadapost-tracking-status-mapping
Open

canadapost: normalize tracking status mapping for padded event ids#970
HansDaigle wants to merge 5565 commits intokarrioapi:mainfrom
HansDaigle:fix/canadapost-tracking-status-mapping

Conversation

@HansDaigle
Copy link
Contributor

@HansDaigle HansDaigle commented Feb 19, 2026

Summary

  • add a canonical Canada Post tracking status map with explicit code to status normalization
  • normalize padded identifiers (for example 0100 -> 100) before status/reason lookup
  • support description-specific overrides for ambiguous codes (for example 1479)
  • expose code metadata (__description_en__, __description_fr__) in the mapping for maintainability
  • update tracking parser to use shared mapping helpers for shipment status and event status/reason

Tests

  • updated modules/connectors/canadapost/tests/canadapost/test_tracking.py expected parsed response for normalized statuses
  • added tests for padded ID normalization, description override behavior, and unknown fallback
  • executed python -m unittest discover -f tests in modules/connectors/canadapost

Ansh-Dev-Nagar and others added 30 commits January 20, 2026 19:28
danh91 and others added 21 commits February 14, 2026 06:30
Fix Cache.get() writing None to system cache instead of actual value
when syncing from shallow cache. Reduce DHL Parcel DE buffer_minutes
from 30 to 5 to prevent tokens from being considered immediately
expired when expires_in <= 1800s.
- Fix periodic_data_archiving running every minute by setting crontab to daily at midnight
- Always include feature flags in CONSTANCE_CONFIG with False default when module absent
- Replace naive datetime.now() with timezone.now() for Fee record queries
- Fix health status API double-slash URL causing 404
- Add keyword search field to tracing records filter
fix: resolve OSS admin bugs and developer tools issues
@vercel
Copy link

vercel bot commented Feb 19, 2026

@HansDaigle is attempting to deploy a commit to the karrio Team on Vercel.

A member of the Team first needs to authorize it.

@HansDaigle
Copy link
Contributor Author

Implementation note: Canada Post can emit the same event code with different event descriptions, and those variants can map to different normalized statuses. This PR handles that by supporting description-specific overrides in the status mapping, with a default fallback when no description-specific rule matches.

@HansDaigle
Copy link
Contributor Author

Updated this PR with an additional Canada Post tracking parser fix.

What changed:

  • handle responses where <tracking-detail> is the XML root node (not only nested)
  • added a regression test covering root tracking-detail payload shape

Why:

  • some real Canada Post tracking responses come back as root tracking-detail; previously this could produce empty tracking results and a 404 fallback.

@danh91
Copy link
Member

danh91 commented Mar 1, 2026

Merged into patch-2026.1.16 release branch.

@danh91 danh91 closed this Mar 1, 2026
@danh91 danh91 reopened this Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants