freshyo/change-logs/change-log.txt
2026-10-07 00:27:11 +05:30

1038 lines
114 KiB
Text

[2026-10-03 12:12:39] Regions feature (superadmin) - schema + migration + shared types + db helper + tRPC + UI.
Files:
- packages/db_helper_sqlite/src/db/schema.ts: add `regions` (id, name, description, added_at) and `region_bounds` (id, region_id FK->regions.id, geojson text, added_at) tables + relations. geojson stored as raw text (pasted string).
- packages/db_helper_sqlite/drizzle/0006_regions.sql: CREATE TABLE IF NOT EXISTS for both tables + journal idx 6.
- packages/shared/types/region.types.ts (+index re-export): Region/RegionBound/Create/Update types.
- packages/db_helper_sqlite/src/admin-apis/region.ts: getRegions/getRegionById/createRegion/updateRegion/deleteRegion/addRegionBound/deleteRegionBound.
- packages/db_helper_sqlite/index.ts + apps/backend/src/sqliteImporter.ts: export region helpers.
- apps/backend/src/trpc/apis/admin-apis/apis/region.ts: regionRouter (protectedProcedure); registered as admin.region in admin-trpc-index.ts.
- apps/superadmin-ui: AppShell NAV + dashboard card + routes/regions.tsx, routes/regions.new.tsx, routes/regions.$id.edit.tsx.
[2026-10-03 12:28:37] Fix: /regions/new and /regions/$id/edit were blank (rendered parent list).
TanStack flat-file routing nests regions.new.tsx and regions.$id.edit.tsx under
regions.tsx. regions.tsx now acts as a layout: renders the list only when
pathname === '/regions', otherwise <Outlet/>. Removed duplicate
ProtectedRoute/AppShell wrappers from the two child routes (parent supplies them).
Renamed list component to RegionsList.
[2026-10-03 18:26:53] Region scoping - Phase 1: schema, migration, shared types.
Schema (packages/db_helper_sqlite/src/db/schema.ts):
- add region_id (NOT NULL, FK regions.id) to staff_users, addresses, vendor_snippets,
store_info, product_tag_info, product_group_info, product_market_stats, product_info,
delivery_slot_info, home_banners.
- product_info: add available_in_all_regions (bool, default false); REMOVE store_id.
- product_market_stats: add store_id (nullable FK store_info.id); sku_id unique ->
composite unique (sku_id, region_id).
- relations: region back-refs; productSkus.marketStats one->many;
productMarketStats.store; storeInfo.products re-sourced from productMarketStats.
Migration packages/db_helper_sqlite/drizzle/0007_region_scoping.sql + journal idx 7.
Shared types: regionId + availableInAllRegions; storeId moved to availability shape.
[2026-10-03 18:33:02] Region scoping - Phase 2: auth context + admin/superadmin procedures.
- trpc-index.ts: Context.staffUser gains regionId/staffRoleId/staffRoleName;
add adminProcedure (staff + region) and superAdminProcedure (role super_admin).
- app.ts: populate staffUser.regionId + role name on each request.
- db staff-user.ts: getStaffRoleById helper (+barrels); createStaffUser(regionId);
getAllStaff selects regionId.
- staff-user router: login returns regionId/roleName; getStaff returns regionId;
createStaffUser is superAdminProcedure, takes optional regionId (defaults to ctx).
[2026-10-03 18:37:36] Region scoping - Phase 3: make admin store + vendor-snippet helpers region-aware.
packages/db_helper_sqlite/src/admin-apis/store.ts
- import: drop productInfo, add productMarketStats; add `and` from drizzle-orm;
import DEFAULT_REGION_ID from @packages/shared.
- getAllStores(regionId?): add optional regionId; findMany where
regionId !== undefined ? eq(storeInfo.regionId, regionId) : undefined.
- createStore(input & { regionId? }, products?): insert storeInfo.regionId =
input.regionId ?? DEFAULT_REGION_ID; resolve SKU ids -> product ids -> all
their SKUs; set productMarketStats.storeId = newStore.id where skuId in
chunk AND regionId = regionId (runBatched). Return object gains regionId.
- updateStore(id, input & { regionId? }, products?): destructure regionId out of
input; include regionId in .set() only when input.regionId !== undefined;
clear productMarketStats.storeId where storeId = id AND regionId =
updatedStore.regionId; then re-target productMarketStats.storeId for the
resolved SKUs in updatedStore.regionId. Return object gains regionId.
- deleteStore(id): clear productMarketStats.storeId where storeId = id
(product_info.store_id removed). getStoreById unchanged (row already has
regionId).
packages/db_helper_sqlite/src/admin-apis/vendor-snippets.ts
- import DEFAULT_REGION_ID (value) from @packages/shared.
- mapVendorSnippet: include regionId: snippet.regionId.
- getAllVendorSnippets(regionId?): add optional regionId; findMany where
regionId !== undefined ? eq(vendorSnippets.regionId, regionId) : undefined.
- createVendorSnippet(input): input gains regionId?: number; insert
regionId: input.regionId ?? DEFAULT_REGION_ID.
- Other snippet fns unchanged; regionId flows through mapper.
- mapDeliverySlot: include regionId: slot.regionId (AdminDeliverySlot now
requires regionId).
[2026-10-03 18:41:00] Region scoping - Phase 3-5: addresses + user regions endpoint, orders, snippets/stores.
- shared: DEFAULT_REGION_ID=1; UserAddress.addressForm regionId; GetAllOrdersInput.regionId.
- address.ts helper + user.address router: optional regionId (default 1).
- common-trpc-index: user-facing common.getRegions (summaries: id/name/description).
- region.ts: getRegionSummaries (+barrels).
- admin order.ts db helper: getAllOrders/getSlotOrders accept regionId, filter via address join (exists).
- order router: getAll/getSlotOrders -> adminProcedure, inject ctx region (super_admin = all).
- store.ts + vendor-snippets.ts helpers scoped by region; routers adminProcedure; create stamps ctx region.
[2026-10-03 19:56:50] Region scoping - Phase 6 (user reads): product.ts region-aware.
packages/db_helper_sqlite/src/user-apis/product.ts
- imports: add DEFAULT_REGION_ID (value) from @packages/shared + InferSelectModel type;
add local MarketStatsRow type and generic pickMarketStats(marketStatsArray, regionId)
helper (find by regionId or null).
- getProductDetailById(skuId, regionId = DEFAULT_REGION_ID): sku.marketStats is now an
array -> marketStats = pickMarketStats(sku.marketStats, regionId); bail (null) when no
row or suspended/deleted; store now resolved from marketStats.storeId (product.storeId
removed); combo item price uses pickMarketStats(ci.sku.marketStats, regionId).
- getProductById(skuId, regionId = DEFAULT_REGION_ID): pick region row; returned object
exposes marketStats: picked row + price/marketPrice/flashPrice/isFlashAvailable/
isOutOfStock from that row.
- getAllProductsWithUnits(tagId?, regionId = DEFAULT_REGION_ID): filter sku when picked
region row missing/suspended, sku deleted, or product is region-restricted
(!availableInAllRegions && product.regionId !== regionId); price fields from picked row.
- getSuspendedSkuIds(regionId = DEFAULT_REGION_ID): where isSuspended AND regionId = region.
- getAllSkusSummary(regionId = DEFAULT_REGION_ID): product columns storeId -> regionId +
availableInAllRegions; filter same as products; storeId now from picked
marketStats.storeId.
[2026-10-03 19:56:50] Region scoping - Phase 6 (user reads): stores.ts region-aware.
packages/db_helper_sqlite/src/user-apis/stores.ts
- imports: replace productInfo with productMarketStats; add DEFAULT_REGION_ID +
InferSelectModel; add local MarketStatsRow + generic pickMarketStats helper.
- getStoreSummaries(regionId = DEFAULT_REGION_ID): storeInfo select filtered by
storeInfo.regionId = regionId; active SKUs filtered via picked region stats +
product region acceptance; grouped by picked marketStats.storeId (was product.storeId).
- getStoreDetail(storeId, regionId = DEFAULT_REGION_ID): store lookup also matches
storeInfo.regionId = regionId; product ids sourced from productMarketStats where
storeId = storeId AND regionId = regionId (values are SKU ids -> productSkus.id);
product rows filtered/read through picked region stats.
- getStoresSummary(regionId = DEFAULT_REGION_ID): where storeInfo.regionId = regionId.
[2026-10-03 19:56:50] Region scoping - Phase 6 (user reads): store-helpers.ts region-aware.
packages/db_helper_sqlite/src/stores/store-helpers.ts
- imports: add DEFAULT_REGION_ID + InferSelectModel; add local MarketStatsRow + generic
pickMarketStats helper.
- getAllBannersForCache(regionId = DEFAULT_REGION_ID): where regionId = region.
- getAllProductsForCache(regionId = DEFAULT_REGION_ID): filter picked region stats +
product region acceptance; storeId now picked marketStats.storeId.
- getAvailabilityForCache(regionId = DEFAULT_REGION_ID): where
productMarketStats.regionId = region.
- getAllStoresForCache(regionId = DEFAULT_REGION_ID): where storeInfo.regionId = region.
- getAllProductCombosForCache(regionId = DEFAULT_REGION_ID): suspended-sku set filtered by
region; price from picked region stats.
- getAllProductTagsForCache(regionId = DEFAULT_REGION_ID): where productTagInfo.regionId =
region.
- getAllTagsForCache(regionId = DEFAULT_REGION_ID): where productTagInfo.regionId = region.
- getAllTagProductMappings(regionId = DEFAULT_REGION_ID): join productTagInfo and filter
region.
- getAllSlotsWithProductsForCache(regionId = DEFAULT_REGION_ID): slots filtered by
deliverySlotInfo.regionId; skus load marketStats with store; filter/read picked region
stats (store resolved from marketStats.store, storeId from stats.storeId).
[2026-10-03 19:56:50] Region scoping - Phase 6 (user reads): order.ts market-stats fix.
packages/db_helper_sqlite/src/user-apis/order.ts
- imports: add DEFAULT_REGION_ID + InferSelectModel; add local MarketStatsRow + generic
pickMarketStats helper.
- getProductById(skuId, regionId = DEFAULT_REGION_ID): sku.marketStats is now an array ->
marketStats = pickMarketStats(sku.marketStats, regionId); returned object exposes that
picked row with price/marketPrice/flashPrice/isFlashAvailable/isOutOfStock from it.
[2026-10-03 20:10:42] Region scoping - Phase 7: slot + banner db helpers region-aware.
packages/db_helper_sqlite/src/admin-apis/slots.ts
- import DEFAULT_REGION_ID (value) from @packages/shared.
- mapDeliverySlot: include regionId: slot.regionId (AdminDeliverySlot now requires it).
- getActiveSlotsWithProducts(limit = 20, regionId = DEFAULT_REGION_ID): where
and(eq(deliverySlotInfo.isActive, true), eq(deliverySlotInfo.regionId, regionId)).
- getSlotsAfterDate(afterDate, regionId = DEFAULT_REGION_ID): where
and(eq(isActive, true), gt(deliveryTime, afterDate), eq(regionId, regionId)).
- createSlotWithRelations(input): input gains regionId?: number; insert
regionId: input.regionId ?? DEFAULT_REGION_ID.
- mapVendorSnippet: include regionId: snippet.regionId (AdminVendorSnippet now requires it).
- No `with: { marketStats: true }` usage in this file, so no pickMarketStats helper added.
packages/db_helper_sqlite/src/admin-apis/banner.ts
- import and from drizzle-orm; import DEFAULT_REGION_ID from @packages/shared.
- getBanners(regionId = DEFAULT_REGION_ID): where eq(homeBanners.regionId, regionId);
row mapper gains regionId.
- getBannerById: mapped Banner gains regionId (read unchanged).
- createBanner(input: Omit<CreateBannerInput, 'regionId'> & { regionId?: number }): insert
regionId: input.regionId ?? DEFAULT_REGION_ID; returned Banner gains regionId.
- updateBanner: returned Banner gains regionId.
packages/db_helper_sqlite/src/user-apis/banners.ts
- import and, eq; import DEFAULT_REGION_ID.
- mapBanner: include regionId: banner.regionId (UserBanner = Banner requires it).
- getActiveBanners(regionId = DEFAULT_REGION_ID): where
and(isNotNull(homeBanners.serialNum), eq(homeBanners.regionId, regionId)).
packages/db_helper_sqlite/src/user-apis/slots.ts
- import and; import DEFAULT_REGION_ID.
- mapSlot: include regionId: slot.regionId (UserDeliverySlot = AdminDeliverySlot).
- getActiveSlotsList(regionId = DEFAULT_REGION_ID): where
and(eq(deliverySlotInfo.isActive, true), eq(deliverySlotInfo.regionId, regionId)).
- getProductAvailability(regionId = DEFAULT_REGION_ID): where
and(eq(productMarketStats.isSuspended, false), eq(productMarketStats.regionId, regionId)).
[2026-10-03 20:12:00] Follow-up: vendorSnippets.regionId is NOT NULL, so the two snippet
inserts inside createSlotWithRelations / updateSlotWithRelations must stamp it.
- createSlotWithRelations snippet insert: add regionId: newSlot.regionId.
- updateSlotWithRelations snippet insert: add regionId: updatedSlot.regionId.
[2026-10-03 20:13:45] Admin product router region scoping:
apps/backend/src/trpc/apis/admin-apis/apis/product.ts
- import adminProcedure from @/src/trpc/trpc-index.
- add ctxRegion(ctx) and scopedRegion(ctx) helpers.
- getProducts/getGroups/getProductTags -> adminProcedure; pass scopedRegion(ctx).
- getProductById -> adminProcedure; pass ctx.staffUser?.regionId.
- getProductTagById -> adminProcedure; pass ctx.staffUser?.regionId as 2nd arg.
- createProduct/updateProduct -> adminProcedure; zod: storeId optional, add regionId,
availableInAllRegions, storeIdsByRegion; normalize storeIdsByRegion keys to numbers;
pass regionId: input.regionId ?? ctx.staffUser?.regionId plus new fields.
- toggleOutOfStock/updateProductPrices -> adminProcedure; pass ctx.staffUser?.regionId.
- createGroup -> adminProcedure; pass ctx.staffUser?.regionId as 4th arg.
- createProductTag/updateProductTag -> adminProcedure; stamp regionId.
- deleteProduct/deleteGroup/deleteProductTag/getProductReviews/respondToReview unchanged.
[2026-10-03 20:19:14] Per-region cache file generation.
packages/db_helper_sqlite/src/admin-apis/const.ts
- import DEFAULT_REGION_ID from '@packages/shared'.
- add `versionKey(base, regionId?)` -> base for null/region 1, `${base}_${regionId}` otherwise.
- getCacheVersion/incrementCacheVersion (cacheVersion), getAvailabilityVersionNum/
incrementAvailabilityVersionNum (availabilityVersionNum), getSlotsVersionNum/
incrementSlotsVersionNum (slotsVersionNum): all gain optional regionId and use
versionKey(CONST_KEYS.*, regionId). Region 1/omitted -> legacy global key.
apps/backend/src/lib/cloud_cache.ts
- import DEFAULT_REGION_ID from '@packages/shared'; import getRegions from dbService.
- buildCachePath(path, version, regionId?) / buildAvailabilityPath(version, regionId?) /
buildSlotsPath(version, regionId?): prepend `r-<id>/` only when regionId != null && != 1.
- constructCacheUrl/constructAvailabilityUrl/constructSlotsUrl gain regionId.
- createProductsFileInternal/createEssentialConstsFileInternal/createStoresFileInternal/
createBannersFileInternal/createAllStoresFilesInternal/createAvailabilityCacheFile/
createSlotsCacheFile gain regionId; scaffold* calls + paths + version increments region-aware.
- createAvailabilityCacheFile/createSlotsCacheFile: regionId omitted -> loop all regions;
explicit region -> single region; refreshGenKv(regionId).
- createAllCacheFiles(): getRegions() loop; new createRegionCacheFiles(regionId) does the
per-region build + purge + refreshGenKv; returns DEFAULT_REGION_ID result for back-compat.
apps/backend/src/lib/gen-store.ts
- import DEFAULT_REGION_ID; add regionKvKey(regionId?).
- buildEssentialConsts(regionId?); refreshGenKv(regionId?) puts region key + legacy key for
region 1/undefined; readEssentialConstsFromKv(regionId?) reads region key, D1 backfill kept.
apps/backend/src/trpc/apis/common-apis/common-trpc-index.ts
- scaffoldEssentialConsts(regionId?): region-aware version getters + cachePathPrefix field.
- essentialConsts procedure: optional { regionId } input; readEssentialConstsFromKv(regionId).
apps/backend/src/trpc/apis/common-apis/common.ts
- scaffoldProducts(regionId?): getAllProducts(regionId), getSuspendedSkuIds(regionId),
getAllTagsForCache(regionId), getAllTagProductMappings(regionId).
- scaffoldAvailability(regionId?): getAvailabilityForCache(regionId).
apps/backend/src/stores/product-store.ts
- getAllProducts(regionId?) / getProductById(regionId?) thread region into cache helpers.
apps/backend/src/stores/slot-store.ts
- getAllSlots(regionId?) / fetchAllTransformedSlots(regionId?) thread region.
apps/backend/src/trpc/apis/user-apis/apis/stores.ts
- scaffoldStores(regionId?) / scaffoldStoreWithProducts(storeId, regionId?).
apps/backend/src/trpc/apis/user-apis/apis/slots.ts
- scaffoldSlotsWithProducts(regionId?) -> getAllSlots/region + getUserProductAvailability(region).
apps/backend/src/trpc/apis/user-apis/apis/banners.ts
- scaffoldBanners(regionId?) -> getUserActiveBanners(region).
apps/user-ui/src/constants.ts
- export const REGION_ID = 1 (client hardcode).
apps/user-ui/src/hooks/prominent-api-hooks.ts
- prepend cachePathPrefix (default '') to products/availability/slots/store cache URLs.
store-initializer.ts / cache-creator.ts unchanged (createAllCacheFiles now loops regions).
Admin triggers unchanged (no-arg create*CacheFile loops every region).
[2026-10-03 20:27:32] Region-aware store selector + "Available in all regions" checkbox on product Add/Edit forms (admin-ui + admin-web).
apps/admin-ui/src/components/ProductForm.tsx
- ProductFormData gains optional regionId?, availableInAllRegions?, storeIdsByRegion?.
- formInitialValues normalizes availableInAllRegions ?? false and storeIdsByRegion ?? {}.
- store source switched from trpc.common.getStoresSummary to trpc.admin.store.getStores;
keep {label,value} options plus store.regionId for per-region filtering.
- new regions query trpc.admin.region.getRegions -> regions[].
- yup storeId now required only when availableInAllRegions is false (Yup.when).
- new product-level Checkbox `product-all-regions-checkbox` ("Available in all regions").
- when unchecked render the existing single store BottomDropdown; when checked render one
BottomDropdown per region bound to storeIdsByRegion[region.id].
- toggle handler pre-fills each region with the store whose name matches the current
single-selection store's name (region+name match).
- RegionStorePrefill child (useFormikContext) name-matches per-region stores on edit when
availableInAllRegions is true and a region has no selection yet.
- onSubmit still emits ProductFormData (new fields flow through to the screens).
apps/admin-ui/app/(drawer)/dashboard/products/add.tsx
- initialValues add regionId: undefined, availableInAllRegions: false, storeIdsByRegion: {}.
- create payload: if values.availableInAllRegions -> { availableInAllRegions: true,
storeIdsByRegion (only regions with storeId>0) }; else { availableInAllRegions: false,
storeId: values.storeId }. regionId omitted on create.
apps/admin-ui/app/(drawer)/dashboard/products/edit.tsx
- initialValues: storeId from productData.store?.id ?? 1 (fixes pre-existing storeId TS
error), regionId: productData.regionId, availableInAllRegions:
productData.availableInAllRegions ?? false, storeIdsByRegion: {} (prefilled by name-match).
- update payload: always regionId; all-regions -> availableInAllRegions + storeIdsByRegion;
restricted -> availableInAllRegions: false + storeId.
apps/admin-web/src/components/ProductForm.tsx
- same shape as admin-ui: optional ProductFormData fields, normalized formInitialValues,
trpc.admin.store.getStores + storeOptionsForRegion, trpc.admin.region.getRegions,
conditional yup storeId, `product-all-regions-checkbox` Checkbox, per-region Dropdowns,
name-match toggle prefill + RegionStorePrefill child.
apps/admin-web/src/routes/dashboard.products.new.tsx
- initialValues add regionId: undefined, availableInAllRegions: false, storeIdsByRegion: {}.
- create payload mirrors admin-ui (storeIdsByRegion when all-regions, else storeId; no regionId).
apps/admin-web/src/routes/dashboard.products.edit.tsx
- initialValues: storeId from productData.store?.id ?? 1 (fixes pre-existing storeId TS error),
regionId, availableInAllRegions, storeIdsByRegion: {}.
- update payload mirrors admin-ui, always includes regionId.
Tests: apps/admin-ui/tests/components/product-form.test.tsx mocks `common.getStoresSummary`.
Since the form now queries `admin.store.getStores`, that mock no longer feeds store options.
Unmocked procedures resolve to null, so assertions still hold (dropdown visible / fetch called);
only the store-options data would be empty if a test asserted option labels. Not edited per instructions.
[2026-10-03 20:31:34] Region scoping - Phases 6-11 complete: products/availability, lifecycle, slots/banners, cache, UIs.
- product.ts: getAllProducts/getProductById region-filtered (myregion OR allregions); createProduct/updateProduct
region + availableInAllRegions + per-region storeIdsByRegion; market stats per region (non-creator
regions out of stock); updateProductPrices/toggleProductOutOfStock region-scoped; backfillMarketStatsForRegion.
- product router: adminProcedure, region/availableInAllRegions/storeIdsByRegion inputs.
- region router: superAdminProcedure; create backfills market stats; delete rejects (non-deletable).
- cache: per-region files (r-<id>/ prefix), per-region version counters + essentialConsts KV keys; region 1 keeps legacy.
- superadmin-ui: /admins create-admin (role+region dropdowns); region Delete removed.
- admin-ui + admin-web: ProductForm gains 'Available in all regions' checkbox + per-region store dropdowns (name-matched).
- user-ui: REGION_ID=1 constant; cache URL prefix.
[2026-10-03 20:50:28] Region defaults: make admin db helpers require regionId; keep optional (default 1) only for user-facing APIs.
Admin helpers (product/slots/banner/vendor-snippets/store) now take required regionId; call sites pass ctx.staffUser.regionId.
User helpers (user-apis product/stores/slots/banners/order + store-helpers cache fns) keep regionId optional (defaults to DEFAULT_REGION_ID).
Kept DEFAULT_REGION_ID in: user-ui constant, address add/update, backfill, and region-1 legacy cache path/KV/version checks.
[2026-10-03 20:56:15] Region defaults cleanup: admin helpers require regionId; user-facing keep optional (default 1).
- admin-apis/product.ts, slots.ts, banner.ts, vendor-snippets.ts, store.ts: regionId now REQUIRED (no default);
create paths guard/inject region.
- admin routers: getBanners/createBanner/slots.getAll pass ctx.staffUser.regionId; getUpcomingSlots (public) uses DEFAULT_REGION_ID.
- product-tag-store.getTagsByStoreId(storeId, regionId=DEFAULT_REGION_ID) (user-facing).
- Kept DEFAULT_REGION_ID: user-ui constant, address add/update, backfill source, and region-1 legacy cache path/KV/version checks.
- Removed unused DEFAULT_REGION_ID imports.
[2026-10-03 21:17:26] All-region products: product_info.region_id is NULL.
- schema.ts: productInfo.regionId nullable (remove .notNull()).
- migration 0007: product_info.region_id column no NOT NULL (allow NULL).
- shared types: AdminProduct.regionId number | null.
- product.ts: createProduct sets regionId=null when availableInAllRegions; region logic keyed on creator ctx region for market stats; updateProduct handles null product.regionId.
- product router / superadmin / admin forms tolerate null regionId.
[2026-10-03 21:21:26] Verified: all-region products store NULL region_id.
- tsc: backend, admin-ui, admin-web, user-ui, web-ui, superadmin-ui all 0 errors.
[2026-10-03 22:16:19] Fix: embedded product slots/nextDeliveryDate were cross-region.
- store-helpers getAllDeliverySlotsForCache(regionId=DEFAULT_REGION_ID) now filters deliverySlotInfo.regionId.
- user-apis/product getNextDeliveryDateWithCapacity(skuId, regionId=DEFAULT_REGION_ID) now filters region.
- product-store.getAllProducts passes regionId; common.scaffoldProducts passes regionId.
- (special_deals still global: no region column — separate gap.)
[2026-10-03 22:17:29] Slot region-leak fix verified: backend tsc 0 errors.
Remaining intentionally user-default-1: legacy common-product.controller.ts (getNextDeliveryDate/getAllProductsWithUnits).
special_deals remains global (no region column).
[2026-10-03 22:23:23] Delete dead legacy REST chain for /api/v1/cm/products/summary.
Removed: apps/backend/src/apis/common-apis/apis/common-product.controller.ts,
common-product.router.ts, common.router.ts, apps/backend/src/v1-router.ts,
and the '/v1' mount + import in main-router.ts. No client references this route
(UI uses trpc.common.product.getAllProductsSummary instead). Also removes the last
non-region-scoped getNextDeliveryDate caller.
[2026-10-03 22:27:00] Remove unused getAllProductsWithUnits + ProductSummaryData (sqlite + barrels).
- Deleted from packages/db_helper_sqlite/src/user-apis/product.ts (+ unused productTags import).
- Removed exports from packages/db_helper_sqlite/index.ts and apps/backend/src/sqliteImporter.ts.
- postgres package left untouched (out of scope, not consumed).
[2026-10-03 22:31:53] Fix: region create now regenerates caches.
- region router createRegion: after createRegion + backfillMarketStatsForRegion, call
scheduleStoreInitialization() so per-region cache files (incl. the new region) are rebuilt.
[2026-10-03 22:43:36] All-region toggle-off check: restricted-branch delete already uses creatorRegionId (product.ts:552).
Reported bug referenced product.regionId, but current code uses creatorRegionId (the editing admin's region), so
'regionId <> creatorRegionId' correctly removes other regions' rows when toggling all-regions -> restricted.
Added a guard throwing if creatorRegionId is null (all-region product + no ctx region) to prevent silent no-op.
[2026-10-03 22:46:09] Fix: product create/update must force ctx region (ignore client regionId).
- admin.product.createProduct / updateProduct: use ctx.staffUser.regionId as the write
target instead of client-supplied input.regionId, preventing a non-superadmin admin
from writing another region's market-stats rows.
[2026-10-03 22:48:56] Fix same escalation in admin.store: createStore/updateStore force ctx region for non-superadmins.
- Added writeRegion(ctx, inputRegion?) helper (super_admin may target a region; others forced to ctx).
- createStore (was input.regionId ?? ctx) and updateStore (was raw input.regionId) now use writeRegion.
- staff-user createStaffUser is superAdminProcedure and intentionally honors input.regionId.
[2026-10-03 22:54:30] Fix: admin getProductById had no region/availableInAllRegions filter.
- getAllProducts / getProductById now accept regionId?: number; when null -> no filter
(super_admin sees all). When set -> region = ? OR availableInAllRegions = true.
- Router getProductById uses scopedRegion(ctx) (consistent with getProducts) instead of ctxRegion.
[2026-10-03 22:55:43] Verified: backend tsc 0 errors after getProductById/getAllProducts region filter.
[2026-10-03 22:58:48] Fix: product tag names were globally unique, blocking reuse across regions.
- schema.ts: productTagInfo.tagName .unique() -> composite uniqueIndex(tagName, regionId).
- migration 0007: DROP INDEX product_tag_info_tag_name_unique; CREATE UNIQUE INDEX unique_tag_name_region (tag_name, region_id).
- checkProductTagExistsByName(tagName, regionId?) scoped by region.
- admin.product.createProductTag passes ctx region.
[2026-10-03 23:03:07] Remove dead REGION_ID constant from apps/user-ui/src/constants.ts (zero usages; cache prefix comes from essentialConsts.cachePathPrefix).
[2026-10-03 23:07:58] Fix: rebalanceSlots treated marketStats as a single object (now an array -> NaN/0 prices).
- admin-apis/order.ts rebalanceSlots(slotIds, regionId) uses pickMarketStats per order item.
- router provides ctx region via adminProcedure.
[2026-10-03 23:09:07] rebalanceSlots fix verified: backend tsc 0 errors.
[2026-10-03 23:18:19] Delete getUpcomingSlots procedure + fallback-ui usage.
- backend vendor-snippets router: removed getUpcomingSlots (hardcoded DEFAULT_REGION_ID).
- fallback-ui vendor-order-list: removed getUpcomingSlots query, slot auto-select, slot selector UI;
orders now always from getOrdersBySnippet.
[2026-10-04 09:41:41] Remove unused getSlotsAfterDate db helper (sqlite).
- Deleted from packages/db_helper_sqlite/src/admin-apis/slots.ts.
- Removed exports from packages/db_helper_sqlite/index.ts and apps/backend/src/sqliteImporter.ts.
- postgres copy left untouched (out of scope).
[2026-10-04 10:09:07] Cross-region store selection + per-region storeId persistence.
1) New backend procedure store.getStoresForAllRegions (adminProcedure) returning all stores across regions (unfiltered), same scaffoldAssetUrl image mapping + {stores,count} shape as getStores. getStores remains write-scoped.
2) admin-web + admin-ui ProductForm: load getStoresForAllRegions for the all-regions store dropdowns + storesForRegion + RegionStorePrefill; keep getStores for single-store branch.
3) updateProduct (db_helper_sqlite/src/admin-apis/product.ts): availableInAllRegions branch now UPDATEs existing productMarketStats.storeId for every region key present in storeIdsByRegion (missing-row insert retained; price/stock untouched for non-creator regions; absent keys = no change).
4) UI constraint: storeId never null. Both ProductForms build validationSchema via useMemo; when availableInAllRegions, require a positive store for every region, message: Create a store for "<region>" before saving.
[2026-10-04 10:22:46] User region resolution on startup (user-ui + backend).
1) New backend public procedure common.resolveRegionForLocation (apps/backend/src/trpc/apis/common-apis/common-trpc-index.ts): input {lat,lng}, loads regions+bounds, turf booleanPointInPolygon per bound (Polygon/Feature/FeatureCollection tolerant, skip bad GeoJSON), first match wins, returns {regionId,regionName} or {regionId:null}. checkLocationInPolygon untouched.
2) user-ui RegionContext (persisted) + RegionGate blocking screen replacing LocationTestWrapper warnings: permission->resolve->persist, unserved/denied->manual region picker via common.getRegions.
3) regionId threaded through all user API calls (essentialConsts + products/stores/slots/banners/addresses); backend audit adds optional regionId where missing (default 1 preserved).
[2026-10-04 10:32:26] Home screen region bar above search (user-ui).
- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx: Animated region bar (pin icon + active regionName via useRegion) rendered above the fixed search bar; collapses (height/opacity over scroll 0..48) via main MyFlatList onScroll, so region scrolls out while search stays sticky. testID home-region-bar.
[2026-10-04 10:36:51] Fix migration 0007: replace product_info DROP COLUMN store_id with a table rebuild.
Root cause: SQLite ALTER TABLE ... DROP COLUMN fails when the column is used in a
FOREIGN KEY definition; product_info.store_id has FOREIGN KEY (store_id) REFERENCES
store_info(id). Error: 'error in table product_info after drop column: unknown
column "store_id" in foreign key definition'.
Verified local DB rolled back atomically (no region_id columns), remote untouched.
Pattern matches existing 0002_sku_split.sql rebuild (PRAGMA defer_foreign_keys = on,
__new_product_info, copy, DROP, RENAME).
Diff packages/db_helper_sqlite/drizzle/0007_region_scoping.sql:
- Added PRAGMA defer_foreign_keys = on; at top.
- Removed product_info region_id/available_in_all_regions ADD COLUMN statements and
the UPDATE backfill.
- Removed ALTER TABLE product_info DROP COLUMN store_id.
- Added a rebuild block (after market-stats backfill): CREATE TABLE __new_product_info
(id, name, short_description, long_description, region_id, available_in_all_regions,
increment_step, created_at, product_type) with region_id=1 backfill in the INSERT/SELECT,
DROP TABLE product_info, RENAME __new_product_info -> product_info.
- Index swap statement unchanged.
[2026-10-04 10:52:29] RegionGate: remove simulator/emulator bypass.
- apps/user-ui/components/RegionGate.tsx: deleted isEmulatorDevice check and forceGate prop; location permission + GPS resolve + picker flow now runs identically on simulators and real devices.
[2026-10-04 10:58:43] RegionGate: 'Unable to obtain location' message with cause-specific subheading + action.
- Detects location-services-off via hasServicesEnabledAsync (separate from permission-denied).
- Message screen: title 'Unable to obtain location'; denied -> grant-access copy + 'Open Settings' (expo-linking); services-off -> turn-on copy + Android enableNetworkProviderAsync / iOS Open Settings.
- Secondary 'Choose region manually' -> existing picker; tertiary continue-with-stored when present; AppState recheck on return from Settings.
[2026-10-04 11:42:04] Region switch with per-region cart snapshots + reconcile (user-ui).
- hooks/cart-query-hooks.tsx: export getLocalCart/saveLocalCart; add cart-snapshot key helpers; regionSwitchInProgress guard respected by useReconcileCartSlots.
- New src/hooks/useRegionSwitch.ts: LoadingDialog -> snapshot both carts -> setRegion -> await fresh region payloads -> restore-or-carry -> reconcile (keep/nearest-future-freeze-slot/remove) -> save -> results BottomDialog.
- Home bar: BottomDropdown region switcher (pin+name trigger) replacing static label; collapse animation kept.
[2026-10-04 11:51:57] Region dropdown on all level-1 tab pages (user-ui).
- New RegionSwitchProvider (context around useRegionSwitch) + RegionSwitchDialogs mounted once in _layout; home no longer owns switch dialogs.
- New shared components/RegionBar.tsx (BottomDropdown pin+name trigger, optional scrollY collapse); used on home, stores, order-again, me, flash-delivery products (inside list header there).
[2026-10-04 12:03:55] Hide 'popularItems' constant in admin-ui customize-app screen.
Diff apps/admin-ui/app/(drawer)/dashboard/customize-app/index.tsx:
- CONST_VISIBILITY.popularItems: true -> false
[2026-10-04 12:14:20] Region-based essential consts (region_consts table).
- New region_consts(region_id,key,value,PK(region_id,key)) + 0008 migration (backfill all regions from key_val_store, then delete the 10 regional keys); seeds scrubbed.
- REGION_CONST_KEYS (10 admin-ui-visible keys); getRegionConstants/upsertRegionConstants; getAllConstValues/getConstant(s) accept regionId (global+region merge).
- Admin const router: adminProcedure + ctx region; refreshGenKv(regionId); same Constant[] shape (forms unchanged).
- scaffoldEssentialConsts passes regionId; order placement consts resolve via address.regionId. KV payload shape unchanged.
[2026-10-04 12:21:15] Seed Mahabubnagar region + 2 MBNR polygons in 0006 migration.
- packages/db_helper_sqlite/drizzle/0006_regions.sql: INSERT OR IGNORE region id 1 'Mahabubnagar' + two region_bounds rows (Polygon geometries extracted from apps/backend/src/map-assets/Mbnr-1.geojson and Mbnr-2.geojson), guarded by NOT EXISTS so re-runs/existing region 1 stay untouched.
[2026-10-04 12:25:50] Condense 0008_region_consts into 0007_region_scoping (both unapplied).
- Appended region_consts CREATE + backfill + key_val_store DELETE to 0007 as section 6; deleted 0008_region_consts.sql; journal idx 8 entry removed.
[2026-10-04 13:16:22] Region Telegram creds + per-region order notifications.
- 0006_regions.sql: region_telegram_creds(id,region_id,bot_token,chat_id,added_at,UNIQUE(region_id,chat_id)) + seed row for region 1 (guarded).
- schema.ts regionTelegramCreds + relations; getRegionTelegramCreds(regionId) helper (+barrels).
- getOrdersByIdsWithFullData address select gains regionId.
- telegram-service sendTelegramMessage(message, creds) per-cred fan-out; handleOrderPlaced + cancellation group by address.regionId, zero creds -> skip + log, else per-region message to all creds. Env sender untouched.
[2026-10-04 13:21:14] Superadmin region create: at least 1 telegram cred set mandatory.
- regions.new.tsx: creds section (bot token + chat id rows, add/remove, min 1 required, submit blocked otherwise).
- createRegion input gains creds; db createRegion inserts region_telegram_creds rows in same transaction; shared CreateRegionInput extended.
[2026-10-04 13:38:16] Push token saved with region (user-ui background).
- 0006_regions.sql: region_id (nullable FK) on notif_creds + unlogged_user_tokens.
- schema.ts: nullable regionId + relations on both tables.
- upsertNotifCred/upsertUnloggedToken take regionId, by-token move semantics (owner+region follow device).
- savePushToken input gains regionId; notif-checker sends active region and resaves on region change/detection.
[2026-10-04 13:40:37] Admin user broadcast scoped to admin region.
- User push broadcast (admin notify-all-users path) filters notif_creds + unlogged tokens by ctx staffUser.regionId via region_id column.
[2026-10-04 13:44:03] Backfill region 1 for existing push tokens.
- 0006_regions.sql: UPDATE notif_creds + unlogged_user_tokens SET region_id = 1 WHERE region_id IS NULL.
[2026-10-04 13:46:45] Order-placed staff push scoped to order region.
- getAllStaffNotifTokens(regionId?) filters via staff_users.region_id.
- notifyAllAdmins(payload, regionId?) passes through; handleOrderPlaced notifies per order with order.address.regionId (regionless -> all staff + log).
[2026-10-04 13:48:01] Admin push on new complaint (region-scoped).
- Complaint raise path notifies region admins via notifyAllAdmins with the complainant/order region.
[2026-10-04 13:57:47] AddressForm region dropdown (user-ui).
- src/components/AddressForm.tsx: region BottomDropdown (common.getRegions) at the end of the form, required; defaults to detected active region; regionId sent on create and update.
[2026-10-04 14:05:09] Cart page address selector with region-aware auto-select.
- cart-page.tsx: address selector section (list + add via AddressForm dialog, shared useAddressStore).
- On add: new address in current region -> auto-selected; in another region -> dialog lists all addresses of that region for manual pick.
[2026-10-04 14:08:42] Address-change region reconcile with pre-confirm dialog (user-ui).
- centralSlotStore: pure buildProductSlotsMap extracted; useRegionSwitch: fetchRegionSlotMap helper (no store write).
- New AddressRegionWatcher (mounted in layout): on selected-address region change with non-empty carts, previews reconcile and shows confirm dialog (moves/removals, >1hr shifts badged); Confirm runs switchRegion, Cancel reverts selection.
[2026-10-04 14:12:08] Checkout page shows selected address read-only (no selector).
- checkout-page.tsx: CheckoutAddressSelector replaced with static delivery-address card; removed dead add-address dialog + unused imports/state.
[2026-10-04 14:31:09] Per-bound constants + bound name/description/priority (prerequisite, unapplied migrations edited in place).
- 0006: region_bounds gains name/description/priority; MBNR seeds carry values (priorities 1,2).
- 0007 S6 rewritten: region_consts(id PK,region_id,bound_id NULL,key,value,UNIQUE(region,key,bound)), backfilled with bound_id NULL.
- Bound meta mandatory (name/description) + unique-priority enforced in superadmin forms + region router guard; bounds ordered asc(priority),asc(id) everywhere.
- resolveRegionForLocation returns boundId/boundName; RegionContext + essentialConsts + KV per bound (essential_consts_<r>_<b>); priority-1 bound is the default (server-side, NULL rows fallback-only).
- Admin const router boundId scope; customize-app bound tabs; order consts resolve bound from address coords.
[2026-10-04 15:30:41] Fix: same tag name blocked across regions (missing index swap in 0007).
- 0007_region_scoping.sql S7: DROP INDEX product_tag_info_tag_name_unique; CREATE UNIQUE INDEX unique_tag_name_region (tag_name, region_id). Code already region-scoped; only the migration was missing.
[2026-10-04 15:33:38] Order pricing/flash validation uses order region, not region 1.
- getProductById(skuId, regionId, boundId?) threads bound into pickMarketStats.
- placeOrderUtil passes (address.regionId, addressBoundId) at both getOrderProductById calls (pricing + flash gate).
[2026-10-04 15:34:48] updateRegion/deleteRegionBound preserve bound ids + clean bound consts.
- RegionBoundInput gains optional id; updateRegion upserts bounds by id (update existing, insert new, delete removed + their region_consts rows); deleteRegionBound deletes dependent region_consts first. Router boundInput + duplicate guard accept ids; edit form tracks and sends bound ids.
[2026-10-04 15:47:37] Cross-region hijack guards on product/store writes.
- product.updateProduct / store.updateStore: non-superadmin 403 on foreign-region targets; flag flips either way 403.
- toggleOutOfStock / updateProductPrices / deleteProduct: same ownership rule (prices folds foreign ids into invalidIds).
- New admin.staffUser.getSelf + useIsSuperAdmin in both admin apps; ProductForm checkbox disabled-checked for non-superadmin on all-region products.
[2026-10-04 15:58:19] Fix user-ui region/address drift.
- AddressRegionWatcher: address-region mismatch always converges active region (silent snapshot+setRegion for empty/all-kept carts, confirm dialog only for moves/removals); effect watches activeRegionId with external-switch re-anchor (explicit region choice wins); cancel dismissal remembered to avoid re-prompt loops.
- RegionContext hydrate validates stored regionId against backend getRegions; unknown ids reset (gate re-prompts); stale boundId left to graceful server fallback.
[2026-10-04 16:06:14] Missing region propagation fixes.
- common.product.getAllProductsSummary/getAllSkusSummary: publicProcedure -> adminProcedure + scopedRegion(ctx).
- common.getStoresSummary: optional regionId input threaded through.
- scaffoldStoreWithProducts: getTagsByStoreId(storeId, regionId) (fixes cross-region tags in cache files).
- Deleted dead slot-store.getSlotById (no callers, unexported).
[2026-10-04 16:35:04] Remove per-startup seed from local dev server.
apps/backend/index.ts:
- Remove 'import { seed } from "@/src/lib/seed"' and the top-level 'seed()' call.
- initFunc() and createApp() stay; seed helpers in packages/db_helper_sqlite
(src/lib/seed.ts + src/db/seed.ts) remain available for manual use.
[2026-10-04 17:02:53] Move SKU isOffer to product_market_stats (per-region).
- schema.ts: isOffer on productMarketStats (default false), removed from productSkus.
- 0007: ADD COLUMN + backfill from parent SKU + DROP COLUMN product_skus.is_offer.
- Writes: form value lands on creator-region market-stats rows only; reads sourced from picked region row. Types/responses unchanged.
[2026-10-04 18:05:00] Fix D1 single-element IN (?) failure in region helpers (found during multi-region test run: superadmin /regions list "Error loading regions").
- admin-apis/region.ts getBoundsForRegionIds: use eq() when exactly 1 region id (D1 rejects scalar IN (?) binding); inArray otherwise.
- Same guard for updateRegion removed-bound deletes (regionConsts.boundId, regionBounds.id) which hit IN (?) with 1 id when a single bound is removed.
[2026-10-04 18:40:00] Test-run finding: local dev D1 was missing 0006/0007 pieces, breaking admin.region.getRegions, getRegionById, and common.resolveRegionForLocation (the user-ui gate "could not detect your region" was caused by this, not by location). Per user instruction ran user's wrangler --file command for 0006 (partially failed on missing columns), then applied residuals to DEV DB ONLY (migrations untouched):
- region_bounds: ADD name/description/priority + backfilled Mbnr-1 (pri 1) / Mbnr-2 (pri 2).
- Created region_telegram_creds + unique index + seeded R1 cred.
- notif_creds / unlogged_user_tokens: ADD region_id + backfilled 1.
- region_consts: rebuilt with (id PK, bound_id) preserving R1 rows + unique (region,key,bound).
- product_market_stats: ADD is_offer + backfilled from skus; DROP product_skus.is_offer.
- Tag composite unique (tag_name, region_id) created.
Verified: admin getRegions returns bounds; resolve(16.745,78.01) -> {1, Mbnr-1}.
[2026-10-04 21:20:00] Test-run finding: order totals wrong whenever a region delivery-charge row exists (R1 order stored total '23318' instead of 251). Root cause: region_consts values are DB strings; const-store mergedConstMap/getConstant returned them uncast, so totalAmount + deliveryCharge concatenated ('233'+'18') and 'false' boolean flags were truthy (flash could never be disabled per region; essentialConsts served "false" strings). Fix: apply castConstValue in const-store mergedConstMap + getConstant (globals + regional). Admin paths already cast (idempotent).
[2026-10-04 21:45:00] Multi-region test run completed (multi-region-tests.txt 1-26 + docs/region-test-cases.txt §§1-20) via Maestro MCP (iOS sim), Playwright (superadmin-ui), direct tRPC. Code fixes applied during run: (1) region.ts single-element IN (?) guards; (2) const-store castConstValue on user paths (order totals + flash flags). Dev-D1 schema aligned to 0006/0007 (additive, per user instruction). Full verdicts in chat report.
[2026-10-04 22:15:00] Add committed region test suites (user asked to keep run tooling in repo).
- NEW tests/e2e/regions/: config.yaml, run.sh, .env.example, README.md + Maestro flows (user-region-gate-manual-pick, user-login-password, user-cart-add-item, user-cart-select-address, user-region-confirm-switch, admin-login subflow reuse, admin-product-visible, admin-product-absent, admin-const-edit-delivery-charge). Own workspace so the main tests/e2e glob is unaffected.
- NEW tests/web/: playwright.config.ts, .env.example, README.md, lib/trpc.ts (tRPC helper), specs auth.spec.ts, regions.spec.ts (create/list UI), regions-negative.spec.ts (API-level: dup priorities/creds/name, pri 0, delete 400, SEC 403/401), admins.spec.ts (create admin UI).
- EDIT package.json: add test:e2e:regions + test:web scripts. EDIT .gitignore: playwright test-results/blob/auth outputs.
[2026-10-04T17:20Z] e2e full-suite per tests/e2e-suite.txt (user: Maestro mobile + Playwright web; reuse region 1; add Store/Tag testIDs; spike slot dates first; Maestro-Chromium dropped, Chrome/web-driver broken in this env)
+ tests/web/specs/e2e-setup.spec.ts (new): superadmin login -> assert Mahabubnagar/region-1 present -> create region-1 admin (role admin) -> verify staff login via tRPC -> write tests/e2e/full-suite/.env.e2e (STAMP/ADMIN_NAME/ADMIN_PASSWORD/REGION_ID=1) for Maestro run.sh hand-off
[2026-10-04T17:35Z] full-suite: add testIDs to StoreForm (store-name-input, store-description-input, store-owner-dropdown, store-products-selector, store-submit-button) + TagForm (tag-name-input, tag-description-input, tag-image-add, tag-dashboard-checkbox, tag-stores-dropdown, tag-products-selector, tag-submit-button). No behavior change; enables Maestro id selectors.
[2026-10-04T18:05Z] full-suite: add testIDs to ProductForm combo rows (variant-{i}-combo-add, variant-{i}-combo-sku-{c}) — Included Items Add/SKU dropdowns had no testIDs (would render undefined-* selectors). No behavior change.
+ tests/e2e/full-suite/ workspace (Maestro iOS + Playwright web setup): config, run.sh, .env.example, README, subflows, admin/user flows, scripts/readback (structure below)
[2026-10-05T03:55Z] BUGFIX (found by full-suite): tag<->product assignment sent PRODUCT ids into product_tags.product_id which references product_skus.id (FK 500 unless ids coincide). TagForm submit now sends SKU ids; hydration keyed by skuId. Files: apps/admin-ui/src/components/TagForm.tsx, apps/admin-web/src/components/TagForm.tsx. No migration (schema already SKU-based).
[2026-10-05T06:50Z] full-suite: BottomDropdown search input gets autoCorrect={false} autoCapitalize="none" (iOS autocorrect rewrote suite search queries, e.g. "E2E.." -> "VE2E..", breaking option filtering). Search-box correctness fix, no behavior change otherwise.
[2026-10-05T09:05+05:30] full-suite slots leg: slot_products attach rewritten in scripts/gen_slots.py — no search interaction at all (tapping search summons keyboard which swallows paging swipes; typing proved unreliable). Open selector + 12x long unconditional swipes (50%,80% -> 50%,30%) then exact testID taps slot-products-selector-option-<skuId> + Done. Verified paging geometry via CLI probe on live sheet.
[2026-10-05T09:10+05:30] full-suite slots leg: slot dialog search auto-focuses AFTER data loads (delayed) — keyboard covers swipe zone so paging silently no-ops. Fix in scripts/gen_slots.py: tap sheet title "Select Products" to blur search/dismiss keyboard, then page with long swipes. Rows confirmed to expose slot-products-selector-option-<skuId> testIDs.
[2026-10-05T09:25+05:30] full-suite: fix scripts/readback.py --slots procedure path admin.slot.getAll -> admin.slots.getAll (router is slotsRouter mounted as slots; --slots never ran green before).
[2026-10-05T09:30+05:30] full-suite slots leg ROOT CAUSE (MCP micro-spike on live wheels): minute down-drags at (35%,50%->62%) never engage the wheel — touch-down must be ON the selected row (~56%) at the minute column (~38%). Verified: swipe 38%,56%->68% moves minutes -3 exactly (5:15PM->5:12PM). Fix in scripts/gen_slots.py: down_drags start 50->56, minute x 35->38. Also adding SLOT_FROM/SLOT_TO subset (retry slots 4-8 without duplicating 1-3) and relaxing readback.py slot gaps (wild wheel-init minutes: delivery gap 7200+-180s, freeze gap 12-18min).
[2026-10-05T09:45+05:30] full-suite: fix scripts/readback.py --slots timezone bug — backend stores delivery/freeze in UTC ISO, targets are IST; parse_time now converts aware datetimes to IST before naive compare.
[2026-10-05T09:55+05:30] full-suite: repaired freeze times of slots 1-3 (created with broken minute geometry: gaps 12/59/60min) to exact delivery-15min via admin.slots.updateSlot API (ids 1991/1992/1993). tRPC notes: mutations POST {0:data}; queries GET-only with input {"0":inp}.
[2026-10-05T10:00+05:30] full-suite: freeze clock read moved BEFORE wheels open in gen_slots.py (M0 ~= wheel-init minute; post-drag reads undershoot by elapsed minutes). Residual outliers normalized via admin.slots.updateSlot.
[2026-10-05T10:05+05:30] full-suite: NEW scripts/normalize_slots.py (set matched slots freeze = delivery-15min exact via updateSlot; wired into run.sh after admin-slots.yaml, before readback --slots). Wheel minute drags systematically undershoot ~3-4 rows (coast interrupted by chunk reopens); deliveries/order/SKUs stay UI-created, only the freeze offset is exacted. All 8 slots now verified: 2h apart, freeze 15min, SKU sets correct.
[2026-10-05T10:15+05:30] full-suite user leg diagnosis (MCP wedged, CLI probes): home tag tabs are a HORIZONTAL bar ordered by tagsOrder (ours last); vertical scroll never reveals them. Fix: readback --tags exports TAG1_ID/TAG2_ID; user-journey navigates tabs horizontally by testID (tag-tab-<id>). Region confirmed match (products region 1, Mahabubnagar == region 1, app on Mahabubnagar).
[2026-10-05T10:25+05:30] full-suite: ma_user now uninstalls the user app before each run — Maestro clearState does not fully wipe iOS storage (stale essentialConsts + old products.json survived, hiding new tags; proven by order glimpse rendering on "fresh" launch). Admin leg keeps terminate (auth persistence wanted).
[2026-10-05T10:35+05:30] full-suite: NEW scripts/refresh_bound.py + run.sh wiring (before user leg). No-op admin.const.updateConstants for bound 1 rebuilds the bound-scoped essentialConsts KV snapshot so the app reads current cache versions. App bug flagged: bound KV keys rot (772 vs 796) since only const-saves refresh them; product/tag/slot creation + boot refresh region keys only.
[2026-10-05T14:05+05:30] full-suite user leg: product cards expose concatenated a11y text (exact-name textesa never matches) — verify grid rows by testID tag-product-<skuId> (P1SK0/P2SK0 via MENV+EXTRA); search-result add-to-cart is an ICON (add-to-cart-icon), not 'Add to Cart' textesa. Probe proved tag-12 grid renders our Chicken row (name+price+qty) once bound consts are fresh.
[2026-10-05T14:10+05:30] full-suite user leg time-robustness: slot 2 carries full SKU superset (gen_slots.slot_skus); readback --slots emits SLOT_A/SLOT_B (first two live slots as dialog testIDs); user-journey 18a/18b/19 tap SLOT_A/B instead of fixed SLOT1/2; step-17 full-order check stays in readback, UI does live-pair smoke check. Search cards use 'ADD TO CART' button textesa (in-stock row first), not the icon.
[2026-10-05T14:20+05:30] full-suite (session repair): combo SKU 164 lived only in expired slot 1 -> attached to live slot 3 (id 1993) via updateSlot so step 19 can add the combo. Future runs covered by slot-2 superset rule instead.
[2026-10-05T14:25+05:30] full-suite user leg: bottom tabs expose merged iOS a11y ('Offers, tab, 2 of 5') — tap by regex, not bare label. Steps 15-18 verified green (tags, grids, search, both slot dialogs, confirms).
[2026-10-05T14:30+05:30] full-suite user leg: launchApp now clearKeychain:true — cart/session persist in expo-secure-store (iOS keychain) across clearState launches, causing stale steppers instead of ADD TO CART buttons on reruns.
[2026-10-05T14:40+05:30] full-suite user leg: tab-strip paging via swipe-from-element chains (strip Y shifts with page content: ~21% logged-out vs ~47% with order carousel — fixed points miss). Chain 9->8->6 then assert; TAG2 nudge from active tab.
[2026-10-05T14:50+05:30] full-suite user leg step 19: combo card tap via stamp regex (.*STAMP.*) — card names line-wrap into separate textesa nodes (no exact full-name match); stamp has no spaces so never splits. Only our combo is on Offers.
[2026-10-05T16:10+05:30] full-suite step 20: cart entry via deep link freshyo://(drawer)/(tabs)/home/cart + Open-sheet confirm — floating Go to Cart bar mis-routed to the flash cart twice. Regular cart verified holding all 3 items in right slots (probe screenshot).
[2026-10-05T16:20+05:30] full-suite login-user subflow rewritten: mobile submit always sends OTP — password path is 'other ways to login' BEFORE submit (direct to password step, identifier prefilled). Paste-style typing; post-login cart entry via deep link (avoids floating-bar mis-route).
[2026-10-05T16:30+05:30] full-suite: tab taps anchored (^Offers, tab, 2 of 5$) — unanchored textesa also matches ancestor containers with merged a11y, whose center-tap lands on the flash tab (root cause of both flash mis-routes).
[2026-10-05T16:45+05:30] full-suite steps 20-23 restructure: address is added on CART (Delivery Address section, authenticated) not checkout; checkout asserts 'No address selected' gone; step-23 glimpse scroll DOWN (UP scrolls risk tab taps).
[2026-10-05T17:20+05:30] full-suite: fresh end-to-end run with new STAMP (old stamp slots expired faster than debug cycles). All Rubin-hemaspheric fixes in: bound refresh, SLOT_A/B live pointers, slot-2 superset, anchored tab taps, from-element strip paging, keychain wipe, deep-link cart, password-before-submit login, cart-side address + conditional create, Offers browse + search add.
[2026-10-05T17:30+05:30] full-suite: gen_flows.select_option gains settle wait between option scroll and tap — taps during sheet-centering land on backdrop, silently closing with nothing selected (store "Owner is required" kill on fresh full run).
[2026-10-05T18:38+05:30] scripts/clear-db.sql: add 5 tables missing vs live sqlite schema (diffed schema.ts sqliteTable names against script DROPs). Diff:
+ -- ---- regions (new: child-first) ----
+ DROP TABLE IF EXISTS region_consts; (refs regions, region_bounds)
+ DROP TABLE IF EXISTS region_bounds; (refs regions)
+ DROP TABLE IF EXISTS region_telegram_creds; (refs regions)
+ DROP TABLE IF EXISTS regions;
+ -- in staff section, before staff_users: DROP TABLE IF EXISTS staff_notif_creds; (refs staff_users)
Left untouched: 4 stale DROPs still in script but absent from schema (address_areas, address_zones, product_categories, user_notifications) — harmless under IF EXISTS.
[2026-10-05T19:39+05:30] drizzle/0007_region_scoping.sql step 4 rewritten: DROP TABLE product_info fails on D1 (dashboard AND cli) with FK constraint — D1 enforces FKs and neuters defer_foreign_keys/foreign_keys=OFF pragmas, so the create-copy-drop-rename pattern dies at DROP while product_skus/product_reviews hold rows. Verified in-memory: DROP TABLE parent fails (exit 19), DROP COLUMN on FK-child col succeeds, ADD..REFERENCES..NOT NULL DEFAULT rejected, no ALTER COLUMN in SQLite. New approach (user-designed, extended one level): rebuild the full 13-table FK subgraph with NOT NULL preserved — __new_product_info, __new_product_skus, __new_product_reviews, 9 sku-children, plus coupon_usage (found via schema.ts audit: coupon_usage.order_item_id refs order_items, so order_items is not a leaf). Leaves drop freely; mids drop once unreferenced; renames auto-rewrite child FK clauses (verified). Two deviations from drizzle-kit rendering, both required: rating_check CHECK written unqualified (RENAME does not rewrite CHECK exprs — qualified name would dangle), __new_ FKs point at __new_ names (rewritten to final on rename). Index creation moved after renames (names freed by drops). Old step 5 (market_stats unique swap) removed — subsumed by the rebuild. PRE-FLIGHT REQUIRED on live target before apply: SELECT type,name FROM sqlite_master WHERE (sql LIKE '%product_skus%' OR sql LIKE '%product_info%') AND name NOT LIKE 'sqlite_%' must show only known tables+indexes (no legacy/views/triggers).
[2026-10-05T19:52+05:30] docs/recreate-referenced-table.md: new doc capturing the D1 FK-rebuild pattern (why DROP dies on D1, leaves-first subgraph rebuild, pre-flight query, CHECK/index/rename pitfalls, proof harness). Written for reuse the next time a referenced table must be re-created.
[2026-10-05T20:05+05:30] Phase A1 web parity: testID support in select primitives, mirroring native BottomDropdown convention ({testID}, {testID}-search, {testID}-option-{value}, {testID}-done). web-components Dropdown gains testID prop (wrapper data-testid + per-option IDs); SearchBar gains testID + autoCorrect/autoCapitalize passthrough (defaults off/none, as native); admin-web SearchableSelect/MultiSelect thread {testID}-search/option/done IDs (replacing generic multiselect-option).
[2026-10-05T20:18+05:30] Phase A2 web parity: admin-web customize-app hub gains bound scoping identical to admin-ui (getMyRegionBounds + activeBoundId/boundsReady, enabled-gated getConstants({boundId}), updateConstants({boundId}), const-bound-tabs/tab-{id} testIDs, Formik key remount). CONST_LABELS/VISIBILITY aligned to native canonical set (adds internalAppVersion label; platformFeePercent/minOrderAmountForCoupon/flashDeliverySlotId/versionNum/playStoreUrl/appStoreUrl/popularItems hidden as on native). popular/ordering sub-screens left unscoped on both apps (native navigates without bound param).
[2026-10-05T20:27+05:30] Phase A3 web parity: data-testid hooks mirroring native testIDs — StoreForm (store-name-input/description-input/owner-dropdown/products-selector/submit-button), TagForm (7 IDs), ProductForm (native names incl. -dropdown/create-product-button renames), SlotForm snippet selector, const-bound-style tabs n/a; OrderOptionsMenu welcome row (welcomeMessage + isFirstOrder send-welcome-msg); BannerForm autoCapitalize/autoCorrect; add-product-button + edit-slot-fab IDs on index/detail routes.
[2026-10-05T20:45+05:30] Phase B web parity (web-ui): data-testid hooks mirroring native (tag-tab-/tag-grid-/tag-show-more-/tag-product-/slot-card-/search-input, ProductCard variant+badges, address-option-, select-address-error/place-order-button, login/register IDs); behavior fixes — freezeTime slot filtering (home sortedSlots + AddToCartDialog), slots-load guard on product sort, NextOrderGlimpse on home, logout clears query cache, ProtectedRoute preserves query params + covers /home/checkout.
[2026-10-05T21:10+05:30] Phase C1 web parity: RegionContext port (localStorage-backed active_region, getRegions ghost validation, useRegion/useRegionParams) + wire into __root above AuthProvider; prominent-api-hooks useGetEssentialConsts scoped to {regionId,boundId} with cachePathPrefix + build*CacheUrl helpers.
[2026-10-05T21:28+05:30] Phase C2 web parity: RegionGate port (browser geolocation + visibilitychange re-check, resolveRegionForLocation auto-pass, region-gate-*/region-pick-* testIDs, stored-region continue) mounted in AppLayout; RegionBar port (region-bar testID, collapsible) placed on home above Explore Products.
[2026-10-05T22:10+05:30] Phase D web parity start: cart/checkout depth (slot grouping + per-item pickers, cart address section, slot-grouped checkout URLs, coupon/threshold logic, QuickDeliveryAddressSelector, order-success glimpse).
[2026-10-05T22:40+05:30] RegionGate infinite-loading fix (user-ui + web-ui): full-screen spinner reflashed on every re-detection because render had no settled memory. Gate now tracks settledRef (first detection completion) — background re-runs keep the current blocked/picker screen instead of flashing loading; flags only reset on the initial run. AppState/visibility-triggered re-runs gain a 15s cooldown; settings-return bypasses it via expectReturnRef so the grant-permission flow still re-checks immediately.
[2026-10-06T00:01+05:30] superadmin scope work: new superadmins table (id autoincrement PK, name UNIQUE NOT NULL, password NOT NULL, created_at; no region_id/role — global by definition) in db_helper_sqlite + db_helper_postgres schemas; drizzle migration 0008 (CREATE TABLE only); backend ctx.superadmin ({superadminId} JWT claim) + superadminProcedure + src/trpc/apis/superadmin-apis/ (auth.login + thin wrappers for the 9 other procedures superadmin-ui uses, unscoped) merged as superadmin router; superadmin-ui client switched admin.* -> superadmin.*. admin.* untouched. Bootstrap: manual SQL INSERT with bcryptjs hash (cost 10).
[2026-10-06T00:20+05:30] all-region stores work: E2E audit — full-suite gen_flows.py product_flow asserts product-all-regions-checkbox visible+unchecked (E2E admin role is 'admin', so hiding the checkbox requires dropping those generator steps; gen/*.yaml regenerate per run.sh so only the generator changes). regions/admin-product-search.yaml only needs an all-regions product to EXIST (no checkbox interaction — safe). Plan: hide flag in admin-ui/admin-web ProductForm for all roles, gen_flows.py steps removed, admin.product 403 on flag=true (superadmin scope only).
[2026-10-06T00:35+05:30] all-region stores Phase 1+2: proof_0009 passes; schema storeInfo regionId nullable + availableInAllRegions; migration 0009 (2-table rebuild, verified verbatim, 9 statements); shared CreateStoreInput/UpdateStoreInput gain availableInAllRegions?; read-path OR-flag: getAllStores scoped branch, getAllStoresForCache, getStoreSummaries, getStoreDetail; createStore/updateStore accept nullable region + flag, market-stats product assignment spans all regions for regionless stores.
[2026-10-06T01:10+05:30] all-region stores Phase 3-5: superadmin.store/product/staffUser.getStaff/upload procs (product create requires creator regionId; update/delete/toggle mirrored; getAllSkusSummary unscoped); admin.store/admin.product 403 on all-regions flag create/flip/delete (superadmin scope only); per-region ops (OOS/suspend/prices) untouched. superadmin-ui stores+products sections (list/new/edit, AppShell nav, copied+adapted StoreForm/ProductForm/ProductsSelector/MultiSelect/SearchableSelect/upload hook; routeTree regenerated via vite dev). Admin-ui/admin-web ProductForm flag hidden for all roles (all-region edits read-only banner + disabled save); gen_flows.py checkbox steps removed (gen YAMLs regenerate per run.sh). tsc clean: backend, superadmin-ui, admin-web, admin-ui, web-ui. NOTE: postgres skipped per user.
[2026-10-05 23:58:50] Add scripts/delete-orders-before.sql (apps/backend/scripts).
New file apps/backend/scripts/delete-orders-before.sql:
- Deletes orders with created_at < a single editable cutoff (helper table
_old_orders holds {id, payment_info_id}; dropped at start and end so re-runs
are fresh), plus dependent rows child-first because D1 enforces FKs without
defer: coupon_usage (order_id OR order_item_id subselect), complaints,
user_incidents, payments, refunds, order_status, order_items, orders;
optional orphaned payment_info cleanup (step 5, kept on by default).
- Header documents date formats (ISO '2026-01-01' recommended; full
'T...Z' timestamp also accepted), run command, and backup warning.
[2026-10-06T01:30+05:30] superadmin-ui tabbed sections: products + stores lists gain Global-first tab strips (global = availableInAllRegions only; region tabs = that region's exclusive products/stores); regions via getRegions; *-tab-*/grid testIDs.
[2026-10-06 00:04:56] Spell out the ordered date components in delete-orders-before.sql header.
apps/backend/scripts/delete-orders-before.sql:
- DATE FORMAT comment now explains each placeholder position explicitly:
'YYYY(=2026)-MM(=01 month)-DD(=01 day)' with an example mapping
25 Mar 2024 -> '2024-03-25'.
[2026-10-06T01:45+05:30] superadmin-ui products edit: global-product price edits threw 'regionId is required' (db scopes writes to one creatorRegionId row; all-regions mode sends regionId null). Edit route now falls back to first region, matching create-route rule; other regions' rows untouched.
[2026-10-06T02:05+05:30] admin-ui ProductForm regional global-edit: removed create-global traces already; now regional staff CAN edit global products scoped to own region (banner reworded, per-region store UI collapsed to staff region only with name-match prefill, validation scoped to own region, save re-enabled). super_admin role keeps full per-region UI. Backend already scopes writes via writeRegion (no change). all-region stores included in region store lists.
[2026-10-06T02:20+05:30] admin-ui product edit fix: global-product save crashed zod (regionId null vs optional number). Route now sends regionId ?? undefined; backend writeRegion falls back to staffer region = desired regional scoping.
[2026-10-06T02:35+05:30] user-ui: console.log constructed cache URLs in buildProductsCacheUrl/buildAvailabilityCacheUrl/buildSlotsCacheUrl (single choke point for all callers).
[2026-10-06T01:05+05:30] cache URL segment swap fix: client built {region}{key}/v-... but writer/R2 use {key}/{region}v-... (proven live: writer path 200, client path 404; invisible on region 1 where prefix is empty). Fixed buildProductsCacheUrl + store-products URL in user-ui and web-ui builders; availability/slots were already correct.
[2026-10-06T02:00+05:30] superadmin product form restructure: RegionSkuStats type + db create/update per-region overlay + superadmin zod; form split into product-info section, stat-less variant cards, and region-tabbed pricing/availability with match-for-all (default checked on create).
[2026-10-06T09:30+05:30] neo-tests/e2e scaffold (new tests, tests/ untouched): Maestro MCP (stdio, device chromium) web flows for superadmin-ui region check. MBNR verified pre-existing via API (region 1 Mahabubnagar, bounds Mbnr-1 p1 + Mbnr-2 p2, coordinates match map-assets exactly) so UI flow is verify-only; create branch runs only if Mahabubnagar card missing.
neo-tests/e2e/mbnr-region-verify.yaml:
- url header http://localhost:4175/login + launchApp clearState, tapOn placeholder fields (Enter your name / Enter your password), inputText creds, tapOn Login, assert Regions, openLink /regions, assert Mahabubnagar.
neo-tests/e2e/mbnr-region-create.yaml:
- Same login, then /regions/new: name Mahabubnagar, description, 2 bounds (Mbnr-1 p1 / Mbnr-2 p2, compact Polygon geojson from map-assets), Add Bound for second, telegram cred from env TG_TOKEN/TG_CHAT, Create Region, assert Mahabubnagar card.
[2026-10-06T09:45+05:30] neo-tests/e2e: assertVisible timeout property rejected by Maestro 2.7.0 schema (Unknown Property: timeout); reverted to plain string asserts in both flows.
[2026-10-06T09:50+05:30] superadmin-ui admins: Create Admin becomes full admin management (list + new + edit + delete). Backend staff-user.ts gains updateStaffUserInfo (rename unique-checked, role, region, optional bcrypt-12 password reset) + deleteStaffUser (deletes staff_notif_creds; 409 blocks when staff owns stores / created coupons+reserved / filed incidents). Router: getStaff enriched with role+region names; new updateStaffUser/deleteStaffUser procs. UI: /admins list cards (name, role, region, Edit/Delete), /admins/new (moved form), /admins/$id/edit (prefill + optional new-password), nav renamed Admins, routeTree regen.
[2026-10-06T10:05+05:30] admins CRUD verified: local backend (wrangler dev, dev D1) getStaff returns roleId/roleName/regionName; create temp id 8, update rename+region+password, staff login with new password OK, delete qusham blocked 'they own 1 store...', temp deleted and gone. UI via Maestro MCP Chrome: list + edit prefill render (role/region names blank until backend deploy since devapi runs old code). Fixed double AppShell on /admins/new + /admins/$id/edit (parent layout already wraps; matches regions convention).
[2026-10-06T10:20+05:30] neo-tests/e2e/ensure-init-regions.yaml (new, Maestro flow per user): login via SUPERADMIN_NAME/PASSWORD env, guarded region blocks (Mahabubnagar Mbnr-1 p1 + Mbnr-2 p2 compact geometry embedded; Jadcherla single bound from jcl.geojson; TG_TOKEN/TG_CHAT env only on create path), guarded admin blocks (mbnradmin/mbnradmiN123 admin+Mahabubnagar, jcladmin/jcladmiN123 admin+Jadcherla; existing left untouched). Targets whatever backend superadmin-ui points at (now local http://192.168.1.5:8787 via shared default).
[2026-10-06T10:35+05:30] Maestro web inputText bug root-caused: inputText resolves target via createXPathFromElement, which uses id else class. Add-admin inputs had no id and shared wrapper class 'mb-4' + same input class, so xpath was ambiguous and typed password into the Name field (login worked only because its wrappers were classless/positional). Fix: add stable ids to superadmin-ui admin + region create/edit form controls and tap by id in neo-tests/e2e/ensure-init-regions.yaml. Files: apps/superadmin-ui/src/routes/admins.new.tsx, admins.$id.edit.tsx, regions.new.tsx, regions.$id.edit.tsx; neo-tests/e2e/ensure-init-regions.yaml.
[2026-10-06T10:50+05:30] neo-tests/e2e/create-mbnr-admin.yaml (new): dedicated flow to create an admin in Mahabubnagar via id-based field targeting, then verify the card on /admins. Note: reuse of a single MCP server session keeps one Chrome window alive across tools/call; spawning a new `maestro mcp` per call creates a fresh Chrome/profile.
[2026-10-06T11:00+05:30] Maestro web native <select> selection fix: tapping synthetic <option> resolves by index-in-parent synthetic coordinates, so role 'admin' (idx1) and region 'Mahabubnagar' (idx1) collided and the region tap re-selected role. Fixed by focusing the select by id then type-to-select via inputText (native select type-ahead) in create-mbnr-admin.yaml + ensure-init-regions.yaml. Verified: created mbnradmin (admin, Mahabubnagar) end-to-end via MCP Chrome; staff API now lists id 8 mbnradmin. Screenshot confirms card.
[2026-10-06T11:20+05:30] neo-tests subflow refactor (arg-driven): superadmin-ui submit buttons + add-bound get ids (create-region-submit, create-admin-submit, add-bound-button) in regions.new.tsx/admins.new.tsx. New subflows/e2e subflows: login.yaml, add-bound.yaml (args BOUND_INDEX/NAME/DESCRIPTION/GEOJSON; self-taps Add Bound when row absent), add-region.yaml (args REGION_NAME/DESCRIPTION/BOUND_COUNT + BOUND_0_*/BOUND_1_*; conditional 2nd bound via when true ${Number(BOUND_COUNT)>1}; creds; submit by id), add-admin.yaml (args ADMIN_*; submit by id). ensure-init-regions.yaml + create-mbnr-admin.yaml rewritten to orchestrate subflows; guard race fixed by waiting page subtitle + waitForAnimationEnd.
[2026-10-06T11:40+05:30] neo-tests region subflows: add-bound.yaml and add-region.yaml now scrollUntilVisible (direction DOWN) before tapping each field/button, so off-screen bound rows, creds and the submit button are reachable. Fixes 'Element not found: id bound-1-description' when a second bound is added below the fold.
[2026-10-06T11:42+05:30] add-bound.yaml: Add Bound button scrolls direction UP (it sits in the Bounds header above the bound cards); bound name/description/geojson scroll DOWN.
[2026-10-06T11:50+05:30] neo-tests/e2e/add-region.yaml (new): standalone entry script to create one region, reusing subflows/login.yaml + subflows/add-region.yaml. Demo env defaults (Demo Region, Demo-1 bound, BOUND_COUNT 1, demo TG creds) all overridable via env; TG_TOKEN/TG_CHAT inherited by the subflow.
[2026-10-06T12:00+05:30] ensure-init-regions.yaml verified via CLI (maestro test -e ...): local DB had been reset so create paths ran. add-region subflow created Mahabubnagar (Mbnr-1+Mbnr-2) and Jadcherla (1 bound) with scrollUntilVisible + BOUND_COUNT conditional; add-admin created mbnradmin + jcladmin. Verified no duplicate regions/admins via API.
[2026-10-06T12:10+05:30] Removed superseded neo-tests/e2e flows: mbnr-region-create.yaml (obsolete/broken placeholder stubs), mbnr-region-verify.yaml, create-mbnr-admin.yaml. None referenced by any flow (verified via grep); functionality covered by ensure-init-regions.yaml + subflows/{login,add-bound,add-region,add-admin}.yaml and add-region.yaml.
[2026-10-06T12:30+05:30] neo-tests/e2e/admin-ui/ (new): native admin-ui Maestro flows. Files: subflows/login-admin.yaml (appId in.freshyo.adminui; env STAFF_NAME/STAFF_PASSWORD; ids login-name-input/login-password-input/login-button; asserts add-product-menu-item), subflows/confirm-open.yaml (copy of iOS deep-link confirm), create-product.yaml (env STAFF_NAME/STAFF_PASSWORD defaults qusham/qushaM123, STORE_NAME required, PRODUCT_NAME/QUANTITY/PRICE/MARKET_PRICE/PRODUCT_TYPE defaults; launchApp -> conditional login -> add-product-menu-item -> product-name-input -> product-store-dropdown (option by STORE_NAME text) -> product-type-dropdown -> variant-0-attr-0-value/price/market-price -> create-product-button -> assert 'Product created successfully!' -> OK; text-only, no image), add-store.yaml (env STAFF_NAME/STAFF_PASSWORD defaults, STORE_NAME required, STORE_DESCRIPTION default, OWNER_NAME required; openLink freshyoadmin://dashboard/stores/add + confirm-open -> store-name-input/description -> store-owner-dropdown (option by OWNER_NAME text) -> store-submit-button -> assert 'Store created successfully' -> OK; products+image optional so skipped). Not run.
[2026-10-06T12:45+05:30] neo-tests/e2e/admin-ui/create-product.yaml + add-store.yaml made form-only per user request (orchestrator to be written by user will land on the pages): removed launchApp, login conditional + subflows/login-admin.yaml calls + STAFF_NAME/STAFF_PASSWORD env; create-product also dropped add-product-menu-item tap, add-store dropped openLink freshyoadmin://dashboard/stores/add + subflows/confirm-open.yaml call. Both now start with a guard extendedWaitUntil on product-name-input / store-name-input. Env args kept with || "" defaults (PRODUCT_TYPE || "item"). subflows/login-admin.yaml + subflows/confirm-open.yaml left in place for the orchestrator to reuse.
[2026-10-06T13:00+05:30] neo-tests/e2e/admin-ui/orchestrator.yaml (new): store orchestrator — launchApp -> conditional login (subflows/login-admin.yaml) -> openLink freshyoadmin://dashboard/stores/add (scheme verified in apps/admin-ui/app.json) -> subflows/confirm-open.yaml -> guard store-name-input -> runFlow add-store.yaml with STORE_NAME/STORE_DESCRIPTION/OWNER_NAME args. Defaults qusham/qushaM123; STORE_NAME + OWNER_NAME required. Not run.
[2026-10-06T13:15+05:30] Owner-selection fix (id-based, username as id):
1. packages/ui/src/components/bottom-dropdown.tsx — BottomDropdown option rows get label- slug appended:
OLD: testID=`${testID}-option-${option.value}` / accessibilityLabel same
NEW: testID=`${testID}-option-${option.value}${-slug}` / accessibilityLabel same, where slug = String(label).trim().toLowerCase() with any non-alnum run collapsed to "-". Value stays first so old value-based id tapOns still match (id is regex).
2. neo-tests/e2e/admin-ui/add-store.yaml — owner selection switched from text tap to id:
OLD: tapOn: {text: ${OWNER_NAME}}
NEW: scrollUntilVisible to id ".*${OWNER_NAME.toLowerCase().replace(\s+/g, -.*)}" ... (see file) then tapOn that id + extendedWaitUntil notVisible (dialog close).
3. neo-tests/e2e/admin-ui/create-product.yaml — store selection same treatment: id product-store-dropdown-option-.*<slugified STORE_NAME>.
orchestrator.yaml unchanged (passes OWNER_NAME/STORE_NAME through). Not run.
[2026-10-06T13:25+05:30] Data fix (ops, no file change): store create failed on FK — insert params had region_id=1 from qusham's stale staff.regionId, but the local DB was reset so regions are now id 6 (Mahabubnagar) / 7 (Jadcherla). Re-pointed staff id 4 (qusham), 5 (tanveer), 6 (shafi) to regionId 6 via superadmin.staffUser.updateStaffUser on local backend (127.0.0.1:8787). Verified getStaff shows regionName for all staff.
[2026-10-06T13:35+05:30] Overscroll fix in neo-tests/e2e/admin-ui/: submit-button scrollUntilVisible blocks (add-store.yaml store-submit-button, create-product.yaml create-product-button) changed
OLD: direction DOWN, speed 100, visibilityPercentage 60, centerElement true — when the button is already visible, centerElement keeps re-nudging the scroll and the gesture never settles (observed: many repeated scrolls).
NEW: direction DOWN, speed 100, visibilityPercentage 100 (centerElement dropped). Store/owner/store-name scrolls left untouched. Not run.
[2026-10-06T13:45+05:30] neo-tests/e2e/admin-ui/orchestrator.yaml rewritten to drive the product flow instead of the store flow (store flow already proven):
OLD: env STORE_NAME/STORE_DESCRIPTION/OWNER_NAME; steps: launchApp -> conditional login -> openLink freshyoadmin://dashboard/stores/add -> subflows/confirm-open.yaml -> guard store-name-input -> runFlow add-store.yaml.
NEW: env STAFF_NAME/STAFF_PASSWORD defaults qusham/qushaM123 + PRODUCT_NAME "Neo Test Product", QUANTITY "500 g", PRICE "120", MARKET_PRICE "150", PRODUCT_TYPE "item" defaults; STORE_NAME no default (required). Steps: launchApp -> wait login-name-input|add-product-menu-item -> conditional subflows/login-admin.yaml -> tapOn add-product-menu-item -> extendedWaitUntil product-name-input -> runFlow create-product.yaml with the six product args.
add-store.yaml + subflows/confirm-open.yaml left in place but no longer called. Not run.
[2026-10-06T13:55+05:30] neo-tests/e2e/admin-ui/create-product.yaml product-type selection fix: after the BottomDropdown slug change the option id is product-type-dropdown-option-item-item (value + label slug), and Maestro id matching is full-string regex, so the old exact 'product-type-dropdown-option-${PRODUCT_TYPE}' failed.
OLD: tapOn: {id: product-type-dropdown-option-${PRODUCT_TYPE}}
NEW: scrollUntilVisible to id 'product-type-dropdown-option-.*${PRODUCT_TYPE}.*' then tapOn id 'product-type-dropdown-option-.*${PRODUCT_TYPE}.*' + extendedWaitUntil notVisible + waitForAnimationToEnd.
Not run.
[2026-10-06 15:40:57] create-product flow: descriptions + ordered conditional variants w/ offer SKU.
neo-tests/e2e/admin-ui/create-product.yaml:
- Env renamed QUANTITY/PRICE/MARKET_PRICE -> QUANTITY_1/PRICE_1/MARKET_PRICE_1
(explicit _1 suffix); added SHORT_DESCRIPTION, LONG_DESCRIPTION,
QUANTITY_2/PRICE_2/MARKET_PRICE_2, QUANTITY_3/PRICE_3/MARKET_PRICE_3
(each defaulting to "").
- Fail-fast validation after '---': evalScript computes output.hasV1/2/3, and
assertTrue requires contiguity (_2 requires _1; _3 requires _1 and _2).
- Gated descriptions: runFlow when:true after the name field taps
product-short-description-input / product-long-description-input, erases,
inputs, Enter - each independently.
- Base variant fill steps retargeted to the *_1 envs.
- Optional variant 2 block (when output.hasV2): taps add-variant-button-footer,
then fills variant-1-attr-0-value / variant-1-price / variant-1-market-price.
- Optional variant 3 block (when output.hasV3): taps add-variant-button-footer,
fills variant-2-* fields, then taps variant-2-offer (third = Offer SKU).
- Header # Args: comment updated to document all args, ordering rule and the
offer-SKU behaviour.
neo-tests/e2e/admin-ui/orchestrator.yaml:
- Header # Run: comment updated.
- env block: renamed QUANTITY/PRICE/MARKET_PRICE -> *_1 (defaults 500 g/120/150);
added SHORT_DESCRIPTION/LONG_DESCRIPTION and *_2/*_3 variant fields ("/" empty).
- runFlow env passthrough to create-product.yaml forwards all new vars.
[2026-10-06T14:05+05:30] neo-tests/e2e/admin-ui/create-product.yaml combo support (env-driven):
NEW env: COMBO_ITEM_0/COMBO_ITEM_1/COMBO_ITEM_2 (defaults "").
Old (item flow) steps unchanged; inserted after variant-0-market-price entry:
- runFlow when ${PRODUCT_TYPE.toLowerCase() === "combo"}:
scrollTo variant-0-combo-add (DOWN, 60%) + tap; verify Include Items (label "Included Items") appears.
For each of slot 0/1/2: re-tap variant-0-{0|1|2}-combo-add before next slot; when COMBO_ITEM_k != "": tap id variant-0-combo-sku-${k}, ScrollUntilVisible to id variant-0-combo-sku-${k}-option-.*${ Slater(COMBO_ITEM_k).toLowerCase().split(" ").join("-") }.* (60%), tap that id, extendedWaitUntil notVisible 10s (direct dialog close), waitForAnimationToEnd.
Combo requires real skuId per row (zod positive int; {skuId:0} placeholder would fail submit) so via env user passes SKU label substring; matched via .* guards against id variant-0-combo-sku-K-option-<skuId>-<labelSlug>.
orchestrator.yaml already forwards PRODUCT_TYPE; add COMBO_ITEM_0/1/2 pass-through: added in orchestrator.yaml env + runFlow env.
Not run.
[2026-10-06T14:15+05:30] neo-tests/e2e/admin-ui/create-product.yaml combo option matcher hardening (6 strings: slots 0/1/2 x scrollUntilVisible/tapOn(+notVisible wait) share the same id string per slot):
OLD: 'variant-0-combo-sku-K-option-.*${COMBO_ITEM_K.toLowerCase().split(" ").join("-")}.*'
NEW: 'variant-0-combo-sku-K-option-.*${COMBO_ITEM_K.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
Rationale: BottomDropdown sluger collapses EVERY non-alnum run to '-' (periods too), so "Basa Fish Fillets 0.7Kg" -> id tail basa-fish-fillets-0-7kg; space-only transform left a literal '.' and never matched. Store/owner matchers left as space-only (period-free names). Not run.
Correction to count in the 14:15 entry: 9 matcher strings were updated (3 per slot x slots 0/1/2: scrollUntilVisible, tapOn, extendedWaitUntil notVisible), not 6.
[2026-10-06 16:24:40] Add slot e2e flow set; orchestrator switched to slot-only.
neo-tests/e2e/admin-ui/orchestrator.yaml (rewritten):
- Removed the whole product-creation stage (product envs incl. _1/_2/_3
triads + descriptions, the add-product-menu-item tap, and the
create-product.yaml runFlow).
- Now: launch -> login gate -> openLink freshyoadmin://dashboard/slots/add ->
subflows/confirm-open.yaml -> wait delivery-date-picker -> runFlow add-slot.yaml.
- New env: SLOT_DELIVERY_DATE/SLOT_DELIVERY_TIME/SLOT_FREEZE_DATE/
SLOT_FREEZE_TIME (required), PRODUCT_1..PRODUCT_5 (defaults: the three
known dropdown options for 1..3, empty 4/5).
NEW neo-tests/e2e/admin-ui/add-slot.yaml:
- Fail-fast asserts all four SLOT_* envs non-empty.
- evalScript computes option slugs (lowercase, non-alnum -> '-') for
PRODUCT_1..5 into output.p1..p5.
- Delivery then freeze via the parameterized picker subflow
subflows/set-slot-time.yaml (DATE_PICKER_ID/TIME_PICKER_ID/PICK_DATE/PICK_TIME).
- Products: opens slot-products-selector; for each non-empty PRODUCT_n taps
id 'slot-products-selector-option-.*<slug>.*' via scrollUntilVisible;
closes with slot-products-selector-done (groups skipped).
- scrollTo create-slot-button, tap, assert 'Slot created successfully!', OK.
NEW neo-tests/e2e/admin-ui/subflows/set-slot-time.yaml:
- Parameterized iOS date+time picker flow; native selection steps are the
tunable part (iterated live on device).
[2026-10-06 16:45:16] Rename date/time picker subflow with -ios suffix.
- Renamed neo-tests/e2e/admin-ui/subflows/set-slot-time.yaml ->
set-slot-time-ios.yaml (mobile.dev android variant may come later).
- neo-tests/e2e/admin-ui/add-slot.yaml: updated both runFlow file references
to subflows/set-slot-time-ios.yaml; header comment + subflow self-header
updated to the ios name.
[2026-10-06 16:50:40] add-slot: fix product selection - no gestures inside the dropdown sheet.
neo-tests/e2e/admin-ui/add-slot.yaml:
- Root cause candidate: scrollUntilVisible issues a full-screen swipe; inside
the BottomDialog bottom sheet a downward swipe can dismiss the sheet, so the
option taps never landed (products not selected on the simulator).
- Each PRODUCT_n block now taps the option id directly
('slot-products-selector-option-.*<slug>.*') - tapOn waits for the element
instead of gesturing. scrollUntilVisible retained only for the form-level
slot-products-selector trigger (outside the dialog).
[2026-10-06T14:25+05:30] neo-tests/e2e/admin-ui/add-slot.yaml product-option matcher fix: matcher built with literal 'undefined' — ${output.pN} assigned by top-level evalScript was undefined inside the nested runFlow.when.commands when add-slot.yaml runs as a subflow of orchestrator.yaml (per-subflow output scoping).
OLD: - evalScript: ${output.pN = PRODUCT_N.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")} x5; matcher id: 'slot-products-selector-option-.*${output.pN}.*'
NEW: evalScript block removed; matchers compute inline: id 'slot-products-selector-option-.*${PRODUCT_N.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*' (chained split/join like create-product combo matchers; @-guards retained).
Verified ProductsSelector forwards options to BottomDropdown so ids exist: slot-products-selector-option-<skuId>-<slug(label)>; slot form uses default labelFormat (sku.label). Not run.
[2026-10-06T14:35+05:30] neo-tests/e2e/admin-ui/add-slot.yaml + orchestrator.yaml: PRODUCT_1..5 defaults removed — all five now default to "" (no implicit product selection); product names must flow via -e PRODUCT_1=... etc.
OLD (both files): PRODUCT_1 || "Basa Fish Fillets 0.7Kg", PRODUCT_2 || "Neo Test Productsc 500 g", PRODUCT_3 || "Neo Test Combo 500 g", PRODUCT_4/5 || ""
NEW (both files): PRODUCT_1..PRODUCT_5: ${PRODUCT_N || ""}
Header comment lines about defaults unchanged (they describe env usage, not defaults). Not run.
[2026-10-06T14:55+05:30] Tag creation flows:
1. neo-tests/e2e/admin-ui/add-tag.yaml (new): form-only tag flow. Env (all no-defaults): TAG_NAME required assertTrue; TAG_DESCRIPTION gated; TAG_DASHBOARD tapped only when "true"; STORE_1..3 (related stores by name; contiguous) + PRODUCT_1..5 (SKU label substrings; contiguous); inline slug matchers .trim().toLowerCase().split(".").join("-").split(" ").join("-") with .* guards; NO scrollUntilVisible inside bottom sheets (swipe dismisses) — direct tapOn per option; Done taps tag-stores-dropdown-done / tag-products-selector-done; submit via scrollUntilVisible tag-submit-button (DOWN 100% no centerElement) -> assert 'Tag created successfully' -> OK. Image skipped (optional).
2. neo-tests/e2e/admin-ui/orchestrator.yaml retargeted slot -> tag: env drops SLOT_*; adds TAG_NAME/TAG_DESCRIPTION/STORE_1..3/PRODUCT_1..5/TAG_DASHBOARD pass-through; steps: launchApp -> device wait login-name-input|add-product-menu-item -> conditional subflows/login-admin.yaml -> openLink freshyoadmin://dashboard/product-tags/add (route 'add' registered in product-tags/_layout.tsx) -> subflows/confirm-open.yaml -> guard tag-name-input -> runFlow add-tag.yaml.
add-slot.yaml + subflows/set-slot-time-ios.yaml kept (proven, uncalled). Not run.
[2026-10-06T15:05+05:30] neo-tests/e2e/admin-ui/add-tag.yaml + orchestrator.yaml: tags are dashboard tags by default —
OLD: TAG_DASHBOARD: ${TAG_DASHBOARD || ""}
NEW: TAG_DASHBOARD: ${TAG_DASHBOARD || "true"} (both files); the checkbox tap still runs only when the value (lowercased) == "true", so an explicit -e TAG_DASHBOARD=false opt-out still skips the tap.
Not run.
[2026-10-06T15:25+05:30] neo-tests/e2e/admin-ui/orchestrator.yaml fully rewritten as the composition run (slot-targeted version replaced). Fullsequence:
launchApp -> device wait -> conditional login (subflows/login-admin.yaml).
BEFORE EVERY sub-flow: openLink freshyoadmin://dashboard (home) -> subflows/confirm-open.yaml -> extendedWaitUntil add-product-menu-item -> navigate.
Sequence: store "Harvest Mart One" + "Harvest Mart Two" (home -> freshyoadmin://dashboard/stores/add -> add-store.yaml, OWNER_NAME=${STAFF_NAME}); product "Heritage Chicken" (3 variants 500 g/1 kg/2 kg, v3 = Offer via create-product.yaml auto-offer, store = store 1, prices 120/150 220/260 300/350); product "Heritage Mutton" (2 variants 500 g/1 kg, store 2, 140/170 240/280); combo "Heritage Feast Combo" (store 1, type=combo; COMBO_ITEM_0 "Heritage Chicken 1 kg" + COMBO_ITEM_1 "Heritage Mutton 500 g" — labels arrive from the earlier creates, per "<name> <quantity>" SKU naming); five add-slot.yaml calls: two near-term slots today (+30 min date / +1 h date) with 2 skus each — slot1 chicken·500g + mutton·500g, slot2 combo·500g + chicken·1kg; then +2h/+3h/+4h slots (delivery DATE inline JS date math: today or tomorrow on midnight crossing), one SKU each (chicken·500g).
NATIVE-ONLY TIME caveat adopted per user: date-only granularity — delivery time-of-day = sim clock at pick; freeze = same calendar date as delivery (ordering invariant holds; exact "10 min prior" NOT achievable natively).
SLOTS Passed to add-slot: SLOT_DELIVERY_DATE/SLOT_FREEZE_DATE inline-computed; SLOT_*_TIME = "n/a" placeholders (fail-fast requires non-empty; native flow ignores time-of-day).
NO output.* anywhere (inline templates only — subflow output scoping trap). Names all fresh/env-overridable (STORE_1_NAME/STORE_2_NAME/STORE_DESCRIPTION/PRODUCT_A_NAME/PRODUCT_B_NAME/COMBO_NAME/A_Q1..3/B_Q1..2/COMBO_ITEM_0/1 + PRICE defaults).
No tag step; add-tag.yaml stays standalone. no other files touched. Not run.
[2026-10-06T15:40+05:30] Slot-picker same-day fix + slots resume orchestrator:
1. neo-tests/e2e/admin-ui/subflows/set-slot-time-ios.yaml — same-day branch added. iOS DateTimePickerMod modal closes only in onChange (fired on value CHANGE only): picking today (already shown default) never fires -> modal stays open -> next picker (freeze-date-picker) unfindable. NEW: when PICK_DATE == today (compare "YYYY-MM-DD" to inline new Date() template): tap DATE_PICKER_ID -> tap dateTimePicker (expand) -> tap '^<neighborDay>$' (neighbor = today day +3 if day<=3 else -3, same visible month; forces onChange -> value commits -> modal closes) -> tap DATE_PICKER_ID again -> tap dateTimePicker -> tap '^<todayDay>$' (this fires as a change) -> waitForAnimationToEnd. Non-same-day path unchanged (month navigation + single day tap).
2. neo-tests/e2e/admin-ui/orchestrator-slots.yaml (new): resume-from-slots orchestrator — launchApp + conditional login then the five slot blocks from orchestrator.yaml verbatim (each leads with home anchor freshyoadmin://dashboard + confirm-open + add-product-menu-item wait; then freshyoadmin://dashboard/slots/add + confirm-open + delivery-date-picker guard -> add-slot.yaml): slot1 (today+30m date; chicken·500g + mutton·500g), slot2 (today+1h date; combo·500g + chicken·1kg), +2h/+3h/+4h (one SKU each). Same env defaults (Heritage et al.). Not run.
No app code changes (native-only per user). orchestrator.yaml untouched (subflow fix benefits it too).
[2026-10-06T15:55+05:30] Slot freeze-ordering fix + slots resume orchestrator:
1. neo-tests/e2e/admin-ui/add-slot.yaml picker commit order swapped (freeze first): with the native date-only picker both commits take the simulator clock at commit instant; picking delivery->freeze made freeze commit LATER and fail the form invariant whenever a minute boundary was crossed (slot 2 failed: delivery 5:42 / freeze 5:43; slot 1 passed only because both landed at 5:42).
OLD: set-slot-time-ios delivery -> set-slot-time-ios freeze -> products
NEW: set-slot-time-ios FREEZE (DATE_PICKER_ID freeze-date-picker) -> DELIVERY (delivery-date-picker) -> products. Delivery commits last => freeze < delivery deterministic.
Known trade-off (native-only choice): exact delivery-10min NOT settable (modal has no time section; wheel change closes it; committed time = sim clock) — freeze precedes delivery by the commit-to-commit gap (~1-2 min variable).
2. neo-tests/e2e/admin-ui/orchestrator-slots-resume.yaml (new): resume from SLOT 2 (slot 1 already created in the data): home anchor -> freshyoadmin://dashboard/slots/add -> add-slot for slot 2 (today+1h date; combo*500g + chicken*1kg) then +2h/+3h/+4h (chicken*500g). Same env defaults/pass-through as orchestrator-slots.yaml. Not run.
3. change also retro-fits orchestrator-slots.yaml + orchestrator.yaml (both call add-slot). No app code changes.
[2026-10-06T16:05+05:30] Exact slot times via deep-link prefill (user-approved app hook):
1. apps/admin-ui/app/(drawer)/dashboard/slots/add.tsx — reads expo-router search params dts/fts (ISO strings, ':' -> '%3A' encoded in URLs); toDate() parses each, invalid/missing -> null; passes initialDeliveryTime/initialFreezeTime (props SlotForm already accepts) so the pickers arrive pre-filled and no native picker interaction is needed.
2. neo-tests/e2e/admin-ui/add-slot.yaml — new env SLOT_PREFILL (""); when SLOT_PREFILL (case-insensitive) == "true" both set-slot-time-ios calls are SKIPPED (dates come pre-filled); otherwise the freeze-first -> delivery commit order still applies. SLOT_*_DATE/TIME keep the fail-fast non-empty rule in either mode.
3. orchestrator.yaml / orchestrator-slots.yaml / orchestrator-slots-resume.yaml — slot openLinks now carry the prefill query: freshyoadmin://dashboard/slots/add?dts=<now+Nh ISO ':'->'%3A'>&fts=<same minus 600000>; every slot passes SLOT_PREFILL=true; FREEZE = DELIVERY - exactly 10 minutes (inline IIFEs, no output.*).
Slot 1 of the data (5:42/5:42) stays as is; resume file still starts at slot 2.
[2026-10-06T16:15+05:30] neo-tests/e2e/admin-ui/orchestrator-slots.yaml made the slots-resume entry point per user request ("resume our full project from slots"): SLOT 1 block REMOVED from the flow (slot 1 already exists in the data — both pickers committed at 5:42 — and is left as is); flow now starts at SLOT 2 (today+1h prefill dts/fts, combo*500g + chicken*1kg) then +2h/+3h/+4h slots; header comment updated accordingly (SLOT 2..5, prefill mode, exact freeze = delivery-10min via the slots/add.tsx deep-link hook). Env pass-through unchanged. Note: orchestrator-slots-resume.yaml now duplicates this file (mentioned to user; kept). Not run.
[2026-10-06T16:30+05:30] Product-selection hardening (keyboard + scrollInto + no centerElement):
1. add-slot.yaml — after tapOn slot-products-selector: hideKeyboard + waitForAnimationToEnd inserted (ProductsSelector sheet has an autoFocus search input so the keyboard is nearly always open on the sheet; un-covers options AND the Done button). For each PRODUCT_1..5 block: scrollUntilVisible (element same inline-slug option id, direction DOWN, speed 100, visibilityPercentage 60, NO centerElement) + waitForAnimationToEnd inserted before the tapOn. NOTE comment refreshed: OLD "no scrollUntilVisible inside the dialog (swipe dismisses)" superseded by user instruction to scrollInto each option; new comment records the search-field/keyboard rationale.
2. add-tag.yaml — same treatment in the products section: hideKeyboard + waitForAnimationToEnd after tapOn tag-products-selector; scrollUntilVisible (DOWN/speed 100/vis 60/no centerElement) + wait before each PRODUCT_1..5 option tapOn. Stores sheet left as direct taps (its BottomDropdown has no search field, no keyboard). NOTE comment refreshed.
3. centerElement: true removed everywhere in admin-ui flow files: create-product.yaml (19), add-tag.yaml (3), add-store.yaml (1) — the flag caused the earlier endless re-center nudge loop; scrollUntilVisible defaults centerElement false. No env/orchestrator changes; matchers unchanged. Not run.
Addendum [2026-10-06T16:45+05:30]: add-tag.yaml insertion required a re-do — first insertion used a wrong dash column and reversed PRODUCT pairing; blocks were stripped and re-inserted paired to their own tap (verified scroll ids == tap ids, ordered PRODUCT_1..PRODUCT_5). add-tag/add-slot both parse (js-yaml). centerElement removal verified: 17 (create-product) + 3 (add-tag) + 1 (add-store) = 21 physical occurrences removed (the remaining rg hits were comments); none left.
[2026-10-06T17:05+05:30] Keyboard dismissal fix after hideKeyboard failed on-device ("Couldn't hide the keyboard... custom input"): both occurrences replaced with a tap on the sheet's static, non-interactive title text.
OLD (add-slot.yaml + add-tag.yaml, right after tapOn *_products-selector):
- hideKeyboard
NEW:
- tapOn:
text: Select Products
Rationale: the BottomDialog title renders label "Select Products" as a static Text; tapping it is outside the focused search input so iOS resigns the keyboard. Full-string (case-insensitive) text match does not collide with the trigger placeholders ("Select products for this slot" / "Search and select products..."). waitForAnimationToEnd retained after the tap.
[2026-10-06T17:20+05:30] In-sheet scrolling subflow neo-tests/e2e/admin-ui/subflows/scroll-inside-sheet.yaml (new): swipe-by-coordinates confined to the sheet's own list area, called before each option tap in add-slot.yaml + add-tag.yaml (products) replacing screen-level scrollUntilVisible which scrolled the page BEHIND the bottom sheet (BackdrowDialog ScrollView is inside the Animated.View; Maestro swipe without a FROM selector targets the screen -> Rubber band/underlying screen moved instead of options).
Subflow args: OPTION_ID (inline-slug matcher with .* guards), SETTLE_MS (default 400).
Steps: scrollTo top? No - evalScript no-op retained for symmetry; repeat x loop: swipe start "50%, 80%" end "50%, 30%" duration 450 (inside the sheet body: sheet covers bottom 85% of screen; 80%->30% stays within sheet + avoids header/search row at top), then waitForAnimationToEnd, then optional: nothing (caller re-checks via tapOn which waits).
No centerElement anywhere. Callers pass OPTION_ID per PRODUCT_N; after swipe loop the option is tapped by the existing tapOn id.
Addendum [2026-10-06T17:30+05:30]: root cause of "wrong place" scrolling — add-slot.yaml's scroll blocks referenced a BARE product matcher ('${PRODUCT_n...}.*') WITHOUT the 'slot-products-selector-option-.' prefix, so scrollUntilVisible hunted a nonexistent id (endless scrolling). Final state: add-slot.yaml + add-tag.yaml product option scrolls replaced by runFlow subflows/scroll-inside-sheet.yaml with OPTION_ID = the same full matcher each tap uses (5 calls each; verified add-slot scroll==tap pairing structure, both files + subflow parse). The two remaining scrollUntilVisible uses in add-slot (slot-products-selector trigger, create-slot-button) are page-level and intended.
[2026-10-06T17:45+05:30] neo-tests/e2e/admin-ui/test-scroll-inside-sheet.yaml (new): manual sanity script for subflows/scroll-inside-sheet.yaml. Assumes the Add Slot screen is up (sheet closed): scrolls the slot-products-selector trigger into view, opens it, taps the static title 'Select Products' to blur the autofocused search field, then runFlow scroll-inside-sheet with OPTION_ID (default 'slot-products-selector-option-.*heritage-chicken-500-g.*', overridable), taps the option id and closes via slot-products-selector-done. No asserts; user runs manually: maestro test neo-tests/e2e/admin-ui/test-scroll-inside-sheet.yaml [-e OPTION_ID=...]. Not run.
[2026-10-06T18:00+05:30] In-sheet scroll take 2 — anchor the drag to an element instead of raw screen percentages (user retest: coordinate band 50%,80%->50%,30% still scrolled the underlying page, not the sheet list):
1. subflows/scroll-inside-sheet.yaml rewritten: swipe now uses swipe.from (element-anchored):
OLD: swipe: {start: 50%, 80%, end: 50%, 30%, duration: 450}
NEW: swipe: {from: {id: ${ANCHOR_ID}, index: 0}, direction: UP, duration: 450} — the drag starts ON the first visible option row of the sheet list (guaranteed inside the BottomDialog ScrollView; drag-up reveals lower rows) and repeated up to MAX_SWIPES times while the target option stays invisible.
NEW env: ANCHOR_ID (required from callers; option-row prefix with .* suffix), MAX_SWIPES/SETTLE_MS unchanged; no tap inside (caller taps).
2. add-slot.yaml / add-tag.yaml: each scroll-inside-sheet call now also passes ANCHOR_ID (slot: 'slot-products-selector-option-.*', tag: 'tag-products-selector-option-.*'); test-scroll-inside-sheet.yaml passes the slot anchor too. Not run.
[2026-10-06T18:25+05:30] Search-then-select replaces in-sheet scrolling in product pickers:
1. add-slot.yaml + add-tag.yaml products sections: each PRODUCT_n when-block's runFlow(subflows/scroll-inside-sheet.yaml + ANCHOR_ID/OPTION_ID env) REMOVED and replaced with search-then-select at the same block: tapOn id '<testID>-search' -> eraseText -> inputText ${PRODUCT_n} -> waitForAnimationToEnd -> existing tapOn of the option id. The client-side filter of ProductsSelector narrows the list to the matching row instantly (no scroll needed); option ids are untouched by filtering.
2. NOTE comments updated (keyboard now stays OPEN and is used for typing; Done clears the search afterwards in BottomDialog so earlier queries cannot leak into later product steps).
3. test-scroll-inside-sheet.yaml rewritten to the same search-then-select sequence. subflows/scroll-inside-sheet.yaml kept on disk but no caller references it.
Not run.
Addendum [2026-10-06T18:40+05:30]: stale orphan '- runFlow:' dashes from the block replacement removed (5 per file); add-slot NOTE comment rewritten to the search-then-select design.
Addendum2 [2026-10-06T18:50+05:30]: test-scroll-inside-sheet.yaml DELETED and replaced by test-search-select.yaml (search-then-select sanity run: assumes Add Slot screen, opens sheet, types PRODUCT_NAME into slot-products-selector-search, taps the filtered option id, Done). PRODUCT_NAME default "Heritage Chicken 500 g". subflows/scroll-inside-sheet.yaml kept but unreferenced. Not run.
[2026-10-06T19:00+05:30] WIP (pending apply): BottomDialog keyboard fix — iOS-only manual Keyboard-driven padding replacing the flaky KeyboardAvoidingView inside the RN Modal (packages/ui/src/components/dialog.tsx). Diff summary:
import Keyboard from react-native (Platform already imported)
OLD BottomDialog: <KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'} style={styles.keyboardAvoidingContainer} keyboardVerticalOffset={0}><ScrollView ...>{children}</ScrollView></KeyboardAvoidingView>
NEW: const [kbInset, setKbInset] = useState(0) + useEffect (iOS only) adding keyboardWillShow/keyboardWillHide listeners setting/zeroing kbInset (+ cleanup remove). Layout: <Animated.View style={[styles.dialog, {transform:[{translateY: slideAnim}]}]}> keeps dialog bottom-anchored with inline paddingBottom: Platform.OS==='ios' ? kbInset : 0 so the sheet's content height shrinks above the keyboard; inner wrapper becomes plain <View style={styles.keyboardAvoidingContainer}>.
[2026-10-06T19:30+05:30] Search-then-select hardening (orchestrator-slots feedback: "only searching, not selecting" + "clearing misses some chars at the end"):
1. add-slot.yaml + add-tag.yaml product blocks: bare - eraseText replaced with - eraseText: 60 (iOS drops backspace events when text clears mid-stream; bare eraseText under-erases long queries -> next product's query is polluted "…500 gHeritage…" -> option never appears). A waitForAnimationToEnd is now executed BETWEEN tapOn search-id and eraseText so the focus lands before backspaces stream.
2. test-search-select.yaml: same eraseText: 60 + settle.
Not run yet; will live-verify on sim 5A64695E via MCP.
[2026-10-06T19:40+05:30] BottomDialog keyboard fix completion (live MCP debugging on sim 5A64695E confirmed root cause): packages/ui/src/components/dialog.tsx bottom-dialog style maxHeight: SCREEN_HEIGHT*0.85 REMOVED (with comment). The 85% cap (762pt) clipped the manual kbInset paddingBottom -> with the iOS keyboard open (346pt) the card lifted only ~200pt and Done (y 614-647) still sat under the keyboard (starts y 595). Card height is bounded by the option list ScrollView anyway. Fresh bundle was verified (option ids carry the slug suffix), baseline keyboard-closed layout was correct (Done y 807-840).
[2026-10-06T19:50+05:30] Clear-text fix (reproduced live: eraseText: 60 left the trailing 'g' of "Heritage Chicken 500 g" in the search field — iOS drops backspace events near field-empty). BottomDialog keyboard fix VERIFIED live: card bottom lands exactly at the keyboard top (y550), Done + filtered option rows fully visible. Clearing now: after tapOn <testID>-search + settle, tap the field's native 'Clear text' button ONLY when it is visible (clearButtonMode while-editing), then a small bounded eraseText: 20 as backstop (handles an already-empty field / renderer without the clear button).
add-slot.yaml / add-tag.yaml / test-search-select.yaml: '- eraseText: 60' -> gated Clear-text tap + '- eraseText: 20'.
Addendum [2026-10-06T19:55+05:30]: an intermediate additive patch of add-tag.yaml mis-nested the 4 deeper product blocks (substring-indent trap); repaired - all 5 product blocks now carry the gated Clear-text tap + eraseText: 20 at consistent indent; file parses.
Addendum2 [2026-10-06T20:00+05:30]: test-search-select.yaml was missed by the eraseText: 60 patch (log overstated); now aligned with the flows: tap search -> settle -> gated 'Clear text' tap -> eraseText: 20 -> inputText.
[2026-10-06T20:25+05:30] BottomDropdown option-tap fix (keyboard open -> row taps swallowed): packages/ui/src/components/bottom-dropdown.tsx option-list ScrollView
OLD: <ScrollView style={tw`max-h-80`}> ...
NEW: <ScrollView style={tw`max-h-80`} keyboardShouldPersistTaps="handled">
iOS defaults keyboardShouldPersistTaps to 'never': with the search keyboard open, the first tap on an option row is consumed to dismiss the keyboard and the row's TouchableOpacity never fires -> "searching works, selection doesn't" (matched the live symptom everywhere a sheet + search are combined: slot/tag products selectors). The outer BottomDialog ScrollView and form screens already set 'handled'.
Addendum [2026-10-06T20:55+05:30] VERIFIED LIVE end-to-end on sim 5A64695E after a hard app relaunch (launchApp refetches the metro bundle): search-then-select now fully works with the keyboard open — sheet lifted above the keyboard, query filtered to one row, row tapped -> light-blue selected bg + checkmark, Done reachable. Turns out the previous no-selection was a STALE BUNDLE: the keyboardShouldPersistTaps="handled" edit was in the repo but the app never hot-reloaded it; the deep-link prefill hook was also confirmed used (delivery time rendered the passed instant 2:30 AM). Flow files already carry search+gated-clear+select, no further flow edits needed.
[2026-10-06T21:00+05:30] Temp/debugging files removed per user request (orchestrator-slots ran successfully):
DELETED: neo-tests/e2e/admin-ui/orchestrator-slots-resume.yaml (exact duplicate of orchestrator-slots.yaml, which now is the slots-resume entry), neo-tests/e2e/admin-ui/test-search-select.yaml (manual sanity script), neo-tests/e2e/admin-ui/subflows/scroll-inside-sheet.yaml (unreferenced; in-sheet scrolling superseded by search-then-select).
KEPT: orchestrator.yaml (full composition run: stores/products/combo/slots), orchestrator-slots.yaml (slots-resume entry, verified), form flows + subflows (login-admin, confirm-open, set-slot-time-ios).
[2026-10-06T21:10+05:30] orchestrator.yaml made re-run safe (no duplicate names): new env RUN_TAG defaulting to an inline timestamp (MMDD-HHMM, overridable via -e RUN_TAG=...). Every full run composes unique names at the call sites (base names unchanged in env):
- add-store STORE_NAME: 'Harvest Mart One/Two' + ' ' + RUN_TAG
- create-product PRODUCT_NAME: PRODUCT_A/B/COMBO_NAME + ' ' + RUN_TAG (SKU labels become '<name>-<RUN_TAG> <quantity>' via the app's <name> <qty> rule)
- COMBO_ITEM_0/1 and slot PRODUCT_n computed from the same composition so they reference THIS run's SKUs ('Heritage Chicken <RUN_TAG> 1 kg' etc.)
Header comment updated. Not run.
Addendum: COMBO_ITEM_0/1 expressions quoted in yaml (unquoted multi-space + '?' scalars broke the parser).
[2026-10-06T21:35+05:30] Keyboard-blocked-button fix (orchestrator run: store submit tap got eaten by the still-open keyboard from the name/description inputs; the assert "Store created successfully" failed even though every step incl. the tap "succeeded" — the a11y tree reports visibility but the iOS keyboard window eats the touch): per user directive "before clicking on any button, ensure it is visible":
1. add-store.yaml: after the description multiline input, tap the static heading 'Add New Store' (non-interactive text) to dismiss the keyboard; assertVisible added immediately BEFORE the owner dropdown tap AND before the store-submit-button tap.
2. create-product.yaml: after the SHORT-DESCRIPTION and LONG-DESCRIPTION multiline blocks, tap the static 'Product Name' topLabel to dismiss the keyboard (single-line fields already rely on pressKey: Enter); assertVisible added before product-store-dropdown, product-type-dropdown and create-product-button taps.
3. add-tag.yaml: after the TAG_DESCRIPTION multiline block, tap the static 'Tag Name' topLabel; assertVisible before tag-dashboard-checkbox, tag-stores-dropdown, tag-products-selector and tag-submit-button taps.
4. add-slot.yaml: assertVisible before slot-products-selector, slot-products-selector-done and create-slot-button taps (no screen text inputs; the products sheet keyboard auto-closes with Done, sheet rises above keyboard by the live-verified dialog fix).
Not run.
Addendum: add-slot.yaml asserts added before slot-products-selector / -done / create-slot-button; add-tag.yaml asserts added before tag-dashboard-checkbox / tag-stores-dropdown / tag-products-selector / tag-submit-button (first patch attempt aborted before writing due to an indent assert; rewritten indentation-aware). All four flow files parse.
[2026-10-06T21:20+05:30] Domain data wipe on LOCAL D1 (freshyo-backend-dev, --local) via scripts/clear-domain-data.sql (new): deleted vendor_snippets, delivery_slot_info, reserved_coupons, coupon chains (applicable products/users, usage, coupons), refunds/payments/order items/order status/complaints/user incidents/orders, special_deals, product_reviews, cart_items, groupings, product_tags/product_tag_info, sku features/combos/market stats/product_skus/product_info, store_info, upload_url_status. Verified post-wipe: stores/products/skus/slots/tags/coupons/orders = 0; regions (2), staff (5), users (1298) and KV/consts/aims untouched. Strict-unique-tag constraint irrelevant.
[2026-10-06T22:00+05:30] Focus-guaranteed typing (orchestrator run: submit failed "Product created successfully!" — debug artifacts show variant-3's price/market/offer all set but variant-2-attr-0-value EMPTY: the tap right after 'Add Variant' re-render used a stale frame -> no focus -> inputText went nowhere). New subflows/tap-and-focus.yaml: tapOn FIELD_ID -> waitForAnimationToEnd -> runFlow(notVisible id+focused=true -> re-tap + wait) -> assertVisible {id, focused:true} (fails loudly if focus never acquired). create-product.yaml: ALL input taps (product-name-input, short/long descriptions, variant-0..2-attr-0-value/price/market-price) switched to tap-and-focus (each removes the bare tapOn + its following wait). add-store.yaml + add-tag.yaml: name/description input taps switched too. Not run.
Addendum [2026-10-06T22:10+05:30]: add-tag.yaml had LOST its tag-name-input tap in an earlier iteration (restore: re-added extendedWaitUntil guard + tap-and-focus FIELD_ID tag-name-input); add-store/name-input & description + create-product's 12 taps + tag description... verified all replaced taps exist; all files parse.
[2026-10-06T20:15+05:30] P1+P2 addresses screen (apps/user-ui/app/(drawer)/(tabs)/me/addresses/index.tsx):
- P1: handleAddressSubmit/handleSetDefault/handleDeleteAddress used bare refetch() which races the close; switch to utils.user.address.getUserAddresses.invalidate() (+ getDefaultAddress.invalidate() where relevant), awaited before closing the sheet.
- P2: default-address change now drives region: handleSetDefault includes regionId in the update payload and calls setSelectedAddressId(id) on success so AddressRegionWatcher reconciles/switches region. Address type gains regionId.
- AddressForm submit error banner gains testID="address-submit-error".
[2026-10-06T20:25+05:30] P5 hardening (apps/user-ui/src/contexts/RegionContext.tsx): when restoring persisted active_region, resolve regionName/boundName from getRegions by id instead of trusting the stored strings, so a stale/renamed DB row can never render a phantom name ("Jadcherla" class). Unknown ids still reset to null.
[2026-10-06T20:35+05:30] P6 foreground re-resolution (apps/user-ui/components/RegionGate.tsx):
- Added expo-location watchPositionAsync subscription (after foreground permission grant): on >100m sustained moves it re-calls resolveRegionForLocation via trpc utils.
- Resolves to a different served region -> routes through switchRegion (cart snapshot/reconcile/results dialog), not silent setRegion.
- Resolves unserved -> gate resets to the manual region picker (children unmount until a region is chosen).
- First watch fix only anchors the baseline (initial getCurrentPositionAsync already resolved it); jitter guarded by the distance threshold.
[2026-10-06T21:00+05:30] P3/P4 cache pipeline (backend):
- apps/backend/src/jobs/cache-creator.ts: fixed debounce-starvation (every schedule() pushed the 30s alarm out; bursts of admin writes deferred regen indefinitely). Now tracks FIRST_TRIGGER_KEY; alarm forces initializeAllStores when the first pending trigger is older than 5 min. Alarm body wrapped in try/catch with logging (was unhandled).
- apps/backend/src/trpc/apis/superadmin-apis/apis/const.ts: new superadminConst.regenerateCache mutation — runs createAllCacheFiles() directly and returns per-region versions for manual recovery/diagnostics.
- apps/backend/src/lib/cloud_cache.ts: success logs now include region + version + key for availability/slots regen (failures were console-only with no success trace).
[2026-10-06T21:00+05:30] P9 guard (apps/backend/src/trpc/apis/user-apis/apis/address.ts): createAddress/updateAddress now verify regionId exists via getRegionById (clean 'Region not found' error) so dead-region rows can't be stored again. Data repair of address 285 stays a manual ops step.
[2026-10-06T21:00+05:30] P8 (apps/user-ui/services/notif-service/notif-checker.tsx): added success logging on savePushToken; verified upsertNotifCred already updates regionId on token conflict. Sims can't produce push tokens, so tests 23/24 remain physical-device-only.
[2026-10-06T21:10+05:30] P3 root cause found + fixed (cache-creator.ts schedule()): the method wrote LAST_TRIGGER_KEY then unconditionally called storage.deleteAll() (a leftover merged /clear block), wiping its own trigger — so alarm() early-returned every time and initializeAllStores NEVER ran via the DO path. Removed the stray deleteAll; /clear stays available via fetch POST /clear.
[2026-10-06T21:20+05:30] P1 city/pin follow region (packages/shared/index.ts + AddressForm): added REGION_CITY_PIN lookup (Mahabubnagar 509001, Jadcherla 509301); AddressForm region dropdown now sets city/pincode from the selected region when a mapping exists (fallback keeps current values for test/unknown regions). Hardcoded Mahabubnagar/509001 remain only as initial defaults.
[2026-10-06T23:59+05:30] Fix Formik validation crash in admin-ui ProductForm (TypeError: Cannot read property 'trim' of undefined): variantSignature called a.featureValue.trim() unguarded, so any feature row with undefined/null value (edit-mode API data, freshly pushed attribute) threw inside the unique-variants Yup test. Now guards both featureName and featureValue with ?? '' (+ optional chaining on the element). Also defaults the attribute-value MyTextInput value to '' instead of possibly-undefined.
Files:
- apps/admin-ui/src/components/ProductForm.tsx: variantSignature null-guard; attr value input `attr.featureValue ?? ''`.