Job 1788150295323

Command: powershell -NoProfile -Command "$root='C:\Users\ash\Documents\ShopeeApi'; Write-Output ('ROOT_EXISTS='+(Test-Path $root)); Get-ChildItem -LiteralPath $root -Recurse -File -Filter *.py -ErrorAction SilentlyContinue | Select-String -Pattern 'list_ready_to_ship_for_arrange','ship_order','READY_TO_SHIP','Instant Delivery','instant_delivery' -SimpleMatch | Select-Object Path,LineNumber,Line | Format-List"
Directory: projects
Status: TIMEOUT
Exit code: -1

Cancel Job Rerun Command Refresh

Error Summary

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7115
Line       : def get_ready_to_ship_packing(source: str = "auto", days: int = 7, limit: int = 300, group_by: str = 
             "canonical") -> dict[str, Any]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
---
Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3225
Line       : def api_operations_instant_delivery_feed(device: dict[str, Any] = Depends(require_operations_device)):

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3229
---
Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3260
Line       :         raise HTTPException(403, "Hanya telefon utama boleh mengesahkan Instant Delivery")

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3261
---
ROOT_EXISTS=True


Path       : C:\Users\ash\Documents\ShopeeApi\app\config.py
LineNumber : 123
Line       :     instant_delivery_reconcile_seconds: int = max(60, int(_env("INSTANT_DELIVERY_RECONCILE_SECONDS", 
             default="120") or "120"))

Path       : C:\Users\ash\Documents\ShopeeApi\app\config.py
LineNumber : 124
Line       :     instant_delivery_reconcile_lookback_minutes: int = max(5, 
             int(_env("INSTANT_DELIVERY_RECONCILE_LOOKBACK_MINUTES", default="15") or "15"))

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 228
Line       : def acknowledge_instant_delivery(shop_id: int, order_sn: str, device_id: str) -> dict[str, Any]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 232
Line       :             """INSERT INTO 
             instant_delivery_acknowledgements(shop_id,order_sn,acknowledged_by_device_id,acknowledged_at,updated_at)

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 240
Line       :             "SELECT * FROM instant_delivery_acknowledgements WHERE shop_id=? AND order_sn=?",

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 246
Line       : def instant_delivery_acknowledgements(shop_id: int, order_sns: list[str]) -> dict[str, dict[str, Any]]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 253
Line       :             f"SELECT * FROM instant_delivery_acknowledgements WHERE shop_id=? AND order_sn IN 
             ({placeholders})",

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 2320
Line       :     CREATE TABLE IF NOT EXISTS instant_delivery_acknowledgements (

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6388
Line       : def _get_ready_to_ship_overview_uncached() -> dict[str, Any]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6391
Line       :     Include both READY_TO_SHIP and PROCESSED so the dashboard does not go blank

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6412
Line       :             WHERE o.shop_id=? AND o.order_status IN ('READY_TO_SHIP','PROCESSED')

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6430
Line       :             WHERE o.shop_id=? AND o.order_status IN ('READY_TO_SHIP','PROCESSED')

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6440
Line       :                    WHERE shop_id=? AND order_status IN ('READY_TO_SHIP','PROCESSED')

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6444
Line       :         instant_delivery_orders = conn.execute(

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6457
Line       :               AND o.order_status IN ('READY_TO_SHIP', 'PROCESSED')

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6459
Line       :                     LOWER(COALESCE(o.shipping_carrier, '')) LIKE '%instant delivery%'

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6460
Line       :                  OR LOWER(COALESCE(o.checkout_shipping_carrier, '')) LIKE '%instant delivery%'

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6462
Line       :             ORDER BY CASE WHEN o.order_status='READY_TO_SHIP' THEN 0 ELSE 1 END,

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6470
Line       :         "status": "READY_TO_SHIP_AND_PROCESSED",

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6472
Line       :         "ready_order_count": int(status_counts.get("READY_TO_SHIP", 0)),

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6480
Line       :         "instant_delivery_count": len(instant_delivery_orders),

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6481
Line       :         "instant_delivery_orders": [dict(x) for x in instant_delivery_orders],

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6486
Line       : def get_ready_to_ship_overview() -> dict[str, Any]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6487
Line       :     return _cached(f"ready:overview:{_shop_id()}", settings.dashboard_cache_seconds, 
             _get_ready_to_ship_overview_uncached)

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6516
Line       : def _get_ready_to_ship_packing_uncached() -> dict[str, Any]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6517
Line       :     """Spreadsheet-style PRINT (DATA) packing list for all READY_TO_SHIP orders.

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6566
Line       :             WHERE o.shop_id=? AND o.order_status='READY_TO_SHIP'

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6574
Line       :             WHERE o.shop_id=? AND o.order_status='READY_TO_SHIP'

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6586
Line       :             WHERE shop_id=? AND order_status='READY_TO_SHIP'

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6661
Line       :         "status": "READY_TO_SHIP",

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6679
Line       : def get_ready_to_ship_packing() -> dict[str, Any]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6680
Line       :     return _cached(f"ready:packing:{_shop_id()}", settings.dashboard_cache_seconds, 
             _get_ready_to_ship_packing_uncached)

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6702
Line       :         return ["PROCESSED", "READY_TO_SHIP"], 7, "RECENT"

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6703
Line       :     return ["READY_TO_SHIP"], None, "READY_TO_SHIP"

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 6743
Line       :         statuses = ["READY_TO_SHIP"]

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7099
Line       :             ready = _get_packing_for_statuses_uncached(["READY_TO_SHIP"], source="ready", days=None, 
             limit=limit, group_by=group_by)

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7105
Line       :             processed["note"] = "READY_TO_SHIP kosong, jadi preview ambil order PROCESSED/arranged 
             terkini untuk test packing."

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7115
Line       : def get_ready_to_ship_packing(source: str = "auto", days: int = 7, limit: int = 300, group_by: str = 
             "canonical") -> dict[str, Any]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7143
Line       :             ["READY_TO_SHIP"], source="ready_stickers", days=None, limit=1000, group_by="order",

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7149
Line       :     """Product analytics from synced order_items. Uses create_time range and READY_TO_SHIP/completed/etc. 
             local data."""

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7190
Line       :             WHERE oi.shop_id=? AND o.order_status='READY_TO_SHIP'

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7244
Line       :         "ready_to_ship_products": [dict(x) for x in ready],

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7376
Line       :     ready = get_ready_to_ship_overview()

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7382
Line       :         "ready_to_ship": {

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7731
Line       : def list_ready_to_ship_for_arrange(limit: int = 100) -> list[dict[str, Any]]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7732
Line       :     """READY_TO_SHIP orders with package numbers, sorted by order masuk.

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7744
Line       :             WHERE o.shop_id=? AND o.order_status='READY_TO_SHIP'

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7761
Line       :     """Local status update after Shopee ship_order succeeds.

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7782
Line       :     source=auto tries READY_TO_SHIP first then PROCESSED/SHIPPED.

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7786
Line       :         status_groups = [["READY_TO_SHIP"], ["PROCESSED", "SHIPPED"]]

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7788
Line       :         status_groups = [["READY_TO_SHIP"], ["PROCESSED"], ["SHIPPED"]]

Path       : C:\Users\ash\Documents\ShopeeApi\app\db.py
LineNumber : 7792
Line       :         status_groups = [["PROCESSED"], ["SHIPPED"], ["READY_TO_SHIP"]]

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 1307
Line       : def ready_to_ship():

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 1308
Line       :     result = db.get_ready_to_ship_overview()

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 1399
Line       :         status = "PROCESSED" if source == "processed" else "READY_TO_SHIP"

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 1477
Line       : def ready_to_ship_packing(

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 1483
Line       :     result = db.get_ready_to_ship_packing(source=source, days=days, limit=limit, group_by=group_by)

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 1806
Line       :     return {"ready_to_ship": db.get_ready_to_ship_overview(), "products": 
             db.get_product_analytics(days=days, limit=15), "summary": db.get_summary()}

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 2100
Line       :         # if dropoff has no extra info_needed, ship_order may accept an empty dropoff object.

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 2208
Line       : def arrange_all_ready_to_ship(req: BatchShipmentRequest):

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 2215
Line       :     packing_before = db.get_ready_to_ship_packing(source="auto", days=7, limit=req.limit)

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 2216
Line       :     candidates = db.list_ready_to_ship_for_arrange(req.limit)

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 2225
Line       :             if current_status != "READY_TO_SHIP":

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 2246
Line       :                             ship_result = client.ship_order(ship_body)

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 2266
Line       :                                 ship_result = client.ship_order(retry_body)

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 2270
Line       :                         db.save_order_raw(None, current_shop_id(), order_sn, 
             "logistics/ship_order/batch_arrange", ship_result)

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 2333
Line       :         result=client.ship_order(body); db.log_audit("admin","arrange_shipment",req.order_sn,{"method":met
             hod,"package_number":req.package_number})

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3225
Line       : def api_operations_instant_delivery_feed(device: dict[str, Any] = Depends(require_operations_device)):

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3229
Line       :     overview = db.get_ready_to_ship_overview()

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3230
Line       :     orders = overview.get("instant_delivery_orders") or []

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3231
Line       :     acknowledgements = db.instant_delivery_acknowledgements(shop_id, [str(row.get("order_sn") or "") for 
             row in orders])

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3253
Line       : def api_operations_instant_delivery_ack(

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3260
Line       :         raise HTTPException(403, "Hanya telefon utama boleh mengesahkan Instant Delivery")

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3261
Line       :     acknowledgement = db.acknowledge_instant_delivery(shop_id, req.order_sn, str(device["device_id"]))

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3263
Line       :         actor=f"operations:{device['device_id']}", action="instant_delivery_ready_acknowledged",

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3396
Line       : def api_scanner_instant_delivery_alerts():

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3398
Line       :     overview = db.get_ready_to_ship_overview()

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 3399
Line       :     orders = overview.get("instant_delivery_orders") or []

Path       : C:\Users\ash\Documents\ShopeeApi\app\main.py
LineNumber : 4817
Line       :                     WHERE oi.shop_id=? AND UPPER(o.order_status) IN 
             ('UNPAID','TO_CONFIRM','PROCESSED','READY_TO_SHIP')""",

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 18
Line       : _LAST_RUN: dict[str, int | None] = {"orders": None, "products": None, "instant_delivery": None, 
             "shop_logos": None, "inventory_normalize": None, "finance_releases": None}

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 19
Line       : _LAST_ERROR: dict[str, str | None] = {"orders": None, "products": None, "instant_delivery": None, 
             "shop_logos": None, "inventory_normalize": None, "finance_releases": None}

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 90
Line       :         "instant_delivery_reconcile_seconds": settings.instant_delivery_reconcile_seconds,

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 421
Line       :     start_ts = now - settings.instant_delivery_reconcile_lookback_minutes * 60

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 431
Line       :                 order_sync.sync_order_numbers(shop_id, order_sns, source="instant_delivery_reconcile")

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 437
Line       :     _LAST_ERROR["instant_delivery"] = "; ".join(errors)[:500] if errors else None

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 592
Line       :         instant_last = int(_LAST_RUN.get("instant_delivery") or 0)

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 593
Line       :         if not instant_last or now - instant_last >= settings.instant_delivery_reconcile_seconds:

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 594
Line       :             _LAST_RUN["instant_delivery"] = now

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 597
Line       :                 _LAST_ERROR["instant_delivery"] = None

Path       : C:\Users\ash\Documents\ShopeeApi\app\scheduler.py
LineNumber : 599
Line       :                 _LAST_ERROR["instant_delivery"] = str(exc)[:500]

Path       : C:\Users\ash\Documents\ShopeeApi\app\services\awb_printing.py
LineNumber : 1031
Line       :     if "instant delivery" in value:

Path       : C:\Users\ash\Documents\ShopeeApi\app\services\inventory_publishing.py
LineNumber : 337
Line       :         # Tolak order tertunggak (PROCESSED/READY_TO_SHIP): pati telah diperuntukkan

Path       : C:\Users\ash\Documents\ShopeeApi\app\shopee\client.py
LineNumber : 409
Line       :     def ship_order(self, body: dict[str, Any]) -> dict[str, Any]:

Path       : C:\Users\ash\Documents\ShopeeApi\app\shopee\client.py
LineNumber : 410
Line       :         return self.shop_post("/api/v2/logistics/ship_order", body)

Path       : C:\Users\ash\Documents\ShopeeApi\app\sync\order_sync.py
LineNumber : 107
Line       :         or str(states[order_sn].get("order_status") or "").upper() != "READY_TO_SHIP"

Path       : C:\Users\ash\Documents\ShopeeApi\handover\ShopeeOperations-Full-Handover-1.2.0-20260812-clean\server-compa