budget-app/docs/GRADLE_FREE_VALIDATION.md

126 lines
6 KiB
Markdown

# Gradle-free migration — validation results
Validated 2026-10-26 on Linux with isolated Rust stable 1.99.1 environments.
This report supersedes the older Gradle/layout harness instructions.
## Results
| Gate | Result |
|---|---|
| Application Rust unit tests | 96 passed |
| Native facade Rust unit tests | 4 passed |
| Public application model integration tests | 7 passed |
| Real bundled-model OCR inference/buffer tests | 3 passed |
| Real Makepad release UI tests | 3 passed, none ignored |
| Java product/price/currency extraction tests | 12 passed |
| Owner-local Python packaging/privacy contracts | 4 passed |
| Makepad CLI host unit tests, including prerequisite fixes | 69 passed |
| Full desktop native build/link | Passed |
| Actual `cargo run` | Remained alive through the 15-second smoke window |
| Production Java against Android SDK 35 | Passed |
| Actual app manifest/resources against AAPT 35.0.1 | Passed |
| ARM64 Android Rust/JNI/OCR release build | Passed |
| Actual Cargo/Makepad APK assembly and inspection | Passed |
| Temporary environment cleanup | Completed, including failed attempts |
The Budget Rust total is 113, including three real UI tests. UI tests drive history
navigation, text entry, validation buttons and capture-boundary messaging in isolated
HOME/XDG directories. They use the current `makepad-test` owned-app protocol, not a
Studio hub or ignored/mock widget tests. OCR tests actually recognized the synthetic
“Wireless Mouse / ZAR 249.99” image and checked blank/invalid input.
## Actual Android packaging evidence
Command used in the disposable environment:
```
cargo makepad android --sdk-path=<temporary-sdk> build -p budget --release
```
The intended device command remains:
```
cargo makepad android run -p budget --release
```
The real build emitted:
```
Building APK (package=org.nigig.oldmutualbudget, label=Old Mutual Budget,
versionCode=1, versionName=1.0.0, debuggable=false)
Bundling secondary dex .../budget-capture-.../out/classes.dex -> classes2.dex
APK Build completed
Actual APK verified: identity, permissions, native components/DEX,
exported OCR JNI and bundled models
```
`app/tests/verify_apk.py` inspected the actual compiled APK, including:
- Original application ID and overlay permission; no Internet permission.
- Tile, overlay, permission and share components in the compiled manifest.
- All seven required native Java classes in APK DEX files.
- A real ARM64-path ELF library with exported
`Java_org_nigig_budgetshare_BudgetOcr_recognize`.
- Exact bytes of both pinned OCR models inside the native library.
- The model licence resource inside the APK.
No dummy native library, Gradle host, patched APK or compile-only fixture was
substituted for this build. Resource preflight archives are explicitly only an early
check; the subsequent real APK build is the packaging gate. The temporary APK was
removed with the toolchain/build environment, not distributed as a production release.
## Makepad prerequisite
The existing Makepad branch needed two narrow fixes, now recorded at
`326530539c5c66ed0d05c254e37fcb1e4b08212b` on the existing
`nigig-traffic-camera-boom-fix` branch. No new branch was created.
1. Remove an unused duplicated Windows-link helper and restore the metadata
`manifest_path` field, with a regression test. The live Windows linking path remains.
2. Use compile platform SDK 35 and matching build tools 35.0.1 so AAPT can encode
Android 14's symbolic `specialUse|mediaProjection` foreground-service type.
Minimum Android remains 26, target remains 35 and NDK remains r28b.
The combined patch against `2d732a5` ships as
`docs/MAKEPAD_PACKAGER_COMPILE_FIX.patch`. Rebuild cargo-makepad and reinstall its
SDK after applying it. Archive roots were checked for Linux, Windows and macOS;
macOS's required universal libc++.dylib is explicitly staged. All 69 host tool tests
passed after the final source changes. Windows/macOS execution is not claimed.
## Issues caught during validation
- Isolated javac required explicit UTF-8 encoding; fixed in production and tests.
- Build-script javac needed an explicit Android SDK classpath; fixed.
- AAPT 33 rejected both the new service-type name and an attempted numeric encoding.
The numeric workaround was removed; final manifests use symbolic Android flags.
- AAPT 33 could not read SDK 35's resource table. Matching build tools 35.0.1 fixed
this; a fast real-manifest/resource preflight now catches such errors before linking.
## Reproduction and logs
```
FULL_ANDROID=1 bash app/tests/run-clean.sh
# To rerun only the Android/tool gates after a successful native/UI run:
ANDROID_ONLY=1 FULL_ANDROID=1 bash app/tests/run-clean.sh
```
Session logs retained outside the repository:
- `/home/user/branch-cleanup/budget-native-ui-passed-packager-failed.log`: passed
native/UI/Java/OCR gates followed by the original Makepad CLI compile failure.
- `/home/user/branch-cleanup/budget-cargo-android-validation.log`: final successful
Android/tool/resource/APK gates and cleanup.
- `/home/user/branch-cleanup/makepad-sdk35-final-tests.log`: final 69 CLI tests.
## Remaining limits
- No Android device/emulator execution: consent, overlay dragging, lifecycle,
cold-start JNI loading, phone OCR latency and notification behavior need device tests.
- No production signing-key or signed-update/data-retention verification. Reuse the
existing production certificate; development signing is not update compatibility.
- No Windows/Quest/CEF device validation. No iOS cross-app overlay support; Swift OCR
remains source-only.
- Existing Makepad warnings remain, including deprecated APIs and a native `read`
FFI return-type warning. The app also lacks launcher mipmap artwork (the capture
tile drawable is packaged). These are not represented as warning-free builds.
- OCR models are unmodified CC BY-SA 4.0 material; attribution and full terms ship
in application resources and attribution appears in capture review. OCR engine
MIT notices are also included. No screenshot or recognized text is uploaded.