172 lines
36 KiB
Markdown
172 lines
36 KiB
Markdown
# Freshyo E2E — complete error log (run 2026-10-10 16:30 IST)
|
||
|
||
Every error, failure, rejection and exception observed during the run (and during the setup work in
|
||
the same session), with the exact message, where it came from, whether it is an **app/API defect**, a
|
||
**harness limitation**, or **my own input**, and what happened next.
|
||
|
||
Companion files: `e2e-sanity-test-results-2026-10-10-1650.md` (case outcomes),
|
||
`e2e-findings-2026-10-10.md` (curated defects F1–F14).
|
||
|
||
Counts: **18 app/API defects** (A) · **9 API-contract/validation errors caused by my inputs** (B) ·
|
||
**3 response quirks that are not defects** (C) · **11 harness/tooling errors** (D) ·
|
||
**7 mistakes of mine in scripts/inspection** (E) · **4 false alarms retracted** (F).
|
||
|
||
---
|
||
|
||
## A. App / API defects reproduced in this run
|
||
|
||
| # | Where / trigger | Exact message | Root cause | Ref |
|
||
|---|---|---|---|---|
|
||
| A1 | `admin.product.deleteProduct {id:152}` and `{id:151}` (region 1) | `Failed query: delete from "product_info" where ("product_info"."id" = ? and "product_info"."region_id" = ?) returning "id", … params: 152,1` → HTTP 500 `INTERNAL_SERVER_ERROR` | D1 enforces FKs; `product_skus.product_id` (NOT NULL, `ON DELETE no action`) still referenced the row. Fixed as a soft delete — see F1 | **FIXED 2026-10-10 18:26** (soft delete) |
|
||
| A2 | Order #2495 (₹473.6 payable = ₹304 items − ₹30.4 coupon + ₹200 fee, coupon 10 %) | both order-detail APIs reported `discountAmount: 47.36` while the charge applied `₹30.4` | Discount is recomputed at read time on the wrong base: read paths used `order.totalAmount` (473.6, the paid total) instead of the items subtotal (304) | **FIXED 2026-10-10 18:47** (both paths now report 30.4) |
|
||
| A3 | `updateSlotCapacity {slotId:2033,isCapacityFull:true}` then app → product → `ADD TO CART` | UI: slot `Sun, 11 Oct • 7-8 PM` still listed, checkbox enabled, `Add to Cart` accepted (bar `₹199 • 1 Item`) | Three disagreeing slot sources: `AddToCartDialog` reads the cached `slots.json` at a version pointer stuck at 13 (`essentialConsts` KV blob) while newer files exist; checkout's `user.slots.getSlots` returned an unfiltered multi-region list; only `user.cart.getCartSlots` (live DB) and `placeOrder` filter capacity. The app never reads `isCapacityFull` | F3 (open; `getSlots` scoping **FIXED 2026-10-10 19:20**; stale-pointer part closed as KV delay, by decision) |
|
||
| A4 | `admin.product.createProductTag` with a presigned `imageUrl`; read back via `getProductTags` then `deleteProductTag {id:10}` | read returns `"imageUrl": "https://assets2.freshyo.in/https://da9b1aa7…r2.cloudflarestorage.com/meatfarmer-dev/tags/…?X-Amz-…"`; delete → `Failed to delete image` (500) and tag 10 still exists | Write stores the caller's string verbatim (`createProductTag`/`updateProductTag`), reads run `scaffoldAssetUrl` which blind-prefixes the assets domain, and delete passes that same string to `deleteImageUtil` as an object key → S3 rejects, the mutation throws before the row is deleted. Legacy tags 1/4 are already corrupted in the same way (`…jpeg%3FX-Amz-…`) | **FIXED 2026-10-10 20:00** — normalise on write, idempotent scaffolding, non-fatal image cleanup; legacy tags 1/4 images cleared pending re-upload |
|
||
| A5 | `admin.product.createProduct` with a never-uploaded image URL | `Failed to claim upload URL` (500) — but product **151 + 2 SKUs were created** | Claim runs after the insert transaction commits and is unguarded (`claimUploadUrl` throws when no `pending` row exists for the key). Same pattern at 6 sites: createProduct/updateProduct/respondToReview/createProductTag/updateProductTag + user createReview. `upload_url_status` has no readers, so the image itself is fine — the damage is the orphaned row, the misleading 500 and the retry collision | **FIXED 2026-10-10 20:35** — validate the upload URLs before the write (400 naming the keys), claim afterwards without failing the request |
|
||
| A6 | `superadmin.regions.updateBoundSettings {boundId:1,settings:[{key:"isFlashDeliveryEnabled",value:"true"}]}` | `{"success":true,"updatedCount":1}` yet `essentialConsts.isFlashDeliveryEnabled` stays `false`; a stray `isFlashDeliveryEnabled:"true"` row now sits in bound 1's settings | Neither superadmin const endpoint validates key scope: `scaffoldEssentialConsts` resolves each key from its own table (`isFlashDeliveryEnabled` from `region_consts`) and never reads bound rows wholesale, while `updateBoundSettings`/`updateRegionConstants` upsert any key into their own table. `CONST_SCOPE` exists and is enforced by `admin.const.updateConstants` only. The superadmin UI is scope-correct, so this traps scripts/agents (mirror case: bound keys into `region_consts`) | **FIXED 2026-10-10 21:10** — `CONST_SCOPE` validation in all four const endpoints (400 naming the right endpoint); `value: null` now deletes a row, so the stray bound row was removed |
|
||
| A7 | `superadmin.regions.delete {id:2}` | `No procedure found on path "superadmin.regions.delete"` (404) — no region/bound delete and no region status flag; region 2 stays in `common.listRegions` | **Not a defect** — deleting a region is not an allowed action (confirmed by the product owner). The consequence is process-level: the test plan's RG-01 cleanup step is unactionable and a created region is permanent/customer-visible, so fixtures should reuse one long-lived test region or be renamed and have their bound polygon shrunk. **Bounds are deletable** (`deleteBound`, added 2026-10-10 22:15) subject to two guards: not the region's only bound, and no address referencing it | F7 (by design) |
|
||
| A8 | `user.address.createAddress` without lat/lng (fresh customer 1314, first address); then the app's own `+ Attach Current Location` flow; then the active-bound rule for a mixed address set | create → `{id:881, boundId:null}`; attach-location (coords only) → coords set, `boundId` still null. Active bound observed live: with the user's only bounded address on bound 2, `common.activeBound` returns **2** while region 1's least-priority bound is **1** | **Not a defect (by design, confirmed 2026-10-10):** an address may exist without a bound and is served by the active bound (`common.activeBound` = least-priority bound of the user's addresses in the region, region's effective bound when they have none); `placeOrder` uses `params.boundId ?? getEffectiveBoundId(regionId)` and verifies the bound belongs to the region. Kept for reference only: the charge for a bound-less address follows the client's `params.boundId`, and `orders` has no `boundId` column | F8 (by design) |
|
||
| A9 | Home screen, region-switch attempts (customer app) — captured 5:02/5:02/5:03 | endless centred spinner **above the `DELIVER TO` bar**, no sheet and no backdrop, content fully loaded; `common.listRegions` answered normally over curl; cleared only by relaunch | Re-read from the screenshots (not the reported cause): this is the home list's `RefreshControl` (`home/index.tsx:758-764`), whose `isRefreshing` state (`:504`) is cleared only when all four refetches in `handleRefresh` (`:603-621`) settle. `products/stores/slots.json` are fetched with plain `axios.get(cacheUrl)` with **no timeout** (`prominent-api-hooks.ts:160-171`) under a query client with `retry: 3` and no fetch timeout, so one hanging request pins the spinner until relaunch. The region sheet was **never open** in those captures (a presented `BottomDialog` dims the screen with `rgba(0,0,0,0.3)`), so the original "region sheet hangs" wording was a misread of the harness screen. Separately confirmed by code: the region gate can strand forever on `LoadingScreen("Finding your region...")` when location is denied and no region is saved (`useRegion.ts:180-191`), with `refreshLocation` wired nowhere | F9 |
|
||
| A10 | Add-Product form on iOS via Maestro testIDs | Product Name ended up `E2E Sanity 1655n500 g199249 1 kg`; variant quantity/price fields left empty; keyboard never dismissed | **Not an app defect (harness/flow).** `MyTextInput` is a passthrough to react-native-paper's `TextInput` with no focus logic (`packages/ui/src/components/textinput.tsx`), and the repo's own `tests/e2e/add-product.yaml` shows the required pattern (`inputText` → `hideKeyboard` → `scrollUntilVisible` → tap per field). My exploratory flow skipped that, so with the keyboard up the lower fields sat behind it, taps hit the keyboard, focus stayed on Product Name and every `inputText` appended there. Minor genuine gap kept in the report: `ProductForm` is a bare `ScrollView` and admin-ui has no `KeyboardAvoidingView`/auto-scroll | F10 (reclassified) |
|
||
| A11 | `admin.product.toggleOutOfStock {id:152}` then `placeOrder {skuId:153}` and `{skuId:154}` | both rejected: `Product 153 is unavailable`, `Product 154 is unavailable` | Stock lives per SKU per region (`product_market_stats.is_out_of_stock`), but `toggleProductOutOfStock(regionId, productId)` writes one computed value to **all** of the product's SKU rows for the region — no `skuId` input. PD-06 (one variant out) is only expressible via `updateProduct`/`createProduct` (or the global-product form), and the toggle collapses a partial state (one out + one in → press 1 = all in, press 2 = all out). The admin list switch reads only the default SKU, so a partially-out product can show as in stock | **FIXED 2026-10-10 23:20** — `toggleOutOfStock` accepts optional `skuIds` + `isOutOfStock` (per-variant, validated) while `{id}` alone keeps the all-variants toggle; the admin app picks variants in a new `VariantStockDialog` (BottomDialog) and the row chip/filters/counters now aggregate over all variants (In / Partial / Out) |
|
||
| A12 | All business rejections (OOS, full slot, guards) | HTTP **500** `INTERNAL_SERVER_ERROR` with a correct message — e.g. `Selected delivery slot is at full capacity…`, `Cannot delete a store that still has products…`, `Address is attached to an ongoing order…`, `Cannot delete default address…` | ApiError statuses flattened to 500 | F12 |
|
||
| A13 | My Orders list for delivered order #2495 | `SHIPPING STATUS: success` (detail screen shows `DELIVERED`) | Internal status string rendered in the list | F13 |
|
||
| A14 | Cart, first selection of the A2 address | screen rendered `Your cart is empty / Looks like you haven't added anything…` with A2 checked; the same cart came back with the A2 fee on the next attempt | Unconfirmed client flap | F14 |
|
||
| A15 | `common.essentialConsts?boundId=1` with a **staff** token | values came back `null` (`products_version_num: null`, `deliveryCharge: null`) while the same call with a superadmin token returned real values | Mixed/absent tenant resolution for staff context on a customer-facing endpoint | — |
|
||
| A16 | `pi mcp list` in the project | `…/freshyo/.pi/mcp.json is ignored because the project is not trusted` although `~/.pi/agent/trust.json` contains `{"/Users/…/freshyo": true}` | Trust decision honoured by sessions but not by the shell subcommand | — |
|
||
| A17 | Maestro MCP handshake against `maestro mcp` | `{"code":-32601,"message":"Server does not support resources/list"}` | Server advertises tools only — informational, listed for completeness | — |
|
||
| A18 | `maestro mcp --help` | `Unknown option: '--help'` + usage text | CLI accepts no help flag | — |
|
||
|
||
## B. Errors caused by my inputs (API contract / validation)
|
||
|
||
| # | Call | Exact message | What I did wrong / fix |
|
||
|---|---|---|---|
|
||
| B1 | `superadmin.regions.updateBoundSettings {"bounds…","settings":{…}}` | zod: `expected: "array", code: "invalid_type", path: ["settings"], "Invalid input: expected array, received object"` | `settings` is an **array** of `{key,value}` — corrected and retried |
|
||
| B2 | `user.order.getOrderById {"orderId":2495}` | zod: `expected: "string"`, path `orderId`, `Invalid input: expected string, received number` | this endpoint takes the id as a **string** (`"2495"`) |
|
||
| B3 | `admin.order.updatePackaged {"orderId":2495}` / `updateDelivered {"orderId":2495}` | same zod string/number error | ids are strings for these mutations |
|
||
| B4 | `admin.order.getAll {"flashDeliveryFilter": true}` | zod: `invalid_value`, `values: ["all","flash","regular"]`, path `flashDeliveryFilter` | the filter is an **enum**, not a boolean. With `"flash"` it correctly returned orders 2496/2474/2473 — **my earlier "filter defect" claim is retracted** |
|
||
| B5 | `superadmin.staff.create` (region B admin) | `"Unexpected token '}', ...\"regionId\":}\" is not valid JSON"` | my shell variable for `regionId` was empty (bad jq path) → invalid JSON body |
|
||
| B6 | `admin.product.updateProduct` for the region-2 product | `Store belongs to a different region` (500) | I passed region-1 `storeId:1` for a region-2 product; must use store 12 (and later the staff-B token was already deleted) |
|
||
| B7 | `superadmin.staff.remove {"id":12}` | `Staff user not found` (500) | wrong id — the created staff was id **7**; removed correctly afterwards |
|
||
| B8 | `admin.staff.list`, `user.address.list`, `user.addresses.list`, `user.address.getAddresses`, `common.getRegions`, `common.regions`, `common.regionList`, `user.region.list` | `No procedure found on path "…"` (404) | guessed procedure names; correct ones are `admin.staffUser.*`, `user.address.getUserAddresses`, `common.listRegions` |
|
||
| B9 | `admin.staffUser.login {name:"e2eadminA"}` (first attempt) | `UNAUTHORIZED` (401) | the 13:10 fixture staff no longer existed — expected, not a defect |
|
||
|
||
## C. Response quirks that are **not** defects
|
||
|
||
| # | Observation | Why it is not a bug |
|
||
|---|---|---|
|
||
| C1 | `GET /` → 404; `superadmin.regions.list` without a token → 401 | expected for a tRPC-only worker and an authenticated procedure |
|
||
| C2 | `admin.order.getOrderDetails {orderId:2495}` with the **region-B** token → `Order not found`; `admin.product.getProductById {id:152}` with the B token → `Product not found` | correct cross-region isolation (SEC-02/OR-01 evidence) |
|
||
| C3 | Cart moves the ₹20 delivery fee back on **after** a coupon drops the subtotal below ₹300; "Add products worth ₹26 for free delivery" | internally consistent post-discount policy (the discrepancy is in what gets *persisted* — A2) |
|
||
|
||
## D. Harness / tooling errors
|
||
|
||
| # | Where | Exact message | Cause / workaround |
|
||
|---|---|---|---|
|
||
| D1 | `run` without an `appId` header | `Failed to run flow: Config Section Required at /var/folders/…/maestro-flow….yaml:1:1` | flows need `appId: …` + `---`; fixed each time |
|
||
| D2 | `run` while a second `maestro mcp` server was attached | `Failed to run flow: Device became unreachable during viewHierarchy` | two MCP servers (opencode's + mine) competing for the same iOS driver; killed my orphans and switched to `detached: true` + `killpg` |
|
||
| D3 | `tapOn: "Home"` in a flow | `Failed to run flow: Element not found: Text matching regex: Home` | Maestro text matching is **full-string regex**; the tab node is `Home, tab, 1 of 5` → use `"Home, tab, 1 of 5"`, `"Home.*"` or a point tap |
|
||
| D4 | `assertVisible: "DELIVER TO"` | `Failed to run flow: Assertion is false: "DELIVER TO" is visible` | the customer home is one a11y node with `txt: ""`; fragments of the concatenated blob never match |
|
||
| D5 | Long chained flow (region switch with two waits + 45 s `extendedWaitUntil`) | `Error: MCP request timed out after 60000ms` (codemode `Script failed`) | per-request MCP ceiling is 60 s; flows must be split or `timeout` raised in `.pi/mcp.json` |
|
||
| D6 | `run` on the flash flow | `Failed to run flow: Assertion is false: ".*Order Placed Successfully.*" is visible` | my `Checkout`/`Place Order` coordinates were stale (screen had grown); retried at 72 %,77 % and 50 %,69 % |
|
||
| D7 | Reusing `clearState` to log out | *(no error raised)* the session simply survived | `launchApp: {clearState:true}` is a no-op on iOS; log out through the UI |
|
||
| D8 | After the first region switch, `DELIVER TO` taps | *(no error raised)* endless spinner, sheet never opens | see A9; workaround = relaunch the app |
|
||
| D9 | Killing my helper client | orphaned `java … maestro.cli.AppKt mcp` processes remained (driver contention) | SIGTERM to the `maestro` wrapper does not kill the JVM; spawn detached and kill the process group |
|
||
| D10 | `pi --approve mcp list` | *(no error raised)* it started a full agent session with the prompt "mcp list" instead of listing servers | put flags after the subcommand; it did prove the MCP server was reachable |
|
||
| D11 | `curl …/superadmin.regions.bounds` (bounds of region 1) | response body cut mid-JSON in my capture (`{"id":2,…` truncated by my own `head -c`) | display artefact only |
|
||
|
||
## E. Mistakes of mine in scripts/inspection (no product impact)
|
||
|
||
| # | Where | Exact message | Fix |
|
||
|---|---|---|---|
|
||
| E1 | codemode script | `TypeError: tools.describeNamespace does not exist. Available: read, bash, …, mcp__maestro__*` | in codemode, MCP tools are `tools.mcp__maestro__run(...)` etc.; namespace description is not exposed |
|
||
| E2 | codemode script with `dev.structuredContent?.devices ?? JSON.parse(...)` | `TypeError: not a function` | `list_devices` returns only `content[0].text` as JSON — parse that instead |
|
||
| E3 | codemode script using `typeof ''.includes` inside a single-quoted string | `SyntaxError: Unexpected string` | quoting bug in my own probe |
|
||
| E4 | codemode script | `TypeError: cannot read property 'slice' of undefined` | guarded the optional field afterwards |
|
||
| E5 | codemode options line typo | `@options must be valid JSON with supported fields 'max_output_tokens' and 'timeout_ms': Expected ':' after property name…` | corrected JSON |
|
||
| E6 | `sqlite3 apps/backend/dumps/latest.sqlite "select … from regions"` | `Error: in prepare, no such table: regions` | that dump is not the live DB; no SQLite ground truth is reachable (`.wrangler/` empty; `find` over `~/Library` timed out at 180 s) |
|
||
| E7 | `cat ~/.nvm/alias/lts` (unrelated shell work) | `cat: …/alias/lts: Is a directory` (exit 1) | it is a directory of LTS codenames, not a file |
|
||
|
||
## F. Retracted / false alarms (kept so nobody re-chases them)
|
||
|
||
| # | Earlier claim | Verdict |
|
||
|---|---|---|
|
||
| F1 | "`admin.order.getAll {flashDeliveryFilter:true}` returns nothing → filter defect" | **Not a bug.** The schema wants `"all" | "flash" | "regular"`; with `"flash"` it returned orders 2496, 2474, 2473. My boolean input produced a zod error that my jq rendered as `[]` |
|
||
| F2 | "Selecting the A2 address wipes the cart" | **Unconfirmed.** The empty-cart render occurred once; the very next attempt kept both lines and the coupon. Logged as A14 |
|
||
| F3 | "`common.essentialConsts` is broken" | **Wrong.** It returns data for a superadmin token; the `null` payload was reproduced only with a staff token (A15) |
|
||
| F4 | "`admin.store.deleteStore` is broken" | **Not a bug.** Both stores refused with `Cannot delete a store that still has products…` — correct guard; my fixtures simply still had products (and products cannot be deleted because of A1) |
|
||
|
||
## Cross-reference: which case IDs these errors affected
|
||
|
||
`RG-01` (A7) · `RG-06`/`AD-05` (A9, A14) · `PD-01` (A5, A10) · `PD-13` (A1, F4) · `SL-05` (A3, A12) ·
|
||
`CP-01`/`BL-01`/`BL-03`/`BL-04` (A2) · `DS-01` (A4) · `AD-01`/`AD-04` (A8) · `OR-01`/`OR-04` (A13) ·
|
||
`FL-01` (A6) · `PD-06`/`PD-11` (A11) · all API cases (A12) · whole run (D1–D11).
|
||
|
||
## Data still stranded because of A4 (A1 fixed, A7 by design)
|
||
|
||
Region 2 + bound 3 (**by design — region deletion is not an allowed action**) · stores 11 and 12 ·
|
||
region-2 product 153 · customer `9000011715` + default address 880 · address 879 (tied to order #2495) ·
|
||
slots 2033/2034 (deactivated) · orders #2495 (delivered), #2496 (flash, pending). Everything else was
|
||
restored: staff B removed, coupon 43 invalidated, flash `false`, bound-1 constants 300/20, slot 2033
|
||
capacity cleared, tag 10 deleted, tags 1/4 images cleared.
|
||
|
||
**A1 fix (2026-10-10 18:26):** products 152/151 were soft-deleted and disappeared from the catalog; their
|
||
rows remain as tombstones so order lines keep the product name. Store 11/12 are still blocked by region-2
|
||
product 153, and tag 10 by the image-delete bug (A4).
|
||
|
||
---
|
||
|
||
## G. New defects from the full-plan run (2026-10-10 20:30–21:30 IST)
|
||
|
||
Run report: `docs/test reports/e2e-full-run-2026-10-10.md` (161 cases: 79 PASS / 47 PARTIAL / 23 FAIL / 8 BLOCKED / 4 NOT RUN).
|
||
Defects are numbered A19+ (continuing this file's A-series). Every row below was reproduced live against the
|
||
running dev server with authoritative API reads.
|
||
|
||
| # | Defect | Evidence (live) | Impact / notes |
|
||
|---|---|---|---|
|
||
| A19 | ~~**`ApiError` → HTTP 500.**~~ **FIXED 2026-10-10.** Root cause (read out of the installed tRPC 11 source): `callRecursive` catches every resolver error and hands middleware a `{ ok: false, error }` **result** — it never throws — and `getTRPCErrorFromUnknown` wraps a non-TRPCError as `INTERNAL_SERVER_ERROR` with the original on `cause`. The previous fix put `toTRPCError` in a `catch` around `next()`, which is unreachable for resolver errors, so the mapping never ran. | **verified live after the fix:** expired reserved coupon → **400 BAD_REQUEST**; only-address delete → **409 CONFLICT**; default-address delete → **409**; address with an open order → **409**; capacity-full slot → **403 FORBIDDEN**; duplicate product name → **400**; bogus image on product create and on tag create → **400**; wrong-scope const write (admin + superadmin) → **400**. Controls unchanged: zod input → **400**, unknown procedure → **404**, no token → **401**. | Fix: `translateResultError(result.error)` in `errorLoggerMiddleware` — maps `result.error.cause` only when it is an ApiError, so tRPC's own codes are preserved. **Residual:** business rejections thrown as **plain `Error` inside the db-helper packages** still return 500 — notably `validateAndGetCoupon` (`not applicable` → 500, `Coupon has expired` → 500), seen in SEC-06. |
|
||
| A20 | ~~**SKU-restricted coupon is not enforced.**~~ **CLOSED — by design.** Coupons are **not** SKU/product-scoped, so a coupon applying to every SKU in the cart is the intended behaviour. The observed order 2498 is correct. | order 2498 (coupon `E2ESKU17753`, discount 22.5) | **Policy (2026-10-10, user):** coupons are global, not product/SKU based. The remaining question is only whether the admin surface should stop offering SKU scoping at all (see follow-up). Plan CP-05 expectation to be updated. |
|
||
| A21 | ~~**Cross-region coupon is not enforced.**~~ **CLOSED — by design.** Coupons are **not** region-based, so a region-2-created coupon applying to a region-1 order is the intended behaviour. The observed order 2499 is correct. | order 2499 (coupon `E2EB17769`, 25% of ₹150) | **Policy (2026-10-10, user):** coupons are global, not region based. The remaining question is whether the admin surface should stop scoping coupon listing/creation by region (see follow-up). Plan CP-11 expectation to be updated. |
|
||
| A22 | ~~**Expired reserved coupon can be redeemed.**~~ **FIXED 2026-10-10.** `admin.coupon.createReservedCoupon` with `validTill` in the past no longer redeems. | verified live: expired secret → rejected `"This coupon has expired"`; valid secret → still 200. Atomic claim verified: 6/6 rounds of 3 concurrent redeemers produced exactly one winner. | Plan CP-10/SEC-06. Policy: `validTill` is the single deadline for claiming the secret **and** spending the coupon. Changes: `backend/…/user-apis/apis/coupon.ts`, `db_helper_sqlite/…/user-apis/coupon.ts`, tests + BUGS.md #11. |
|
||
| A23 | ~~**Multi-slot suborders record `discountAmount: null` while the payable is discounted.**~~ **CLOSED 2026-10-10 — accepted, not a defect.** A sibling sub-order shows its own payable total; the prorated discount is not itemised on it. | orders 2517/2518, 2526/2527 | **Decision (user):** leave as-is — it's fine. Coupon usage is recorded once on the coupon-holding sub-order by design; sibling sub-orders are not required to reconstruct item/discount/fee. Plan BL-04/BL-05 expectations updated. |
|
||
| A24 | ~~**Client-supplied `boundId` overrides the address's bound.**~~ **FIXED 2026-10-10.** Address 879 (bound 2, ₹200/₹800) ordered with `boundId: 1` (₹20/₹300) was accepted and charged ₹20. | verified live after the fix: same request now charges **₹200**; `boundId: 2` → ₹200; no `boundId` → ₹200. Bound-less address (882) still honours the client bound (₹20 for bound 1, ₹200 for bound 2). | Policy: address bound → client bound → region effective bound. Plan BL-06/SEC-04. Change: `backend/…/user-apis/apis/order.ts` `placeOrderUtil`; BUGS.md #21. |
|
||
| A25 | ~~**Double-tap `placeOrder` creates two orders.**~~ **CLOSED 2026-10-10 — already client-guarded; server rule declined.** | two concurrent API POSTs (my harness) both returned 200 → orders 2539/2540. **Not** reachable by tapping: `PaymentAndOrderComponent` has a synchronous `submittingRef` re-entrancy guard + `disabled={… isPending}` button and is the only caller of `placeOrder` in the app. | **Decision (user):** close — no server-side idempotency. Residual exposure documented: retry after an ambiguous failure / lost response (RC-04), API replay, another device. `BUGS.md` #17 stays as-is. Plan OR-12 reworded. |
|
||
| A26 | ~~**Admin can edit notes on a delivered order.**~~ **CLOSED 2026-10-10 — business decision, not a defect.** | `admin.order.updateNotes {orderId: 2495}` → 200 while the customer path rejects the same edit | **Decision (user):** admins may annotate delivered orders (internal notes are operational records). The customer-side restriction stays. Plan OR-03 reworded so the case asserts the customer path only. |
|
||
| A27 | ~~**Explicit rebalance drops the delivery fee.**~~ **FIXED 2026-10-10.** Rebalance wrote `total_amount = items − discount`, so the order's own invariant (`items − discount + fee = total`) broke and the payable lost the fee. | verified live (isolated slot 2057, order 2558): placed with a 10% coupon → items 249, discount 24.9, fee 20, payable 244.1 → **no-op rebalance 244.1** (fee kept); after **invalidating the coupon** + rebalance **244.1** (discount frozen); after reprice 249→299 + rebalance **294.1** = 299 − 24.9 + 20 ✓ | Policy (user): **freeze the historic discount and delivery fee; rebalance only product prices**. Delivered/cancelled orders are now skipped; a SKU with no region price keeps its stored price. Plan OR-10. Change: `db_helper_sqlite/…/admin-apis/order.ts` `rebalanceSlots`; BUGS.md #22. |
|
||
| A28 | ~~**`updateProduct` accepts never-uploaded image keys via `skus[].images`.**~~ **FIXED 2026-10-10.** | verified live (probe product 174): fabricated key in `skus[].images` → rejected with nothing written; fabricated key in `newImageUrls` → rejected; another product's already-claimed image → rejected; the product's **own** already-claimed image re-sent → 200 (honest edit form unaffected); a genuine pending upload → 200 and claimed. | Plan P-02. Root cause: create validated `skus.flatMap(images)` but update validated only `newImageUrls`, then wrote `skus[].images` unvalidated (the edit form re-sends existing images, so validating the whole set would fail). Fix validates the **delta** (keys the product doesn't already own) + `newImageUrls`. Change: `backend/…/admin-apis/apis/product.ts`, new `getProductImageKeys` helper; BUGS.md #23. |
|
||
| A29 | ~~**Editing an address clears its default flag.**~~ **FIXED 2026-10-10.** `updateAddress` passed `isDefault: isDefault || false`, so an edit that omitted the optional field unset the default and left the user with **zero** defaults. | verified live (U2 address 882): set default → edit **without** `isDefault` → still default (previously became false). Explicit `isDefault: false` still clears it; `isDefault: true` still moves the default off the others. | Plan AD-02. Fix: `backend/…/user-apis/apis/address.ts` → `isDefault: isDefault ?? existingAddress.isDefault`; BUGS.md #24. The UI was already sending the current value, so the API contract was the hole. |
|
||
| A30 | ~~**Invalid phone/pincode accepted by `createAddress`.**~~ **FIXED 2026-10-10.** Rule: phone = exactly 10 digits starting 6/7/8/9; pincode = exactly 6 digits. Applied to **both** `createAddress` and `updateAddress`. | verified live: phone `123` / `1234567890` / `5678901234` / 9-digit / 11-digit and pincode 5-digit / 7-digit / non-numeric all **400**; valid pair → 201; update with `phone: "123"` → 400. Probe rows deleted. | Plan AD-03. The UI already had `/^\d{10}$/` + `/^\d{6}$/`; the server enforced only `min(1)`. Change: `backend/…/user-apis/apis/address.ts` (+ UI phone regex aligned); BUGS.md #25. |
|
||
| A31 | ~~**Deleting the user's only address was allowed** (no protection, empty message).~~ **FIXED 2026-10-10.** Deleting the user's **only** address is now refused, and the reason is shown to the customer in a **BottomDialog**. | verified live — API: U3 (exactly one address) → refused, address kept; U2 default → refused; a freshly created unused address → deleted and gone. UI on the simulator (signed in as U3, one address): tapping **Delete** opened the bottom sheet “**Cannot delete address** — This is your only address. Add another address before deleting this one.” with **OK**; the address stayed. Evidence: `/tmp/freshyo-e2e/A31-delete-only-address-dialog.jpg`. | Plan AD-08. Also converted the other `deleteAddress` refusals from plain `Error` to `ApiError` (404/409) so customers get 4xx once A19 lands, and the UI check runs before the “are you sure?” step. Changes: `backend/…/user-apis/apis/address.ts`, `apps/user-ui/…/me/addresses/index.tsx`; BUGS.md #26. |
|
||
| A32 | ~~**`createReview` fails for SKU-split products.**~~ **CLOSED 2026-10-10 — not applicable.** | OP-06 probe: works for the legacy 1:1 product 102, 500 “Product not found” for product 170 | **Decision (user): reviews are no longer dealt with — the issue is dropped.** The review feature is unsupported/out of scope, so this is not a defect to fix. Plan OP-06 marked out of scope. |
|
||
| A33 | ~~**Permanent vendor snippet metadata query fails**: `vendorSnippets.getOrdersBySnippet` → 500 “Vendor snippet not associated with a slot”.~~ **CLOSED 2026-10-10 — not a problem.** | OP-03 probe | **Decision (user): vendor snippets are not a current concern — the issue is dropped.** Plan OP-03 marked out of scope; the snippet areas that were verified as working (OP-01 snippet SKU filtering, SEC-02/SEC-07 snippet access) keep their results. |
|
||
| A34 | ~~**`isComboOnly` SKUs are still orderable standalone.**~~ **CLOSED 2026-10-10 — accepted, not a concern.** | PD-11 probe: with the flag set on a component (SKU 129), `placeOrder` accepted it (order 2547, ₹249); the flag was then restored. | **Decision (user):** the only route to a combo-only SKU is a direct API call — the app hides them everywhere — so this is dropped at this point. Backend enforcement is **not** added. Plan PD-11 closed. **Open observation kept separately:** the flag's real semantics are ambiguous — the only flagged product in region 1, **GYM PACK** (sku 149, live, ₹210, `comboItems` = its components), is a *bundle* and is therefore hidden from the app's Combos section too, so it cannot be bought in-app. Not A34; needs a product decision. |
|
||
| A35 | ~~**No minimum-order policy exists.**~~ **CLOSED 2026-10-10 — business decision, not a problem.** There is deliberately no minimum order value; orders of any amount are accepted. | BL-02 probe: a ₹249 order was accepted, `minRegularOrderValue` appears nowhere in the code. | **Decision (user):** no minimum-order policy is intended. The stray `minRegularOrderValue` row in bound-2 settings is inert (nothing reads it) and can be deleted as housekeeping. Plan BL-02 reworded. |
|
||
| A36 | ~~**Global SKUs are rejected when attached to a region slot/banner** (“SKU 102 belongs to a different region”).~~ **FIXED 2026-10-10.** Rule: a SKU is acceptable when its product's region is **null (global)** or the target region. | verified live: attaching global SKU 102 (Basa Fish Fillets, product regionId null) to region-1 slot 2036 → **200**; a **scheduled** order for it in that slot → **200, ₹498** (region-1 price; slot check still applied); controls: a genuine region-2 SKU (155) is still rejected when attached to a region-1 slot and at order time → **409 `Product 155 is not available in this region`**. | Fix: `placeOrderUtil` SEC-04 + `assertSkuIdsInRegion` in `slots.ts` / `banner.ts` / `coupon.ts` now accept globals (product.ts already did). `vendor-snippets.ts` (deprecated) left as-is. Plan SEC-04 reworded; BUGS.md #29. |
|
||
| A37 | ~~**`updateProductPrices` takes a SKU id under the name `productId` — and can silently reprice the wrong product.**~~ **FIXED 2026-10-10.** The field is now **`skuId`** (no alias), the messages say SKU, and an entry with no price fields is rejected instead of "succeeding"; `updatedCount` counts rows actually written. | verified live on probe product 175 (SKUs 185/186): `{skuId:186, price:250}` → `200 "Updated prices for 1 SKU(s)"`, prices `185:100 186:250` (no cross-write); `{skuId:185}` with no fields → rejected `No price fields to update for SKU(s): 185` with nothing written. | Callers updated: `admin-ui` + `admin-web` prices screens, and the three test payloads (incl. `cache-invalidation.test.ts`, which had been passing a *product* id — it only worked when the two ids coincided). **Residual (accepted):** id *values* still overlap, so a caller that passes a product id *value* still hits the same-numbered SKU — now an explicit caller error rather than an API trap; resolving product ids to SKUs is deliberately not done. `db_helper_postgres` (unused by the apps) not changed. BUGS.md #27. |
|
||
| A38 | **Customer product/review APIs are SKU-id keyed while admin APIs are product-id keyed.** `user.product.getProductDetails {id:'170'}` → 500; `{id:'178'}` (a SKU id) → 200 returning that SKU's data. | PD-01/PD-03 probes | Mixed id spaces; the review half is moot (see A32 — reviews dropped 2026-10-10). Also `getProductDetails {id:'155'}` resolved to a different product's SKU. |
|
||
| A39 | **Inconsistent order-id typing:** `admin.order.updatePackaged` / `updateDelivered` require `orderId` as a **string**, while every other order endpoint takes a number. | OR-04/OR-05 probes (numeric → 400 zod) | Minor but a real integration wart. |
|
||
| A40 | **`admin.store.createStore` rejects `imageUrl: null`** (`z.string().optional()`), while the UI can create a store without an image. | PD-01 probe | Minor contract wart. |
|
||
| A41 | **New foreign-region addresses get `boundId: null`** instead of the region's effective bound. | AD-06 probe: region 2 address → `boundId: null` | Partly covered by the settled “bound-less addresses allowed” policy, but AD-06 expects derivation. |
|
||
| A42 | **Coupon-limit race loser gets a 500** (message correct) — the limit itself held (one order). | SEC-06 race: 200 / 500 | Covered by A19; recorded for traceability. |
|
||
|
||
### Policy decisions recorded during triage (2026-10-10)
|
||
|
||
- **Coupons are neither region-based nor product/SKU-based.** They are global: created once, visible to every
|
||
region, and applicable to the whole cart regardless of which SKUs it contains. → **A20 and A21 are not defects**
|
||
(CP-05 / CP-11 / the coupon-scope half of SEC-06 change expectation; SEC-06's FAIL now rests solely on **A22**,
|
||
the expired reserved coupon).
|
||
- Consequence to decide separately: the admin coupon API still *pretends* to support scoping —
|
||
`admin-apis/coupon.ts` writes `regionId` and rejects foreign-region SKUs (`assertApplicableSkusInRegion`),
|
||
coupon list/detail/invalidate/reserved queries are filtered by `ctx.staffUser.regionId`, and the coupon form
|
||
carries `skuIds` / `applicableProducts` (the admin list even renders “Products: N selected”). Either bring that
|
||
surface in line with the global policy or leave it as dormant metadata.
|
||
|
||
### Positive verifications that moved to PASS in this run
|
||
Soft-delete + order history (T-01/S-01/S-05), tag image normalisation + delete (T-02/Q-04),
|
||
upload-URL validation with no partial rows (P-01/P-03/T-03), per-variant stock with sibling orderable
|
||
(T-05/R-03), region+future slot scoping (T-06), bound-settings propagation to essentials and the next
|
||
order (Q-03), fee rules at the threshold (BL-01), coupon cap math and no negative payable (CP-01/CP-02),
|
||
first-order coupon (CP-07), invalidated coupon (CP-08), reserved redemption + one-time secret (CP-09),
|
||
flash pricing/fees/eligibility (FL-01…FL-05), order lifecycle notes/packaging/delivered/cancel/charge-removal
|
||
(OR-01/02/03-partial/04/05/06/07/09/11), snippet SKU filtering (OP-01), complaints end-to-end (OP-05),
|
||
region priority reload (RG-10), tagsOrder/popular items per region (DS-03/DS-04), banner lifecycle (DS-07),
|
||
Cart/Checkout layout and the disabled online payment (CT-01/05/09, PAY-01).
|