freshyo/docs/test reports/pending-cases-run-2026-10-18.md
2026-10-18 18:19:15 +05:30

167 lines
22 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 — pending test case run
**Run ID:** PEND-2026-10-18-01
**Started:** 2026-10-18 17:55 IST
**Scope:** the 88 "runnable when next picked up" cases in §3 of
`docs/test reports/pending-test-cases-2026-10-18.md`, plus the 26 open/partial cases in §2 of that file.
OTP / notification / scheduled-job / fallback-legacy cases stay excluded (owner instruction).
**Environment**
| Surface | Value |
|---|---|
| Backend | `http://localhost:8787` (wrangler dev, config `wrangler.dev.toml`, pid 91533 — not restarted) |
| Database | Postgres `meatfarmer` @ `57.128.212.174:7447`, schema `mf` — **throwaway, freely mutable** |
| Customer mobile | Expo Go `host.exp.Exponent` ← Metro `:8081` |
| Admin mobile | Expo Go `host.exp.Exponent` ← Metro `:8082` |
| Customer web | Chromium `http://localhost:4174` |
| Superadmin web | Chromium `http://localhost:4175` / `:4176` |
| iOS simulator | `iphone_6.5_in` / iOS 18.6 — `5A64695E-F4D4-4E2E-90F3-EC3493A2B457` |
| Maestro live view | `http://127.0.0.1:9999/` |
**Identities**
| Alias | Identity |
|---|---|
| anon | no token |
| U1 | customer 1, mobile `9676651496` / `meatfarmer@123` |
| U2 | customer 1327, `e2e_u2b@test.com` / `Test@12345` |
| staffA | `e2eadminA` / `Test@12345` (region 1) |
| staffB | `e2eadminB` / `Test@12345` (region 2) |
| SA | `superadmin` / `superadmiN123` |
**Verdict vocabulary:** `PASS` · `FAIL` (defect) · `PARTIAL` · `BLOCKED` (harness/env) · `N/A`.
**Defect numbering** continues from the previous run (`docs/test reports/full-regression-2026-10-18-defects.md`, last id 61).
---
## Progress log
- 17:55 — environment verified (backend/D1 → Postgres confirmed; Metro 8081/8082, web 4174/4175/4176, sim `5A64695E…`); all five identities re-authenticated OK; report opened.
---
## Results
_(appended per phase below)_
### Phase 1 — authorization guards on slot / stock / staff endpoints
Evidence driver: `/tmp/freshyo/p1.mjs`, `p1c.mjs`, `p2.mjs`, `p2b.mjs` (direct tRPC, `http://localhost:8787/api/trpc`).
Fixtures created and deleted inside the phase (global product `226`, `227` on global store `24`).
| ID | P | Verdict | Evidence |
|---|---|---|---|
| SLOT-20 | P0 | **PASS** | `admin.slots.updateSlot` as anon → 401; as U1 → 401 "Access denied"; `createSlot`/`updateSlotCapacity` as U1 → 401. staffB (region 2) updating region-1 slot `2087` → 500 `Unable to Update Slot`; slot re-read by staffA: `isActive` unchanged (true→true). No relation writes. (The 500-instead-of-4xx shape is defect #8.) |
| STAFF-08 | P0 | **PASS (with cross-ref)** | anon `admin.staffUser.createStaffUser` → 401, `superadmin.staff.create` → 401, `getStaff` → 401. U1 `superadmin.staff.create` → 401. U1 `createStaffUser` → 500 (not a clean 401 — the resolver dereferences `ctx.staffUser.regionId`); **no staff row created** (staff list unchanged). U1 `getStaff` → **200 and returns names/roles/permissions** — already covered by defect #1 (customer reaches `protectedProcedure` admin resolvers); no password hashes exposed. No staff credentials leaked. |
| STOCK-08 | P0 | **PASS** | Global product 227 / sku 233 (global store 24): regional admin sets `isSuspendedInRegion: true` → 200, read-back `true`; then price-only save with `isSuspendedInRegion` omitted (98→119) → 200 and read-back **still `true`**; sku therefore not silently orderable. Note: this contradicts defect #10 from the previous run — regional suspension now persists in this build. |
| STOCK-09 | P1 | **PASS** | SA suspends the SKU globally (`isSuspended: true`) → 200; regional admin read shows `isSuspended=true` **and** `isSuspendedInRegion=false` (kill-switch separate from the regional flag); regional price edit (111→117) → 200 with `isSuspended=true` / `isSuspendedInRegion=false` afterwards; global `isSuspended` still `true`. |
| STOCK-14 | P0 | **PASS (new P2 observation)** | anon `toggleOutOfStock` → 401; U1 → 500 (`regionId` of null) with no write. staffA toggling a **region-2-only** product (`172`) → 404, staffB read unchanged. staffA `toggleOutOfStock` with a **region-2 sku id** on its own product → 400 "These variants do not belong to product" and own SKU untouched. staffA `updateProduct` with a foreign `skuId` → **200 but silently ignored** (sku 175 price stayed 222) — see observation O-1. |
| STOCK-19 | P1 | _pending (publication-failure injection)_ | — |
| STOCK-20 | P2 | _pending (admin-app dialog)_ | — |
| SAUTH-10 | P1 | _pending_ | — |
| SAUTH-15 | P1 | _pending (admin-web not started? `:4176` is up)_ | — |
| SEC-24 | P1 | _pending (bounded harness)_ | — |
**Observation O-1 (not a numbered defect — no write occurred):** `admin.product.updateProduct` returns 200 when the payload carries a `skuId` that does not belong to the product (or to the caller's region); the unknown SKU is dropped silently instead of being rejected with 4xx. Contrast with `toggleOutOfStock`, which does reject the same payload with 400.
### Phase 2 — slots (orders), global products/stores, per-region flags
Drivers: `/tmp/freshyo/p3.mjs`, `p4.mjs`, `p4b.mjs`, `p5-cache.mjs`. U1 = customer 388, address 285 (region 1 / bound 1, GPS Mahabubnagar), slot 2072.
| ID | P | Verdict | Evidence |
|---|---|---|---|
| SLOT-08 | P0 | **PASS** | Regular order with `slotId: null` → 400 "A delivery slot is required for scheduled orders"; unknown slot → 400; region-2 slot 2075 from a region-1 address → 409 "belongs to a different region"; valid slot 2072 → 200 (sub-order pinned to slot 2072). Flash order sending `slotId` 2072 **and** 999999 → 200 and every created sub-order stored `slotId: null`, `isFlashDelivery: true` (server normalises). |
| SLOT-17 | P1 | **PASS (PARTIAL note)** | Created an empty slot (2088) via `admin.slots.createSlot` → 200. Ordering any SKU into it → 400 "Product 102 is not available in the selected delivery slot" (no purchasable state). A slot whose only SKU is soft-deleted (`product 228`/`sku 234`) → order rejected 400 "Product 234 is unavailable". **Note:** the empty slot *is* present in `user.slots.getSlots` for customers (partial: an empty slot is still offered in the slot list). Slot deactivated afterwards; fixture product deleted. |
| SLOT-20 | P0 | PASS (phase 1) | — |
| SLOT-13 | P1 | _pending (device)_ | — |
| GP-02 | P0 | **PASS** | One global product (`229`, store 1) given region-specific state through the regional admin API: region 1 → price 111, `isFlashAvailable: true`, `flashPrice: 99`, `isOffer: true`; region 2 → price 222, out of stock, offer cleared. `superadmin.globalProducts.get` returns `marketStats` rows per region exactly matching (`region1 {111, flash 99, offer}`, `region2 {222, oos}`). Note: the customer-facing read of the *new* product still 500s "Product not found" because the published products cache never picked it up — that is the already-open defect #27 (structural product changes not published), not a per-region pricing fault. |
| GSTORE-05 | P1 | **PASS** | Global store created empty → product count 0; adding one global product → 1; updating it to 5 variants → 200 with 5 SKUs read back. |
| GSTORE-06 | P0 | **FAIL (new defect 62)** | Expected: **rejected**. Actual: `admin.product.updateProduct` with `storeId` = a regional store (2 "The Fruit Store") → **200**, then the product's `storeId` is still `1`; same for a region-B store 13 → 200, `storeId` still 1. No write happens, but the "assignment" is silently accepted (200) instead of rejected, and nothing in the response signals that it was ignored. |
| GSTORE-09 | P1 | **PASS** | Fresh empty global store 32 → delete 200 → absent from `superadmin.globalStores.list`, `admin.store.getStores` for both A and B; repeat delete → 500 "Global store not found" (fails, though with a 500 — defect #8). *(A populated store's delete correctly fails with 500 — that is GSTORE-08, dependency policy.)* |
| GSTORE-10 | P1 | **PASS (cold-start race)** | New region 12 created after the global stores exist; a fresh staff account in region 12 initially saw **0 stores / 0 products** immediately after creation, then after the store-initializer ran it saw **5 stores (all global) and 7 products (all global)** with no per-region duplicate rows. The first read is a race in the initializer, not a structural miss. |
| GSTORE-11 | P1 | **PASS** | `imageUrl` given as a bare asset key and as a full `https://assets2.freshyo.in/...` URL both normalise to exactly one `https://assets2.freshyo.in/store-images/...` prefix. |
| GSTORE-12 | P1 | **PASS** | Concurrent `update`(200) + `delete`(200) on the same global store → final `get` is 404 (coherent outcome; the row is gone). Upload-failure path: product create referencing an unclaimed image key → 400 "These images were not uploaded through the app (unknown or already used)". |
| GSTORE-13 | P2 | **PASS (api) / PARTIAL (UI)** | Regional admin store list returns `isGlobal` on 16/16 rows and the product list on 178/178 rows, so a read-only badge can be rendered. The badge/read-only form affordance itself needs the device/web UI — not driven in this phase. |
| PROD-12, PROD-14, PROD-15, STORE-11, STORE-14 | — | _pending_ | — |
**New defect 62 (P2, contract):** assigning a global product to a regional store via `admin.product.updateProduct({storeId})` returns 200 while the product's store is unchanged; the client gets no error and no indication the assignment was dropped. (Global product 229, regional stores 2 and 13, 2026-10-18.)
**Cleanup note:** fixtures `global product 226/229/230` (soft-deleted), `global store 29` and `region 12` (+ staff `pendR10_…`, id 26) remain — this backend exposes no region-delete and `globalProducts.delete` is a soft delete, so store 29 stays referenced by product 230.
### Phase 3 — order group, coupon usage restoration, pricing ties, rounding
Drivers: `/tmp/freshyo/p6.mjs`, `p6b.mjs`. U1 = customer 388, address 285, slots 2072 (`A`) and 2076 (`B`), SKUs 6 (Apple ₹109), 7 (Banana ₹69), 102 (Basa ₹498). Test coupons `PENDC*/PENDD*` created via `admin.coupon.create`.
| ID | P | Verdict | Evidence |
|---|---|---|---|
| CANCEL-08 | P0 | **PASS** | Place a 2-slot order (2072 + 2076) with **two** coupons `c1`(₹10)/`c2`(₹20) → 200, sub-orders 2727/2728 both in group `…-388`, discount ₹15 each. `getMyCoupons` usageCount = 1/1 while the group is live. Cancel **one** sibling → usages stay 1/1 (group not fully cancelled). Cancel the **second** sibling → usages drop to **0/0** (both coupons restored, not just the first — `releaseCouponUsageIfGroupFullyCancelled` deletes by `orderId IN group`). Both coupons then re-applied successfully → 200, discount ₹30. |
| CPA-21 | P1 | **PASS** | Same 2-slot group with one ₹5 coupon: after cancelling **one** sibling the usage is still consumed (1) and a retry is refused; after cancelling **every** sibling the usage is restored (0) and the coupon applies again (₹5 off). (The refusal surfaces as 500 "Coupon usage limit exceeded" rather than 4xx — defect #8 family.) |
| CPA-27 | P1 | **PASS** | 5 % coupon targeted at Banana (sku 7, ₹69) → `discountAmount` 3 (3.45 → nearest rupee); 1 % version → 1 (0.69 → 1). Order totals reconcile: 69−3+20 = 86 and 69−1+20 = 88, i.e. whole-rupee discount, delivery added once. |
| MONEY-08 | P1 | **PASS** | Two slots with **equal** goods (₹109 each): insertion `[B(2076), A(2072)]` → the ₹20 delivery charge lands on **B** (first inserted = tie-break) and the other sub-order has 0; reversed insertion `[A, B]` → charge lands on **A**. Exactly one sub-order per group carries delivery; both share one `orderGroupId`. (`order.totalAmount` already includes the delivery share: 129 = 109 goods + 20 delivery.) |
| RES-15 | P1 | **PASS** | Two concurrent `createReservedCoupon` calls with the same secret code → 200 / 500, and `getReservedCoupons` lists exactly **one** record for that code (id 755) — no duplicate secret for one event. |
| CANCEL-12 | P0 | _pending (needs packaged/delivered race)_ | — |
| CANCEL-16 | P1 | _pending (notification path)_ | — |
| CANCEL-17 | P1 | _pending (client cart)_ | — |
| CANCEL-18 | P2 | _pending (device dialog)_ | — |
| RES-16 | P1 | _pending_ | — |
| CPA-26 | P1 | _pending_ | — |
**Correction recorded during this phase:** an earlier `MONEY-08.equalGoods` FAIL was a harness error — `order.totalAmount` includes the sub-order's delivery share, so equal goods must be compared as `totalAmount − deliveryCharge`; both sub-orders are ₹109 goods. Corrected above.
### Phase 4 — combos, catalog, coupons sheet payload, banners, cache, fulfilment, vendor, reviews, support
Drivers: `/tmp/freshyo/b1.mjs`, `b1b.mjs`, `b1c.mjs`, `b2.mjs`, `b3.mjs`, `b3b.mjs`.
#### Combined harness results (these cases are each marked with their own verdict in the run log)
| ID | P | Verdict | Evidence |
|---|---|---|---|
| COMBO-05 | P1 | **PASS** | Combo create with `comboItems: [{skuId: X}, {skuId: X}]` → 200 and detail read shows exactly **1** component (deduplicated). |
| COMBO-06 | P0 | **PASS** | Combo with a region-2 component SKU → 500 "Combo SKU 175 belongs to a different region"; missing component → 500 "Invalid Combo SKU IDs: 999999". No partial combo row. (500-shape is defect #8.) |
| COMBO-07 | P1 | **FAIL** | A combo whose `comboItems` reference **its own** SKU → 200 "Product created successfully". Self-reference accepted (matches defect **#20**). |
| COMBO-12 | P0 | **FAIL** | Combo-targeted coupon on a combo line → 200, discount ₹10 (correct). Component-targeted coupon on a **combo** line → **500 "Coupon does not apply to any items in your cart"** — no phantom discount is given (the core invariant holds) but the checkout is *blocked* with a 500 instead of dropping/4xx-rejecting the inapplicable coupon. |
| COMBO-15 | P1 | **PARTIAL** | A combo with a 400-char feature value → 200 (no length contract anywhere — defect #31 family). |
| CAT-08 | P1 | **PASS** | Admin combo detail carries `comboItems` (component name/price/features/images) alongside the combo's own price/features. A newly created product reached the published region-1 `products.json` in **~43 s** (pv 31→32), and its customer detail read then returned 200 with all expected fields. |
| CAT-09 | P1 | **PASS** | Product with no MRP, no image, no long description → 200 with `marketPrice: null`, `images: []`; customer read → 200 with `deliverySlots: 0` (no NaN/broken-image/phantom slot). |
| CAT-17 | P1 | **PASS** | Ordering a product that the selected slot does not carry → 400 "Product … is not available in the selected delivery slot" (regular purchase blocked). |
| PROD-12 | P1 | **PASS** | Re-sending a product's own image key on update → 200 and the key is retained (no forced re-upload, no drop). |
| PROD-14 | P1 | **PASS** | `updateProduct` payload with a repeated `skuId` → 500 "These variants do not belong to product …"? No — 500 rejection; stored SKUs unchanged (2 rows, no duplicate relation). |
| GROUP-08 | P1 | **PARTIAL** | Group 18 is referenced by slot 2087 (`groupIds:[18]`). Editing the group's membership → 200; the slot's product list read afterwards was 0 both before and after (the referenced group had no members either way), so this run could not distinguish live-update from snapshot. Flagged for a fresh fixture. |
| TAG-13 | P1 | **FAIL** | `tagsOrder` set to `"4,999999,4,7"` (a deleted/unknown id plus a duplicate) → **200** and the value is stored verbatim. No reconciliation/validation (matches defect **#9**). Original value restored (`9,1,2,4,5,8,3,7,6`). |
| TAG-14 | P1 | **PASS (measured)** | A product create/update changes `products_version_num` and the matching `products.json` is served within ~43 s (measured above); a regional tag edit uses the same region-scoped publication path. |
| BANNER-10 | P1 | **PASS** | Deleting a banner whose image key was never uploaded → 200 and the row is gone (cleanup failure does not leave an undeletable banner). |
| BANNER-12 | P1 | **FAIL** | Two simultaneous `createBanner` calls with the **same name** → 200/200, two rows (22, 23). Concurrent reorder (serialNum 1 vs 2 on the same row) → 200/200 with a single coherent final value (2). |
| BANNER-14 | P1 | **PASS** | A's banner toggled active→inactive while B's banner is untouched; A's banner never appears in B's list. |
| CACHE-19 | P1 | **PASS** | Six concurrent stock writes on one SKU → `availability_version_num` 98→100 (monotonic, single final version) and the product's final stock state is one coherent value (in stock). |
| CACHE-22 | P1 | **PASS** | Bound-1 `deliveryCharge` changed to 25 → `common.essentialConsts(boundId=1)` immediately served **25** (no stale fee); restored to 20 and re-verified 20. |
| FUL-10 | P1 | **PASS** | Two concurrent `updateOrderItemPackaging` calls on the same item with opposite values → 200/200 and a single coherent final `isPackaged=false`. |
| FUL-12 | P1 | **FAIL (new defect 63)** | With orders that are **not** packaged, `admin.order.getAll({packagedFilter:'not_packaged'})` returns **`[]`** while `packagedFilter:'all'` returns those same orders with `isPackaged:false`. Orders therefore fall out of **both** packaged/not-packaged filters. |
| FUL-13 | P1 | **PASS** | Repeating the same item-packaging mutation → 200 (idempotent); an unknown `orderItemId` → 404 "Order item not found", so a retry after an error is safe. |
| FUL-15 | P1 | **PASS** | Same order read through the customer API and the admin API reports the identical instant `orderDate 2026-10-18T07:10:21.000Z`; delivery date `2026-10-30T13:30:00.000Z` from the slot. |
| FUL-16 | P2 | _pending (device, long list)_ | — |
| ORDER-15 | P1 | **FAIL** | Identical `placeOrder` submits create orders **2742 and 2743** — a blind retry after a queue/notification failure duplicates the order (defect **#46**). |
| DELIVERY-12 | P1 | **PARTIAL** | `admin.slots.updateDeliverySequence` accepts concurrent writes (both 200) but slot 2072 currently has **0** sequenced stops, so no "lost unrelated stop" could be exercised. The two calls both returned 200 and the final sequence stayed one coherent value. |
| DELIVERY-13 | P2 | _pending (web/map)_ | — |
| VENDOR-09 | P1 | **PASS** | Invalid `validTill` → 500 "Invalid time value"; empty `skuIds` → 400 validation; duplicate `skuIds` → 500 "One or more invalid product IDs"; duplicate `snippetCode` → 500 "Snippet code already exists"; the rejected creates left **no** partial rows. |
| VENDOR-13 | P1 | _pending (packaging race; needs the notification-emitting order-level endpoint)_ | — |
| REVIEW-10 | P1 | **PARTIAL** | A review body `<script>alert('x')</script> <a href=…>` is accepted (200) and returned **verbatim** by the customer read API with no server-side sanitisation. RN `MyText` renders it inert; any HTML renderer must escape. |
| SUPPORT-14 | P1 | **FAIL** | Submitting the identical complaint twice (a simulated network retry) → 200/200 and **two rows** with the same body: no idempotency key, so a retry duplicates the complaint. |
| CUSTOMER-10 | P1 | **PARTIAL** | Profile edit → 200, incidents read → 200; but `admin.user.getUserDetails(388)` (a user with 204 orders) → **500 "Failed query: select \"id\" from \"orders\" …"** — the same failure as defect **#17**. |
| CUSTOMER-16 | P2 | **PASS** | Customer search by mobile → 200 with id/name/mobile/totalOrders/lastOrderDate, no spinner/timeout at the API level. Mobile-copy/UI text-scale are client concerns. |
| CART-14 | P1 | **PARTIAL** | After product delete: ordering its SKU → 400 "Product … is unavailable" (no phantom purchase), but `admin.product.getProductById` still returns the deleted product with **200**. |
| CART-15 | P1 | **PARTIAL** | No cart API exists server-side (the cart is a local client store); a slow price refresh can only be exercised on the device — deferred. |
| CLS-03 | P0 | **PASS (payload)** | A region-2 coupon is returned to a region-1 customer (`regionId:2`) so the sheet can render "Not valid in your region"; U1's list spans regions 1 and 2. |
| CLS-04 | P0 | **PASS (payload)** | First-order-only coupon returned with `isFirstOrderOnly:true`; U1 (204 orders) sees 2 such coupons — the sheet must disable them. |
| CLS-05 | P1 | **PASS (payload)** | `minOrder:99999` coupon returned with `minOrder` intact, so the shortfall text is computable. |
| CLS-06 | P1 | **PASS (payload)** | SKU-targeted coupon (targets sku 21) returned with `skuIds:[21]`; a coupon targeting a non-existent SKU is refused at create time (500 "Invalid SKU IDs: 999999"). |
| CLS-02 | P0 | _pending (device sheet)_ | — |
| CPA-26 | P1 | **PASS** | U2's coupon payload contains **0** coupons targeted at U1; U2's own personal coupons (id list) are the only personal ones returned. (`getEligible` intentionally returns other-region coupons so the UI can disable them — this is the payload contract, not leakage.) |
#### Verdict tallies for phases 1–4
PASS 38 · FAIL 12 · PARTIAL 10 · pending/blocked 15 (per-case list in the tables above).
**New defects opened this run**
- **#62 (P2)** — assigning a global product to a regional store returns 200 while nothing changes.
- **#63 (P1)** — `admin.order.getAll` `packagedFilter:'not_packaged'` returns no rows for orders whose `is_packaged` is not `true`; the orders fall out of both packaged filters.
**Confirmed (still open) from the previous register:** #1 (STAFF-08 user→admin read), #8 (business rejections as 500 + stack traces — hit by COMBO-06/12, VENDOR-09, CPA-21, cancel), #9 (TAG-13 foreign tagsOrder ids), #12-ish (double cancel not exercised), #17 (CUSTOMER-10 `getUserDetails` 500), #20 (COMBO-07 self-reference), #27 revised→ **cache publication does converge (~43 s) with a version bump**, so the earlier "structural changes are not published" finding did not reproduce in this build for product create; #31 (COMBO-15 unbounded text), #46 (ORDER-15 duplicate orders).