mirror of
https://github.com/morluto/rea.git
synced 2026-10-19 04:19:54 -05:00
perf(android): filter class pages before bridge serialization (#4791)
Filter class names at the native owner before serialization, and resume matching pages through contiguous inventory positions without a second index or query-result cache. Preserve selected source Evidence, query identity, complete top-level coverage and shared CLI/MCP behavior. Fixes #4776. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
16 files changed
+361
-73
No files matched your search
@@ -12,6 +12,7 @@ import { JADX_RELEASE } from "../../../dist/android/JadxRelease.js";
|
||||
import fixture from "../../fixtures/android/apidemos.json" with { type: "json" };
|
||||
import { verifyAndroidCliCancellation } from "./cli-cancellation.mjs";
|
||||
import { verifyAndroidMetadata } from "./metadata.mjs";
|
||||
import { verifyAndroidClassSearch } from "./class-search.mjs";
|
||||
import { verifyAndroidFailureRecovery } from "./failure-recovery.mjs";
|
||||
import {
|
||||
resolveJadxConfigurationInputs,
|
||||
@@ -217,6 +218,7 @@ try {
|
||||
overloadedEvidence.normalized_result,
|
||||
);
|
||||
console.log("PASS real overloaded method references through CLI/MCP");
|
||||
await verifyAndroidClassSearch({ client, path, sha256: fixture.sha256 });
|
||||
} catch (cause) {
|
||||
process.stderr.write(stderr);
|
||||
throw cause;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { parseEvidence } from "../../../dist/domain/evidence.js";
|
||||
import { requireMcpOperationResult } from "../../lib/mcp-verifier-results.mjs";
|
||||
|
||||
/** Compare native selection with an explicit full-inventory oracle on one live session. */
|
||||
export const verifyAndroidClassSearch = async ({ client, path, sha256 }) => {
|
||||
const search = async (query) => {
|
||||
const response = await client.callTool(
|
||||
{ name: "search_android_classes", arguments: { path, query } },
|
||||
{ timeout: 150_000 },
|
||||
);
|
||||
const result = requireMcpOperationResult(
|
||||
response,
|
||||
"search_android_classes",
|
||||
);
|
||||
const evidence = parseEvidence(response.structuredContent);
|
||||
assert.equal(evidence.subject.digest.sha256, sha256);
|
||||
assert.equal(evidence.parameters.query, query);
|
||||
assert.equal(result.query, query);
|
||||
return result;
|
||||
};
|
||||
const full = await search("");
|
||||
assert.equal(full.matches.length, full.total_classes);
|
||||
for (const query of [
|
||||
"ApiDemos",
|
||||
"apidemos",
|
||||
"[.*]",
|
||||
"😀",
|
||||
"日本語",
|
||||
"\0",
|
||||
"\ud800",
|
||||
"\udc00",
|
||||
]) {
|
||||
const selected = await search(query);
|
||||
assert.equal(selected.coverage, "complete");
|
||||
assert.equal(selected.total_classes, full.total_classes);
|
||||
assert.deepEqual(
|
||||
selected.matches,
|
||||
full.matches.filter((name) => name.includes(query)),
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
"PASS native class search matches full inventory, including literal and UTF-16 selectors",
|
||||
);
|
||||
};
|
||||
@@ -69,6 +69,10 @@ export const verifyAndroidMetadata = async ({
|
||||
result.stdout,
|
||||
/METADATA_REGRESSION_PASS classes=\d+ overloads=3/u,
|
||||
);
|
||||
assert.match(
|
||||
result.stdout,
|
||||
/CLASS_SEARCH_REGRESSION_PASS pages=\d+ nonzero=true/u,
|
||||
);
|
||||
assert.match(
|
||||
result.stdout,
|
||||
/INITIALIZER_REGRESSION_PASS folded=2 bounded=true/u,
|
||||
@@ -80,6 +84,9 @@ export const verifyAndroidMetadata = async ({
|
||||
console.log(
|
||||
"PASS real cold metadata, full generic types and stable overloaded method selection",
|
||||
);
|
||||
console.log(
|
||||
"PASS real Java filtered pages, nonzero inventory cursors and complete combined results",
|
||||
);
|
||||
console.log(
|
||||
"PASS real folded and mixed static initializers, absent bodies and bounded smali",
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user