From 7d729cce238dece65c9cbe94e4c1c336b014105b Mon Sep 17 00:00:00 2001 From: JhiNResH Date: Mon, 20 Jul 2026 21:44:55 +0800 Subject: [PATCH 1/2] fix: avoid double-counting queue capacity delay --- src/core/orders.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/orders.ts b/src/core/orders.ts index 1998fc9..f386fe0 100644 --- a/src/core/orders.ts +++ b/src/core/orders.ts @@ -123,17 +123,18 @@ export async function estimatedPickupWaitMinutes(merchantId: string, item: Catal const activeAhead = (await activePickupOrders(merchantId, productionClass)).length; const capacity = CAPACITY_BY_PRODUCTION_CLASS[productionClass]; const prepMinutes = Math.max(item.prepMinutes || 5, 1); - const baseWait = prepMinutes + Math.floor(activeAhead / capacity) * CAPACITY_WINDOW_MINUTES; + const queueWait = prepMinutes + Math.floor(activeAhead / capacity) * CAPACITY_WINDOW_MINUTES; const now = new Date(); - const desiredReadyAt = addMinutes(now, baseWait); + const desiredReadyAt = addMinutes(now, prepMinutes); for (let offset = 0; offset < 32; offset += 1) { const probeAt = addMinutes(desiredReadyAt, offset * CAPACITY_WINDOW_MINUTES); const window = await capacityWindowAt(merchantId, productionClass, probeAt); if (window.available >= quantity) { - return baseWait + offset * CAPACITY_WINDOW_MINUTES; + const capacityWait = prepMinutes + offset * CAPACITY_WINDOW_MINUTES; + return Math.max(queueWait, capacityWait); } } - return baseWait + 32 * CAPACITY_WINDOW_MINUTES; + return Math.max(queueWait, prepMinutes + 32 * CAPACITY_WINDOW_MINUTES); } async function pickupPromise(merchant: MerchantProfile, item: CatalogItem, input: OrderRequest, now: Date, quantity: number): Promise { From d3e693f21e82614de0040a49bf8e5d5b16b42d9d Mon Sep 17 00:00:00 2001 From: JhiNResH Date: Mon, 20 Jul 2026 21:44:55 +0800 Subject: [PATCH 2/2] ci: add SLL-R validation workflow --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f5a3f09 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install pnpm + run: npm install --global pnpm@9.15.9 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build and smoke test + run: pnpm check