[PR #1145] [MERGED] fix(android): validate engine archive prerequisites #2681

Closed
opened 2026-10-17 21:09:00 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1145
Author: @N0zoM1z0
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/android-engine-readiness


📝 Commits (2)

  • b93ea0a fix(android): validate engine archive prerequisites
  • 571392f fix(android): bound engine metadata reads before allocation

📊 Changes

9 files changed (+180 additions, -17 deletions)

View changed files

📝 docs/android-analysis.md (+8 -0)
📝 scripts/verify/android/failure-recovery.mjs (+26 -3)
📝 src/android/JadxConfiguration.ts (+48 -0)
📝 src/artifacts/ZipArtifactReader.ts (+21 -4)
📝 tests/boundary/android/jadxConfiguration.test.ts (+34 -8)
📝 tests/boundary/filesystem/artifactZipIntegrity.test.ts (+24 -0)
📝 tests/boundary/process/jadxIntegration.test.ts (+2 -1)
📝 tests/fixtures/android/jadx.ts (+2 -1)
➕ tests/fixtures/android/jadxJar.ts (+15 -0)

📄 Description

Summary

A readable regular file is insufficient evidence that the configured Android engine is usable. With a working JDK, a plain-text REA_JADX_MCP_JAR previously made all five tools available and failed later with JDK-first advice. Shared readiness and execution now inspect the JAR's ZIP directory for the metadata bridge's class dependencies and return JAR-specific recovery.

Fixes #1124. Fixes #1125.

Problem and expected behavior

Malformed archives and unrelated JARs must report an unavailable Android provider before bridge launch. A valid selected engine must retain ordinary analysis, session reuse, cancellation and artifact identity.

Change and scope

Reuse the existing ZIP reader for classpath inventory in the Android configuration boundary, with an 8 MiB per-read metadata budget enforced before buffer allocation. Oversized metadata preserves the requested bytes, budget and JAR path. Update synthetic protocol fixtures to contain real ZIP directories and extend the real-provider failure matrix. Inventory checks establish necessary prerequisites; they do not verify every class implementation.

Contract and boundary impact

  • Semantic owner: Android provider configuration, shared by discovery and execution.
  • CLI/MCP: unchanged schemas and complete 138-tool inventory; invalid engine configuration returns capability_unavailable and unavailable readiness.
  • Compatibility/evidence: existing Linux/macOS ownership boundary and caller-selected JAR digests remain intact.
  • Process/authorization: existing lifecycle; archive inspection reads metadata without loading engine code.
  • Generated metadata/package/installation: no authored changes required.

Evidence and regression coverage

The new malformed/unrelated-archive regression fails on the base revision and passes with this fix. Real stdio MCP also reproduced the original false-ready result. Synthetic tests cover session identity, reuse, cancellation and cleanup; real JADX validates the executable path.

Validation performed

  • npm run build:cached — passed.
  • Eight focused Android/composition/CLI/process test files — 59 tests passed.
  • Follow-up readiness/ZIP integrity/backpressure checks — 14 tests passed, including a valid ZIP control for a budget failure.
  • Actual JADX package CLI and stdio MCP readiness after the allocation guard — passed; a sparse 64 MiB metadata request is rejected before allocation while all 138 tools remain visible and the server stays responsive.
  • node scripts/verify/android/analysis.mjs with the digest-pinned JADX 0.7.1 and ApiDemos 6.0.18 fixtures — passed on Linux/JDK 21: all five CLI/MCP operations, readiness, JRE/missing-Java/invalid-JAR recovery, invalid selectors, cancellation and unchanged APK.
  • npm run check:fast and npm run jscpd — passed.
  • git diff --check — passed.

Compatibility, safety, and release

No schema migration or release metadata change. Real Hopper/Ghidra was not run for this Android change; no new macOS, Windows or JDK 25 execution claim. ZIP checks inspect metadata through the existing reader and join its cleanup.

Review checklist

  • Focused bug fix with linked issues and Conventional Commit title.
  • Failure paths, lifecycle, owning docs and CLI/MCP behavior verified.
  • Final diff contains no binaries, generated output or unrelated cleanup.

🔄 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/1145 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/android-engine-readiness` --- ### 📝 Commits (2) - [`b93ea0a`](https://github.com/morluto/rea/commit/b93ea0ab980b6d5af15abb62671aea9f8259d81b) fix(android): validate engine archive prerequisites - [`571392f`](https://github.com/morluto/rea/commit/571392faeeeb5ca0cbe2e1f6150d5cdda3199ed3) fix(android): bound engine metadata reads before allocation ### 📊 Changes **9 files changed** (+180 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `docs/android-analysis.md` (+8 -0) 📝 `scripts/verify/android/failure-recovery.mjs` (+26 -3) 📝 `src/android/JadxConfiguration.ts` (+48 -0) 📝 `src/artifacts/ZipArtifactReader.ts` (+21 -4) 📝 `tests/boundary/android/jadxConfiguration.test.ts` (+34 -8) 📝 `tests/boundary/filesystem/artifactZipIntegrity.test.ts` (+24 -0) 📝 `tests/boundary/process/jadxIntegration.test.ts` (+2 -1) 📝 `tests/fixtures/android/jadx.ts` (+2 -1) ➕ `tests/fixtures/android/jadxJar.ts` (+15 -0) </details> ### 📄 Description ## Summary A readable regular file is insufficient evidence that the configured Android engine is usable. With a working JDK, a plain-text `REA_JADX_MCP_JAR` previously made all five tools available and failed later with JDK-first advice. Shared readiness and execution now inspect the JAR's ZIP directory for the metadata bridge's class dependencies and return JAR-specific recovery. Fixes #1124. Fixes #1125. ## Problem and expected behavior Malformed archives and unrelated JARs must report an unavailable Android provider before bridge launch. A valid selected engine must retain ordinary analysis, session reuse, cancellation and artifact identity. ## Change and scope Reuse the existing ZIP reader for classpath inventory in the Android configuration boundary, with an 8 MiB per-read metadata budget enforced before buffer allocation. Oversized metadata preserves the requested bytes, budget and JAR path. Update synthetic protocol fixtures to contain real ZIP directories and extend the real-provider failure matrix. Inventory checks establish necessary prerequisites; they do not verify every class implementation. ## Contract and boundary impact - Semantic owner: Android provider configuration, shared by discovery and execution. - CLI/MCP: unchanged schemas and complete 138-tool inventory; invalid engine configuration returns `capability_unavailable` and unavailable readiness. - Compatibility/evidence: existing Linux/macOS ownership boundary and caller-selected JAR digests remain intact. - Process/authorization: existing lifecycle; archive inspection reads metadata without loading engine code. - Generated metadata/package/installation: no authored changes required. ## Evidence and regression coverage The new malformed/unrelated-archive regression fails on the base revision and passes with this fix. Real stdio MCP also reproduced the original false-ready result. Synthetic tests cover session identity, reuse, cancellation and cleanup; real JADX validates the executable path. ## Validation performed - `npm run build:cached` — passed. - Eight focused Android/composition/CLI/process test files — 59 tests passed. - Follow-up readiness/ZIP integrity/backpressure checks — 14 tests passed, including a valid ZIP control for a budget failure. - Actual JADX package CLI and stdio MCP readiness after the allocation guard — passed; a sparse 64 MiB metadata request is rejected before allocation while all 138 tools remain visible and the server stays responsive. - `node scripts/verify/android/analysis.mjs` with the digest-pinned JADX 0.7.1 and ApiDemos 6.0.18 fixtures — passed on Linux/JDK 21: all five CLI/MCP operations, readiness, JRE/missing-Java/invalid-JAR recovery, invalid selectors, cancellation and unchanged APK. - `npm run check:fast` and `npm run jscpd` — passed. - `git diff --check` — passed. ## Compatibility, safety, and release No schema migration or release metadata change. Real Hopper/Ghidra was not run for this Android change; no new macOS, Windows or JDK 25 execution claim. ZIP checks inspect metadata through the existing reader and join its cleanup. ## Review checklist - [x] Focused bug fix with linked issues and Conventional Commit title. - [x] Failure paths, lifecycle, owning docs and CLI/MCP behavior verified. - [x] Final diff contains no binaries, generated output or unrelated cleanup. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:00 +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#2681
No description provided.