# Required staging checks before live use

Run these with synthetic data and distinct admin, manager, driver A and driver B accounts.

- Import schema into a fresh MySQL database; verify no SQL errors. Run tests/mysql.php on a separate empty *_test database. Confirm the production database is never used for tests.
- Log in on separate browsers/devices; change each temporary password. Wrong credentials, logout, expired sessions, password reset and access after reset must behave correctly. Check no database password, VAPID private key or API key is served publicly.
- Admin creates packages, hotels and tours; day/week/month/calendar navigation and editing work. Manager can view/chat but cannot change tours, team, bank details or GPS history.
- Dispatch to selected drivers and all available drivers. Accept, decline, retry, withdraw and redispatch. Race acceptance from two browsers: only one driver wins. Race two overlapping tours for the same driver: at most one wins. Check conflicting saves and network retries.
- Inspect driver API responses before release: no tourist names, pickup, hotel, phone, email, vehicle or payment information. Verify the 1-hour/2-hour reveal boundary against Sri Lanka time. Details disappear after withdrawal/end. Check direct API access to another driver's data is denied.
- Send messages from admin and manager to driver A; driver A sees the same shared thread. Test driver A reply, refresh, older messages, retry, logout/login and driver B isolation.
- Driver completes profile, bank name/account, email/phone and vehicle. Leading zeros in bank numbers survive. Manager cannot retrieve bank fields. Rate a finished assigned tour; unassigned/future tour ratings are denied.
- Explicitly allow GPS and start sharing in the valid window. Add multiple points; admin sees ordered markers/history and accurate last-update time. Refresh/retry doesn't duplicate points. Stop, withdraw and finish: sharing closes. Manager/other driver cannot retrieve history. Admin deletion removes only selected GPS history.
- Configure test email sender. Admin opens a full-tour draft, edits driver/name/body/recipient, reviews and sends explicitly. Booking stays unchanged. A changed booking invalidates an old draft. Retry with the same send reference doesn't produce a second provider message. Check history against provider records.
- Enable push on real Android/browser and iPhone Home Screen installation. Run cron with the website closed; test driver 24-hour, admin 24-hour and admin 1-hour reminder thresholds, plus email preference off/on. Confirm provider logs and actual receipt. Expired devices are deactivated; withdrawn/reassigned reminders are cancelled.
- Verify cron last-run health and private logs. Test invalid provider credentials, network failure, queue backlog and retry recovery. Provider-accepted status must not be interpreted as delivered.
- Back up and restore database and config in a private staging environment. Verify HTTPS, API no-store, private directories, hosting PHP error settings, file permissions and mobile layout.
- Before switching from the existing Site: complete a separate data migration, record count/role/privacy checks, cutover plan and rollback rehearsal. This export alone does not move live records.
