ser
This commit is contained in:
1 parent
208da38586
commit
41a2648c6e
17 files changed
+1171
-216
No files matched your search
@@ -0,0 +1,102 @@
|
||||
# Thoughts and Answers to Technical Audit
|
||||
|
||||
Here are my thoughts and proposed actions for every single point raised in the technical audit report. The agent did a fantastic job pointing out native Android issues and server-side edge cases that are crucial for a Google Play launch.
|
||||
|
||||
---
|
||||
|
||||
## 🔴 Critical Blockers
|
||||
|
||||
### 1. Conflicting `build.gradle.kts`
|
||||
**Thoughts:** The agent is 100% correct. Applying `com.android.application` in the root `build.gradle` is an anti-pattern in Flutter and will cause massive headaches during the release build.
|
||||
**Action:** Remove the `android {}` block and plugin from the root `build.gradle.kts`.
|
||||
|
||||
### 2. Missing Foreground Service Type Declaration
|
||||
**Thoughts:** Android 14+ is incredibly strict about Foreground Services. However, `VpnService` is a special case in Android that generally provides its own system-level notification. If we are using `FOREGROUND_SERVICE_SPECIAL_USE`, Google Play will definitely flag us for a manual review.
|
||||
**Action:** We need to inspect `wireguard_flutter` and potentially remove our manual `FOREGROUND_SERVICE` permissions if the AmneziaWG AAR handles it, or correctly classify it to avoid Play Store rejection.
|
||||
|
||||
### 3. AdMob SSV Completely Bypassed
|
||||
**Thoughts:** We knowingly bypassed this for your rapid testing phase, so this isn't a surprise. But the agent is right: if we ship this to Google Play, anyone can bypass the ads, and Google might reject it for deceptive ad behavior.
|
||||
**Action:** When you are ready to enable real ads, we must remove the client-side fake ping in `hivemind_service.dart` and uncomment the ECDSA signature verification in the Python server.
|
||||
|
||||
### 4. `app_config.dart` Contains Production Secrets
|
||||
**Thoughts:** AdMob App IDs are public anyway (they are embedded in the APK), but tracking IP addresses and configurations in Git is bad practice.
|
||||
**Action:** We should ensure `app_config.dart` is untracked (`git rm --cached`) so future changes don't pollute the repository.
|
||||
|
||||
### 5. `/api/session/start` Endpoint Does Not Exist
|
||||
**Thoughts:** Excellent catch by the agent! Our `addBonusTime()` method in Flutter posts to a `/session/start` endpoint that the Python server doesn't even have.
|
||||
**Action:** We need to refactor `addBonusTime()`. It shouldn't try to start a session. Instead, watching the ad should trigger the real SSV callback on the server (which already correctly handles `bonus_ad` to extend time), and the client should simply re-sync the timer.
|
||||
|
||||
### 6. Server Public Key Fallback Is a Hardcoded Invalid String
|
||||
**Thoughts:** Passing `"server key="` when `awg0` fails to read the pubkey will guarantee the Flutter client crashes with an invalid WireGuard config.
|
||||
**Action:** We should make the server throw a proper HTTP 500 error instead of silently passing garbage to the client.
|
||||
|
||||
---
|
||||
|
||||
## 🟡 Warnings — Architecture & Reliability
|
||||
|
||||
### 7. Optimistic Client State Before Server Confirmation
|
||||
**Thoughts:** Showing 01:00:00 before the server confirms the real time causes a glitchy UI jump.
|
||||
**Action:** We will add a "Calculating..." or "Syncing..." state in the UI until the first `_syncWithHivemind` succeeds.
|
||||
|
||||
### 8. Race Condition: In-Flight HTTP Callback During Disconnect
|
||||
**Thoughts:** If the 3-second sync finishes right after the user hits disconnect, it triggers a double-disconnect.
|
||||
**Action:** Easy fix. Add a `bool _isDisconnecting` guard.
|
||||
|
||||
### 9. No Graceful Recovery From Temporary Network Drops
|
||||
**Thoughts:** Very important for mobile. If the user drives through a tunnel and loses 4G, the local timer shouldn't blindly tick down to 0 while the server sync fails.
|
||||
**Action:** Pause the local timer decrement if the HTTP sync throws an error, and resume when it reconnects.
|
||||
|
||||
### 10. Permission Dialog + Immediate Failure = Broken UX
|
||||
**Thoughts:** Throwing an exception in Kotlin while the Android permission dialog is still on screen is a bad bug in `wireguard_flutter`.
|
||||
**Action:** We need to edit `WireguardFlutterPlugin.kt` to await the `onActivityResult` before returning to Flutter.
|
||||
|
||||
### 11. 3-Second Polling Per Client — Server Scalability Issue
|
||||
**Thoughts:** Polling every 3 seconds is ~33 req/sec for 100 users. Flask might struggle with this under heavy load.
|
||||
**Action:** We can increase this to 10 seconds. The local Dart timer is accurate enough to cover the gap.
|
||||
|
||||
### 12. `isVpnChecked` Flag — Single-Use
|
||||
**Thoughts:** We actually solved most of the state restoration in our previous chat, but the native Kotlin plugin state tracking is still a bit messy.
|
||||
**Action:** Minor cleanup in the Kotlin plugin.
|
||||
|
||||
### 13. Server: `management_loop` Blocks on Subprocess Calls
|
||||
**Thoughts:** `subprocess.run("awg show ...")` is synchronous and blocks the Python GIL.
|
||||
**Action:** We can optimize the server to run this in a thread or use a timeout.
|
||||
|
||||
### 14. Server: `tc filter` Cleanup Is Never Done on Expiry
|
||||
**Thoughts:** This is a **massive server bug**. If a user's session expires naturally, we delete them from memory but leave their bandwidth throttling rules active in the Linux kernel forever. Over time, the server will choke on dead rules.
|
||||
**Action:** We must call `remove_throttle()` and `remove_wg_peer()` in the expiry loop inside `server_hivemind_5_0.py`.
|
||||
|
||||
### 15. No ProGuard/R8 Rules for AmneziaWG Native Library
|
||||
**Thoughts:** Standard Android release builds strip unused code. If it strips AmneziaWG, the release APK will crash on launch.
|
||||
**Action:** Add ProGuard rules for `org.amnezia.awg.**`.
|
||||
|
||||
---
|
||||
|
||||
## 🟢 Polish & Best Practices
|
||||
|
||||
**16-23.** The agent's points here are all solid minor improvements. We should host the Privacy Policy on GitHub Pages instead of a raw `.md` file, make `AppConfig` private, and untrack `server full picture.txt`.
|
||||
|
||||
---
|
||||
|
||||
## 👤 User Experience Bugs
|
||||
|
||||
The agent highlighted 16 UX bugs. Here are the most impactful ones that we should fix:
|
||||
|
||||
* **UX-1 (5-Second Cooldown on Failure):** We shouldn't lock the connect button for 5 seconds if the connection fails instantly.
|
||||
* **UX-3 ("TAP TO CONNECT" Always Visible):** We should change the text dynamically (e.g., "NO NETWORK").
|
||||
* **UX-4 & UX-9 (No Ad Load Feedback):** We need to prevent the user from connecting if the ad isn't loaded yet, and show them a "Loading ad..." state.
|
||||
* **UX-5 (Fake "+30 mins" Snackbar):** We must only show this snackbar if the server actually extended the time.
|
||||
* **UX-6 (2.5s Splash Delay):** The artificial `Future.delayed` in `intro.dart` should be removed so the app opens instantly.
|
||||
* **UX-7 (Notification "0.00 KB/s"):** We should show "Idle" instead of "0.00 KB/s" to look more professional.
|
||||
* **UX-10 (Timer clears instantly on Disconnect):** We should let the timer stay visible until the disconnection finishes.
|
||||
* **UX-13 (No Haptic Feedback):** Adding `HapticFeedback.lightImpact()` on the connect button will make the app feel much more premium.
|
||||
|
||||
---
|
||||
|
||||
### Conclusion
|
||||
|
||||
The agent provided an incredibly valuable roadmap.
|
||||
I recommend we tackle these in batches:
|
||||
1. **Server Fixes:** Fix the `tc filter` memory leak (Critical) and the AdMob SSV / bonus time endpoints.
|
||||
2. **Android Native Fixes:** Fix the `build.gradle.kts` conflict, ProGuard rules, and the Kotlin permission dialog bug.
|
||||
3. **Flutter UX Polish:** Fix the fake snackbars, loading states, and haptic feedback.
|
||||
Reference in new issue
Block a user