Skip to content

Commit 28d1fb1

Browse files
authored
Patch 2026.1.11 (#967)
1 parent 7f25871 commit 28d1fb1

File tree

123 files changed

+6765
-609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+6765
-609
lines changed

AGENTS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,41 @@ Shipment.objects.select_related('shipper', 'recipient', 'carrier_connection')
771771
Shipment.objects.prefetch_related('parcels', 'customs', 'rates')
772772
```
773773

774+
### ⚠️ N+1 Query Prevention (Critical!)
775+
776+
N+1 queries are a common Django ORM pitfall that can severely degrade performance,
777+
especially on serverless databases (Aurora Serverless) where each query incurs connection overhead.
778+
779+
**Always review loops that touch the database:**
780+
781+
```python
782+
# ❌ BAD - N+1: one UPDATE per tracker in a loop
783+
for tracker in trackers:
784+
tracker.status = compute_status(tracker)
785+
tracker.save() # N individual UPDATE queries
786+
787+
# ❌ BAD - N+1: one SELECT per related object in a loop
788+
for shipment in shipments:
789+
print(shipment.carrier.name) # N individual SELECT queries (lazy loading)
790+
791+
# ✅ GOOD - Bulk update: single UPDATE for all trackers
792+
for tracker in trackers:
793+
tracker.status = compute_status(tracker)
794+
Tracking.objects.bulk_update(trackers, ["status", "updated_at"])
795+
796+
# ✅ GOOD - Prefetch/select related: single JOIN query
797+
shipments = Shipment.objects.select_related("carrier").filter(...)
798+
for shipment in shipments:
799+
print(shipment.carrier.name) # No extra queries
800+
```
801+
802+
**Key patterns to watch for:**
803+
- `model.save()` inside a loop → use `bulk_update()` or `bulk_create()`
804+
- `model.related_field.attribute` without `select_related` → add `select_related()`
805+
- `model.related_set.all()` without `prefetch_related` → add `prefetch_related()`
806+
- `update_or_create()` in high-concurrency paths → use split `create()`/`filter().update()` to avoid `SELECT FOR UPDATE` lock contention
807+
- Individual `filter().update()` calls in a loop → collect changes and use `bulk_update()`
808+
774809
---
775810

776811
## Background Jobs (Huey)

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
1+
# Karrio 2026.1.11
2+
3+
## Changes
4+
5+
### Feat
6+
7+
- feat: add markup feature gating with `meta.feature_gate` for conditional markup application
8+
- feat: add feature_gate field to markup editors (inline and advanced admin)
9+
- feat: add tracker bulk webhook resend and per-row action menu
10+
- feat: add batch webhook resend API endpoint
11+
- feat: integrate worker action buttons in devtools frontend
12+
- feat: add worker management GraphQL mutations for admin
13+
- feat: add markup filtering by meta category, plan, active status and type
14+
- feat: improve CSV preview with progressive markup totals and column filtering
15+
- feat: add markups management to rate sheet editor and improve markup dialogs
16+
17+
### Fix
18+
19+
- fix: make Health view scrollable and wrap maintenance actions in card
20+
- fix: skip empty rate rows in CSV preview
21+
- fix: align tracker checkbox column width with shipments table
22+
- fix: show exact page counts instead of "of many" in devtools pagination
23+
- fix: resolve duplicate TaskExecution records causing stuck executing status
24+
- fix: use icontains for meta and metadata value filters on markups
25+
- fix: port rate sheet editor layout improvements and bug fixes
26+
27+
### Perf
28+
29+
- perf: cache middleware auth result to prevent duplicate token DB lookups
30+
- perf: reuse pre-loaded carriers in buy_shipment_label to avoid duplicate connection queries
31+
- perf: batch constance config queries to eliminate N+1 in shipment creation
32+
- perf: batch tracker saves to eliminate N+1 UPDATE queries in tracking pipeline
33+
- perf: eliminate SELECT FOR UPDATE lock contention in task signal handler
34+
35+
### Refactor
36+
37+
- refactor: update devtools drawer, navbar, and rate sheet CSV preview
38+
- refactor: use generic meta_key/meta_value and metadata_key/metadata_value filters for markups
39+
40+
### Test
41+
42+
- test: add batch webhook resend tests
43+
- test: add admin CRUD tests for markup meta field and filters
44+
- test: add feature-gated markup applicability tests
45+
46+
### Chore
47+
48+
- chore: generate admin migrations
49+
50+
---
51+
152
# Karrio 2026.1.10
253

354
## Changes

0 commit comments

Comments
 (0)