Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
106f260d18 | ||
|
|
7b2087e449 |
No files matched your search
@@ -322,11 +322,7 @@ does not emit a `changed_from` edge; its pairing and uncertainty remain in the i
|
||||
|
||||
One-sided absence is `added` or `removed` only when the opposite input graph has
|
||||
complete coverage. With partial, unavailable, or truncated input, the same
|
||||
condition is `unknown`. A one-sided node whose observations are all
|
||||
`unavailable`, such as an unselected or failed parse scope, records an analysis
|
||||
gap rather than an application entity; it stays `unknown` with its
|
||||
`availability` and `coverage` dimensions and the gap's limitations, whatever
|
||||
the opposite coverage. The comparison retains every classified item and
|
||||
condition is `unknown`. The comparison retains every classified item and
|
||||
ambiguity candidate. Coverage carries omitted counts and limits from each input
|
||||
graph; comparison adds no caller-selected item, candidate, graph node, or edge
|
||||
budget. Unresolved comparison items are recorded as a residual unknown linked
|
||||
|
||||
@@ -220,17 +220,6 @@ const leftOnlyItem = (
|
||||
dimensions: ["availability"],
|
||||
limitations: [AMBIGUOUS_MATCH_LIMITATION],
|
||||
});
|
||||
const unavailable = unavailableAnalysisLimitations(node);
|
||||
if (unavailable !== undefined)
|
||||
return itemWithId({
|
||||
...common,
|
||||
status: "unknown",
|
||||
match: unmatchedMatch(),
|
||||
dimensions: ["availability", "coverage"],
|
||||
limitations: unavailable,
|
||||
left_node_id: node.node_id,
|
||||
right_node_id: null,
|
||||
});
|
||||
const absenceObserved = absenceClaimable(context.rightGraph.coverage);
|
||||
return itemWithId({
|
||||
...common,
|
||||
@@ -271,17 +260,6 @@ const rightOnlyItem = (
|
||||
dimensions: ["availability"],
|
||||
limitations: [AMBIGUOUS_MATCH_LIMITATION],
|
||||
});
|
||||
const unavailable = unavailableAnalysisLimitations(node);
|
||||
if (unavailable !== undefined)
|
||||
return itemWithId({
|
||||
...common,
|
||||
status: "unknown",
|
||||
match: unmatchedMatch(),
|
||||
dimensions: ["availability", "coverage"],
|
||||
limitations: unavailable,
|
||||
left_node_id: null,
|
||||
right_node_id: node.node_id,
|
||||
});
|
||||
const absenceObserved = absenceClaimable(context.leftGraph.coverage);
|
||||
return itemWithId({
|
||||
...common,
|
||||
@@ -296,23 +274,6 @@ const rightOnlyItem = (
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* An unmatched node whose every observation is unavailable is the producer's
|
||||
* marker for an analysis gap, not a positive application entity, so its
|
||||
* presence on one side cannot establish an addition or removal.
|
||||
*/
|
||||
const unavailableAnalysisLimitations = (
|
||||
node: ApplicationNode,
|
||||
): string[] | undefined =>
|
||||
node.observations.every(({ evidence }) => evidence.state === "unavailable")
|
||||
? [
|
||||
...new Set([
|
||||
UNAVAILABLE_ANALYSIS_LIMITATION,
|
||||
...node.observations.flatMap(({ evidence }) => evidence.limitations),
|
||||
]),
|
||||
]
|
||||
: undefined;
|
||||
|
||||
const matchedMatch = (
|
||||
pair: ApplicationVersionNodePair,
|
||||
): Extract<
|
||||
@@ -367,9 +328,6 @@ const unmatchedMatch = (): Extract<
|
||||
|
||||
const AMBIGUOUS_MATCH_LIMITATION =
|
||||
"Multiple nodes share the same permitted match key; no cross-version pair was selected.";
|
||||
const UNAVAILABLE_ANALYSIS_LIMITATION =
|
||||
"This node records unavailable analysis on one side, so its absence from the other side is not an addition or removal.";
|
||||
|
||||
const INCOMPLETE_GRAPH_LIMITATION =
|
||||
"The opposite graph is incomplete, so an unmatched node cannot be classified as added or removed.";
|
||||
|
||||
|
||||
@@ -38,7 +38,12 @@ export const classifySwiftSymbol = (
|
||||
let category: SwiftTypeCategory | null = null;
|
||||
for (;;) {
|
||||
const end = identifierEnd(mangling, offset);
|
||||
if (end === undefined) break;
|
||||
if (end === undefined) {
|
||||
// A word-substituted or punycode identifier (`0…`) may name a nested
|
||||
// type of any kind, so the enclosing nominal no longer decides it.
|
||||
if (mangling.charAt(offset) === "0") category = null;
|
||||
break;
|
||||
}
|
||||
const kind = mangling.charAt(end);
|
||||
const nominal = NOMINAL_CATEGORIES.get(kind);
|
||||
if (nominal === undefined) {
|
||||
|
||||
@@ -28,6 +28,10 @@ describe("modern Swift category evidence", () => {
|
||||
"$sSi4mainE7doubledSiyF",
|
||||
"$s9999999999999999999999BadVMa",
|
||||
"$s4main04PairVMa",
|
||||
// Nested types named by punycode identifiers inside struct Envelope.
|
||||
"_$s6Nested8EnvelopeV007IhuqBAbO8describeSSyF",
|
||||
"_$s6Nested8EnvelopeV007jvrtDBlCAEycfC",
|
||||
"_$s6Nested8EnvelopeV007jvrtDBlCMa",
|
||||
];
|
||||
const result = categorizeSwiftTypes(
|
||||
names.map((name, index) => ({ address: String(index), name })),
|
||||
@@ -52,6 +56,16 @@ describe("modern Swift category evidence", () => {
|
||||
).toMatchObject({ total: 0, unclassified: [] });
|
||||
});
|
||||
|
||||
it("keeps a nested punycode class unresolved under a class filter", () => {
|
||||
const name = "_$s6Nested8EnvelopeV007jvrtDBlCMa";
|
||||
expect(
|
||||
categorizeSwiftTypes([{ address: "0x1", name }], { category: "classes" }),
|
||||
).toMatchObject({
|
||||
total: 0,
|
||||
unclassified: [{ name, reason: "category_not_decoded" }],
|
||||
});
|
||||
});
|
||||
|
||||
it("deduplicates display names after selecting a category", () => {
|
||||
expect(
|
||||
categorizeSwiftTypes(
|
||||
|
||||
@@ -347,91 +347,3 @@ cliTest(
|
||||
).toBe(true);
|
||||
},
|
||||
);
|
||||
|
||||
cliTest(
|
||||
"keeps unselected source scopes unknown while genuine additions remain added",
|
||||
async ({ cli }) => {
|
||||
const root = await createTestTempDirectory("rea-version-unselected-");
|
||||
const write = async (name: string, files: Record<string, string>) => {
|
||||
const directory = join(root, name);
|
||||
await mkdir(directory);
|
||||
for (const [path, text] of Object.entries(files))
|
||||
await writeFile(join(directory, path), text);
|
||||
return directory;
|
||||
};
|
||||
const lib = "export function shared() {\n return 1;\n}\n";
|
||||
const main = 'export const name = "one";\n';
|
||||
const full = await write("full", { "lib.js": lib, "main.js": main });
|
||||
const copy = await write("copy", { "lib.js": lib, "main.js": main });
|
||||
const mainOnly = await write("main-only", { "main.js": main });
|
||||
const analyze = async (directory: string, ...selection: string[]) => {
|
||||
const response = await cli.run({
|
||||
arguments: [
|
||||
"analyze-javascript-application",
|
||||
directory,
|
||||
...selection,
|
||||
"--json",
|
||||
],
|
||||
environment: { REA_LOG_LEVEL: "silent" },
|
||||
});
|
||||
expect(response.exitCode, response.stderr).toBe(0);
|
||||
return parseEvidence(response.json);
|
||||
};
|
||||
const compare = async (name: string, left: unknown, right: unknown) => {
|
||||
const input = join(root, `${name}.json`);
|
||||
await writeFile(input, JSON.stringify({ left, right }));
|
||||
const response = await cli.run({
|
||||
arguments: ["compare-application-versions", input, "--json"],
|
||||
environment: { REA_LOG_LEVEL: "silent" },
|
||||
});
|
||||
expect(response.exitCode, response.stderr).toBe(0);
|
||||
return applicationVersionComparisonResultSchema.parse(
|
||||
parseEvidence(response.json).normalized_result,
|
||||
);
|
||||
};
|
||||
const complete = await analyze(full);
|
||||
const selected = await analyze(full, "--source-path", "main.js");
|
||||
const scope = javascriptApplicationAnalysisResultSchema
|
||||
.parse(selected.normalized_result)
|
||||
.graph.nodes.find((node) =>
|
||||
node.observations.some(
|
||||
({ properties }) =>
|
||||
properties.path === "lib.js" &&
|
||||
properties.operation === "select-javascript-sources",
|
||||
),
|
||||
);
|
||||
if (scope === undefined) throw new Error("Missing unselected scope");
|
||||
|
||||
for (const [name, left, right, side] of [
|
||||
["forward", complete, selected, "right_node_id"],
|
||||
["reverse", selected, complete, "left_node_id"],
|
||||
] as const) {
|
||||
const result = await compare(name, left, right);
|
||||
expect(result.summary).toMatchObject({ added: 0, removed: 0 });
|
||||
const item = result.items.find((value) => value[side] === scope.node_id);
|
||||
expect(item).toMatchObject({
|
||||
status: "unknown",
|
||||
node_kind: "unknown",
|
||||
dimensions: ["availability", "coverage"],
|
||||
});
|
||||
expect(item?.limitations).toContain(
|
||||
"Source is outside the caller-selected source_paths; it was inventoried but not analyzed.",
|
||||
);
|
||||
}
|
||||
|
||||
const control = await compare("control", complete, await analyze(copy));
|
||||
expect(control.summary).toMatchObject({
|
||||
added: 0,
|
||||
removed: 0,
|
||||
changed: 0,
|
||||
unknown: 0,
|
||||
});
|
||||
const growth = await compare("growth", await analyze(mainOnly), complete);
|
||||
expect(growth.items).toContainEqual(
|
||||
expect.objectContaining({
|
||||
status: "added",
|
||||
node_kind: "javascript-asset",
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -176,7 +176,13 @@ it.each(["caller", "host"] as const)(
|
||||
);
|
||||
let closing: ReturnType<NonNullable<typeof host.close>> | undefined;
|
||||
try {
|
||||
await expect.poll(async () => (await fakeKunaCalls(kuna)).length).toBe(1);
|
||||
// The preceding Ghidra probe may prepare Darwin process ownership before
|
||||
// Kuna starts; keep startup separate from the bounded post-abort join.
|
||||
await expect
|
||||
.poll(async () => (await fakeKunaCalls(kuna)).length, {
|
||||
timeout: 10_000,
|
||||
})
|
||||
.toBe(1);
|
||||
const probe = (await fakeKunaCalls(kuna))[0];
|
||||
if (probe === undefined) throw new Error("Missing Kuna version probe");
|
||||
expect(probe.argv).toEqual(["--version"]);
|
||||
|
||||
Reference in new issue
Block a user