[PR #5021] [MERGED] fix(tests): restore Android prerequisite verification #6739

Closed
opened 2026-11-01 21:42:41 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5021
Author: @gensokyo-dev
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @gensokyo-dev

Base: main ← Head: investigate/java-bridge-20261018


📝 Commits (2)

  • 3769a07 fix(tests): restore Android prerequisite verification
  • 9188a2a fix(tests): match typed Android prerequisite failures

📊 Changes

10 files changed (+242 additions, -48 deletions)

View changed files

📝 docs/android-analysis.md (+8 -0)
📝 scripts/lib/ghidra-installation-inspection.mjs (+5 -24)
➕ scripts/lib/jadx-configuration-inspection.d.mts (+11 -0)
➕ scripts/lib/jadx-configuration-inspection.mjs (+17 -0)
📝 scripts/lib/verifier-file-resources.d.mts (+6 -0)
📝 scripts/lib/verifier-file-resources.mjs (+27 -0)
📝 scripts/verify/android/analysis.mjs (+3 -5)
📝 scripts/verify/android/failure-recovery.mjs (+44 -12)
📝 scripts/verify/android/windows-lifecycle.mjs (+4 -6)
📝 tests/boundary/process/verifierFileResources.test.ts (+117 -1)

📄 Description

Summary

The real Android verifier still follows the old Java-prerequisite contract: three calls omit the newly required resource owner and crash before Java starts; the recovery checks also demand generic full-JDK advice when the selected Java launcher is missing. Production correctly returns a typed java_runtime/runtime_missing error with the retained ENOENT observation and launcher-specific guidance.

Route the main verifier and both Windows Java-selection probes through a named owned validation boundary. Share the existing Ghidra verifier scope, preserving exact cleanup leases, retry behavior and primary failures. Parse recovery outputs with the named error schema and verify each scenario's typed diagnostics and applicable guidance. Document the boundary and add regressions. No separate issue was opened for these directly reproduced verifier regressions.

Contract and boundary impact

  • Semantic owner: verifier prerequisite validation, before fixture generation or engine startup. Failed cleanup remains owned until release or an explicit retry lease is returned.
  • Contribution scope: routine correction within existing providers; maintainer scope decision not applicable.
  • CLI/MCP, Evidence, target authority, generated catalogs and package/install contracts: no changes.
  • Verification reads the selected JDK/JAR, launches the selected Java tools and uses temporary fixtures. APKs/native fixtures are not executed. Linux x64 is verified locally; real Windows/macOS and JEB coverage are unavailable.

Evidence and validation

  • New entrypoint regression fails on clean base 093ce695f for all three unowned calls. New boundary cases exercise clean JDK/JAR validation, exact-descriptor close retry, and persistent close failure retaining both primary error and cleanup authority.
  • npm run test:focused -- tests/boundary/process/verifierFileResources.test.ts — 13 passed; includes existing Ghidra cleanup/cancellation cases. jadxConfiguration.test.ts — 16 passed in the combined run described below.
  • npm run check — passed all static tasks and architecture guards. npm run docs:check — passed, including five README consistency tests.
  • Ghidra 12.1.4 / JDK 21.0.12.1: all nine bridge sources compile against 195 jars; an isolated missing-HashMap-import control fails compilation. Real verify-real-ghidra-address-context.mjs passes CLI/MCP parity, decompilation, address mapping, unchanged source bytes and verified empty process lineage. The extracted verifier prerequisite helper also accepts this real installation.
  • JADX headless MCP 0.7.1 / ApiDemos 6.0.18: public CLI package inspection and onCreate decompilation pass with the audited artifact digests. node scripts/verify/android/analysis.mjs — the complete real Linux lane passes: five CLI/MCP operations, metadata/method-body/direct-invoke controls, readiness, JRE/compiler and missing-Java recovery, malformed JARs, invalid selectors, successful recovery and real CLI cancellation. Original APK digest is unchanged and the APK was never executed.

The owner-only revision 3769a0711 reproduced the stale missing-Java assertion after all five CLI/MCP operations and cancellation passed; the updated recovery subworkflow now completes. One initial full Android attempt hit the existing 30-second MCP initialization deadline during resource contention. The same onCreate request passed alone in 20.2 seconds with identical JVM/timeouts. A combined focused run passed 28/29 tests but an existing Ghidra prerequisite subprocess timed out during host memory/I/O stalls; its file subsequently passed all 13 tests. These attempts remain recorded; they do not establish a fix for startup timing. Timeout settings were not changed.

Local work uses two CPU cores. Sampled process-family RSS peaks: static checks 4137 MiB; Ghidra workflow 1591 MiB; complete Android workflow 2187 MiB. Sampling sums RSS every 100 ms and may double-count shared pages or miss short-lived/reparented children. The final complete Android run took 571.9 s (584.1 s aggregate CPU); no performance improvement is claimed.

Author readiness

Human owner: @gensokyo-dev

The owner explicitly authorized ready-for-review publication, delegated completion of these declarations, and merge in the task instructions. Codex performed the diff review and validation; a separate human review was not independently observed.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/5021 **Author:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `investigate/java-bridge-20261018` --- ### 📝 Commits (2) - [`3769a07`](https://github.com/morluto/rea/commit/3769a07113fbf81e611857bdc84a4bbcd13fc0c2) fix(tests): restore Android prerequisite verification - [`9188a2a`](https://github.com/morluto/rea/commit/9188a2a78fb2df86186c7d21cf74b7be6a360315) fix(tests): match typed Android prerequisite failures ### 📊 Changes **10 files changed** (+242 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `docs/android-analysis.md` (+8 -0) 📝 `scripts/lib/ghidra-installation-inspection.mjs` (+5 -24) ➕ `scripts/lib/jadx-configuration-inspection.d.mts` (+11 -0) ➕ `scripts/lib/jadx-configuration-inspection.mjs` (+17 -0) 📝 `scripts/lib/verifier-file-resources.d.mts` (+6 -0) 📝 `scripts/lib/verifier-file-resources.mjs` (+27 -0) 📝 `scripts/verify/android/analysis.mjs` (+3 -5) 📝 `scripts/verify/android/failure-recovery.mjs` (+44 -12) 📝 `scripts/verify/android/windows-lifecycle.mjs` (+4 -6) 📝 `tests/boundary/process/verifierFileResources.test.ts` (+117 -1) </details> ### 📄 Description ## Summary The real Android verifier still follows the old Java-prerequisite contract: three calls omit the newly required resource owner and crash before Java starts; the recovery checks also demand generic full-JDK advice when the selected Java launcher is missing. Production correctly returns a typed `java_runtime/runtime_missing` error with the retained `ENOENT` observation and launcher-specific guidance. Route the main verifier and both Windows Java-selection probes through a named owned validation boundary. Share the existing Ghidra verifier scope, preserving exact cleanup leases, retry behavior and primary failures. Parse recovery outputs with the named error schema and verify each scenario's typed diagnostics and applicable guidance. Document the boundary and add regressions. No separate issue was opened for these directly reproduced verifier regressions. ## Contract and boundary impact - Semantic owner: verifier prerequisite validation, before fixture generation or engine startup. Failed cleanup remains owned until release or an explicit retry lease is returned. - Contribution scope: routine correction within existing providers; maintainer scope decision not applicable. - CLI/MCP, Evidence, target authority, generated catalogs and package/install contracts: no changes. - Verification reads the selected JDK/JAR, launches the selected Java tools and uses temporary fixtures. APKs/native fixtures are not executed. Linux x64 is verified locally; real Windows/macOS and JEB coverage are unavailable. ## Evidence and validation - New entrypoint regression fails on clean base 093ce695f for all three unowned calls. New boundary cases exercise clean JDK/JAR validation, exact-descriptor close retry, and persistent close failure retaining both primary error and cleanup authority. - `npm run test:focused -- tests/boundary/process/verifierFileResources.test.ts` — 13 passed; includes existing Ghidra cleanup/cancellation cases. `jadxConfiguration.test.ts` — 16 passed in the combined run described below. - `npm run check` — passed all static tasks and architecture guards. `npm run docs:check` — passed, including five README consistency tests. - Ghidra 12.1.4 / JDK 21.0.12.1: all nine bridge sources compile against 195 jars; an isolated missing-HashMap-import control fails compilation. Real `verify-real-ghidra-address-context.mjs` passes CLI/MCP parity, decompilation, address mapping, unchanged source bytes and verified empty process lineage. The extracted verifier prerequisite helper also accepts this real installation. - JADX headless MCP 0.7.1 / ApiDemos 6.0.18: public CLI package inspection and `onCreate` decompilation pass with the audited artifact digests. `node scripts/verify/android/analysis.mjs` — the complete real Linux lane passes: five CLI/MCP operations, metadata/method-body/direct-invoke controls, readiness, JRE/compiler and missing-Java recovery, malformed JARs, invalid selectors, successful recovery and real CLI cancellation. Original APK digest is unchanged and the APK was never executed. The owner-only revision 3769a0711 reproduced the stale missing-Java assertion after all five CLI/MCP operations and cancellation passed; the updated recovery subworkflow now completes. One initial full Android attempt hit the existing 30-second MCP initialization deadline during resource contention. The same `onCreate` request passed alone in 20.2 seconds with identical JVM/timeouts. A combined focused run passed 28/29 tests but an existing Ghidra prerequisite subprocess timed out during host memory/I/O stalls; its file subsequently passed all 13 tests. These attempts remain recorded; they do not establish a fix for startup timing. Timeout settings were not changed. Local work uses two CPU cores. Sampled process-family RSS peaks: static checks 4137 MiB; Ghidra workflow 1591 MiB; complete Android workflow 2187 MiB. Sampling sums RSS every 100 ms and may double-count shared pages or miss short-lived/reparented children. The final complete Android run took 571.9 s (584.1 s aggregate CPU); no performance improvement is claimed. ## Author readiness Human owner: @gensokyo-dev The owner explicitly authorized ready-for-review publication, delegated completion of these declarations, and merge in the task instructions. Codex performed the diff review and validation; a separate human review was not independently observed. - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:42:41 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6739
No description provided.