[PR #2439] [MERGED] feat(android): expose exact DEX descriptors and direct invoke sites #5232

Closed
opened 2026-10-31 01:05:00 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2439
Author: @LcokHcak
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @morluto

Base: main ← Head: codex/rea-android-invokes


📝 Commits (3)

  • b6220ed feat(android): expose precise method references and DEX invoke sites
  • d17dee5 fix(android): bound invoke evidence without losing reference inventory
  • a4a9e5d perf(android): skip invoke admission for class references

📊 Changes

17 files changed (+870 additions, -38 deletions)

View changed files

📝 bridge/android/ReaJadxBridge.java (+107 -9)
📝 docs/android-analysis.md (+29 -7)
📝 scripts/verify/android/analysis.mjs (+45 -1)
➕ scripts/verify/android/direct-invokes.mjs (+112 -0)
📝 scripts/verify/android/metadata.mjs (+25 -0)
📝 src/android/JadxAnalysis.ts (+32 -7)
📝 src/android/JadxProtocol.ts (+16 -0)
📝 src/android/JadxRelease.ts (+2 -1)
📝 src/cli/androidCommands.ts (+12 -2)
📝 src/contracts/android/androidToolContracts.ts (+3 -3)
📝 src/domain/android/androidAnalysis.ts (+35 -2)
➕ tests/boundary/android/JadxAnalysis.test.ts (+304 -0)
📝 tests/boundary/process/jadxIntegration.test.ts (+16 -3)
📝 tests/conformance/android/ReaJadxMetadataRegression.java (+104 -2)
➕ tests/fixtures/android/direct-invokes/Caller.smali (+9 -0)
➕ tests/fixtures/android/direct-invokes/Target.smali (+7 -0)
📝 tests/fixtures/android/jadx-mcp.mjs (+12 -1)

📄 Description

Summary

Expose exact DEX method descriptors and individual direct invoke-* sites in Android reference results. This lets an analyst distinguish a method that uses a target from each call instruction inside that method.

Problem and expected behavior

In the included two-invoke fixture, fixture.Caller.twice() calls fixture.Target.mark() twice. JADX getUseIn() reports one using method, so REA previously returned total: 1 with no instruction location. The result looked complete at method granularity but could not answer how many direct calls existed or where they occurred.

Change and scope

The JADX bridge now provides the DEX descriptor and direct invoke instruction data when the producer can match them. The Android adapter validates and carries the source method identity, DEX entry, code-unit offset, method index and opcode through the domain result and both CLI/MCP paths. total and reference_unit: "using_node" keep their existing meaning; direct_invokes is separate instruction evidence. No APK is executed and no new provider is introduced. No issue is linked because this was reproduced with a controlled repository fixture.

Contract and boundary impact

  • Semantic owner and earliest changed stage: JADX bridge producer, followed by Android protocol validation and result mapping.
  • Contribution scope fit and linked maintainer decision: ordinary static cross-reference improvement within the existing JADX provider; a separate scope decision is not applicable.
  • CLI and MCP/tool-catalog contract: additive dex_descriptor and direct_invokes fields, with the same result through both adapters; no new tool.
  • Provider, bridge, target-format, or platform compatibility: fixed JADX 0.7.1 bridge; DEX offsets are code units and may be unavailable when producer evidence is absent.
  • Evidence and provenance: retain method-level usage counts and exact instruction facts without presenting them as runtime calls.
  • Authority and cleanup: existing local APK/JAR reads, Java bridge process and private workspace; no added target execution or mutation.
  • Generated metadata and package impact: Android documentation and contracts updated; no additional packaged binary.

Known workflow effects: reads the selected APK and supplied JADX JAR, runs the existing local Java bridge, and uses its private temporary workspace. It does not run APK code or contact a target service.

Evidence and regression coverage

The controlled fixture now returns one using method with two direct invoke offsets, 0 and 3, for fixture.Caller.twice()V. Tests cover overload identity, malformed producer values, single/multi-DEX source identity, CLI/MCP parity, and unchanged APK bytes. These are static observations; runtime call counts remain unknown. The regression would fail on the base revision because direct_invokes and the exact descriptor were absent.

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity and source provenance remain preserved.
  • Unsupported or incomplete instruction evidence remains visible.

Validation performed

  • On the standalone Android branch at 37b7550: npm run build:cached and the full real Android/JADX lane passed with JDK 21, fixed JADX 0.7.1 JAR and public ApiDemos APK. Single/multi-DEX offsets, overload identity, CLI/MCP parity and APK hash checks passed.
  • On the combined branch at 37b7550: npm run check, npm run docs:check, npm run verify:test-discovery, 16 relevant Vitest tests and the full real Android and Chrome lanes passed.
  • The branch was rebased without conflict onto 4773c15; npm run check passed on the combined branch at that base. The four intervening upstream commits did not change the Android invoke files.

Compatibility, safety, and release

  • Breaking changes or migration steps: none intended; new fields are additive.
  • Real-provider coverage: Windows/JDK 21/JADX 0.7.1/public APK. Linux, macOS and other JADX versions were not run here.
  • Security/privacy: no vulnerability claim or target execution; retain artifact provenance and private-workspace cleanup behavior.

Before merge

  • Concrete reproduced analyst problem and one focused outcome.
  • Scope and authority reviewed against CONTRIBUTING.md.
  • No issue linked; controlled fixture and expected behavior are described above.
  • Tests cover observable behavior and malformed/partial evidence.
  • Owning documentation and contracts updated.
  • CLI/MCP output represented by the fixture example above.
  • Diff checked for secrets, unrelated cleanup and unsupported claims.

🔄 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/2439 **Author:** [@LcokHcak](https://github.com/LcokHcak) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/rea-android-invokes` --- ### 📝 Commits (3) - [`b6220ed`](https://github.com/morluto/rea/commit/b6220ede304527a7b40fbb3702799ebcd94c1dbd) feat(android): expose precise method references and DEX invoke sites - [`d17dee5`](https://github.com/morluto/rea/commit/d17dee591db6e3687c9833b3fc477a98f900a33d) fix(android): bound invoke evidence without losing reference inventory - [`a4a9e5d`](https://github.com/morluto/rea/commit/a4a9e5db1a2f6c3eede5cd51840808dc02c5f8c2) perf(android): skip invoke admission for class references ### 📊 Changes **17 files changed** (+870 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `bridge/android/ReaJadxBridge.java` (+107 -9) 📝 `docs/android-analysis.md` (+29 -7) 📝 `scripts/verify/android/analysis.mjs` (+45 -1) ➕ `scripts/verify/android/direct-invokes.mjs` (+112 -0) 📝 `scripts/verify/android/metadata.mjs` (+25 -0) 📝 `src/android/JadxAnalysis.ts` (+32 -7) 📝 `src/android/JadxProtocol.ts` (+16 -0) 📝 `src/android/JadxRelease.ts` (+2 -1) 📝 `src/cli/androidCommands.ts` (+12 -2) 📝 `src/contracts/android/androidToolContracts.ts` (+3 -3) 📝 `src/domain/android/androidAnalysis.ts` (+35 -2) ➕ `tests/boundary/android/JadxAnalysis.test.ts` (+304 -0) 📝 `tests/boundary/process/jadxIntegration.test.ts` (+16 -3) 📝 `tests/conformance/android/ReaJadxMetadataRegression.java` (+104 -2) ➕ `tests/fixtures/android/direct-invokes/Caller.smali` (+9 -0) ➕ `tests/fixtures/android/direct-invokes/Target.smali` (+7 -0) 📝 `tests/fixtures/android/jadx-mcp.mjs` (+12 -1) </details> ### 📄 Description ## Summary Expose exact DEX method descriptors and individual direct `invoke-*` sites in Android reference results. This lets an analyst distinguish a method that uses a target from each call instruction inside that method. ## Problem and expected behavior In the included two-invoke fixture, `fixture.Caller.twice()` calls `fixture.Target.mark()` twice. JADX `getUseIn()` reports one using method, so REA previously returned `total: 1` with no instruction location. The result looked complete at method granularity but could not answer how many direct calls existed or where they occurred. ## Change and scope The JADX bridge now provides the DEX descriptor and direct invoke instruction data when the producer can match them. The Android adapter validates and carries the source method identity, DEX entry, code-unit offset, method index and opcode through the domain result and both CLI/MCP paths. `total` and `reference_unit: "using_node"` keep their existing meaning; `direct_invokes` is separate instruction evidence. No APK is executed and no new provider is introduced. No issue is linked because this was reproduced with a controlled repository fixture. ## Contract and boundary impact - Semantic owner and earliest changed stage: JADX bridge producer, followed by Android protocol validation and result mapping. - Contribution scope fit and linked maintainer decision: ordinary static cross-reference improvement within the existing JADX provider; a separate scope decision is not applicable. - CLI and MCP/tool-catalog contract: additive `dex_descriptor` and `direct_invokes` fields, with the same result through both adapters; no new tool. - Provider, bridge, target-format, or platform compatibility: fixed JADX 0.7.1 bridge; DEX offsets are code units and may be unavailable when producer evidence is absent. - Evidence and provenance: retain method-level usage counts and exact instruction facts without presenting them as runtime calls. - Authority and cleanup: existing local APK/JAR reads, Java bridge process and private workspace; no added target execution or mutation. - Generated metadata and package impact: Android documentation and contracts updated; no additional packaged binary. Known workflow effects: reads the selected APK and supplied JADX JAR, runs the existing local Java bridge, and uses its private temporary workspace. It does not run APK code or contact a target service. ## Evidence and regression coverage The controlled fixture now returns one using method with two direct invoke offsets, `0` and `3`, for `fixture.Caller.twice()V`. Tests cover overload identity, malformed producer values, single/multi-DEX source identity, CLI/MCP parity, and unchanged APK bytes. These are static observations; runtime call counts remain unknown. The regression would fail on the base revision because `direct_invokes` and the exact descriptor were absent. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity and source provenance remain preserved. - [x] Unsupported or incomplete instruction evidence remains visible. ## Validation performed - On the standalone Android branch at `37b7550`: `npm run build:cached` and the full real Android/JADX lane passed with JDK 21, fixed JADX 0.7.1 JAR and public ApiDemos APK. Single/multi-DEX offsets, overload identity, CLI/MCP parity and APK hash checks passed. - On the combined branch at `37b7550`: `npm run check`, `npm run docs:check`, `npm run verify:test-discovery`, 16 relevant Vitest tests and the full real Android and Chrome lanes passed. - The branch was rebased without conflict onto `4773c15`; `npm run check` passed on the combined branch at that base. The four intervening upstream commits did not change the Android invoke files. ## Compatibility, safety, and release - Breaking changes or migration steps: none intended; new fields are additive. - Real-provider coverage: Windows/JDK 21/JADX 0.7.1/public APK. Linux, macOS and other JADX versions were not run here. - Security/privacy: no vulnerability claim or target execution; retain artifact provenance and private-workspace cleanup behavior. ## Before merge - [x] Concrete reproduced analyst problem and one focused outcome. - [x] Scope and authority reviewed against `CONTRIBUTING.md`. - [x] No issue linked; controlled fixture and expected behavior are described above. - [x] Tests cover observable behavior and malformed/partial evidence. - [x] Owning documentation and contracts updated. - [x] CLI/MCP output represented by the fixture example above. - [x] Diff checked for secrets, unrelated cleanup and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:05: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#5232
No description provided.