Two defects found while remediating the unpublished eBay/Etsy twins of this Actor. Both were live here; neither had produced a buyer-visible failure yet, because no buyer had run this Actor with a short timeout (26/26 runs to date used the 1,200 s default — measured per run via GET /v2/actor-runs/{id}, since the runs list endpoint omits options).
- A short run timeout used to close the AliExpress leg at millisecond zero and then blame the deadline.
AE_PHASE_RESERVE_MIN_MS (300 s) and _MAX_MS (420 s) are absolute, but the window they are subtracted from is not: createDeadline() reads the platform's real ACTOR_TIMEOUT_AT and subtracts FINISH_RESERVE_SECS = 48. So aePhaseEndAt = startedAt + (timeout − 48)s − 300s, and at any timeout ≤ 348 s that lands before the run started. Every item went to skippedBy.deadline without one request being made, nothing was charged, and RUN_SUMMARY said trigger: "deadline" / "Stopped at the run deadline" — a report that sends the buyer to the wrong fix (they would lower the batch or give up, when their timeout was actually fine). Proved on this Actor's Amazon twin by four cloud runs (ZgArCYjhffeXErcCz, ohAhoaGgo5nQgLcD5, 0tMzkHk379LkF77GZ at timeout 150 s and 3NPFaKUfe7D93Hjhb at 180 s): 0 rows, trigger: "deadline", $0 charged.
Fix: AE_PHASE_RESERVE_MAX_SHARE = 0.5 and phaseReserveMs(effectiveMs), so the source leg always keeps at least half of whatever window the platform really gave us. The default path is byte-identical — at the 1,110 s hardcode all three terms give 371,700 ms, which is what the old arithmetic gave too; the clamp only binds below a 600 s window. At timeout 300 s the source leg now gets 126 s instead of −48 s.
RUN_SUMMARY.deadlineKind now separates the two time budgets, whose remedies are opposite: platform-timeout (Apify ended the run → lower the batch) vs phase-window (our own 1688 reserve closed the source leg while platform time remained → raise the timeout). When the second one binds, the log explains it and notes carries AE_PHASE_WINDOW_CLOSED platformWindow=<secs> reserve=<secs>.
src/main.js now runs the Actor only when it is the process entry point (invokedDirectly). Before this, any test file that did import '../src/main.js' would execute the whole Actor: top-level await run() → Actor.exit() took the process down before the first assertion, and node --test reported the file as passing with zero subtests. No existing test imported it (the suite really did run: 47/47), so this was a loaded trap rather than a live failure — but it is exactly how a checkpoint-latch test went unexecuted on the eBay twin while that suite still read 154/154. tests/main-deadline.test.js is new and its very first import is the regression test for the guard.
- Disclosed, not changed:
skippedBy.blocked counts blocks from both legs and does not say which. An AliExpress-side block also emits a source row with fetchStatus: "blocked" and is free; a 1688 image-search RISK_CONTROL only bumps the counter, and because the AliExpress fetch had already succeeded that item is charged one ae-item-lookup while yielding no match rows and no summary row. README and the key-value-store schema now say so and give the subtraction that separates the two. Measured on the Etsy twin: 19% of paid lookups on a 56-item run, 8% on a 39-item run. No pricing or billing behaviour was modified in this build.
Tests 47/47 → 52/52.
- AliExpress price parsing now reads
mtop.aliexpress.pdp.pc.query: the regular (crossed-out) price is used, so new-shopper prices, coupon codes and $1 regex backreferences from inline scripts can no longer set priceUsd.
- Rating, review count and sales text come from the PDP
PC_RATING block; the browser layer polls for the PDP XHR after hydration instead of using a fixed sleep.
- Title cleanup strips the
- AliExpress <n> suffix added by meta and JSON-LD blocks.
RUN_SUMMARY.humanReadableReason keeps the explicit validation message for empty input instead of being overwritten by the derived-reason pass.
Initial private build.
- Input: up to 100 AliExpress product URLs and/or 100 direct image URLs, deduplicated per item;
maxSuppliersPerItem 1–20, shipTo, marginCurrency USD/CNY, per-run charge cap and request quota.
- Output: flat
source, match and summary rows; RUN_SUMMARY key-value record with the completeness identity checked before exit.
- AliExpress leg: Playwright with stealth and one sticky residential session per item; punish detection with up to two session rotations; keyword search fallback with exact item-id matching.
- Image pipeline: magic-byte detection, WebP/AVIF → JPEG conversion with sharp (max 800×800, quality 85), 1 MB upload cap.
- 1688 leg: existing mtop reverse-image-search engine with identity pool, token cache and risk-control rotation.
- Unit economics: single run-time USD/CNY rate, consign-first cost basis, negative margins preserved.
- Billing:
run-base-fee $0.00005 (only with a billable row), ae-item-lookup $0.005 (only fetchStatus: ok), supplier-match $0.008 (only delivered rows); six plan tiers; failures and empty lookups free.