Skip to content

feat(android): expose exact DEX descriptors and direct invoke sites - #2439

Merged
morluto merged 3 commits into
morluto:mainfrom
LcokHcak:codex/rea-android-invokes
Oct 13, 2026
Merged

morluto merged 3 commits into
morluto:mainfrom
LcokHcak:codex/rea-android-invokes

Conversation

@LcokHcak

Copy link
Copy Markdown
Contributor

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the follow-up fixes the remaining class-query overhead.

Summary

The PR adds exact DEX method prototypes and direct invoke locations while keeping reference totals at the using-node level.

  • Reference results show the direct DEX invoke sites inside each using method.
  • Method reference queries identify the selected overload and its DEX prototype.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Selected APK] --> B[JADX bridge]
  B --> C[Method prototypes]
  B --> D[Using-node inventory]
  D --> E[Byte-bounded direct invoke evidence]
  C --> F[Android adapter checks]
  E --> F
  F --> G[CLI result]
  F --> H[MCP result]
Loading

Reviews (3) · Last reviewed commit: "perf(android): skip invoke admission for..." · Reviewed by Greptile

Comment thread bridge/android/ReaJadxBridge.java Resolved
Comment thread bridge/android/ReaJadxBridge.java Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

Invoke evidence now shares a byte budget derived from the existing 8 MiB local transport frame, reserving the fixed JSON-RPC envelope and accounting for the nested JSON string escaping. Each site is admitted before retaining it, with a conservative expansion bound checked before serialization. All using nodes remain in the response; direct_invokes_exhaustive=false explicitly marks omitted instruction sites, while null means the producer did not establish instruction coverage. This marker is carried through protocol validation, application mapping, domain schema and documentation. No completed-task performance or real JADX verification is claimed for this source-only update.

Source inspected at d17dee5; git diff --check passed. Tests, builds, source checks and CI reruns were skipped at the user's explicit request. No passing runtime/provider verification is claimed for this update.

  1. thread 1

The named trace_android_references contract now distinguishes the containing node dex_offset (still unknown) from direct_invokes DEX code-unit instruction offsets. It also documents the independent direct_invokes_exhaustive coverage marker and preserves using-node totals rather than implying runtime call counts.

Source inspected at d17dee5; git diff --check passed. Tests, builds, source checks and CI reruns were skipped at the user's explicit request. No passing runtime/provider verification is claimed for this update.

  1. thread 1

Added production-adapter boundary cases for malformed DEX descriptors, negative instruction offsets and a missing invoke-site field. Additional cases preserve omitted direct_invokes as null versus an observed empty array, and check that bounded instruction coverage remains separate from complete using-node coverage. These new tests were not run because the user explicitly stopped testing.

Source inspected at d17dee5; git diff --check passed. Tests, builds, source checks and CI reruns were skipped at the user's explicit request. No passing runtime/provider verification is claimed for this update.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

Source fix: a4a9e5db1a2f6c3eede5cd51840808dc02c5f8c2.

Invoke-budget admission was created unconditionally even though class-reference queries have no selected method and never collect invoke sites. Budget creation and its loop now share the targetInfo != null owner boundary. Class queries go directly to their existing final JSON serialization; method queries keep the same escaped-byte admission and completeness markers, and the redundant per-iteration target check is removed.

Source inspection followed class/method selection, marker initialization, budget use, and final response serialization. No schema or evidence fields changed, and no additional downstream workaround remains. Tests, typechecks, builds, lint, JADX/provider workloads, and CI reruns were not run, as explicitly requested; performance was not measured.

@morluto
morluto merged commit c45d912 into morluto:main Oct 13, 2026
3 checks passed
morluto added a commit to junsidon/rea that referenced this pull request Oct 13, 2026
Keep direct_invokes_exhaustive normalization in the Android result contract so its parsed output is JSON-safe. Omitted or explicitly undefined provider coverage becomes null, while false and true remain distinct. Preserve the exact DEX descriptor and direct-invoke evidence introduced by PR morluto#2439.

Backports the Android-only part of main commit 6e25cc3 for older PR branches. Captured main already contains this behavior. Tests, checks, builds, typechecks, lint and CI reruns were intentionally skipped at user request; inspected the producing protocol, adapter mapping and named result contract.

Co-authored-by: LcokHcak <[email protected]>
(cherry picked from commit 9a3b410)
morluto added a commit to yasshmittal/rea that referenced this pull request Oct 13, 2026
Keep direct_invokes_exhaustive normalization in the Android result contract so its parsed output is JSON-safe. Omitted or explicitly undefined provider coverage becomes null, while false and true remain distinct. Preserve the exact DEX descriptor and direct-invoke evidence introduced by PR morluto#2439.

Backports the Android-only part of main commit 6e25cc3 for older PR branches. Captured main already contains this behavior. Tests, checks, builds, typechecks, lint and CI reruns were intentionally skipped at user request; inspected the producing protocol, adapter mapping and named result contract.

Co-authored-by: LcokHcak <[email protected]>
morluto added a commit to yasshmittal/rea that referenced this pull request Oct 13, 2026
Keep direct_invokes_exhaustive normalization in the Android result contract so its parsed output is JSON-safe. Omitted or explicitly undefined provider coverage becomes null, while false and true remain distinct. Preserve the exact DEX descriptor and direct-invoke evidence introduced by PR morluto#2439.

Backports the Android-only part of main commit 6e25cc3 for older PR branches. Captured main already contains this behavior. Tests, checks, builds, typechecks, lint and CI reruns were intentionally skipped at user request; inspected the producing protocol, adapter mapping and named result contract.

Co-authored-by: LcokHcak <[email protected]>
@morluto morluto added the enhancement New feature or request label Oct 14, 2026
@morluto morluto mentioned this pull request Oct 14, 2026
3 tasks done
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants