Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Karrio 2025.5rc17

## Changes

### Fix

- fix: resolved module import error for karrio.server.admin.schemas.orgs in tenant GraphQL schema
- fix: enhanced UPS tracking status codes with comprehensive API documentation mapping
- fix: optimize N+1 query issues in tracking/shipment GraphQL resolvers with proper relationship prefetching
- fix: optimize N+1 query issues in constance configuration loading with bulk database operations
- fix: optimize N+1 query issues in data archiving tasks with bulk deletion for organization links
- fix: optimize N+1 query issues in carrier/organization access filtering for proxy endpoints
- fix: optimize N+1 query issues in tenant domain/client lookups with relationship prefetching
- fix: enhance all manager model querysets with organization relationship prefetching for multi-tenant mode
- fix: improve archiving query performance with optimized existence checks and batch processing
- fix: add database indexes for archiving date-based filters to reduce query execution time
- fix: refactor workflow scheduler error handling with cleaner diagnostic functions
- fix: add workflow-trigger table diagnostic migration for production database issues
- fix: resolve APILog proxy model index conflicts in Django migrations

# Karrio 2025.5rc16

## Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/api/karrio/server/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025.5rc16
2025.5rc17
4 changes: 2 additions & 2 deletions apps/www/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ info:
## Versioning

When backwards-incompatible changes are made to the API, a new, dated version is released.
The current version is `2025.5rc16`.
The current version is `2025.5rc17`.

Read our API changelog to learn more about backwards compatibility.

Expand Down Expand Up @@ -84,7 +84,7 @@ info:
All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure).
API requests without authentication will also fail.
title: Karrio API
version: 2025.5rc16
version: 2025.5rc17
paths:
/:
get:
Expand Down
4 changes: 2 additions & 2 deletions bin/deploy-hobby
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

export KARRIO_TAG="${KARRIO_TAG:-2025.5rc16}"
export KARRIO_TAG="${KARRIO_TAG:-2025.5rc17}"
export SENTRY_DSN="${SENTRY_DSN:-'https://public@sentry.example.com/1'}"

SECRET_KEY=$(head -c 28 /dev/urandom | sha224sum -b | head -c 56)
Expand All @@ -22,7 +22,7 @@ echo ""
if ! [ -z "$1" ]; then
export KARRIO_TAG=$1
else
echo "What version of Karrio would you like to install? (We default to '2025.5rc16')"
echo "What version of Karrio would you like to install? (We default to '2025.5rc17')"
echo "You can check out available versions here: https://hub.docker.com/r/karrio/server/tags"
read -r KARRIO_TAG_READ
if [ -z "$KARRIO_TAG_READ" ]; then
Expand Down
2 changes: 1 addition & 1 deletion bin/deploy-insiders
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

export KARRIO_TAG="${KARRIO_TAG:-2025.5rc16}"
export KARRIO_TAG="${KARRIO_TAG:-2025.5rc17}"
export SENTRY_DSN="${SENTRY_DSN:-'https://public@sentry.example.com/1'}"

SECRET_KEY=$(head -c 28 /dev/urandom | sha224sum -b | head -c 56)
Expand Down
85 changes: 68 additions & 17 deletions bin/update-source-version-freeze
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,20 @@ generate_source_requirements() {
egg_name="${BASH_REMATCH[3]}"
subdir="${BASH_REMATCH[4]}"

# Handle different repository paths based on repo_type
case $repo in
"karrio-insiders")
subdir="ee/insiders/${subdir#../../ee/insiders/}"
;;
"karrio-platform")
subdir="ee/platform/${subdir#../../ee/platform/}"
;;
"karrio")
# Keep the subdirectory as is
;;
"community")
# Remove existing community/plugins/ prefix if it exists, then add it back
subdir="${subdir#community/plugins/}"
subdir="community/plugins/${subdir}"
;;
esac
# Handle different repository paths based on actual subdirectory structure
if [[ $subdir =~ ^../../ee/insiders/ ]]; then
# Remove ../../ee/insiders/ prefix to get direct path
subdir="${subdir#../../ee/insiders/}"
elif [[ $subdir =~ ^../../ee/platform/ ]]; then
# Remove ../../ee/platform/ prefix to get direct path
subdir="${subdir#../../ee/platform/}"
elif [[ $subdir =~ ^community/plugins/ ]]; then
# Keep community/plugins/ paths as-is
subdir="$subdir"
else
# Keep other subdirectories as-is (modules/, apps/, etc.)
subdir="$subdir"
fi

# Replace git URL with local file path
echo "${egg_name} @ file://\${PWD}/${subdir}" >>"$TMP_FILE"
Expand All @@ -130,6 +127,56 @@ generate_source_requirements() {
mv "$TMP_FILE" "$output_file"
}

# Function to generate PyPI requirements for platform (special handling for karrio_server_tenants)
generate_platform_pypi_requirements() {
local input_file=$1
local output_file=$2

echo "Generating ${output_file} with PyPI packages (keeping karrio_server_tenants as git)..."

# Get target version
local target_version=$(cat apps/api/karrio/server/VERSION)

# Create a temporary file
TMP_FILE=$(mktemp)

# Copy the header (--extra-index-url line)
grep "^--extra-index" "$input_file" >"$TMP_FILE"

# Process each line
while IFS= read -r line; do
if [[ $line == -e\ git+https://github.com/* ]]; then
# Extract egg name from git URL
if [[ $line =~ \#egg=([^&]+) ]]; then
egg_name="${BASH_REMATCH[1]}"

# Keep karrio_server_tenants as git, convert all others to PyPI
if [[ "$egg_name" == "karrio_server_tenants" ]]; then
# Clean up the subdirectory path by removing ../../ prefix
cleaned_line=$(echo "$line" | sed 's|subdirectory=../../|subdirectory=|')
echo "$cleaned_line" >>"$TMP_FILE"
else
# Convert to PyPI package
pypi_package=$(convert_egg_to_pypi "$egg_name")
echo "$pypi_package==$target_version" >>"$TMP_FILE"
fi
else
# If we can't extract egg name, keep the original line
echo "$line" >>"$TMP_FILE"
fi
elif [[ $line != --extra-index* ]]; then
# Copy non-git requirements as-is
echo "$line" >>"$TMP_FILE"
fi
done <"$input_file"

# Add a newline at the end
echo "" >>"$TMP_FILE"

# Replace the original file
mv "$TMP_FILE" "$output_file"
}

# Generate source requirements for each variant
generate_source_requirements "requirements.txt" "source.requirements.txt" "base"
generate_source_requirements "requirements.insiders.txt" "source.requirements.insiders.txt" "insiders"
Expand All @@ -141,6 +188,10 @@ generate_pypi_requirements "requirements.txt" "requirements.txt"
# Generate PyPI requirements for insiders (convert git URLs to PyPI package versions)
generate_pypi_requirements "requirements.insiders.txt" "requirements.insiders.txt"

# Generate PyPI requirements for platform (convert git URLs to PyPI package versions, but keep karrio_server_tenants as git)
generate_platform_pypi_requirements "requirements.platform.txt" "requirements.platform.txt"

echo "Generated source requirements files from requirements files"
echo "Updated requirements.txt with PyPI package versions"
echo "Updated requirements.insiders.txt with PyPI package versions"
echo "Updated requirements.platform.txt with PyPI package versions (except karrio_server_tenants)"
2 changes: 1 addition & 1 deletion bin/upgrade-hobby
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ else
fi

[[ -f ".env" ]] && export $(cat .env | xargs) || (echo "No .env file found. Please create it with SECRET_KEY and DOMAIN set." && exit 1)
export KARRIO_TAG="${KARRIO_TAG:-2025.5rc16}"
export KARRIO_TAG="${KARRIO_TAG:-2025.5rc17}"

# get karrio scripts
mkdir -p ./karrio
Expand Down
2 changes: 1 addition & 1 deletion docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ REDIS_PORT=6379
# API - Configuration for the Nginx Reverse proxy.
############

KARRIO_TAG=2025.5rc16
KARRIO_TAG=2025.5rc17
KARRIO_HTTP_PORT=5002

############
Expand Down
2 changes: 1 addition & 1 deletion ee/insiders
2 changes: 1 addition & 1 deletion ee/platform
2 changes: 1 addition & 1 deletion modules/cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio-cli"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Command line interface for Karrio"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/australiapost/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_australiapost"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - Australia Post Shipping Extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/canadapost/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_canadapost"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - Canada Post Shipping Extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/dhl_express/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_dhl_express"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - DHL Express Shipping Extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/dhl_parcel_de/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_dhl_parcel_de"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - DHL Parcel DE Shipping Extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/dhl_poland/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_dhl_poland"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - DHL Parcel Poland Shipping Extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/dhl_universal/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_dhl_universal"
version = "2025.5rc16"
version = "2025.5rc17"
description = "DHL Universal Tracking karrio extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/fedex/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_fedex"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - FedEx Shipping Extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/generic/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_generic"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - Custom carrier Shipping extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/laposte/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_laposte"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - La Poste Shipping Extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/purolator/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_purolator"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - Purolator Shipping extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/seko/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_seko"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - SEKO Logistics Shipping Extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/sendle/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_sendle"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - Sendle Shipping Extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
52 changes: 46 additions & 6 deletions modules/connectors/ups/karrio/providers/ups/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,12 +631,52 @@ class UploadDocumentType(utils.StrEnum):


class TrackingStatus(utils.Enum):
on_hold = ["X"]
pending = ["MP"]
delivered = ["D"]
in_transit = [""]
delivery_failed = ["RS"]
out_for_delivery = ["OT"]
# Based on UPS API documentation - Status types and codes
# D = delivery information, I = in-progress, M/MV = manifest, U = update, X = exception

# Delivered statuses
delivered = ["D", "FS", "KB", "F4"] # D=delivered type, FS=final status, KB=delivered, F4=delivered code

# In-transit/processing statuses
in_transit = ["I", "OR", "DP", "AA", "AR", "AF", "AL", "OD", "DS", "IH", "AP"]
# I=in-progress, OR=origin scan, DP=departure scan, AA=arrival scan, AR=arrival scan
# AF=arrival facility, AL=arrival location, OD=on delivery vehicle, DS=departure scan
# IH=in-transit hub, AP=arrival at post office

# Pending/manifest statuses
pending = ["M", "MV", "MP", "XD", "OA", "DD"] # M=manifest, MV=manifest void, MP=manifest pickup
# XD=signature required, OA=order assigned, DD=data downloaded

# Out for delivery
out_for_delivery = ["OT", "OD", "OF", "DL"] # OT=out for delivery, OD=on delivery vehicle
# OF=out for final delivery, DL=delivery in progress

# On hold/exception statuses
on_hold = ["X", "EX", "HX", "HD", "HI", "HS", "HU", "NH"] # X=exception type
# EX=exception, HX=hold exception, HD=hold at depot, HI=hold instruction
# HS=hold at station, HU=hold until, NH=no such number

# Delivery failed/returned statuses
delivery_failed = ["RS", "RT", "RF", "RH", "UR", "UF", "CC"] # RS=return to sender
# RT=return to, RF=refused, RH=return home, UR=undeliverable return
# UF=unable to forward, CC=call center

# Cancelled/void statuses
cancelled = ["VD", "CA", "CN", "CV"] # VD=void, CA=cancelled, CN=cancel, CV=cancel void

# Ready for pickup
ready_for_pickup = ["RP", "UU", "PU", "AC", "WC"] # RP=ready for pickup, UU=unable to deliver
# PU=pickup, AC=available for collection, WC=will call

# Delivery delayed
delivery_delayed = ["DY", "DE", "DD", "SD"] # DY=delay, DE=delayed, DD=delivery date, SD=service delay

# Return to sender
return_to_sender = ["RS", "RT", "RH", "RU"] # RS=return to sender, RT=return to
# RH=return home, RU=return undeliverable

# Unknown/unrecognized statuses
unknown = [] # For any unrecognized status codes


# from https://developer.ups.com/api/reference/rating/appendix?loc=en_US
Expand Down
2 changes: 1 addition & 1 deletion modules/connectors/ups/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "karrio_ups"
version = "2025.5rc16"
version = "2025.5rc17"
description = "Karrio - UPS Shipping extension"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
Loading