# 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).