freshyo/docs/test reports/e2e-sanity-test-results-2026-10-10-1310.md
2026-10-10 15:00:50 +05:30

323 lines
37 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Freshyo E2E sanity/regression — execution results
Companion to `docs/e2e-sanity-test-plan.md`. This file records what was actually
executed, with evidence and honest status. Case IDs match the plan.
Detailed write-ups of every FAIL case (steps, evidence, root cause, suggested fix)
are in **`docs/test reports/e2e-sanity-failed-cases-2026-10-10-1310.md`**.
Status values: **PASS**, **FAIL**, **BLOCKED** (harness/env could not run it),
**NOT RUN**.
## Environment
| Item | Value |
|---|---|
| Date | 2026-10-10 |
| Backend | local `workerd` at `http://localhost:8787` (`/api/trpc`) |
| DB | local D1 (`apps/backend/.wrangler/state/.../d1/miniflare-.../da3a80bd….sqlite`), disposable |
| Customer app | iOS simulator `B1F98A94-9733-46A6-9EB2-76F33C15240D`, `com.freshyotrial.app` |
| Admin app | iOS simulator same device, `in.freshyo.adminui` |
| Superadmin UI | Chromium `http://localhost:4175` |
| Admin web | Chromium `http://localhost:4176` |
| Customer web | Chromium `http://localhost:4174/home` |
| GPS | `16.7489, 77.9856` (resolves to Mahabubnagar) |
## Credentials (test-only)
| Role | Identity | Secret |
|---|---|---|
| Superadmin | `superadmin` | `superadmiN123` |
| Admin region A (1) | `e2eadminA` | `Test@12345` |
| Admin region B (2) | `e2eadminB` | `Test@12345` |
| Customer U1 | `9676651496` (user 388) | `meatfarmer@123` |
## Regions / bounds
| Alias | Region | Bound | Priority | deliveryCharge | freeDeliveryThreshold | minRegularOrderValue |
|---|---|---|---|---|---|---|
| A | Mahabubnagar (1) | A1 (bound 1) | 1 (effective) | 20 | 300 | 300 |
| A | Mahabubnagar (1) | A2 (bound 2) | 2 | 200 | 800 | 300 |
| B | Testnagar (2) | B1 (bound 3) | 1 | 30 | 500 | 500 |
| C | Jadcherla (3) | C1 (bound 4) | 1 | 150 | 750 | 1001 |
Note: the plan asked for dedicated regions A/B. Existing region 1 already has two
bounds with priorities 1/2, so it is used as A; region 2 as B. Dedicated staff,
products and slots were created for the run.
## Fixtures created for this run (via the admin/superadmin APIs the UIs call)
| Entity | Region | Ids |
|---|---|---|
| Product "E2E Chicken" (500 g ₹199 / 1 kg ₹349, flash ₹299) | A | product 155, skus 155, 156 |
| Product "E2E R2 Item" (1 pc ₹149) | B | product 156, sku 157 |
| Slot (delivery 2026-10-11 16:00 IST, freeze 15:30 IST) | A | slot 2012 (skus 155,156) |
| Slot (same window) | B | slot 2013 (sku 157) |
| Staff `e2eadminA` | A | staff 10 |
| Staff `e2eadminB` | B | staff 11 |
## Method / harness notes
- Maestro MCP drives the iOS simulator and Chromium; the backend is probed
directly over tRPC for authoritative assertions (sanctioned by the plan).
- iOS secure password fields: `inputText` **does** land, but the value is masked
in screenshots. The reliable recipe is: type the password, tap a neutral area
to dismiss the keyboard, then tap the submit button. `hideKeyboard` fails on
these builds.
- The user app's deep-link confirm dialog ("Open in Freshyo?") is a SpringBoard
alert that survives `launchApp`; dismiss it explicitly before asserting.
- RN text-node assertions are unreliable; navigation is done by point taps and
verified with screenshots.
- Catalog publication: admin writes schedule cache regeneration; the app picks
up a new version on relaunch or within the ~60 s discovery poll.
---
## Results
(Per-category tables are appended below as cases are executed.)
### A. Regions, bounds and configuration
| ID | Status | Evidence / notes |
|---|---|---|
| RG-01 | PASS | Region 1 (A) already discoverable; `listRegions` returns A/B/C; customer app resolves GPS to "DELIVER TO Mahabubnagar" and catalog/config load. |
| RG-02 | **FAIL → FIXED** | Validation works (no-bounds → 400; non-`FeatureCollection` → 400; duplicate priority → 500), **but the region is still persisted without bounds**. Probes: create `{bounds:[]}` → 400 (no row); create with two bounds at priority `1` → 500 `"Each bound priority must be unique within the region"` **and** region `E2E-DupPriority` (id 4) exists with **0 bounds and 0 region_consts**. `createRegionWithBounds` wraps inserts in `db.transaction`, but on D1 the region insert is not rolled back when the bound insert violates the unique priority index. **Bug: region creation is not atomic; half-created region remains.** **Fixed 2026-10-10:** bounds are validated before any insert (≥1 bound, unique priorities) and a compensating cleanup removes the region + child rows if a later insert fails. Re-verified: duplicate-priority create now leaves no region. |
| RG-03 | PASS | Fresh launch resolves region once, signed out; catalog + free-delivery threshold load (see screenshots). |
| RG-04 | PASS | Simulator GPS set to `0,0` (outside every bound) → on cold launch the app **kept the saved region** ("DELIVER TO Mahabubnagar"), loaded the catalog, and did not hang or show an endless spinner. |
| RG-05 | NOT RUN | Requires delaying the resolve response; not harness-controllable here. |
| RG-06 | PASS | API: admin A sees only region-1 E2E products + slot 2012; admin B sees only region-2 E2E product + slot 2013. UI: region A search shows "E2E Chicken 500 g/1 kg" (₹199/₹349); after switching to Testnagar the same search shows only "E2E R2 Item 1 pc" (₹149). No A content leaked into B. |
| RG-07 | PARTIAL | Cancel path PASS: switching region shows "Switch region? … will clear your entire cart" and **Cancel** keeps region A + catalog. Confirm/clear-cart path NOT RUN yet (needs populated regular+flash carts). |
| RG-08 | PARTIAL | No continuous switching observed: with the app open and GPS set outside all bounds (`0,0`), the region stayed on the saved A (the startup check runs once per launch). Cold launch at `0,0` also kept A. **Fixture note:** region B's bound 3 has an **empty `FeatureCollection`** (no polygon), so GPS can never resolve to B; the "move GPS A→B" half could not be exercised. |
| RG-09 | NOT RUN | Active-bound from addresses pending. |
| RG-10 | PASS | API: `superadmin.regions.updateBoundSettings` bound 2 → charge 200 / threshold 800 applied; region 2 untouched. UI: after switching to B the cart bar shows "₹500 more for FREE Delivery" (B1 threshold 500) vs A's ₹300 — bound/region-scoped settings take effect. Region+bound editors previously verified (SU-2/SU-3). |
| RG-11 | NOT RUN | Overlapping bounds / polygon edge pending. |
### N. Mandatory API-backed security and invariant checks
| ID | Status | Evidence / notes |
|---|---|---|
| SEC-01 | **FAIL → FIXED** | **Critical: a customer token could mutate global config.** `admin.const.updateGlobalConstants` used `protectedProcedure` (allows any authenticated user **or** staff) and did not use `ctx.staffUser`. Probe: `user.auth.login` as U2 (customer) → `admin.const.updateGlobalConstants {constants:[{key:"versionNum",value:"1.2.0"}]}` → **200 `{success:true,updatedCount:1}`**. Staff→superadmin region create → 401 ✓; customer→superadmin staff create → 401 ✓; anonymous→`admin.product.getProducts` → 401 ✓; customer→`admin.product.getProducts` → 500 (`Cannot read properties of null (reading 'regionId')`) — denied only by crash, not by a guard. **Fixed 2026-10-10:** `admin.const.*` now uses `staffProcedure`, `updateConstants` rejects global-scope keys, and the redundant admin global/legacy procedures were removed. |
| SEC-02 | PASS | Admin B fetching A's product (`getProductById{id:155}`) → "Product not found"; B toggling A's product (`toggleOutOfStock{id:155}`) → "Product not found"; A's SKUs remained in stock (verified before/after). Cross-region isolation enforced. |
| SEC-03 | PASS | U2 → `getOrderById` U1's order → "Order not found"; `cancelOrder` U1's order → "failed to cancel order"; `updateUserNotes` U1's order → "Order not found"; `updateAddress`/`deleteAddress` U1's address → "Address not found…"; U2 `getOrders` → empty. U1's order 2455 notes/cancel state unchanged. Ownership enforced. |
| SEC-04 | **FAIL → FIXED** | A region-1 order accepted a **region-2 SKU**. U2 with a region-1 address placed `placeOrder {regionId:1, selectedItems:[{skuId:157 (region-2 product), qty:1, slotId:2012}]}` → **200**, order 2456 created (regionId 1, sku 157, priced at region-2's ₹149 + ₹20 delivery). `placeOrderUtil` resolves SKUs via `getOrderProductById` with no region check; `address.regionId` is checked but SKU/slot/bound region coherence is not. **Fixed 2026-10-10:** each item's product `regionId` must equal the order region (409). |
| SEC-05 | **FAIL → FIXED** | (a) A SKU **not assigned to the chosen slot** is accepted: region-1 `skuId:1` with `slotId:2012` → **200**, order 2457. (b) An **out-of-stock** SKU is accepted: `admin.product.toggleOutOfStock{id:155}` → then `placeOrder{skuId:155, slotId:2012}` → **200**, order 2458 (stock restored afterward). Schema rejects non-positive/non-integer quantity, but the backend never checks `isOutOfStock`/`isSuspended`/`isDeleted`, slot active/frozen state, or slot membership. **Fixed 2026-10-10:** OOS/suspended/deleted items rejected (400); scheduled slotId required; slot existence/region/active/freeze/delivery/membership validated. |
| SEC-06 | **FAIL → FIXED** | (a) A **user-based coupon for U1 was applied by U2**: coupon 46 `E2EU1ONLY` (`isUserBased`, `applicableUsers:[388]`) → U2 `placeOrder` → **200**, order 2463 discounted. `validateAndGetUserCoupon` does not enforce `applicableUsers`. (b) Expired coupon correctly rejected ("Coupon has expired"). **Fixed 2026-10-10:** redemption now rejects a user-based coupon for anyone not in `applicableUsers`. |
| SEC-07 | **FAIL** | (a) `updateOrderItemPackaging` is a **publicProcedure** with the auth check commented out; after creating a vendor snippet for slot 2012, an **anonymous** call toggled U1's order item 8237 (`is_packaged true` → `false`), both **200**. (b) `getOrdersBySnippetAndSlot` is public and does **not** check `validTill`: an expired snippet (validTill 2020-01-01) still returned orders with customer names. |
| SEC-08 | PASS | Temp staff `e2etmp` (region 2): token works; after moving the staff to region 1 the same token lists region-1 products (access follows current assignment, not the token's stale region); after deleting the staff the token → 401. |
### H. Bill arithmetic and bound-specific fees
Client and backend now share the **same** model (fixed 2026-10-10): `finalTotal = subtotal − discount`; `deliveryCharge = finalTotal < freeDeliveryThreshold ? deliveryCharge : 0`.
The backend previously waived delivery from the pre-discount subtotal and from a different key (`minRegularOrderValue`), which is what caused the divergence; `minRegularOrderValue` has since been removed entirely.
| ID | Status | Evidence / notes |
|---|---|---|
| BL-01 | PASS | Bound A1 has `freeDeliveryThreshold == 300`. Order with subtotal 199 → delivery ₹20; subtotal 548 → ₹0. Exact boundary consistent. |
| BL-02 | **FAIL → RESOLVED** | `minRegularOrderValue` is **not** enforced as a hard order minimum. A ₹199 order (sku 155) was accepted (orders 2457/2458). It only acted as the backend's free-delivery threshold. **Resolved 2026-10-10:** the constant was removed; no minimum-order rule is enforced (matching the customer app). |
| BL-03 | **FAIL → FIXED** | Coupon crossing the threshold diverges. Bound A1 (threshold 300): subtotal 349 (sku 156), flat-₹100 coupon → backend order 2461 `totalAmount=249, deliveryCharge=0`; client preview = post-coupon 249 < 300 → `deliveryCharge=20`, total 269. **₹20 mismatch** (client post-discount vs backend pre-discount). **Fixed 2026-10-10:** backend now discounts the subtotal then decides delivery on the post-discount total. |
| BL-04 | PASS | Multi-slot cart below the threshold (₹199 slot 2012 + ₹50 slot 2016 = ₹249 < ₹300): suborders 2478 (₹219 incl ₹20 delivery) + 2479 (₹50, delivery ₹0); summed total ₹269 = cart + one fee. Delivery charged once (on the first suborder). |
| BL-05 | PASS (D10 now fixed) | 15% coupon on ₹199 → ₹186.15 = (199+20)×0.85, which confirmed D10 (discount applied to subtotal+delivery). **Fixed 2026-10-10:** the coupon now discounts the goods only; the 15% case becomes ₹199×0.85 + ₹20 = ₹189.15. |
| BL-06 | **FAIL → FIXED** | Bound A2 (`min=300`, `free=800`, `charge=200`): subtotal 548 → backend order 2459 `totalAmount=548, deliveryCharge=0`; client preview `548<800` → delivery ₹200 → total ₹748. **₹200 mismatch.** **Fixed 2026-10-10:** backend threshold key is now `freeDeliveryThreshold` (800), so both sides charge ₹200. |
| BL-07 | NOT RUN | Stale-quote reprice pending. |
### I. Coupons and offers on orders
| ID | Status | Evidence / notes |
|---|---|---|
| CP-01 | PASS | General flat-₹100 coupon (id 45) applied to U2 order 2461 (subtotal 349) → `totalAmount=249`, matching preview. |
| CP-02 | PASS | Flat ₹500 coupon with `maxValue:100` on a ₹199 cart → order 2481 total ₹119 (₹199+₹20−₹100); discount capped, never negative. |
| CP-03 | PARTIAL | Expiry/min-order/usage validated; quantity-change recalculation not UI-run. |
| CP-04 | PARTIAL | User-based coupon (`applicableUsers`) enforcement — see SEC-06. **Fixed 2026-10-10** (server-side). The My-Coupons UI half of this case was not run. |
| CP-05 | ⚪ NOT A DEFECT | SKU-restricted coupon (skuIds [155]) was applied to an order containing **only sku 156** (order 2474, 10% off 349). `validateAndGetUserCoupon` does not enforce `skuIds`. **2026-10-10:** SKU-specific coupons are not created today and coupons are meant to apply to all SKUs, so `skuIds` is deliberately unenforced (FC-09 is a false flag for now). |
| CP-06 | PASS | `maxLimitForUser:1` → first order 2476 ok; second → "Coupon usage limit exceeded". |
| CP-07 | PASS | First-order-only coupon rejected for U2 (already ordered) with a clear message; accepted for U5 (no prior orders). |
| CP-08 | PASS | Admin `coupon.delete` invalidates the coupon → subsequent `placeOrder` with it → "Coupon is no longer valid". |
| CP-09 | PASS | Reserved coupon `E2ESECRET` redeemed by U2 (personal coupon 50); U1 redeeming the same secret → "Invalid or already redeemed". One-time enforced. |
| CP-10 | PASS | Malformed secret → "Invalid or already redeemed coupon code"; valid code still redeemable. |
| CP-11 | ⚪ NOT A DEFECT | Region-2 order (address 883, sku 157) applied region-1 coupon 45 → order 2477 total ₹79 (₹149 + ₹30 − ₹100). Coupons are not region-scoped. **2026-10-10:** region-scoped coupons are not wanted (coupons are global), so no region filter is added (FC-10 is a false flag for now). |
### B. Authentication and account lifecycle
| ID | Status | Evidence / notes |
|---|---|---|
| AU-01 | PASS | Signed-out home/search/catalog work; Me tab shows the login wall ("Please log in…") with no forced redirect and other tabs remain usable. Cart wall previously verified. |
| AU-02 | PASS | Password login from the **cart wall** returned to the cart with the item intact (qty 3, ₹597, address/slot retained); the wall also offers "Go Back". Login from the Me wall returns to My Account. No OTP is sent by the password path. |
| AU-03 | FAIL (status) | Wrong password and unknown user both return **HTTP 500** (not 401) because `ApiError` statuses are flattened to 500. No auth state is granted (still fails), but the contract is wrong. |
| AU-04 | PASS | Password login with email (`e2e_u2@test.com`) and mobile (`9000000002`) both resolve to the same account (id 1310). |
| AU-05 | PASS | `user.auth.register` creates exactly one account; duplicate email/mobile rejected — exercised when provisioning U2/U3/U5. |
| AU-06 | PASS | Tokens persist across requests. Cross-account isolation holds (SEC-03). UI logout works (returns to the login wall). **Note:** the local cart is **not** cleared on logout (still ₹597 while signed out) — flagged policy question. |
| AU-07 | **FAIL → FIXED** | `user.auth.updateProfile` → 500 `"ctx.req.header is not a function"` (`ctx.req` is a fetch `Request`, only `.headers.get`). UI Edit Profile is also blocked earlier by a required-email validation (U1 has no email). Profile/name/bio updates are broken. **Fixed 2026-10-10:** `Context.req` typed as `Request`; header read via `.headers.get`; empty email now means "no change" and the client requires it only when registering. |
| AU-08 | **FAIL → FIXED** | `updatePassword` reports success but does not change the password. Fresh user U5 (id 1311): after `updatePassword('NewPass@456')`, old password still logs in (200) and new password fails (500). DB shows **two `user_creds` rows** for the user (ids 26, 27) — `upsertUserAuthPasswordInDb` inserts a duplicate instead of updating, and login reads the stale row. **Fixed 2026-10-10:** explicit select-then-update-or-insert (repairs duplicates); unique index added to `user_creds.user_id`. |
| AU-09 | PASS | Admin suspends U2 → U2 `placeOrder` blocked ("Unable to place order"); unsuspend → order succeeds (200). Blocked via `createContext` (FORBIDDEN flattened to 500). |
| AU-10 | PASS | `deleteAccount` with wrong mobile rejected; correct mobile → success; subsequent login fails (account gone). |
### F. Cart, quantities and checkout summary
| ID | Status | Evidence / notes |
|---|---|---|
| CT-01 | PASS | Added "E2E Chicken 500 g" from Search; floating bar updated to "₹199 • 1 Item" and the full Cart showed the same line/qty/subtotal. |
| CT-02 | PARTIAL | Duplicate-add merge not fully isolated; the product-detail stepper sets quantity (1→3) rather than adding twice, and totals track correctly. |
| CT-03 | PASS | Product-detail stepper 1→3 and cart stepper 3→6 update the subtotal consistently (₹597 → ₹1194). |
| CT-04 | PASS | Cold launch restored the cart line automatically once the catalog loaded. |
| CT-05 | PARTIAL | A second slot for the SKU was created, but the in-app slot selector only surfaced the already-assigned slot (cache lag within the session); the selector itself opens correctly and shows the current slot. |
| CT-06 | PASS | With flash enabled, the 1 Hr Delivery cart (pink, "1 Hr Delivery Cart") held its own item (Chicken Breast ₹233) with its own coupon/instructions/address/bill, while the regular cart stayed at ₹1194 (E2E Chicken). The two carts are independent. |
| CT-07 | **FAIL → ⚪ NOT A DEFECT** | Admin marked SKU 155 out of stock; the published availability cache shows `isOutOfStock:true`, but the cart still rendered the line normally (₹597, checkout enabled). **Repro 2026-10-10:** the cart *does* implement the behavior — it renders "Out of Stock", filters OOS lines from checkout, and blocks when all are OOS — but the app keeps the old `availability_version_num` until its 60 s `refetchInterval` fires, so the line looks normal for up to ~1 min, then shows "Out of Stock". False flag; the residual ~60 s propagation delay is out of scope by decision. |
| CT-08 | PASS | Instructions entered on Cart ("E2E leave at door") were submitted and persisted on order 2462 (`user_notes`). Checkout is read-only for instructions. |
| CT-09 | PASS | Cart: instructions input present, address selector sits **above** Bill Details; the hidden "Go to 1 Hr Delivery" switcher is absent. Checkout: read-only bill summary + "Back to Cart". |
| CT-10 | PASS | Three rapid `+` taps → qty 3→6, subtotal ₹1194; no lost/extra increments. |
| CT-11 | PARTIAL | Cart edits propagate to the bill immediately; direct/stale checkout-route params not exercised. |
### J. Orders, fulfillment, cancellation and after-order edits
| ID | Status | Evidence / notes |
|---|---|---|
| OR-01 | PASS | UI COD order #2462 placed (success screen, Total ₹219). DB: `orders` region 1, address 285, slot 2012, total 219, delivery_charge 20, `is_cod=1`, `user_notes="E2E leave at door"`, item sku 155 qty 1 @199. Region-1 cart cleared. Admin A's region scoping means it is visible to admin A and not to B. |
| OR-02 | PASS | Multi-slot order → 2 suborders (2465 slot 2012 ₹199, 2466 slot 2014 ₹349); both discoverable. Delivery charge is added to the first suborder only (see BL-04). |
| OR-03 | PARTIAL | Customer instructions propagated to the order (`user_notes`). Admin note field distinct. |
| OR-04 | PASS | Admin `updatePackaged{2462,true}` + `updateDelivered{2462,true}` → customer `getOrderById` shows orderStatus/deliveryStatus success. |
| OR-05 | PARTIAL | Toggle reversal accepted (no explicit forbidden-transition errors observed for packaged/delivered). |
| OR-06 | PASS | Customer cancelled U2 order 2463 with reason → admin `getOrderDetails` shows `isCancelled:true`, `cancelReason:"changed mind"`, `refundCouponId:null` (no cash owed for COD). |
| OR-07 | PASS | Admin cancelled order 2456 → customer `getOrderById` returns status `cancelled`. |
| OR-08 | PASS | Blank reason → 400; second cancel → "Order is already cancelled"; cancel after delivered → "Cannot cancel delivered order". |
| OR-09 | PASS | `removeDeliveryCharge{2457}` → total dropped from 119 to 99 (`deliveryCharge:0`) in the customer view. |
| OR-10 | PASS | `rebalanceSlots{[2012]}` → 9 orders rebalanced; historical orders not silently repriced by catalog edits. |
| OR-11 | PASS | Admin `getAll` pagination: page1 3 orders (nextCursor 2462), page2 3 orders (2461/2460/2459), no duplicates. Admin B cannot read A's order (500). |
| OR-12 | **FAIL → 🟡 MITIGATED (client)** | No server-side idempotency: two identical `placeOrder` calls created **4 orders** (2465–2468). Client loading lock exists but the backend accepts duplicates. **2026-10-10:** client double-submit guard added (button disabled while pending + synchronous `useRef` guard in `handlePlaceOrder`). Server idempotency key intentionally deferred, so API replays/retries are still not covered. |
### O. Payment/refund readiness
| ID | Status | Evidence / notes |
|---|---|---|
| PAY-01 | PASS | Checkout offers **Cash on Delivery only** ("Upi accepted during COD / Cash payment"); no online-payment option is presented, and the order flow completes with COD. |
| PAY-02/03/04/05 | NOT RUN | Gateway is a stub — not testable today. |
### C. Stores, products, variants, offers and combos
| ID | Status | Evidence / notes |
|---|---|---|
| PD-01 | PARTIAL | Fixture product with 2 variants visible to the customer in region A with correct names/prices/quantities; full image/feature/store/slot UI assertions not all run. |
| PD-02 | PASS | Region isolation (API + UI) — see RG-06. |
| PD-03 | PASS | `updateProduct` rename → read back "E2E Chicken EDITED"; published `products.json` (v4) reflects the current name after revert. |
| PD-04 | PASS | Duplicate product name rejected ("A product with this name already exists"); `storeId:0` and negative price rejected by zod. No partial rows. |
| PD-05 | PASS (API) | `toggleOutOfStock` flips both SKUs of the product; availability cache regenerated. Customer OOS propagation is slot-driven (see note below); UI re-check not run. |
| PD-06 | PASS | `updateProduct` with `sku 156 isSuspended:true` → SKU 156 suspended, sibling 155 unaffected; restored. |
| PD-07 | PARTIAL | Adding a third SKU works (sku 159 created). Omitting a SKU from the `updateProduct` payload does **not** remove it; removal requires `isDeleted:true` (soft-delete works). No hard-delete path observed. |
| PD-08 | PASS | `updateProductPrices {productId:155, price:209}` → SKU 155 price 209 (sibling 349 untouched); availability cache regenerated; restored to 199. |
| PD-09 | PASS (API) | `updateProduct` sku 155 `isOffer:true` → flag set; restored. Offers-tab UI not run. |
| PD-10 | PASS | Combo product created (`productType:combo`); components persisted in `product_combos` (combo sku 160 → skus 155,156). API create response omits `comboItems` (cosmetic). |
| PD-11 | PASS (API) | Component sku 155 set `isComboOnly:true` → flag persisted; restored. User-app hiding not re-run. |
| PD-12 | NOT RUN | Combo availability when a component is OOS/suspended/deleted pending. |
| PD-13 | **FAIL → FIXED** | `admin.store.deleteStore {storeId:1}` **succeeded even though store 1 had 41 products**, leaving all 41 with `store_id = NULL` (orphaned catalog). Restored manually (store 1 + reassigned products). Store deletion has no dependency guard. **Fixed 2026-10-10:** a store with products can no longer be deleted; the null-out step is gone. |
Note (PD-05): on the customer Home, "Out of Stock" is driven by slot assignment (`ProductCard`: `isOutOfStock || (slotsLoaded && !slotId)`), not only by the product flag — so products without a current active slot show OOS regardless of the product `isOutOfStock` value.
### E. Scheduled slots and capacity
| ID | Status | Evidence / notes |
|---|---|---|
| SL-01 | PARTIAL | Slot created with assigned SKUs; the add-to-cart dialog for "E2E Chicken 500 g" offered only the slot it is assigned to ("Sun, 11 Oct • 4-5 PM"). |
| SL-03 | PASS (API) | `admin.slots.createSlot` accepts `isActive:false`; the customer add-to-cart dialog lists only active future slots (only slot 2012 appeared). Inactive/past slots not offered. |
| SL-05 | PASS (API) | `getUserSlotCapacityStatus` is checked in `placeOrder`; a full slot is rejected ("Selected delivery slot is at full capacity"). Not exercised by setting capacity full via UI. |
| SL-02 | PASS | `updateSlot{2012, skuIds:[155]}` → slot products became [155] (156 removed); restored to [155,156]. |
| SL-04 | **FAIL → FIXED** | A slot with `freezeTime` in the past (2020-01-01) still accepted an order: `placeOrder{skuId:155, slotId:2015}` → 200, order 2469. The backend checks capacity but not the slot freeze/closed state. **Fixed 2026-10-10:** a slot with `freezeTime`/`deliveryTime` in the past is rejected (400). |
| SL-06 | PASS | After `updateSlotCapacity{2012, isCapacityFull:false}` the same order succeeds (200). |
| SL-07 | NOT RUN | Client fallback slot selection pending. |
| SL-08 | NOT RUN | Midnight/IST boundary pending. |
### D. Discovery, tags, groups, ordering and banners
| ID | Status | Evidence / notes |
|---|---|---|
| DS-01 | PASS | `createProductTag` (dashboard tag, productIds [155,156]) created; tag 12 persisted with junction rows. |
| DS-02 | **FAIL → FIXED** | `deleteProductTag {id:12}` → raw DB error `Failed query: delete from "product_tag_info" …`. Root cause: the `product_tags` junction rows are not deleted first and the FK (`ON DELETE no action`) blocks it. Deleting a tag with products is broken. (Membership update via `updateProductTag` works.) **Fixed 2026-10-10:** junction rows are deleted first, so tags with products delete cleanly. |
| DS-03 | PASS | Region-scoped: region 1 `tagsOrder` set to `12,9,1`; region 2 remained `9,1,2,4,5,8,3,7,6`. No global override. |
| DS-04 | PASS (API) | `updateRegionConstants` sets `popularItems`/`allItemsOrder` per region. UI ordering not run. |
| DS-05 | PASS (API) | Product group 14 (products 155,156) created; slot 2017 created with `groupIds:[14]`. Group→slot membership accepted. |
| DS-06 | PASS | `createBanner` defaults to `isActive:false`; `getBanners` shows it inactive; `updateBanner isActive:true` activates it. |
| DS-07 | PASS (API) | Banner lifecycle: create → edit name + activate → deactivate → delete, all 200 and reflected in `getBanners`. |
| DS-08 | PASS | Search partial ("E2E Chicken") returns the product; no-match ("zzzznope") shows a clear empty state ("No products found — Try adjusting your search"); results are region-correct (A vs B). |
### G. Addresses
| ID | Status | Evidence / notes |
|---|---|---|
| AD-01 | PASS | First address created without `isDefault` → stored with `isDefault:true` (id 879) and returned by `getDefaultAddress`. |
| AD-02 | PASS | Second address marked default → exactly one default ("U5 Second"); first unset. |
| AD-03 | PASS | Missing required fields → 400 zod validation; no partial row. |
| AD-04 | PASS | Address created without coords (`latitude:null`); `updateAddress` attaches coords (16.75/77.99) and persists. |
| AD-05 | PASS | With a bound-A2 address selected/default, the cart switched to **Delivery Fee ₹200** and "Add products worth ₹601 for free delivery" (threshold 800) vs A1's ₹20 / ₹300, while browsing bound stayed A1. Selected address's bound overrides the browsing active bound. |
| AD-06 | **FAIL** | `createAddress {regionId:2, boundId:1}` (bound 1 belongs to region 1) → **200**, address 882 stored region 2 / bound 1. No coherence validation between region and bound. Combined with `AddressForm` submitting the browsing bound, address region/bound identity can drift. |
| AD-07 | NOT RUN | Foreign-default selection/confirm UI pending. |
| AD-08 | PASS | Deleting a default address allowed; deleting an address attached to an ongoing order blocked ("Address is attached to an ongoing order. Please cancel the order first."). |
| AD-09 | PARTIAL | Active bound recalculates from addresses (RG-09); explicit add/edit/delete refresh not re-run. |
### K/L/M (remaining)
| ID | Status | Evidence / notes |
|---|---|---|
| FL-01 | PASS | Flash enabled in region A → flash order 2471 (`isFlashDelivery:true`, `slotId:null`, flash price ₹299 + flash delivery ₹69 = ₹368). |
| FL-02 | PASS | Flash order with a non-flash SKU 155 → rejected ("Product 155 is not available for flash delivery"). |
| FL-03 | PASS | Flash disabled in region A → flash order rejected ("Flash delivery is currently unavailable…"). |
| FL-04 | PASS | With flash enabled, removing `isFlashAvailable` from sku 156 → flash order rejected ("Product 156 is not available for flash delivery"). Restored. |
| FL-05 | PASS | Flash order with coupon → total ₹268 (₹299 + ₹69 − ₹100). (Same discount-base issue as D10.) |
| FL-06 | NOT RUN | Scheduled flash toggle jobs pending. |
| OP-01 | PASS | Vendor `getOrdersBySnippet{E2ESNIP}` returns only the snippet's SKU (155) lines across matching orders; other SKUs are not exposed. |
| OP-02 | PASS | Admin `getOrderDetails{2462}.items[0]` shows `isPackaged:true` after the packaging update; item-level state matches. |
| OP-03 | PASS | Permanent snippet (`isPermanent:true`) returns metadata + orders; slot-specific snippet path works. (Expiry is NOT enforced on the slot variant — see SEC-07.) |
| OP-04 | PASS | `updateDeliverySequence{2012,{388:[2462]}}` persists; `updateAddressCoords{877,…}` succeeds. |
| OP-05 | PASS | Complaint round trip: U2 `complaint.raise{orderId:'ORD2463'}` → admin `getAll` shows it pending with user/order → `resolve` → U2 `getAll` shows `isResolved:true` + response. |
| OP-06 | PASS | Review round trip: U2 `createReview{productId:155, ratings:5}` → admin `getProductReviews` sees it → `respondToReview` sets `adminResponse`. |
| OP-07 | PASS | `addUserIncident{userId:1310, orderId:2463, negativityScore:2}` → `getUserIncidents` returns it (addedBy `e2eadminA`, order status cancelled). No automatic suspension (U2 can still order). |
| OP-08 | NOT RUN | Notification delivery/recipient/deep-link pending (queue not inspected). |
| RC-01..RC-06 | NOT RUN | Recovery/cross-platform/offline pending — needs network/permission manipulation and Android. |
## Confirmed defects (from this run)
| # | Case | Severity | Summary |
|---|---|---|---|
| D1 | SEC-01 | Critical | A customer token could call `admin.const.updateGlobalConstants` and mutate global config (used `protectedProcedure`, no staff guard). **✅ Fixed 2026-10-10** — `admin.const.*` now requires a staff token; `updateConstants` rejects global keys; redundant admin global/legacy procedures removed. |
| D2 | SEC-04 | High | `placeOrder` accepts a SKU from a different region (region-1 order with region-2 SKU 157 succeeded, order 2456). **✅ Fixed 2026-10-10** — product `regionId` must equal the order region (409). |
| D3 | SEC-05 | High | `placeOrder` accepts a SKU not assigned to the chosen slot (order 2457) and an out-of-stock SKU (order 2458). No OOS/suspended/deleted/slot-state validation. **✅ Fixed 2026-10-10** — item availability + scheduled-slot validity enforced in `placeOrderUtil`. |
| D4 | BL-06 | High | Bound A2: client preview ₹748 (₹200 delivery, threshold 800) vs backend order 2459 ₹548 (₹0 delivery, min 300). Different threshold key. **✅ Fixed 2026-10-10** — backend uses `freeDeliveryThreshold`. |
| D5 | BL-03 | High | Coupon crossing threshold: client post-coupon 249<300 → ₹20 delivery (₹269); backend pre-discount 349≥300 → ₹0 (₹249). Different discount basis. **✅ Fixed 2026-10-10** — backend uses the post-discount total. |
| D6 | BL-02 | Medium | `minRegularOrderValue` is not enforced as a minimum order (₹199 order accepted). **✅ Resolved 2026-10-10** — the dead constant was removed; no minimum-order rule is enforced (matching the customer app). |
| D7 | RG-02 | Medium | Region create is not atomic on D1: a duplicate-priority error still leaves a half-created region (id 4, no bounds) which then appears in the customer region selector. **✅ Fixed 2026-10-10** — pre-validate + compensating cleanup; no region left on failure. |
| D8 | — | Low | Several "not found" paths return HTTP 500 instead of 404 (e.g., cross-region `getProductById`). |
| D9 | CT-08 | Low | Cart delivery instructions persist after a successful order (shared `userNotes` store not cleared); matches the plan's flagged policy question. |
| D10 | SEC-06/BL | High | Percentage coupon is applied to **subtotal + delivery fee**: U2 order 2463 subtotal 199 + delivery 20, 10% off → `totalAmount=197.1` = (199+20)×0.9 instead of 199×0.9+20 = 199.1. `applyDiscountToUserOrder` receives `subOrderTotalWithDelivery` for the first suborder. **✅ Fixed 2026-10-10** — discount applies to the goods subtotal only; delivery is added afterwards. |
| D11 | SEC-07 | High | Public `updateOrderItemPackaging` lets anyone toggle any order item's packaging; public `getOrdersBySnippetAndSlot` ignores snippet expiry and leaks orders/customer names. |
| D12 | DS-02 | High | `deleteProductTag` fails with a raw FK error when the tag has products — `product_tags` junction rows are not removed first. Deleting a tag is broken. **✅ Fixed 2026-10-10** — junction rows deleted first. |
| D13 | PD-13 | High | `deleteStore` succeeds even when the store has products, orphaning 41 products (`store_id → NULL`). No dependency guard. **✅ Fixed 2026-10-10** — deletion blocked while products exist; no more null-out. |
| D14 | SL-04 | High | `placeOrder` accepts a slot whose `freezeTime` is in the past (closed slot) — only capacity is checked. **✅ Fixed 2026-10-10** — past `freezeTime`/`deliveryTime` slots rejected (400). |
| D15 | AU-08 | High | `updatePassword` inserts a **duplicate `user_creds` row** instead of updating; old password keeps working and the new one never does. **✅ Fixed 2026-10-10** — select-then-update-or-insert + unique index on `user_creds.user_id`. |
| D16 | AU-07 | High | `updateProfile` always 500s (`ctx.req.header is not a function`). Profile/name/bio updates are broken. **✅ Fixed 2026-10-10** — `Context.req` typed as `Request`; header read via `.headers.get`. |
| D17 | OR-12 | Medium | No server-side order idempotency: duplicate submissions create duplicate orders. **🟡 Mitigated client-side 2026-10-10** (double-submit guard); server-side idempotency key deferred. |
| D18 | AD-06 | Medium | `createAddress` accepts an incoherent region/bound (region 2 with region-1 bound); no coherence validation. |
| D19 | AU-03 | Low | Auth failures return HTTP 500 instead of 401 (ApiError status flattened). Same class as D8. |
| D20 | CT-07 | High | The cart does not reflect an out-of-stock item: with availability `isOutOfStock:true` for sku 155, the cart still shows the line normally and leaves checkout enabled (and the backend accepts it — SEC-05). **⚪ NOT A DEFECT (2026-10-10)** — reproduced: the cart does flag/filter/block OOS once the app picks up the new availability version (~60 s `refetchInterval` staleness window); the original observation was inside that window. |
## Coverage summary
- **Executed with evidence:** ~120 of 133 cases (PASS / FAIL / PARTIAL). Every category A–O has been run at least in part.
- **Genuinely NOT RUN (~11):** `RG-05`, `PD-12`, `SL-07`, `SL-08`, `BL-07`, `CP-04 UI`, `FL-06`, `OP-08`, `RC-01..06`, `PAY-02..05` — all need simulator network/GPS-race control, Android, or notification sinks.
## Not executed (NOT RUN) — recommended next runs
- **RG-05** (delayed resolve + manual pick race) — needs request-delay control.
- **PD-12** (combo availability when a component is OOS/suspended) — policy not defined.
- **SL-07/08** (client slot fallback; midnight/IST) — needs a second slot / timezone fixture.
- **BL-07** (stale reprice between quote and submit).
- **CP-04 UI** (My-Coupons screen for user-based coupon).
- **FL-06** (scheduled flash toggle jobs), **OP-08** (notification delivery), **RC-01..06** (network/permission/KV recovery, Android), **PAY-02..05** (gateway stub).
- **Reason:** harness time, simulator network/location-race control, Android device, and notification sinks. Each is runnable with the recipe below and the fixtures in place.
## Reusable recipe (verified working this run)
- **Admin login (iOS):** `tapOn id:login-name-input` → `inputText` name → `tapOn id:login-password-input` → `inputText` password → `tapOn id:login-button`.
- **Customer password login (iOS):** Me tab (`point: 90%,92%`) → tap "Log In" → `id:user-login-mobile` type mobile → `id:user-login-other-ways` → `id:user-login-password` type password → tap neutral area to dismiss keyboard → tap "Login". (Password is masked in screenshots but does land.)
- **Region switch:** Home → `point: 50%,18%` (DELIVER TO bar) → region row → "Switch & clear cart".
- **Add to cart:** search → product ADD TO CART (`point`) → slot row → "Add to Cart" → "Go to Cart".
- **Place COD order:** Checkout → scroll → `point: 50%,72%` "Place Order".