|
| 1 | +# Debug Features - AI Mate |
| 2 | + |
| 3 | +Features that are **only available in DEBUG builds** for testing and development. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 🔧 Data Seeding Shortcut |
| 8 | + |
| 9 | +### Magic VAT Number: `12345` |
| 10 | + |
| 11 | +During onboarding in the mobile app (or web app running in DEBUG mode), entering `12345` as the VAT Registration Number will automatically trigger data seeding. |
| 12 | + |
| 13 | +**How it works:** |
| 14 | +1. User enters `12345` in the VAT Registration Number field |
| 15 | +2. User clicks "Save & Continue" |
| 16 | +3. App calls `/api/dev/reseed` endpoint on the backend |
| 17 | +4. Test data is seeded (sample invoices, jobs, etc.) |
| 18 | +5. User sees feedback: "🔧 Debug mode: Triggering data seeding..." |
| 19 | +6. After seeding, shows: "✅ Debug data seeded successfully! Redirecting..." |
| 20 | + |
| 21 | +**Use Case:** |
| 22 | +- Testing the mobile app with realistic data |
| 23 | +- Demonstrating features without manual data entry |
| 24 | +- E2E testing on devices where backend access is limited |
| 25 | + |
| 26 | +**Security:** |
| 27 | +- ✅ Only works in DEBUG builds (`#if DEBUG`) |
| 28 | +- ✅ Automatically excluded from release/production builds |
| 29 | +- ✅ Backend endpoint only available in Development environment |
| 30 | +- ✅ No security risk in production |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 📱 Mobile App Debug Builds |
| 35 | + |
| 36 | +### Building Debug APK with Data Seeding: |
| 37 | + |
| 38 | +```bash |
| 39 | +# Build debug Android APK |
| 40 | +export JAVA_HOME=$(/usr/libexec/java_home -v 17) |
| 41 | +BUILD_TYPE=debug BUILD_FORMAT=apk ./scripts/build_mobile_android.sh |
| 42 | + |
| 43 | +# Output: build/android/ai-mate-debug.apk |
| 44 | +``` |
| 45 | + |
| 46 | +### Testing on Device: |
| 47 | + |
| 48 | +1. Install debug APK: |
| 49 | + ```bash |
| 50 | + adb install build/android/ai-mate-debug.apk |
| 51 | + ``` |
| 52 | + |
| 53 | +2. Launch app and complete onboarding |
| 54 | + |
| 55 | +3. Enter `12345` as VAT number |
| 56 | + |
| 57 | +4. Click "Save & Continue" |
| 58 | + |
| 59 | +5. Watch for debug message confirming data seeding |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +## 🚀 Production Builds |
| 64 | + |
| 65 | +Release builds automatically exclude all debug features: |
| 66 | + |
| 67 | +```bash |
| 68 | +# Release builds have NO debug features |
| 69 | +BUILD_TYPE=release BUILD_FORMAT=aab ./scripts/build_mobile_android.sh |
| 70 | +``` |
| 71 | + |
| 72 | +**What's removed in release:** |
| 73 | +- ❌ Magic VAT number detection |
| 74 | +- ❌ Data seeding shortcuts |
| 75 | +- ❌ Debug messages |
| 76 | +- ❌ `/api/dev/*` endpoints disabled |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## 🎯 Backend Debug Endpoints |
| 81 | + |
| 82 | +Available only in Development environment: |
| 83 | + |
| 84 | +| Endpoint | Method | Purpose | |
| 85 | +|----------|--------|---------| |
| 86 | +| `/api/dev/reseed` | POST | Seed test data (invoices, jobs) | |
| 87 | +| `/api/dev/default-company` | GET | Get default company ID | |
| 88 | +| `/api/dev/backfill-company` | POST | Backfill company IDs (requires ENABLE_DEV_RESEED=true) | |
| 89 | +| `/api/dev/migrate-per-company` | POST | Migrate to per-company DBs (requires ENABLE_DEV_RESEED=true) | |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## 📝 Notes |
| 94 | + |
| 95 | +- Debug features use `#if DEBUG` preprocessor directives |
| 96 | +- Release builds compile with optimizations and exclude debug code |
| 97 | +- Backend must be running in Development mode for endpoints to work |
| 98 | +- No performance impact in production builds |
| 99 | +- Safe for App Store / Play Store submission |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +**Last Updated:** October 26, 2025 |
0 commit comments