This commit is contained in:
shafi54 2026-10-07 00:27:11 +05:30
parent 5af1afd8ba
commit 8f1e40f8b2
28 changed files with 2247 additions and 42 deletions

105
MULTI_REGION_PROBLEMS.md Normal file
View file

@ -0,0 +1,105 @@
# Problems found — multi-region testing (2026-10-06, local dev)
Source: Maestro MCP runs (iOS sim `5A64695E`, Chromium) + tRPC API checks against
local backend `127.0.0.1:8787`. Test data: region 8 (`MCPTest-222329`),
products 157/158, tags 1–3, slot 1, user address 872. Full per-test report in
session notes; this file lists defects only.
## Open app defects
### P1 — Add Address silently drops the save (data-loss UX)
- Repro: Me → Addresses → + → fill Name/Phone/Line-1, Attach Current Location
(spoofed Jadcherla 16.76,78.14 → "Location Attached"), pick Jadcherla in the
region dropdown → Add Address. Sheet closes, no error — but `getUserAddresses`
still returns 1 address.
- Same payload via `user.address.createAddress` API succeeds (id 872, region 7),
so the app form never POSTs or swallows the error.
- Fix: surface backend errors; verify the payload mapping (city field still read
"Mahabubnagar"/pin "509001" while region=Jadcherla — check whether a
city/pin-vs-region validation rejects it server- or client-side without a toast).
### P2 — Changing default address to another region does not switch region
- Repro: set the Jadcherla address as default ("Success — Default address
updated") → Home still shows Mahabubnagar + MBNR data. No region switch, no
reconciliation notice.
- Product decision needed: should default-address drive the active region, or is
region strictly location/device-driven? Either way the silent no-op is wrong —
at minimum notify ("address saved; region unchanged").
### P3 — Availability cache goes stale; OOS persists after DB says in-stock
- DB `product_market_stats`: sku 160 in-stock @175 in region 6; slot 1 created
(region 6, skus 160+161). App still shows Out of Stock @₹100 after relaunch +
pull-to-refresh.
- Root cause: the app re-reads availability only when its version bumps, and
nothing in the tested writes bumped `availability_version_num`. Slot/product
writes go through fire-and-forget `scheduleStoreInitialization` (DO), which
never visibly ran locally.
- Impact: blocks all cart/checkout E2E (tests 16/17/19) — every item unreadable
as purchasable.
### P4 — Stale price display (same root cause as P3)
- Card shows ₹100/₹120 after backend price update to 175/200 (`admin.product.
updateProduct` verified via API). Products file is version-sticky the same way.
### P5 — Region name spelling: "Jadcherla" (app/region picker) vs "Jadcherla" (DB)
- `getRegions` returns `Jadcherla`; the app header, out-of-service cards, and the
address region picker render "Jadcherla". Maestro `tapOn: "Jadcherla"` fails —
only coordinate taps work. Confirm the intended spelling and fix one side.
### P6 — In-app location change alone does not re-resolve region
- Spoof MBNR→Jadcherla while the app is foregrounded: header stays Mahabubnagar.
Region re-resolves only on relaunch. If live re-resolution is intended, the
location listener is not firing/refreshing; if relaunch-only is intended,
document it (tests 14/15 depend on it).
### P7 — Region selector is sticky; spec expects scroll-out (test 20)
- After 2× swipe-up on Home, the region header + search remain visible.
Either the spec ("selector is scrolled out") is outdated or the sticky header
is a regression. Product call.
### P8 — No notif-creds endpoint fires on region change/detect (tests 23/24)
- No dedicated endpoint found in the user router; `notif_creds` table has a
`regionId` FK but nothing observed writing it on region switch or auto-detect.
Verify whether the mobile client is supposed to call something here or the
requirement is obsolete.
### P9 — Legacy default address points at dead region
- User 388's default address (id 285) has `regionId: 1`, but regions are now
6/7/8. Anything joining address→region for this user silently misses.
Data hygiene: re-point or null it.
## Test-harness notes (Maestro, not app bugs)
- Password `secureTextEntry` field: `inputText` never focuses it (no keyboard,
text goes nowhere). Working sequence: tap `user-login-password` by id →
`eraseText: 50` → `setClipboard` + `pasteText`. Note: `inputText` with `@`
keystroke-types an extra `y` (multilingual SIM keyboard `EN HI`); paste avoids it.
- Never tap a button with the keyboard up: the tap lands on the keyboard
(observed phantom `y` appended to the password when tapping Login).
- `inspect_screen` on the user app throws `RangeError: max depth 32` — used
screenshots + targeted `tapOn` instead.
- Out-of-service screen doubles as the region picker (lists all regions incl.
newly created ones) — useful fallback for region selection tests.
## Fixed during this session (for reference, not open)
- Store submit tap eaten by open keyboard → keyboard dismissal via static-text
tap + `assertVisible` before every button tap.
- BottomDialog sat under the iOS keyboard → manual `Keyboard`-driven inset;
the `maxHeight: 85%` cap choked the inset and was removed (verified live:
sheet bottom lands exactly at keyboard top).
- BottomDropdown option taps swallowed with keyboard open → added
`keyboardShouldPersistTaps="handled"` to the inner option-list ScrollView
(was only on the outer dialog scroll).
- Native iOS date picker: same-day picks never fire `onChange` (modal never
closes); freeze-picked-second crossed minute boundaries (`freeze > delivery`).
Now freeze-first + same-day force-change branch in `set-slot-time-ios.yaml`.
- Flow scoping: `output.*` from `evalScript` does not reach nested
`runFlow.when.commands` in subflows — all matchers compute slugs inline.
- `scrollUntilVisible` + `centerElement: true` re-nudges endlessly on visible
elements; screen-level scrolls move the page behind bottom sheets (superseded
by search-then-select in product pickers).
- BottomDropdown option ids now embed a label slug
(`<testID>-option-<value>-<slug>`); flow matchers anchor with `.*`.
- Exact slot times need the `slots/add.tsx` `dts`/`fts` deep-link prefill hook
(native picker is calendar-only).

View file

@ -7,8 +7,22 @@ import { trpc } from '@/src/trpc-client';
export default function AddSlot() { export default function AddSlot() {
const router = useRouter(); const router = useRouter();
const { baseslot } = useLocalSearchParams(); const { baseslot, dts, fts } = useLocalSearchParams();
const baseSlotId = baseslot ? parseInt(baseslot as string) : null; const baseSlotId = baseslot ? parseInt(baseslot as string) : null;
// e2e hook: SlotForm accepts initial times but nothing passed them, so the
// screen always opened with null times and e2e had to fight the native
// picker (which cannot set time-of-day). Deep links can carry the exact
// delivery/freeze instants as ISO strings: ...?dts=<ISO>&fts=<ISO>.
// URL-encoding collapses colons in ISO strings to %3A, so normalize.
const parseInstant = (raw?: string | string[]): Date | null => {
const value = Array.isArray(raw) ? raw[0] : raw
if (!value) return null
const date = new Date(value.replace(/%3A/gi, ':'))
return isNaN(date.getTime()) ? null : date
}
const initialDeliveryTime = parseInstant(dts)
const initialFreezeTime = parseInstant(fts)
const { refetch } = trpc.admin.slots.getAll.useQuery(); const { refetch } = trpc.admin.slots.getAll.useQuery();
const { data: baseSlotData, isLoading } = trpc.admin.slots.getSlotById.useQuery( const { data: baseSlotData, isLoading } = trpc.admin.slots.getSlotById.useQuery(
@ -33,8 +47,10 @@ export default function AddSlot() {
return ( return (
<AppContainer> <AppContainer>
<SlotForm <SlotForm
onSlotAdded={handleSlotAdded} onSlotAdded={handleSlotAdded}
initialDeliveryTime={initialDeliveryTime}
initialFreezeTime={initialFreezeTime}
initialProductIds={baseSlotData?.slot?.products?.map((p: any) => p.id) || []} initialProductIds={baseSlotData?.slot?.products?.map((p: any) => p.id) || []}
initialGroupIds={baseSlotData?.slot?.groupIds || []} initialGroupIds={baseSlotData?.slot?.groupIds || []}
/> />

View file

@ -80,7 +80,7 @@ const defaultVariant = (): Variant => ({
const variantSignature = (attributes: Attribute[]): string => const variantSignature = (attributes: Attribute[]): string =>
attributes attributes
.map((a) => `${(a.featureName ?? '').trim().toLowerCase()}::${a.featureValue.trim().toLowerCase()}`) .map((a) => `${(a?.featureName ?? '').trim().toLowerCase()}::${(a?.featureValue ?? '').trim().toLowerCase()}`)
.sort() .sort()
.join('|') .join('|')
@ -572,7 +572,7 @@ const ProductForm = forwardRef<ProductFormRef, ProductFormProps>(({
<MyTextInput <MyTextInput
testID={`variant-${vIndex}-attr-${aIndex}-value`} testID={`variant-${vIndex}-attr-${aIndex}-value`}
placeholder={isQuantityFeature(attr) ? 'e.g. 0.5 kg' : 'Value'} placeholder={isQuantityFeature(attr) ? 'e.g. 0.5 kg' : 'Value'}
value={attr.featureValue} value={attr.featureValue ?? ''}
onChangeText={handleChange(`variants.${vIndex}.features.${aIndex}.featureValue`)} onChangeText={handleChange(`variants.${vIndex}.features.${aIndex}.featureValue`)}
/> />
</View> </View>

View file

@ -3,7 +3,12 @@ import { initializeAllStores } from '@/src/stores/store-initializer'
import { ensureWorkerInit } from '@/src/lib/worker-init' import { ensureWorkerInit } from '@/src/lib/worker-init'
const LAST_TRIGGER_KEY = 'lastTrigger' const LAST_TRIGGER_KEY = 'lastTrigger'
const FIRST_TRIGGER_KEY = 'firstTrigger'
const ALARM_DELAY_MINUTES = 0.5 const ALARM_DELAY_MINUTES = 0.5
// Upper bound on debounce deferral: bursts of admin writes must not push
// regeneration out forever. The alarm forces a run when the oldest pending
// trigger is older than this.
const MAX_DEFER_MINUTES = 5
// const ALARM_DELAY_MINUTES = 0.1 // const ALARM_DELAY_MINUTES = 0.1
export class CacheCreator { export class CacheCreator {
@ -18,19 +23,14 @@ export class CacheCreator {
async schedule(): Promise<void> { async schedule(): Promise<void> {
console.log( 'from the fetch method of durable object') console.log( 'from the fetch method of durable object')
// if (request.method === 'POST' && url.pathname === '/schedule') {
const now = Date.now() const now = Date.now()
await this.state.storage.put(LAST_TRIGGER_KEY, now) await this.state.storage.put(LAST_TRIGGER_KEY, now)
const first = await this.state.storage.get(FIRST_TRIGGER_KEY)
if (!first) {
await this.state.storage.put(FIRST_TRIGGER_KEY, now)
}
const alarmAt = dayjs(now).add(ALARM_DELAY_MINUTES, 'minute').valueOf() const alarmAt = dayjs(now).add(ALARM_DELAY_MINUTES, 'minute').valueOf()
await this.state.storage.setAlarm(alarmAt) await this.state.storage.setAlarm(alarmAt)
// return new Response('OK')
// }
// if (request.method === 'POST' && url.pathname === '/clear') {
await this.state.storage.deleteAll()
// return new Response('OK')
// }
// return new Response('CacheCreator ready', { status: 200 })
} }
@ -39,6 +39,10 @@ export class CacheCreator {
if (request.method === 'POST' && url.pathname === '/schedule') { if (request.method === 'POST' && url.pathname === '/schedule') {
const now = Date.now() const now = Date.now()
await this.state.storage.put(LAST_TRIGGER_KEY, now) await this.state.storage.put(LAST_TRIGGER_KEY, now)
const first = await this.state.storage.get(FIRST_TRIGGER_KEY)
if (!first) {
await this.state.storage.put(FIRST_TRIGGER_KEY, now)
}
const alarmAt = dayjs(now).add(ALARM_DELAY_MINUTES, 'minute').valueOf() const alarmAt = dayjs(now).add(ALARM_DELAY_MINUTES, 'minute').valueOf()
await this.state.storage.setAlarm(alarmAt) await this.state.storage.setAlarm(alarmAt)
return new Response('OK') return new Response('OK')
@ -60,10 +64,20 @@ export class CacheCreator {
} }
const threshold = dayjs().subtract(ALARM_DELAY_MINUTES, 'minute') const threshold = dayjs().subtract(ALARM_DELAY_MINUTES, 'minute')
const isQualify = dayjs(lastTrigger).isBefore(threshold); const firstTrigger = await this.state.storage.get(FIRST_TRIGGER_KEY)
console.log({isQualify, threshold, curr: dayjs(lastTrigger)}) const forcedByMaxDefer = firstTrigger != null &&
dayjs(firstTrigger).isBefore(dayjs().subtract(MAX_DEFER_MINUTES, 'minute'))
const isQualify = dayjs(lastTrigger).isBefore(threshold) || forcedByMaxDefer;
console.log({isQualify, forcedByMaxDefer, threshold, curr: dayjs(lastTrigger)})
if (isQualify) { if (isQualify) {
await initializeAllStores() await this.state.storage.delete(FIRST_TRIGGER_KEY)
await this.state.storage.delete(LAST_TRIGGER_KEY)
try {
await initializeAllStores()
console.log('CacheCreator alarm: store initialization completed')
} catch (error) {
console.error('CacheCreator alarm: store initialization failed:', error)
}
} }
} }
} }

View file

@ -167,6 +167,7 @@ export async function createAvailabilityCacheFile(refresh = true, regionId?: num
'application/json', 'application/json',
filePath filePath
) )
console.log(`Availability cache regenerated: region ${regionId}, av-${version}, ${availabilityData.count} rows`)
if (refresh) await refreshGenKv(regionId) if (refresh) await refreshGenKv(regionId)
@ -217,6 +218,7 @@ export async function createSlotsCacheFile(refresh = true, regionId?: number): P
'application/json', 'application/json',
filePath filePath
) )
console.log(`Slots cache regenerated: region ${regionId}, v-${version}`)
if (refresh) await refreshGenKv(regionId) if (refresh) await refreshGenKv(regionId)

View file

@ -5,6 +5,7 @@ import { computeConstants } from '@/src/lib/const-store'
import { refreshGenKv } from '@/src/lib/gen-store' import { refreshGenKv } from '@/src/lib/gen-store'
import { CONST_KEYS, REGION_CONST_KEYS_ARRAY } from '@/src/lib/const-keys' import { CONST_KEYS, REGION_CONST_KEYS_ARRAY } from '@/src/lib/const-keys'
import { scheduleStoreInitialization } from '@/src/stores/store-initializer' import { scheduleStoreInitialization } from '@/src/stores/store-initializer'
import { createAllCacheFiles } from '@/src/lib/cloud_cache'
import { import {
getAllConstants as getAllConstantsFromDb, getAllConstants as getAllConstantsFromDb,
upsertConstants as upsertConstantsInDb, upsertConstants as upsertConstantsInDb,
@ -106,4 +107,17 @@ export const superadminConstRouter = router({
keys: constants.map(c => c.key), keys: constants.map(c => c.key),
}; };
}), }),
regenerateCache: superadminProcedure
.mutation(async () => {
// Manual recovery/diagnostics: run the full cache regen inline
// (same work the CacheCreator DO alarm does) and report versions.
const result = await createAllCacheFiles()
return {
success: true,
cacheVersion: result.cacheVersion,
slotsVersion: result.slotsVersion,
availabilityVersion: result.availabilityVersion,
}
}),
}); });

View file

@ -10,6 +10,7 @@ import {
updateUserAddress as updateUserAddressInDb, updateUserAddress as updateUserAddressInDb,
deleteUserAddress as deleteUserAddressInDb, deleteUserAddress as deleteUserAddressInDb,
hasOngoingOrdersForAddress as hasOngoingOrdersForAddressInDb, hasOngoingOrdersForAddress as hasOngoingOrdersForAddressInDb,
getRegionById as getRegionByIdInDb,
} from '@/src/dbService' } from '@/src/dbService'
import type { import type {
UserAddressResponse, UserAddressResponse,
@ -69,6 +70,11 @@ export const addressRouter = router({
throw new Error('Missing required fields'); throw new Error('Missing required fields');
} }
// Reject dead/unknown regions instead of storing them silently.
if (regionId != null && !(await getRegionByIdInDb(regionId))) {
throw new Error('Region not found');
}
// If setting as default, unset other defaults // If setting as default, unset other defaults
if (isDefault) { if (isDefault) {
await clearDefaultAddressInDb(userId) await clearDefaultAddressInDb(userId)
@ -129,6 +135,11 @@ export const addressRouter = router({
throw new Error('Address not found') throw new Error('Address not found')
} }
// Reject dead/unknown regions instead of storing them silently.
if (regionId != null && !(await getRegionByIdInDb(regionId))) {
throw new Error('Region not found')
}
// If setting as default, unset other defaults // If setting as default, unset other defaults
if (isDefault) { if (isDefault) {
await clearDefaultAddressInDb(userId) await clearDefaultAddressInDb(userId)

View file

@ -6,6 +6,7 @@ import { AppContainer, MyText, tw, useMarkDataFetchers, MyFlatList, MyTouchableO
import { trpc } from '@/src/trpc-client'; import { trpc } from '@/src/trpc-client';
import MaterialIcons from '@expo/vector-icons/MaterialIcons'; import MaterialIcons from '@expo/vector-icons/MaterialIcons';
import AddressForm from '@/src/components/AddressForm'; import AddressForm from '@/src/components/AddressForm';
import { useAddressStore } from '@/src/store/addressStore';
// Address view — required core of the shared UserAddress + optional geo fields // Address view — required core of the shared UserAddress + optional geo fields
type Address = Pick< type Address = Pick<
@ -15,6 +16,7 @@ type Address = Pick<
latitude?: number | null latitude?: number | null
longitude?: number | null longitude?: number | null
googleMapsUrl?: string | null googleMapsUrl?: string | null
regionId?: number | null
} }
function AddressCard({ address, onEdit, onDelete, onSetDefault, isDeleting }: { function AddressCard({ address, onEdit, onDelete, onSetDefault, isDeleting }: {
@ -95,6 +97,7 @@ export default function Addresses() {
const updateAddressMutation = trpc.user.address.updateAddress.useMutation(); const updateAddressMutation = trpc.user.address.updateAddress.useMutation();
const deleteAddressMutation = trpc.user.address.deleteAddress.useMutation(); const deleteAddressMutation = trpc.user.address.deleteAddress.useMutation();
const utils = trpc.useUtils(); const utils = trpc.useUtils();
const setSelectedAddressId = useAddressStore((s) => s.setSelectedAddressId);
const handleAddAddress = () => { const handleAddAddress = () => {
setEditingAddress(null); setEditingAddress(null);
@ -118,9 +121,9 @@ export default function Addresses() {
onPress: () => { onPress: () => {
deleteAddressMutation.mutate({ id }, { deleteAddressMutation.mutate({ id }, {
onSuccess: () => { onSuccess: () => {
refetch(); void utils.user.address.getUserAddresses.invalidate();
// The quick-delivery selector observes getDefaultAddress. // The quick-delivery selector observes getDefaultAddress.
utils.user.address.getDefaultAddress.invalidate(); void utils.user.address.getDefaultAddress.invalidate();
Alert.alert('Success', 'Address deleted successfully'); Alert.alert('Success', 'Address deleted successfully');
}, },
onError: (error) => { onError: (error) => {
@ -147,10 +150,14 @@ export default function Addresses() {
state: addressToUpdate.state, state: addressToUpdate.state,
pincode: addressToUpdate.pincode, pincode: addressToUpdate.pincode,
isDefault: true, isDefault: true,
...(addressToUpdate.regionId != null ? { regionId: addressToUpdate.regionId } : {}),
}, { }, {
onSuccess: () => { onSuccess: () => {
refetch(); void utils.user.address.getUserAddresses.invalidate();
utils.user.address.getDefaultAddress.invalidate(); void utils.user.address.getDefaultAddress.invalidate();
// Drive the active region off the new default: AddressRegionWatcher
// reconciles the cart and switches region when it differs.
setSelectedAddressId(id);
Alert.alert('Success', 'Default address updated'); Alert.alert('Success', 'Default address updated');
}, },
onError: (error) => { onError: (error) => {
@ -161,9 +168,12 @@ export default function Addresses() {
}; };
const handleAddressSubmit = () => { const handleAddressSubmit = () => {
// Invalidate (not bare refetch) so the closed sheet reopens onto the
// fresh list including the just-written address.
void utils.user.address.getUserAddresses.invalidate();
void utils.user.address.getDefaultAddress.invalidate();
setModalVisible(false); setModalVisible(false);
setEditingAddress(null); setEditingAddress(null);
refetch();
}; };
if (isLoading) { if (isLoading) {

View file

@ -6,11 +6,32 @@ import { MyText, MyTouchableOpacity, tw } from 'common-ui';
import type { ReactParentComponent } from '@packages/shared'; import type { ReactParentComponent } from '@packages/shared';
import { trpc } from '../src/trpc-client'; import { trpc } from '../src/trpc-client';
import { useRegion } from '../src/contexts/RegionContext'; import { useRegion } from '../src/contexts/RegionContext';
import { useRegionSwitchContext } from '../src/hooks/useRegionSwitch';
type GateReason = 'denied' | 'servicesOff' | 'unserved' | 'error'; type GateReason = 'denied' | 'servicesOff' | 'unserved' | 'error';
// Minimum sustained movement before a foreground fix re-resolves the region.
// Guards against GPS jitter flapping the region/cart reconciliation.
const RE_RESOLVE_MIN_MOVE_M = 100;
const distanceM = (
a: { lat: number; lng: number },
b: { lat: number; lng: number }
): number => {
const rad = Math.PI / 180;
const dLat = (b.lat - a.lat) * rad;
const dLng = (b.lng - a.lng) * rad;
const s =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(a.lat * rad) * Math.cos(b.lat * rad) *
Math.sin(dLng / 2) * Math.sin(dLng / 2);
return 2 * 6371000 * Math.asin(Math.sqrt(s));
};
const RegionGate: React.FC<ReactParentComponent> = ({ children }) => { const RegionGate: React.FC<ReactParentComponent> = ({ children }) => {
const { regionId, regionName, isLoading: regionLoading, setRegion } = useRegion(); const { regionId, regionName, isLoading: regionLoading, setRegion } = useRegion();
const { switchRegion } = useRegionSwitchContext();
const utils = trpc.useUtils();
const [coords, setCoords] = useState<{ lat: number; lng: number } | null>(null); const [coords, setCoords] = useState<{ lat: number; lng: number } | null>(null);
const [denied, setDenied] = useState(false); const [denied, setDenied] = useState(false);
const [servicesOff, setServicesOff] = useState(false); const [servicesOff, setServicesOff] = useState(false);
@ -28,6 +49,12 @@ const RegionGate: React.FC<ReactParentComponent> = ({ children }) => {
// True while the user is in OS Settings (via the primary action): the // True while the user is in OS Settings (via the primary action): the
// return re-check must bypass the flapping cooldown below. // return re-check must bypass the flapping cooldown below.
const expectReturnRef = useRef(false); const expectReturnRef = useRef(false);
// Baseline for foreground re-resolution (P6): anchored to the first watch
// fix; later fixes only act after sustained movement. Mirrors of values
// the watch callback needs without resubscribing.
const lastFixRef = useRef<{ lat: number; lng: number } | null>(null);
const regionIdRef = useRef<number | null>(null);
regionIdRef.current = regionId;
const runDetection = async () => { const runDetection = async () => {
if (passedRef.current) return; if (passedRef.current) return;
@ -86,6 +113,56 @@ const RegionGate: React.FC<ReactParentComponent> = ({ children }) => {
return () => sub.remove(); return () => sub.remove();
}, []); }, []);
// Foreground re-resolution: a spoofed or real move while foregrounded must
// re-resolve the region (previously only relaunch/background did). A
// different served region goes through switchRegion so carts reconcile; an
// unserved fix drops back to the manual picker.
useEffect(() => {
let subscription: Location.LocationSubscription | null = null;
let cancelled = false;
void (async () => {
const perms = await Location.getForegroundPermissionsAsync();
if (cancelled || perms.status !== 'granted') return;
subscription = await Location.watchPositionAsync(
{
accuracy: Location.Accuracy.Balanced,
timeInterval: 8000,
distanceInterval: 50,
},
(position) => {
const fix = { lat: position.coords.latitude, lng: position.coords.longitude };
const baseline = lastFixRef.current;
if (!baseline) {
lastFixRef.current = fix;
return;
}
if (distanceM(baseline, fix) < RE_RESOLVE_MIN_MOVE_M) return;
lastFixRef.current = fix;
void utils.common.resolveRegionForLocation.fetch(fix).then((resolved) => {
if (resolved?.regionId != null) {
if (resolved.regionId !== regionIdRef.current) {
void switchRegion(resolved.regionId, resolved.regionName ?? '');
}
} else if (regionIdRef.current != null) {
// Moved out of every served polygon: reset the gate so the
// user picks a region instead of serving a ghost one.
passedRef.current = false;
setPicked(false);
setCoords(fix);
}
}).catch((error) => {
console.error('Foreground region re-resolution failed:', error);
});
}
);
})();
return () => {
cancelled = true;
subscription?.remove();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const resolveQuery = trpc.common.resolveRegionForLocation.useQuery( const resolveQuery = trpc.common.resolveRegionForLocation.useQuery(
{ lat: coords?.lat ?? 0, lng: coords?.lng ?? 0 }, { lat: coords?.lat ?? 0, lng: coords?.lng ?? 0 },
{ enabled: !!coords, retry: false, refetchOnWindowFocus: false, staleTime: Infinity } { enabled: !!coords, retry: false, refetchOnWindowFocus: false, staleTime: Infinity }

View file

@ -25,6 +25,9 @@ function NotifChecker(props: Props) {
savePushTokenMutation.mutate( savePushTokenMutation.mutate(
{ token: expoPushToken, ...(regionId != null ? { regionId } : {}) }, { token: expoPushToken, ...(regionId != null ? { regionId } : {}) },
{ {
onSuccess: () => {
console.log('Push token saved for region:', regionId ?? '(none)');
},
onError: (error) => { onError: (error) => {
console.error('Failed to save push token:', error); console.error('Failed to save push token:', error);
}, },

View file

@ -4,6 +4,7 @@ import { useMutation } from '@tanstack/react-query';
import { Formik } from 'formik'; import { Formik } from 'formik';
import * as Yup from 'yup'; import * as Yup from 'yup';
import { tw, MyText, MyTouchableOpacity , Checkbox , MyTextInput , LoadingDialog, BottomDropdown } from 'common-ui'; import { tw, MyText, MyTouchableOpacity , Checkbox , MyTextInput , LoadingDialog, BottomDropdown } from 'common-ui';
import { REGION_CITY_PIN } from '@packages/shared';
import { trpc } from '../trpc-client'; import { trpc } from '../trpc-client';
import { useRegion } from '../contexts/RegionContext'; import { useRegion } from '../contexts/RegionContext';
import LocationAttacher from './LocationAttacher'; import LocationAttacher from './LocationAttacher';
@ -86,7 +87,7 @@ const AddressForm: React.FC<AddressFormProps> = ({ onSuccess, initialValues, isE
{/* Submit Error Message */} {/* Submit Error Message */}
{submitError && ( {submitError && (
<View style={tw`bg-red-50 border border-red-200 rounded-lg p-3 mb-4`}> <View testID="address-submit-error" style={tw`bg-red-50 border border-red-200 rounded-lg p-3 mb-4`}>
<MyText style={tw`text-red-600 text-sm`}>{submitError}</MyText> <MyText style={tw`text-red-600 text-sm`}>{submitError}</MyText>
</View> </View>
)} )}
@ -250,7 +251,15 @@ const AddressForm: React.FC<AddressFormProps> = ({ onSuccess, initialValues, isE
placeholder="Select region" placeholder="Select region"
options={regionOptions} options={regionOptions}
value={(values as { regionId?: string | number }).regionId ?? ''} value={(values as { regionId?: string | number }).regionId ?? ''}
onValueChange={(value) => setFieldValue('regionId', Number(value))} onValueChange={(value) => {
setFieldValue('regionId', Number(value));
const label = regionOptions.find((o) => o.value === value)?.label;
const mapping = label != null ? REGION_CITY_PIN[label] : undefined;
if (mapping) {
setFieldValue('city', mapping.city);
setFieldValue('pincode', mapping.pincode);
}
}}
/> />
{(touched as { regionId?: string }).regionId && (errors as { regionId?: string }).regionId && ( {(touched as { regionId?: string }).regionId && (errors as { regionId?: string }).regionId && (
<MyText style={tw`text-red-500 mb-2`}>{(errors as { regionId?: string }).regionId}</MyText> <MyText style={tw`text-red-500 mb-2`}>{(errors as { regionId?: string }).regionId}</MyText>

View file

@ -71,9 +71,19 @@ export const RegionProvider: React.FC<ReactParentComponent> = ({ children }) =>
useEffect(() => { useEffect(() => {
if (!stored.loaded || regionsData === undefined) return; if (!stored.loaded || regionsData === undefined) return;
const valid = stored.value != null && regionsData.regions.some((r) => r.id === stored.value!.regionId); const match = stored.value != null
if (valid && stored.value != null) { ? regionsData.regions.find((r) => r.id === stored.value!.regionId)
setState({ ...stored.value, isLoading: false }); : undefined;
if (match && stored.value != null) {
// Resolve names from the server list by id: the persisted strings may
// be stale after a region rename, and must never render verbatim.
setState({
regionId: stored.value.regionId,
regionName: match.name ?? stored.value.regionName,
boundId: stored.value.boundId,
boundName: stored.value.boundName,
isLoading: false,
});
} else { } else {
if (stored.value != null) { if (stored.value != null) {
void StorageServiceCasual.removeItem(ACTIVE_REGION_KEY); void StorageServiceCasual.removeItem(ACTIVE_REGION_KEY);

View file

@ -757,3 +757,282 @@ neo-tests/e2e/mbnr-region-create.yaml:
[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: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: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 ?? ''`.

View file

@ -27,4 +27,3 @@
25. In a single region, have multiple bounds with different min delivery threshold, spoof locations to 25. In a single region, have multiple bounds with different min delivery threshold, spoof locations to
2 different bounds and ensure the changes reflect. 2 different bounds and ensure the changes reflect.
26. change consts of regions and bounds and expect the changes to land in the clouflare kv. use dev toml file 26. change consts of regions and bounds and expect the changes to land in the clouflare kv. use dev toml file
27. create / update

View file

@ -0,0 +1,234 @@
# add-slot: fill and submit the Add Slot form (apps/admin-ui).
# Form-only: begins on the Add Slot screen - the orchestrator's job is to land
# there (launch/login/deep-link). Two time modes:
# - SLOT_PREFILL=true: the landing deep-link carried dts/fts ISO instant
# params (slots/add.tsx parses them into SlotForm initial times); both
# native-picker interactions are SKIPPED (exact delivery/freeze achieved,
# e.g. freeze = delivery - 10 min).
# - otherwise (native-only): freeze picker runs FIRST, then delivery; both
# take the sim-clock time-of-day; committing delivery last guarantees
# freeze < delivery.
# Up to
# 5 products (PRODUCT_1..PRODUCT_5, dropdown option names) are selected in the
# slot-products-selector; groups are skipped for now.
#
# NOTE: each option is found via SEARCH-then-select: the sheet's autofocused
# search field is typed with the product name (keyboard stays OPEN and is
# used), ProductsSelector filters its list client-side on the fly, and the
# filtered option row is then tapped by its id. No scrolling inside the sheet:
# every scrolling attempt (screen-level scrollUntilVisible, coordinate swipes)
# ended up moving the page behind the sheet instead of the option rows.
# BottomDialog clears the search when it closes, so queries don't leak
# between products.
#
# Known native-picker limitation: exact time-of-day is not settable (see
# subflows/set-slot-time-ios.yaml header). SLOT_*_TIME is accepted but unused.
# Run from the admin-ui folder or via runFlow from an orchestrator flow.
appId: in.freshyo.adminui
env:
SLOT_DELIVERY_DATE: ${SLOT_DELIVERY_DATE || ""}
SLOT_DELIVERY_TIME: ${SLOT_DELIVERY_TIME || ""}
SLOT_FREEZE_DATE: ${SLOT_FREEZE_DATE || ""}
SLOT_FREEZE_TIME: ${SLOT_FREEZE_TIME || ""}
SLOT_PREFILL: ${SLOT_PREFILL || ""}
PRODUCT_1: ${PRODUCT_1 || ""}
PRODUCT_2: ${PRODUCT_2 || ""}
PRODUCT_3: ${PRODUCT_3 || ""}
PRODUCT_4: ${PRODUCT_4 || ""}
PRODUCT_5: ${PRODUCT_5 || ""}
---
# Fail fast: all four required SLOT_* values must be provided.
- assertTrue:
condition: ${SLOT_DELIVERY_DATE != "" && SLOT_DELIVERY_TIME != "" && SLOT_FREEZE_DATE != "" && SLOT_FREEZE_TIME != ""}
label: "add-slot: SLOT_DELIVERY_DATE, SLOT_DELIVERY_TIME, SLOT_FREEZE_DATE and SLOT_FREEZE_TIME are required (e.g. -e SLOT_DELIVERY_DATE=2026-10-08 -e SLOT_DELIVERY_TIME=20:00)."
# Option ids are slot-products-selector-option-<skuId>-<slug(label)>; slug =
# lowercased label with every non-alnum run collapsed to '-'. The slug is
# computed inline in each matcher: evalScript-assigned output.* vars do NOT
# reach nested runFlow.when.commands when this flow runs as a subflow.
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
# ---- times ----
# With SLOT_PREFILL=true the landing deep-link already pre-filled both
# instants (slots/add.tsx e2e hook) - skip all picker interaction.
- runFlow:
when:
true: ${SLOT_PREFILL.trim().toLowerCase() != "true"}
commands:
# Native-only mode: freeze commits FIRST, then delivery (commit-order
# trick; delivery lands later on the sim clock => freeze < delivery).
- runFlow:
file: subflows/set-slot-time-ios.yaml
env:
DATE_PICKER_ID: freeze-date-picker
PICK_DATE: ${SLOT_FREEZE_DATE}
- runFlow:
file: subflows/set-slot-time-ios.yaml
env:
DATE_PICKER_ID: delivery-date-picker
PICK_DATE: ${SLOT_DELIVERY_DATE}
# ---- products (up to 5; groups skipped) ----
- scrollUntilVisible:
element:
id: slot-products-selector
direction: DOWN
speed: 100
- waitForAnimationToEnd
- assertVisible:
id: slot-products-selector
- tapOn:
id: slot-products-selector
- waitForAnimationToEnd
# the sheet's search field autofocused - put the keyboard away
# hideKeyboard is unreliable on iOS here - tap the sheet's static title
# (non-interactive text) instead, which blurs the focused search field
- tapOn:
text: Select Products
- waitForAnimationToEnd
- runFlow:
when:
true: ${PRODUCT_1 != ""}
commands:
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: slot-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_1}
- waitForAnimationToEnd
- tapOn:
id: 'slot-products-selector-option-.*${PRODUCT_1.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
- runFlow:
when:
true: ${PRODUCT_2 != ""}
commands:
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: slot-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_2}
- waitForAnimationToEnd
- tapOn:
id: 'slot-products-selector-option-.*${PRODUCT_2.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
- runFlow:
when:
true: ${PRODUCT_3 != ""}
commands:
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: slot-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_3}
- waitForAnimationToEnd
- tapOn:
id: 'slot-products-selector-option-.*${PRODUCT_3.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
- runFlow:
when:
true: ${PRODUCT_4 != ""}
commands:
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: slot-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_4}
- waitForAnimationToEnd
- tapOn:
id: 'slot-products-selector-option-.*${PRODUCT_4.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
- runFlow:
when:
true: ${PRODUCT_5 != ""}
commands:
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: slot-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_5}
- waitForAnimationToEnd
- tapOn:
id: 'slot-products-selector-option-.*${PRODUCT_5.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
- assertVisible:
id: slot-products-selector-done
- tapOn:
id: slot-products-selector-done
- waitForAnimationToEnd
# centerElement dropped on purpose: with the button already visible it
# re-nudges the scroll endlessly trying to center it.
- scrollUntilVisible:
element:
id: create-slot-button
direction: DOWN
speed: 100
visibilityPercentage: 100
- waitForAnimationToEnd
- assertVisible:
id: create-slot-button
- tapOn:
id: create-slot-button
- assertVisible: 'Slot created successfully!'
- tapOn: 'OK'

View file

@ -0,0 +1,83 @@
# add-store: fill and submit the Add Store form (apps/admin-ui).
# Form-only: begins on the Add Store screen - it is the orchestrator's job to
# land there (launch/login/openLink freshyoadmin://dashboard/stores/add).
# Text-only: no store image, no product selection (both optional in the form).
# Args: STORE_NAME, STORE_DESCRIPTION, OWNER_NAME.
# Run from the admin-ui folder or via runFlow from an orchestrator flow.
appId: in.freshyo.adminui
env:
STORE_NAME: ${STORE_NAME || ""}
STORE_DESCRIPTION: ${STORE_DESCRIPTION || ""}
OWNER_NAME: ${OWNER_NAME || ""}
---
- extendedWaitUntil:
visible:
id: store-name-input
timeout: 30000
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: store-name-input
- eraseText
- inputText: ${STORE_NAME}
- pressKey: Enter
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: store-description-input
- eraseText
- inputText: ${STORE_DESCRIPTION}
- pressKey: Enter
# multiline field: Enter does NOT dismiss the keyboard - tap a static,
# non-interactive heading instead so the keyboard cannot eat later taps
- tapOn:
text: 'Add New Store'
- waitForAnimationToEnd
- assertVisible:
id: store-owner-dropdown
- scrollUntilVisible:
element:
id: store-owner-dropdown
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- assertVisible:
id: store-owner-dropdown
- tapOn:
id: store-owner-dropdown
- waitForAnimationToEnd
# Select by id: BottomDropdown option testIDs embed the label slug
# (store-owner-dropdown-option-<staffId>-<name>).
- scrollUntilVisible:
element:
id: 'store-owner-dropdown-option-.*${OWNER_NAME.toLowerCase().split(" ").join("-")}.*'
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: 'store-owner-dropdown-option-.*${OWNER_NAME.toLowerCase().split(" ").join("-")}.*'
- extendedWaitUntil:
notVisible:
id: 'store-owner-dropdown-option-.*${OWNER_NAME.toLowerCase().split(" ").join("-")}.*'
timeout: 10000
- waitForAnimationToEnd
# centerElement dropped on purpose: with the button already visible it
# re-nudges the scroll endlessly trying to center it.
- scrollUntilVisible:
element:
id: store-submit-button
direction: DOWN
speed: 100
visibilityPercentage: 100
- waitForAnimationToEnd
- waitForAnimationToEnd
- assertVisible:
id: store-submit-button
- tapOn:
id: store-submit-button
- assertVisible: 'Store created successfully'
- tapOn: OK

View file

@ -0,0 +1,232 @@
# add-tag: fill and submit the Add Tag form (apps/admin-ui).
# Form-only: begins on the Add Tag screen - it is the orchestrator's job to
# land there (launch/login/openLink freshyoadmin://dashboard/product-tags/add).
# Text-only: tag image is optional and skipped.
# Args: TAG_NAME (required), TAG_DESCRIPTION, TAG_DASHBOARD ("true"/""),
# STORE_1..3 (related store names, contiguous),
# PRODUCT_1..5 (SKU label substrings, contiguous).
# Matcher slug = lowercased value with every non-alnum run collapsed to '-',
# computed inline (matches the BottomDropdown option-id slug).
# NOTE: the product sheet opens with an autoFocus search input, so the
# keyboard is (nearly) always up - hideKeyboard first so options and the Done
- extendedWaitUntil:
visible:
id: tag-name-input
timeout: 30000
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: tag-name-input
- eraseText
- inputText: ${TAG_NAME}
- pressKey: Enter
# ---- description (optional) ----
- runFlow:
when:
true: ${TAG_DESCRIPTION != ""}
commands:
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: tag-description-input
- eraseText
- inputText: ${TAG_DESCRIPTION}
- pressKey: Enter
# multiline field: Enter does NOT dismiss the keyboard - tap a static,
# non-interactive topLabel so later taps are not eaten
- tapOn:
text: 'Tag Name'
- waitForAnimationToEnd
# ---- dashboard tag checkbox (optional) ----
- runFlow:
when:
true: ${TAG_DASHBOARD.trim().toLowerCase() == "true"}
commands:
- assertVisible:
id: tag-dashboard-checkbox
- tapOn:
id: tag-dashboard-checkbox
# ---- related stores (multi-select bottom sheet) ----
- runFlow:
when:
true: ${STORE_1 != ""}
commands:
- assertVisible:
id: tag-stores-dropdown
- tapOn:
id: tag-stores-dropdown
- waitForAnimationToEnd
# store 1
- tapOn:
id: 'tag-stores-dropdown-option-.*${STORE_1.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
# store 2
- runFlow:
when:
true: ${STORE_2 != ""}
commands:
- tapOn:
id: 'tag-stores-dropdown-option-.*${STORE_2.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
# store 3
- runFlow:
when:
true: ${STORE_3 != ""}
commands:
- tapOn:
id: 'tag-stores-dropdown-option-.*${STORE_3.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
- tapOn:
id: tag-stores-dropdown-done
- waitForAnimationToEnd
# ---- products (multi-select bottom sheet) ----
- runFlow:
when:
true: ${PRODUCT_1 != ""}
commands:
- assertVisible:
id: tag-products-selector
- tapOn:
id: tag-products-selector
- waitForAnimationToEnd
# the sheet's search field autofocused - put the keyboard away
# hideKeyboard is unreliable on iOS here - tap the sheet's static title
# (non-interactive text) instead, which blurs the focused search field
- tapOn:
text: Select Products
- waitForAnimationToEnd
# product 1
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: tag-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_1}
- waitForAnimationToEnd
- tapOn:
id: 'tag-products-selector-option-.*${PRODUCT_1.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
# product 2
- runFlow:
when:
true: ${PRODUCT_2 != ""}
commands:
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: tag-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_2}
- waitForAnimationToEnd
- tapOn:
id: 'tag-products-selector-option-.*${PRODUCT_2.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
# product 3
- runFlow:
when:
true: ${PRODUCT_3 != ""}
commands:
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: tag-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_3}
- waitForAnimationToEnd
- tapOn:
id: 'tag-products-selector-option-.*${PRODUCT_3.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
# product 4
- runFlow:
when:
true: ${PRODUCT_4 != ""}
commands:
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: tag-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_4}
- waitForAnimationToEnd
- tapOn:
id: 'tag-products-selector-option-.*${PRODUCT_4.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
# product 5
- runFlow:
when:
true: ${PRODUCT_5 != ""}
commands:
# search-then-select: typing filters the list client-side,
# so no scrolling inside the sheet is needed
- tapOn:
id: tag-products-selector-search
- waitForAnimationToEnd
- runFlow:
when:
visible:
text: 'Clear text'
commands:
- tapOn:
text: 'Clear text'
- waitForAnimationToEnd
- eraseText: 20
- inputText: ${PRODUCT_5}
- waitForAnimationToEnd
- tapOn:
id: 'tag-products-selector-option-.*${PRODUCT_5.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- waitForAnimationToEnd
- tapOn:
id: tag-products-selector-done
- waitForAnimationToEnd
# centerElement dropped on purpose: with the button already visible it
# re-nudges the scroll endlessly trying to center it.
- waitForAnimationToEnd
- assertVisible:
id: tag-submit-button
- tapOn:
id: tag-submit-button
- assertVisible: 'Tag created successfully'
- tapOn: 'OK'

View file

@ -0,0 +1,459 @@
# create-product: fill and submit the Add Product form (apps/admin-ui).
# Form-only: begins on the Add Product page - it is the orchestrator's job to
# land there (launch/login/navigate). Text-only (no image upload), product
# create does not need them.
# Args: PRODUCT_NAME, STORE_NAME, PRODUCT_TYPE,
# SHORT_DESCRIPTION, LONG_DESCRIPTION,
# QUANTITY_1, PRICE_1, MARKET_PRICE_1,
# QUANTITY_2, PRICE_2, MARKET_PRICE_2,
# QUANTITY_3, PRICE_3, MARKET_PRICE_3,
# COMBO_ITEM_0, COMBO_ITEM_1, COMBO_ITEM_2.
# Descriptions are optional and gated per field. Variants are optional and must
# be supplied in order (3 requires 2 requires 1, all three fields each). The
# 3rd variant is always created as an Offer SKU.
# Combo: PRODUCT_TYPE=combo adds "Included Items" rows to variant 1. Each
# COMBO_ITEM_n is a SKU-label substring (case-insensitive, spaces become '-')
# matched against the option ids (variant-0-combo-sku-n-option-<skuId>-<slug>).
# Every pushed combo row must get a selection (placeholder skuId 0 fails the
# backend zod positive-int check), so COMBO_ITEM_0 is required for combos.
# Combo items after slot 0 only fill if the previous slots were filled.
# Run from the admin-ui folder or via runFlow from an orchestrator flow.
appId: in.freshyo.adminui
env:
PRODUCT_NAME: ${PRODUCT_NAME || ""}
STORE_NAME: ${STORE_NAME || ""}
PRODUCT_TYPE: ${PRODUCT_TYPE || "item"}
SHORT_DESCRIPTION: ${SHORT_DESCRIPTION || ""}
LONG_DESCRIPTION: ${LONG_DESCRIPTION || ""}
QUANTITY_1: ${QUANTITY_1 || ""}
PRICE_1: ${PRICE_1 || ""}
MARKET_PRICE_1: ${MARKET_PRICE_1 || ""}
QUANTITY_2: ${QUANTITY_2 || ""}
PRICE_2: ${PRICE_2 || ""}
MARKET_PRICE_2: ${MARKET_PRICE_2 || ""}
QUANTITY_3: ${QUANTITY_3 || ""}
PRICE_3: ${PRICE_3 || ""}
MARKET_PRICE_3: ${MARKET_PRICE_3 || ""}
COMBO_ITEM_0: ${COMBO_ITEM_0 || ""}
COMBO_ITEM_1: ${COMBO_ITEM_1 || ""}
COMBO_ITEM_2: ${COMBO_ITEM_2 || ""}
---
# Fail fast: variant levels must be contiguous (3 -> 2 -> 1), each fully specified.
- evalScript: ${output.hasV1 = (QUANTITY_1 != "" && PRICE_1 != "" && MARKET_PRICE_1 != "")}
- evalScript: ${output.hasV2 = (QUANTITY_2 != "" && PRICE_2 != "" && MARKET_PRICE_2 != "")}
- evalScript: ${output.hasV3 = (QUANTITY_3 != "" && PRICE_3 != "" && MARKET_PRICE_3 != "")}
- assertTrue:
condition: ${(!output.hasV2 || output.hasV1) && (!output.hasV3 || output.hasV2)}
label: "create-product: variants must be specified in order - *_3 requires *_2 and *_1, and *_2 requires *_1. Pass all three fields (QUANTITY_n/PRICE_n/MARKET_PRICE_n) for each variant."
# Fail fast: a combo with no item would submit a skuId 0 placeholder row.
- assertTrue:
condition: ${PRODUCT_TYPE.toLowerCase() !== "combo" || COMBO_ITEM_0 != ""}
label: "create-product: PRODUCT_TYPE=combo requires COMBO_ITEM_0 (a SKU label substring to include)"
# Combo items must also be contiguous.
- assertTrue:
condition: ${(COMBO_ITEM_2 != "" && COMBO_ITEM_1 != "" && COMBO_ITEM_0 != "") || (COMBO_ITEM_1 != "" && COMBO_ITEM_0 != "") || COMBO_ITEM_0 != "" || (COMBO_ITEM_1 == "" && COMBO_ITEM_2 == "") && COMBO_ITEM_0 == ""}
label: "create-product: combo items must be specified in order - COMBO_ITEM_2 requires COMBO_ITEM_1 and COMBO_ITEM_0."
- extendedWaitUntil:
visible:
id: product-name-input
timeout: 30000
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: product-name-input
- eraseText
- inputText: ${PRODUCT_NAME}
- pressKey: Enter
# Gated descriptions (independent per field).
- runFlow:
when:
true: ${SHORT_DESCRIPTION != ""}
commands:
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: product-short-description-input
- eraseText
- inputText: ${SHORT_DESCRIPTION}
- pressKey: Enter
# multiline field: Enter does NOT dismiss the keyboard - tap a
# static, non-interactive topLabel so later taps are not eaten
- tapOn:
text: 'Product Name'
- waitForAnimationToEnd
- runFlow:
when:
true: ${LONG_DESCRIPTION != ""}
commands:
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: product-long-description-input
- eraseText
- inputText: ${LONG_DESCRIPTION}
- pressKey: Enter
# multiline field: Enter does NOT dismiss the keyboard - tap a
# static, non-interactive topLabel so later taps are not eaten
- tapOn:
text: 'Product Name'
- waitForAnimationToEnd
- scrollUntilVisible:
element:
id: product-store-dropdown
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- assertVisible:
id: product-store-dropdown
- tapOn:
id: product-store-dropdown
- waitForAnimationToEnd
# Select by id: BottomDropdown option testIDs embed the label slug
# (product-store-dropdown-option-<storeId>-<store-name>).
- scrollUntilVisible:
element:
id: 'product-store-dropdown-option-.*${STORE_NAME.toLowerCase().split(" ").join("-")}.*'
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: 'product-store-dropdown-option-.*${STORE_NAME.toLowerCase().split(" ").join("-")}.*'
- extendedWaitUntil:
notVisible:
id: 'product-store-dropdown-option-.*${STORE_NAME.toLowerCase().split(" ").join("-")}.*'
timeout: 10000
- waitForAnimationToEnd
- scrollUntilVisible:
element:
id: product-type-dropdown
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- assertVisible:
id: product-type-dropdown
- tapOn:
id: product-type-dropdown
- waitForAnimationToEnd
# Value + label slug make ids like product-type-dropdown-option-item-item;
# match with .* on both sides (id matching is full-string regex).
- scrollUntilVisible:
element:
id: 'product-type-dropdown-option-.*${PRODUCT_TYPE}.*'
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: 'product-type-dropdown-option-.*${PRODUCT_TYPE}.*'
- extendedWaitUntil:
notVisible:
id: 'product-type-dropdown-option-.*${PRODUCT_TYPE}.*'
timeout: 10000
- waitForAnimationToEnd
# ---- variant 1 (base) ----
- scrollUntilVisible:
element:
id: variant-0-attr-0-value
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: variant-0-attr-0-value
- eraseText
- inputText: ${QUANTITY_1}
- pressKey: Enter
- scrollUntilVisible:
element:
id: variant-0-price
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: variant-0-price
- eraseText
- inputText: ${PRICE_1}
- pressKey: Enter
- scrollUntilVisible:
element:
id: variant-0-market-price
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: variant-0-market-price
- eraseText
- inputText: ${MARKET_PRICE_1}
- pressKey: Enter
# ---- combo items (PRODUCT_TYPE=combo only; rows live under variant 1) ----
# Each combo-add tap appends one row; each row's dropdown must be given a real
# SKU (placeholder skuId 0 fails the backend). Option ids are
# variant-0-combo-sku-<k>-option-<skuId>-<slug(label)>; slug = lowercased label
# with every non-alnum run collapsed to '-', so match with .* on both sides.
- runFlow:
when:
true: ${PRODUCT_TYPE.toLowerCase() === "combo"}
commands:
- scrollUntilVisible:
element:
id: variant-0-combo-add
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: variant-0-combo-add
- waitForAnimationToEnd
# slot 0 (COMBO_ITEM_0 is required for combos - assertTrue above)
- tapOn:
id: variant-0-combo-sku-0
- waitForAnimationToEnd
- scrollUntilVisible:
element:
id: 'variant-0-combo-sku-0-option-.*${COMBO_ITEM_0.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: 'variant-0-combo-sku-0-option-.*${COMBO_ITEM_0.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- extendedWaitUntil:
notVisible:
id: 'variant-0-combo-sku-0-option-.*${COMBO_ITEM_0.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
timeout: 10000
- waitForAnimationToEnd
# slot 1
- runFlow:
when:
true: ${COMBO_ITEM_1 != ""}
commands:
- scrollUntilVisible:
element:
id: variant-0-combo-add
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: variant-0-combo-add
- waitForAnimationToEnd
- tapOn:
id: variant-0-combo-sku-1
- waitForAnimationToEnd
- scrollUntilVisible:
element:
id: 'variant-0-combo-sku-1-option-.*${COMBO_ITEM_1.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: 'variant-0-combo-sku-1-option-.*${COMBO_ITEM_1.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- extendedWaitUntil:
notVisible:
id: 'variant-0-combo-sku-1-option-.*${COMBO_ITEM_1.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
timeout: 10000
- waitForAnimationToEnd
# slot 2
- runFlow:
when:
true: ${COMBO_ITEM_2 != ""}
commands:
- scrollUntilVisible:
element:
id: variant-0-combo-add
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: variant-0-combo-add
- waitForAnimationToEnd
- tapOn:
id: variant-0-combo-sku-2
- waitForAnimationToEnd
- scrollUntilVisible:
element:
id: 'variant-0-combo-sku-2-option-.*${COMBO_ITEM_2.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: 'variant-0-combo-sku-2-option-.*${COMBO_ITEM_2.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
- extendedWaitUntil:
notVisible:
id: 'variant-0-combo-sku-2-option-.*${COMBO_ITEM_2.toLowerCase().split(".").join("-").split(" ").join("-")}.*'
timeout: 10000
- waitForAnimationToEnd
# ---- variant 2 (optional) ----
- runFlow:
when:
true: ${output.hasV2}
commands:
- scrollUntilVisible:
element:
id: add-variant-button-footer
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: add-variant-button-footer
- waitForAnimationToEnd
- scrollUntilVisible:
element:
id: variant-1-attr-0-value
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: variant-1-attr-0-value
- eraseText
- inputText: ${QUANTITY_2}
- pressKey: Enter
- scrollUntilVisible:
element:
id: variant-1-price
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: variant-1-price
- eraseText
- inputText: ${PRICE_2}
- pressKey: Enter
- scrollUntilVisible:
element:
id: variant-1-market-price
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: variant-1-market-price
- eraseText
- inputText: ${MARKET_PRICE_2}
- pressKey: Enter
# ---- variant 3 (optional) -> Offer SKU ----
- runFlow:
when:
true: ${output.hasV3}
commands:
- scrollUntilVisible:
element:
id: add-variant-button-footer
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: add-variant-button-footer
- waitForAnimationToEnd
- scrollUntilVisible:
element:
id: variant-2-attr-0-value
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: variant-2-attr-0-value
- eraseText
- inputText: ${QUANTITY_3}
- pressKey: Enter
- scrollUntilVisible:
element:
id: variant-2-price
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: variant-2-price
- eraseText
- inputText: ${PRICE_3}
- pressKey: Enter
- scrollUntilVisible:
element:
id: variant-2-market-price
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
# focus-guaranteed tap (validates the field really got focus)
- runFlow:
file: subflows/tap-and-focus.yaml
env:
FIELD_ID: variant-2-market-price
- eraseText
- inputText: ${MARKET_PRICE_3}
- pressKey: Enter
- scrollUntilVisible:
element:
id: variant-2-offer
direction: DOWN
speed: 100
visibilityPercentage: 60
- waitForAnimationToEnd
- tapOn:
id: variant-2-offer
# centerElement dropped on purpose: with the button already visible it
# re-nudges the scroll endlessly trying to center it.
- scrollUntilVisible:
element:
id: create-product-button
direction: DOWN
speed: 100
visibilityPercentage: 100
- waitForAnimationToEnd
- waitForAnimationToEnd
- assertVisible:
id: create-product-button
- tapOn:
id: create-product-button
- assertVisible: 'Product created successfully!'
- tapOn: OK

View file

@ -0,0 +1,128 @@
# orchestrator-slots: resume-from-slots run for apps/admin-ui.
# Skips stores/products/combo creation (assumed done by the full orchestrator
# up to the slot section - default names Heritage*/must match, or pass the
# same -e overrides used there). SLOT 1 is NOT re-created: it already exists
# in the data (both pickers committed at the same sim-clock minute) and is
# left as is. Runs slots 2..5, each with the standard pattern: deep-link to
# HOME (freshyoadmin://dashboard), confirm the iOS prompt, wait for the
# dashboard marker, then deep-link to Add Slot with dts/fts prefill params
# (exact times via the slots/add.tsx hook; freeze = delivery - exactly 10 min).
# Run: maestro test neo-tests/e2e/admin-ui/orchestrator-slots.yaml
# [-e PRODUCT_A_NAME=... -e A_Q1=... -e PRODUCT_B_NAME=... -e B_Q1=...
# -e COMBO_NAME=... -e COMBO_Q1=... -e STAFF_NAME=... ]
appId: in.freshyo.adminui
env:
STAFF_NAME: ${STAFF_NAME || "qusham"}
STAFF_PASSWORD: ${STAFF_PASSWORD || "qushaM123"}
PRODUCT_A_NAME: ${PRODUCT_A_NAME || "Heritage Chicken"}
A_Q1: ${A_Q1 || "500 g"}
A_Q2: ${A_Q2 || "1 kg"}
PRODUCT_B_NAME: ${PRODUCT_B_NAME || "Heritage Mutton"}
B_Q1: ${B_Q1 || "500 g"}
COMBO_NAME: ${COMBO_NAME || "Heritage Feast Combo"}
COMBO_Q1: ${COMBO_Q1 || "500 g"}
---
- launchApp
- extendedWaitUntil:
visible:
id: "login-name-input|add-product-menu-item"
timeout: 120000
- runFlow:
when:
visible:
id: login-name-input
commands:
- runFlow: subflows/login-admin.yaml
# ================== SLOT 2 (today, near-term, 2 SKUs) ====================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: 'freshyoadmin://dashboard/slots/add?dts=${(function(){return new Date(Date.now()+60*60000).toISOString().split(":").join("%3A")})()}&fts=${(function(){return new Date(Date.now()+60*60000-600000).toISOString().split(":").join("%3A")})()}'
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
- runFlow:
file: add-slot.yaml
env:
SLOT_DELIVERY_DATE: '${(function(){var d=new Date(Date.now()+60*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_DELIVERY_TIME: "n/a"
SLOT_FREEZE_DATE: '${(function(){var d=new Date(Date.now()+60*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_FREEZE_TIME: "n/a"
SLOT_PREFILL: "true"
PRODUCT_1: '${COMBO_NAME + " " + COMBO_Q1}'
PRODUCT_2: '${PRODUCT_A_NAME + " " + A_Q2}'
# ====================== SLOT FOR +2 HOURS LATER ==========================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: 'freshyoadmin://dashboard/slots/add?dts=${(function(){return new Date(Date.now()+120*60000).toISOString().split(":").join("%3A")})()}&fts=${(function(){return new Date(Date.now()+120*60000-600000).toISOString().split(":").join("%3A")})()}'
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
- runFlow:
file: add-slot.yaml
env:
SLOT_DELIVERY_DATE: '${(function(){var d=new Date(Date.now()+120*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_DELIVERY_TIME: "n/a"
SLOT_FREEZE_DATE: '${(function(){var d=new Date(Date.now()+120*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_FREEZE_TIME: "n/a"
SLOT_PREFILL: "true"
PRODUCT_1: '${PRODUCT_A_NAME + " " + A_Q1}'
# ====================== SLOT FOR +3 HOURS LATER ==========================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: 'freshyoadmin://dashboard/slots/add?dts=${(function(){return new Date(Date.now()+180*60000).toISOString().split(":").join("%3A")})()}&fts=${(function(){return new Date(Date.now()+180*60000-600000).toISOString().split(":").join("%3A")})()}'
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
- runFlow:
file: add-slot.yaml
env:
SLOT_DELIVERY_DATE: '${(function(){var d=new Date(Date.now()+180*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_DELIVERY_TIME: "n/a"
SLOT_FREEZE_DATE: '${(function(){var d=new Date(Date.now()+180*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_FREEZE_TIME: "n/a"
SLOT_PREFILL: "true"
PRODUCT_1: '${PRODUCT_A_NAME + " " + A_Q1}'
# ====================== SLOT FOR +4 HOURS LATER ==========================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: 'freshyoadmin://dashboard/slots/add?dts=${(function(){return new Date(Date.now()+240*60000).toISOString().split(":").join("%3A")})()}&fts=${(function(){return new Date(Date.now()+240*60000-600000).toISOString().split(":").join("%3A")})()}'
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
- runFlow:
file: add-slot.yaml
env:
SLOT_DELIVERY_DATE: '${(function(){var d=new Date(Date.now()+240*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_DELIVERY_TIME: "n/a"
SLOT_FREEZE_DATE: '${(function(){var d=new Date(Date.now()+240*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_FREEZE_TIME: "n/a"
SLOT_PREFILL: "true"
PRODUCT_1: '${PRODUCT_A_NAME + " " + A_Q1}'

View file

@ -0,0 +1,289 @@
# orchestrator: the full composition run for apps/admin-ui (fresh names).
# Sequence: login -> store 1 -> store 2 -> product A (3 variants, v3 = Offer)
# -> product B (2 variants) -> combo product (1 SKU from A + 1 from B)
# -> 2 near-term slots -> slots for +2h / +3h / +4h (delivery is DATE-only:
# today, or tomorrow when the offset crosses midnight).
# BEFORE EVERY sub-flow: deep-link to HOME (freshyoadmin://dashboard), confirm
# the iOS prompt, wait for the dashboard marker, then navigate to the target
# page (deep-link for stores/slots; the dashboard tile for products).
#
# NATIVE-ONLY TIME handling (no app hook): the native pickers only give us the
# DATE. Delivery time-of-day = simulator clock at pick; freeze = same calendar
# date as delivery (app invariant freeze <= delivery holds; exact "-10 min"
# time-of-day is not achievable natively). SLOT_*_TIME are therefore "n/a"
# placeholders: add-slot fail-fast requires all four, the flow ignores them.
#
# Run: maestro test neo-tests/e2e/admin-ui/orchestrator.yaml
# Everything below is overridable via -e (no name is reused from any earlier
# run; re-running the same names duplicates stores/products/slots).
appId: in.freshyo.adminui
env:
STAFF_NAME: ${STAFF_NAME || "qusham"}
STAFF_PASSWORD: ${STAFF_PASSWORD || "qushaM123"}
# unique suffix per run - every name below gets it, so re-runs never collide
RUN_TAG: ${(function(){var d=new Date();return ("0"+(d.getMonth()+1)).slice(-2)+("0"+d.getDate()).slice(-2)+"-"+("0"+d.getHours()).slice(-2)+("0"+d.getMinutes()).slice(-2)})()}
OWNER_NAME: ${OWNER_NAME || "qusham"}
STORE_1_NAME: ${STORE_1_NAME || "Harvest Mart One"}
STORE_2_NAME: ${STORE_2_NAME || "Harvest Mart Two"}
STORE_DESCRIPTION: ${STORE_DESCRIPTION || "Harvest Mart e2e store"}
PRODUCT_A_NAME: ${PRODUCT_A_NAME || "Heritage Chicken"}
PRODUCT_B_NAME: ${PRODUCT_B_NAME || "Heritage Mutton"}
COMBO_NAME: ${COMBO_NAME || "Heritage Feast Combo"}
A_Q1: ${A_Q1 || "500 g"}
A_Q2: ${A_Q2 || "1 kg"}
A_Q3: ${A_Q3 || "2 kg"}
B_Q1: ${B_Q1 || "500 g"}
B_Q2: ${B_Q2 || "1 kg"}
COMBO_Q1: ${COMBO_Q1 || "500 g"}
COMBO_ITEM_0: ${COMBO_ITEM_0 || "Heritage Chicken 1 kg"}
COMBO_ITEM_1: ${COMBO_ITEM_1 || "Heritage Mutton 500 g"}
---
- launchApp
- extendedWaitUntil:
visible:
id: "login-name-input|add-product-menu-item"
timeout: 120000
- runFlow:
when:
visible:
id: login-name-input
commands:
- runFlow: subflows/login-admin.yaml
# ================================ STORE 1 ================================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: freshyoadmin://dashboard/stores/add
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: store-name-input
timeout: 30000
- runFlow:
file: add-store.yaml
env:
STORE_NAME: ${STORE_1_NAME + " " + RUN_TAG}
STORE_DESCRIPTION: ${STORE_DESCRIPTION}
OWNER_NAME: ${OWNER_NAME}
# ================================ STORE 2 ================================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: freshyoadmin://dashboard/stores/add
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: store-name-input
timeout: 30000
- runFlow:
file: add-store.yaml
env:
STORE_NAME: ${STORE_2_NAME + " " + RUN_TAG}
STORE_DESCRIPTION: ${STORE_DESCRIPTION}
OWNER_NAME: ${OWNER_NAME}
# ============ PRODUCT A: 3 variants, variant 3 = Offer SKU ===============
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- tapOn:
id: add-product-menu-item
- extendedWaitUntil:
visible:
id: product-name-input
timeout: 30000
- runFlow:
file: create-product.yaml
env:
PRODUCT_NAME: ${PRODUCT_A_NAME + " " + RUN_TAG}
STORE_NAME: ${STORE_1_NAME + " " + RUN_TAG}
PRODUCT_TYPE: item
QUANTITY_1: ${A_Q1}
PRICE_1: "120"
MARKET_PRICE_1: "150"
QUANTITY_2: ${A_Q2}
PRICE_2: "220"
MARKET_PRICE_2: "260"
QUANTITY_3: ${A_Q3}
PRICE_3: "300"
MARKET_PRICE_3: "350"
# ==================== PRODUCT B: 2 variants, no offer ====================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- tapOn:
id: add-product-menu-item
- extendedWaitUntil:
visible:
id: product-name-input
timeout: 30000
- runFlow:
file: create-product.yaml
env:
PRODUCT_NAME: ${PRODUCT_B_NAME + " " + RUN_TAG}
STORE_NAME: ${STORE_2_NAME + " " + RUN_TAG}
PRODUCT_TYPE: item
QUANTITY_1: ${B_Q1}
PRICE_1: "140"
MARKET_PRICE_1: "170"
QUANTITY_2: ${B_Q2}
PRICE_2: "240"
MARKET_PRICE_2: "280"
# ================= COMBO: 1 SKU from A + 1 SKU from B ====================
# SKU labels are "<name> <quantity>" (produced by the earlier creates).
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- tapOn:
id: add-product-menu-item
- extendedWaitUntil:
visible:
id: product-name-input
timeout: 30000
- runFlow:
file: create-product.yaml
env:
PRODUCT_NAME: ${COMBO_NAME + " " + RUN_TAG}
STORE_NAME: ${STORE_1_NAME + " " + RUN_TAG}
PRODUCT_TYPE: combo
QUANTITY_1: ${COMBO_Q1}
PRICE_1: "180"
MARKET_PRICE_1: "220"
COMBO_ITEM_0: '${COMBO_ITEM_0 != "" ? COMBO_ITEM_0 : PRODUCT_A_NAME + " " + RUN_TAG + " " + A_Q2}'
COMBO_ITEM_1: '${COMBO_ITEM_1 != "" ? COMBO_ITEM_1 : PRODUCT_B_NAME + " " + RUN_TAG + " " + B_Q1}'
# ================== SLOT 1 (today, near-term, 2 SKUs) ====================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: 'freshyoadmin://dashboard/slots/add?dts=${(function(){return new Date(Date.now()+30*60000).toISOString().split(":").join("%3A")})()}&fts=${(function(){return new Date(Date.now()+30*60000-600000).toISOString().split(":").join("%3A")})()}'
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
- runFlow:
file: add-slot.yaml
env:
SLOT_DELIVERY_DATE: '${(function(){var d=new Date(Date.now()+30*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_DELIVERY_TIME: "n/a"
SLOT_FREEZE_DATE: '${(function(){var d=new Date(Date.now()+30*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_FREEZE_TIME: "n/a"
SLOT_PREFILL: "true"
PRODUCT_1: '${PRODUCT_A_NAME + " " + RUN_TAG + " " + A_Q1}'
PRODUCT_2: '${PRODUCT_B_NAME + " " + RUN_TAG + " " + B_Q1}'
# ================== SLOT 2 (today, near-term, 2 SKUs) ====================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: 'freshyoadmin://dashboard/slots/add?dts=${(function(){return new Date(Date.now()+60*60000).toISOString().split(":").join("%3A")})()}&fts=${(function(){return new Date(Date.now()+60*60000-600000).toISOString().split(":").join("%3A")})()}'
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
- runFlow:
file: add-slot.yaml
env:
SLOT_DELIVERY_DATE: '${(function(){var d=new Date(Date.now()+60*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_DELIVERY_TIME: "n/a"
SLOT_FREEZE_DATE: '${(function(){var d=new Date(Date.now()+60*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_FREEZE_TIME: "n/a"
SLOT_PREFILL: "true"
PRODUCT_1: '${COMBO_NAME + " " + RUN_TAG + " " + COMBO_Q1}'
PRODUCT_2: '${PRODUCT_A_NAME + " " + RUN_TAG + " " + A_Q2}'
# ====================== SLOT FOR +2 HOURS LATER ==========================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: 'freshyoadmin://dashboard/slots/add?dts=${(function(){return new Date(Date.now()+120*60000).toISOString().split(":").join("%3A")})()}&fts=${(function(){return new Date(Date.now()+120*60000-600000).toISOString().split(":").join("%3A")})()}'
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
- runFlow:
file: add-slot.yaml
env:
SLOT_DELIVERY_DATE: '${(function(){var d=new Date(Date.now()+120*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_DELIVERY_TIME: "n/a"
SLOT_FREEZE_DATE: '${(function(){var d=new Date(Date.now()+120*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_FREEZE_TIME: "n/a"
SLOT_PREFILL: "true"
PRODUCT_1: '${PRODUCT_A_NAME + " " + RUN_TAG + " " + A_Q1}'
# ====================== SLOT FOR +3 HOURS LATER ==========================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: 'freshyoadmin://dashboard/slots/add?dts=${(function(){return new Date(Date.now()+180*60000).toISOString().split(":").join("%3A")})()}&fts=${(function(){return new Date(Date.now()+180*60000-600000).toISOString().split(":").join("%3A")})()}'
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
- runFlow:
file: add-slot.yaml
env:
SLOT_DELIVERY_DATE: '${(function(){var d=new Date(Date.now()+180*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_DELIVERY_TIME: "n/a"
SLOT_FREEZE_DATE: '${(function(){var d=new Date(Date.now()+180*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_FREEZE_TIME: "n/a"
SLOT_PREFILL: "true"
PRODUCT_1: '${PRODUCT_A_NAME + " " + RUN_TAG + " " + A_Q1}'
# ====================== SLOT FOR +4 HOURS LATER ==========================
- openLink: freshyoadmin://dashboard
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: add-product-menu-item
timeout: 120000
- openLink: 'freshyoadmin://dashboard/slots/add?dts=${(function(){return new Date(Date.now()+240*60000).toISOString().split(":").join("%3A")})()}&fts=${(function(){return new Date(Date.now()+240*60000-600000).toISOString().split(":").join("%3A")})()}'
- runFlow: subflows/confirm-open.yaml
- extendedWaitUntil:
visible:
id: delivery-date-picker
timeout: 30000
- runFlow:
file: add-slot.yaml
env:
SLOT_DELIVERY_DATE: '${(function(){var d=new Date(Date.now()+240*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_DELIVERY_TIME: "n/a"
SLOT_FREEZE_DATE: '${(function(){var d=new Date(Date.now()+240*60000);return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}'
SLOT_FREEZE_TIME: "n/a"
SLOT_PREFILL: "true"
PRODUCT_1: '${PRODUCT_A_NAME + " " + RUN_TAG + " " + A_Q1}'

View file

@ -0,0 +1,10 @@
# confirm-open: iOS asks "Open in Freshyo Admin?" on the freshyoadmin:// scheme.
# Call right after every openLink in a native admin flow.
appId: in.freshyo.adminui
---
- runFlow:
when:
visible:
text: 'Open in.*'
commands:
- tapOn: Open

View file

@ -0,0 +1,19 @@
# login-admin: staff login for the native admin app (apps/admin-ui).
# Called by entry flows after launchApp; assumes the login screen is showing.
# Run env: STAFF_NAME, STAFF_PASSWORD.
appId: in.freshyo.adminui
env:
STAFF_NAME: ${STAFF_NAME || ""}
STAFF_PASSWORD: ${STAFF_PASSWORD || ""}
---
- tapOn:
id: login-name-input
- inputText: ${STAFF_NAME}
- tapOn:
id: login-password-input
- inputText: ${STAFF_PASSWORD}
- pressKey: Enter
- tapOn:
id: login-button
- assertVisible:
id: add-product-menu-item

View file

@ -0,0 +1,77 @@
# set-slot-time-ios: one parameterized native date picker flow (iOS).
#
# HISTORY / KNOWN NATIVE LIMITATION:
# The modal closes only inside onChange, and RN's iOS DateTimePicker fires
# onChange ONLY when the picked value actually changes. Picking the date the
# picker already shows (today, the default when value is null) fires nothing:
# the modal stays open and the next field (e.g. freeze-date-picker) becomes
# unreachable. ALSO, exact TIME (hour/minute) cannot be set: the time wheels
# expose only the selected row to the a11y tree and close on first change.
# The committed time-of-day therefore = the simulator clock at the tap;
# freeze <= delivery holds whenever SLOT_FREEZE_DATE <= SLOT_DELIVERY_DATE.
# PICK_TIME is accepted for interface stability but not applied.
#
# MITIGATION (same-day branch): to commit "today", first tap a DIFFERENT day
# in the open month (forces onChange -> value commits -> modal closes), then
# reopen and tap the target day (now a real change -> closes again).
# Non-today dates keep the original month-navigation + single tap path.
appId: in.freshyo.adminui
env:
DATE_PICKER_ID: ${DATE_PICKER_ID || "delivery-date-picker"}
PICK_DATE: ${PICK_DATE || ""}
---
# ======== same-day branch (target = today: needs a force-change first) ========
- runFlow:
when:
true: ${PICK_DATE === (function(){var d=new Date();return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}
commands:
- tapOn:
id: ${DATE_PICKER_ID}
- waitForAnimationToEnd
- tapOn:
id: dateTimePicker
- waitForAnimationToEnd
# neighbor day = same month view, guaranteed different from today
# (day > 3 -> day-3, else day+3) forces the first change; closes the modal.
- tapOn:
text: "^${(function(){var d=new Date();var day=d.getDate();return String(day<=3?day+3:day-3)})()}$"
- waitForAnimationToEnd
# reopen and tap the target (today) - now a genuine change
- tapOn:
id: ${DATE_PICKER_ID}
- waitForAnimationToEnd
- tapOn:
id: dateTimePicker
- waitForAnimationToEnd
- tapOn:
text: "^${String((function(){var d=new Date();return d.getDate()})())}$"
- waitForAnimationToEnd
# ================= non-same-day path (original flow) ========================
- runFlow:
when:
true: ${PICK_DATE !== (function(){var d=new Date();return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}
commands:
# Derive the calendar target: month name + year ("November 2026").
- evalScript: ${output.targetMY = (function(){ var M = ["January","February","March","April","May","June","July","August","September","October","November","December"]; var p = PICK_DATE.split("-"); return M[parseInt(p[1], 10) - 1] + " " + parseInt(p[0], 10); })()}
- evalScript: ${output.day = String(parseInt(PICK_DATE.split("-")[2], 10))}
- tapOn:
id: ${DATE_PICKER_ID}
- waitForAnimationToEnd
- tapOn:
id: dateTimePicker
- waitForAnimationToEnd
# Navigate forward to the target month (current month is the start).
- repeat:
while:
notVisible:
text: ${output.targetMY}
commands:
- tapOn:
id: DatePicker.NextMonth
- waitForAnimationToEnd
# Tap the day cell (^$ anchors avoid 8/18/28 hits).
- tapOn:
text: '^${output.day}$'
- waitForAnimationToEnd

View file

@ -0,0 +1,25 @@
# tap-and-focus: tap a text input and GUARANTEE it holds focus.
# Typing right after a tap-on-input can race re-renders (the tap hits a stale
# frame; nothing is focused; the following inputText silently goes nowhere).
# This subflow retries the tap once, then asserts the field is focused —
# failing loudly instead of leaving an empty field behind.
# Args: FIELD_ID.
appId: in.freshyo.adminui
env:
FIELD_ID: ${FIELD_ID || ""}
---
- tapOn:
id: ${FIELD_ID}
- waitForAnimationToEnd
- runFlow:
when:
notVisible:
id: ${FIELD_ID}
focused: true
commands:
- tapOn:
id: ${FIELD_ID}
- waitForAnimationToEnd
- assertVisible:
id: ${FIELD_ID}
focused: true

View file

@ -19,8 +19,18 @@ export const DEFAULT_REGION_ID = 1
*/ */
// export const BASE_API_URL = 'https://worker.freshyo.in' // export const BASE_API_URL = 'https://worker.freshyo.in'
// export const BASE_API_URL = 'https://devapi.freshyo.in' // export const BASE_API_URL = 'https://devapi.freshyo.in'
// export const BASE_API_URL = 'http://192.168.100.126:8787' export const BASE_API_URL = 'http://192.168.100.126:8787'
export const BASE_API_URL = 'http://192.168.1.5:8787' // export const BASE_API_URL = 'http://192.168.1.5:8787'
/**
* City + pincode defaults per region name, used by address forms so the
* stored city/pin match the selected region. Regions without an entry
* (e.g. throwaway test regions) keep whatever the form already holds.
*/
export const REGION_CITY_PIN: Record<string, { city: string; pincode: string }> = {
Mahabubnagar: { city: 'Mahabubnagar', pincode: '509001' },
Jadcherla: { city: 'Jadcherla', pincode: '509301' },
}
// Re-export all types from the types folder // Re-export all types from the types folder
export * from './types' export * from './types'

View file

@ -28,6 +28,17 @@ interface BottomDropdownProps extends DropdownBaseProps<DropdownOption> {
testID?: string; testID?: string;
} }
type DropdownOptionWithSlug = DropdownOption & { slug: string }
const slugifyOptionLabel = (label: unknown): string => {
const slug = String(label ?? '')
.trim()
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '')
return slug === '-' ? '' : slug
}
const BottomDropdown: React.FC<BottomDropdownProps> = ({ const BottomDropdown: React.FC<BottomDropdownProps> = ({
label, label,
topLabel, topLabel,
@ -200,7 +211,7 @@ const BottomDropdown: React.FC<BottomDropdownProps> = ({
</View> </View>
)} )}
<ScrollView style={tw`max-h-80`}> <ScrollView style={tw`max-h-80`} keyboardShouldPersistTaps="handled">
{filteredOptions.length === 0 && searchQuery ? ( {filteredOptions.length === 0 && searchQuery ? (
<View style={tw`py-8 px-4 items-center`}> <View style={tw`py-8 px-4 items-center`}>
<Text style={tw`text-gray-500 text-center`}> <Text style={tw`text-gray-500 text-center`}>
@ -208,14 +219,24 @@ const BottomDropdown: React.FC<BottomDropdownProps> = ({
</Text> </Text>
</View> </View>
) : ( ) : (
filteredOptions.map((option) => { filteredOptions.map((rawOption) => {
const selected = isSelected(option.value); // Slug goes into the testID so flows can select by name-friendly
// ids (store-owner-dropdown-option-qusham). The numeric value
// stays in front so value-based id tapOns still match too.
const option: DropdownOptionWithSlug = {
...rawOption,
slug: slugifyOptionLabel(rawOption.label),
}
const optionId = option.slug
? `${testID}-option-${option.value}-${option.slug}`
: `${testID}-option-${option.value}`
const selected = isSelected(option.value);
const isDisabled = option.disabled || disabled; const isDisabled = option.disabled || disabled;
return ( return (
<TouchableOpacity <TouchableOpacity
key={option.value} key={option.value}
testID={`${testID}-option-${option.value}`} testID={optionId}
accessibilityLabel={`${testID}-option-${option.value}`} accessibilityLabel={optionId}
style={[ style={[
tw`px-4 py-3 rounded-md my-1 mx-2 flex-row items-center justify-between`, tw`px-4 py-3 rounded-md my-1 mx-2 flex-row items-center justify-between`,
selected ? { backgroundColor: colors.brand50 } : tw`bg-transparent`, selected ? { backgroundColor: colors.brand50 } : tw`bg-transparent`,

View file

@ -1,5 +1,5 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Modal, View, TouchableOpacity, StyleSheet, Animated, Easing, Dimensions, TextInput, KeyboardAvoidingView, Platform, ScrollView } from 'react-native'; import { Modal, View, TouchableOpacity, StyleSheet, Animated, Easing, Dimensions, TextInput, Keyboard, Platform, ScrollView } from 'react-native';
import type { ConfirmationDialogProps, DialogProps } from '@packages/shared'; import type { ConfirmationDialogProps, DialogProps } from '@packages/shared';
import MyText from './text'; import MyText from './text';
import MyButton from './button'; import MyButton from './button';
@ -9,6 +9,22 @@ const SCREEN_HEIGHT = Dimensions.get('window').height;
export const BottomDialog: React.FC<DialogProps> = ({ open, onClose, children, enableDismiss = true }) => { export const BottomDialog: React.FC<DialogProps> = ({ open, onClose, children, enableDismiss = true }) => {
const [slideAnim] = useState(new Animated.Value(SCREEN_HEIGHT)); const [slideAnim] = useState(new Animated.Value(SCREEN_HEIGHT));
// KeyboardAvoidingView is unreliable inside an RN Modal on iOS: the sheet
// kept sitting under the keyboard. Drive the padding from the Keyboard
// events directly (iOS only - Android gets it from the window inset).
const [kbInset, setKbInset] = useState(0);
React.useEffect(() => {
if (Platform.OS !== 'ios') return;
const showSub = Keyboard.addListener('keyboardWillShow', (e) =>
setKbInset(e.endCoordinates.height)
);
const hideSub = Keyboard.addListener('keyboardWillHide', () => setKbInset(0));
return () => {
showSub.remove();
hideSub.remove();
};
}, []);
React.useEffect(() => { React.useEffect(() => {
if (open) { if (open) {
@ -44,15 +60,12 @@ export const BottomDialog: React.FC<DialogProps> = ({ open, onClose, children, e
styles.dialog, styles.dialog,
{ {
transform: [{ translateY: slideAnim }], transform: [{ translateY: slideAnim }],
paddingBottom: Platform.OS === 'ios' ? kbInset : 0,
}, },
]} ]}
> >
<View style={styles.handle} /> <View style={styles.handle} />
<KeyboardAvoidingView <View style={styles.keyboardAvoidingContainer}>
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={styles.keyboardAvoidingContainer}
keyboardVerticalOffset={Platform.OS === 'ios' ? 0 : 0}
>
<ScrollView <ScrollView
style={styles.scrollContainer} style={styles.scrollContainer}
contentContainerStyle={styles.scrollContent} contentContainerStyle={styles.scrollContent}
@ -61,7 +74,7 @@ export const BottomDialog: React.FC<DialogProps> = ({ open, onClose, children, e
> >
{children} {children}
</ScrollView> </ScrollView>
</KeyboardAvoidingView> </View>
</Animated.View> </Animated.View>
</Modal> </Modal>
); );
@ -144,7 +157,10 @@ const styles = StyleSheet.create({
shadowOffset: { width: 0, height: -2 }, shadowOffset: { width: 0, height: -2 },
shadowOpacity: 0.2, shadowOpacity: 0.2,
shadowRadius: 8, shadowRadius: 8,
maxHeight: SCREEN_HEIGHT * 0.85, // Limit max height so it doesn't cover entire screen // NOTE: no maxHeight cap here. It used to cap the card at 85% of the
// screen, which choked the manual keyboard padding on iOS (the card
// stayed partially under the keyboard). The card is already bounded by
// the option-list ScrollView inside it.
}, },
handle: { handle: {
width: 40, width: 40,

View file

@ -0,0 +1,53 @@
-- clear-domain-data.sql: delete every row the e2e orchestrations can duplicate.
-- Runs on the LOCAL dev D1 only (wrangler d1 execute --local). Does NOT touch
-- regions/bounds/creds, staff users/roles, superadmins, users, or KV/consts.
-- Order = children first (the local D1 enforces foreign keys).
PRAGMA foreign_keys = OFF;
-- slots (vendor snippets reference slots)
DELETE FROM vendor_snippets;
DELETE FROM delivery_slot_info;
-- coupons chain (sku refs / order refs)
DELETE FROM reserved_coupons;
DELETE FROM coupon_applicable_products;
DELETE FROM coupon_applicable_users;
DELETE FROM coupon_usage;
DELETE FROM coupons;
-- orders + financial chain (also referenced by complaints/incidents)
DELETE FROM refunds;
DELETE FROM payments;
DELETE FROM order_items;
DELETE FROM order_status;
DELETE FROM complaints;
DELETE FROM user_incidents;
DELETE FROM orders;
-- product leaning rows
DELETE FROM special_deals;
DELETE FROM product_reviews;
DELETE FROM cart_items;
-- groupings
DELETE FROM product_group_membership;
DELETE FROM product_group_info;
-- tags (product_tags refs skus)
DELETE FROM product_tags;
DELETE FROM product_tag_info;
-- skus + products
DELETE FROM sku_features;
DELETE FROM product_combos;
DELETE FROM product_market_stats;
DELETE FROM product_skus;
DELETE FROM product_info;
-- stores
DELETE FROM store_info;
-- upload lifecycle junk
DELETE FROM upload_url_status;
PRAGMA foreign_keys = ON;