mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 05:02:40 +00:00
* fix(native): keep unreported value-flow truncation and archive decode coverage unknown * test(verify): count multiline optional-fact defaults and pin the guard's exclusions * fix(domain): keep unknown counts and costs unknown in comparison and coverage summaries (#11325) * fix(domain): keep unknown counts and costs unknown in comparison and coverage summaries * refactor(verify): exempt legitimate optional-fact defaults with a reasoned marker (#11355) * refactor(verify): exempt legitimate optional-fact defaults with a reasoned marker The optional-fact-default guard counted request defaults and absence that is modelled elsewhere as hidden unknowns. A comment `// optional-fact-default: <reason>` on the default's line or the line before now exempts it; the guard reads unstripped source for the marker and ignores matches inside comment lines. Marked: the two evidence paging offsets and four Swift literal reads whose absence swiftLiteralCoverage reports. Removed instead of marked: jsdiff 9 types Change.count as required, so its two `?? 0` defaults were dead; the evidence link traversal now carries retained records, so it no longer re-looks them up behind `?? []`. Baseline 31 -> 22. * fix(verify): blank comment spans instead of skipping comment-led lines in the optional-fact guard Skipping a match whose line starts like a comment hid live code after a leading block comment and counted defaults inside a block comment without leading stars. The counter now blanks comment text (keeping offsets and line breaks, skipping string literals) and matches the blanked code, while exemption markers are still read from the original lines. * refactor(domain): mark optional-fact defaults whose absence is not an observation (#11389) * refactor(domain): mark optional-fact defaults whose absence is not an observation Per-site review of the remaining optional-fact-default entries. Each marked default is a caller option (trace ignore_fields, environment rules), a list whose producer omits the empty case (unknown_size_frames, the schema's min-1 representation_node_ids), caveat text whose completeness another field carries (call diagnostics, unresolved calls, semantic resource limits), or absence that already turns the result unknown (Wasm interface inventory, WebMCP discovery, managed ExportedType rows, legacy integrity mismatch IDs). Left counted: webCaptureDiff redirects (2; the CDP producer always records them, so absence is a legacy record that should compare as unknown, not as no redirects) and HopperCallerReconciliation (2; index-miss semantics not yet verified). Baseline 22 -> 4. * fix(browser): compare redirects as unknown when a capture predates redirect recording (#11402) * fix(browser): compare redirects as unknown when a capture predates redirect recording The CDP producer records every request's redirect chain, empty when there was none; a record without one predates redirect recording (#986). Comparing it against a current capture reported the network dimension as unchanged, treating the missing chain as "no redirects". Redirects are now compared only when both captures recorded them, and the network dimension is otherwise unknown with a reason; proven membership changes are still reported. * refactor(hopper): interpret a caller-index miss once at the lookup (#11403) The forward index holds observations from the examined procedures only, and relationship coverage stays unknown with the scan facts as its reason. A miss therefore adds no callers without showing there are none; the lookup now says so once instead of four optional reads defaulting at each site. The optional-fact-default baseline is now empty. * docs(javascript): state why an omitted representation list adds no nodes * fix(verify): count optional-fact defaults from parsed TypeScript, not comment-blanked text The guard blanked comments with a hand-written scanner and matched a regular expression on the rest, so a default quoted in a string counted and a regular expression holding /* hid the code after it. It now walks the TypeScript syntax tree for property reads defaulted with ?? 0, ?? [] or ?? false, and reads exemption markers only from comment trivia. * fix(verify): tokenize optional-fact defaults without a compiler and count chained defaults * fix(verify): match whole optional-fact default expressions across calls and operators * fix(verify): count optional-fact defaults in template substitutions and after postfix updates, and tie markers to their own expression * refactor(verify): exempt generation and sample caps from the constant-maximum-slice guard by reason marker (#11454) * refactor(verify): exempt generation and sample caps from the constant-maximum-slice guard by reason marker * fix(verify): read reason markers only from real line comments * fix(verify): read reason markers from the shared source tokenizer * fix(verify): read a regular expression after a control head as a statement start The shared tokenizer treated every closing parenthesis as the end of an operand, so in `if (ready) /[/*]/.test(v)` it read `/[` as division and `/*` inside the regex as a block comment, hiding the rest of the file from the marker-aware guards. Parentheses are now tracked: the `)` closing an if/while/for/with head allows a regular expression, while a call's `)` still means division. * fix(verify): keep a keyword-named member call out of control-head detection `policy.if(ready) / (…)` was read as an if-statement head, so the division was taken for a regular expression and the denominator's optional-fact default was not counted. A control keyword after `.` or `?.` is a member call. * refactor(verify): exempt budget-arithmetic cursors and tallies by a not-an-allowance marker (#11493) * refactor(verify): exempt budget-arithmetic cursors and tallies by a not-an-allowance marker The budget-arithmetic guard cannot tell a scan cursor, an observed total, a string being assembled or a tail buffer's retained length from an allowance when each is compared with a limit. A field declaration marked `// not-an-allowance: <reason>` (read through the shared reason-marker scan) is no longer counted. The four remaining sites carry a marker, so the baseline is empty and removed. * refactor(verify): exempt detail levels, lifecycle states and domain vocabularies from the completeness-enum guard by reason marker (#11510) A zod enum containing "complete" is counted as a local coverage vocabulary. Eleven are not coverage: a caller-chosen detail level, how far a command or session ran, and format states (GPU decode depth, WASM name section, SQLite column details). They now carry `// detail-level:`, `// lifecycle-state:` or `// domain-vocabulary:` with a reason, read through the shared reason-marker scan (which gains an optional predicate for the matches a guard counts). local-completeness-enum: 22 -> 11 on this branch. * fix(verify): bind a not-an-allowance marker to its own class field Exemptions were a file-wide set of names, so a marked tally in one class hid an unmarked allowance with the same name in another, and a marked object property could exempt a class field. Markers now exempt only a member declaration (at class member depth) of the top-level class that contains it, and the named- allowance count is taken per class so the same scoping applies to it. * fix(artifacts): keep main's resources import in the Deno standalone reader after merging main * fix(verify): start an expression after a template substitution and a non-member keyword, and accept any marker reason The shared tokenizer read the `/` after `${` as division, so a regular expression holding `/*` in a substitution hid the rest of the file from every tokenizer-based guard, and it treated property names such as `row.return` as keywords. Tokens now record whether template text opens a substitution and whether a name is an expression keyword (not after `.` or `?.`), and the regular-expression rule and the optional-fact-default operand rule read those facts. The optional-fact-default guard reads markers through reason-marker's isReasonMarker, so any non-empty reason exempts, as for the other reason markers. * fix(verify): blank comments with the shared tokenizer before matching architecture guards (#11573) * fix(verify): blank comments with the shared tokenizer before matching architecture guards The guards stripped comments with a regular expression that took a `/*` inside a string, template or regular expression for a comment opener and deleted code up to the next `*/`. src/flutter/FlutterBuildProvider.ts's "lib/*/libapp.so" text hid four --pool-policy remediation strings from cli-option-text-outside-cli. blankComments in source-tokens.mjs now owns comment removal for the architecture guards and the reason-marker scan: it blanks comment tokens in place (newlines kept) and keeps strings, templates and regular expressions. The scan behind it retains only the last tokens it reads, and whitespace runs are skipped at once. The cli-option-text-outside-cli baseline records FlutterBuildProvider.ts at its true count of 4; no other baseline changed. Fixes #11477 * fix(verify): read a regular expression after a statement block and keep comment offsets for wide characters The tokenizer now records whether each `{` opens a statement block or an object literal (from the token before it) and marks the `}` that closes a block, after which a statement, and so a regular expression, can start; an object literal's `}` still ends an operand. blankComments replaces each run of comment text with one space per UTF-16 unit, so a surrogate pair no longer shifts later offsets. * chore(verify): drop the Flutter CLI-text baseline entry now that main names no option there
479 lines
16 KiB
TypeScript
479 lines
16 KiB
TypeScript
import { z } from "zod";
|
|
import { coverageStatusSchema } from "../coverage.js";
|
|
|
|
import {
|
|
nativeMetadataEvidenceSchema,
|
|
nativeMetadataLocationSchema,
|
|
type ObjcSwiftMetadata,
|
|
} from "./objcSwiftMetadata.js";
|
|
import { jsonObjectSchema } from "../jsonValue.js";
|
|
|
|
/** Entity kinds shared by decoded Interface Builder archives and native code. */
|
|
export const nativeInvestigationNodeKindSchema = z.enum([
|
|
"storyboard",
|
|
"scene",
|
|
"view_controller",
|
|
"view",
|
|
"control",
|
|
"constraint",
|
|
"layout_guide",
|
|
"resource",
|
|
"placeholder",
|
|
"external_object",
|
|
"outlet",
|
|
"action",
|
|
"segue",
|
|
"objc_class",
|
|
"objc_selector",
|
|
"swift_declaration",
|
|
"swift_requirement",
|
|
"dispatch_table",
|
|
"dispatch_slot",
|
|
"thunk",
|
|
"function",
|
|
"state_value",
|
|
"global_value",
|
|
"field",
|
|
"branch_condition",
|
|
"sink",
|
|
"unknown",
|
|
]);
|
|
|
|
/** One UI, dispatch, or value entity with optional decoded source location. */
|
|
export const nativeInvestigationNodeSchema = z.strictObject({
|
|
id: z.string().min(1),
|
|
kind: nativeInvestigationNodeKindSchema,
|
|
name: z.string().min(1),
|
|
location: nativeMetadataLocationSchema.nullable(),
|
|
attributes: jsonObjectSchema,
|
|
evidence: z.array(nativeMetadataEvidenceSchema),
|
|
});
|
|
|
|
/** Relationship types preserve UI wiring, native dispatch, and value flow. */
|
|
export const nativeInvestigationRelationSchema = z.enum([
|
|
"contains",
|
|
"outlet_to",
|
|
"target_action",
|
|
"segue_to",
|
|
"objc_dispatch",
|
|
"swift_witness_dispatch",
|
|
"swift_vtable_dispatch",
|
|
"thunk_to",
|
|
"direct_call",
|
|
"indirect_call",
|
|
"provider_call",
|
|
"reads",
|
|
"writes",
|
|
"flows_to",
|
|
"controls",
|
|
]);
|
|
|
|
/** An observed, inferred, or unresolved relationship between entities. */
|
|
export const nativeInvestigationEdgeSchema = z.discriminatedUnion(
|
|
"resolution",
|
|
[
|
|
z.strictObject({
|
|
id: z.string().min(1),
|
|
from: z.string().min(1),
|
|
to: z.string().min(1),
|
|
relation: nativeInvestigationRelationSchema,
|
|
resolution: z.enum(["observed", "inferred", "resolved", "ambiguous"]),
|
|
evidence: z.array(nativeMetadataEvidenceSchema).min(1),
|
|
limitations: z.array(z.string()),
|
|
}),
|
|
z.strictObject({
|
|
id: z.string().min(1),
|
|
from: z.string().min(1),
|
|
to: z.null(),
|
|
relation: nativeInvestigationRelationSchema,
|
|
resolution: z.literal("unresolved"),
|
|
reason: z.string().min(1),
|
|
evidence: z.array(nativeMetadataEvidenceSchema),
|
|
limitations: z.array(z.string()),
|
|
}),
|
|
],
|
|
);
|
|
|
|
export type NativeInvestigationEdge = z.infer<
|
|
typeof nativeInvestigationEdgeSchema
|
|
>;
|
|
|
|
/** Explicit inventory coverage so missing graph parts are not read as absent. */
|
|
export const nativeInvestigationCoverageSchema = z.strictObject({
|
|
facet: z.string().min(1),
|
|
status: z
|
|
.enum([...coverageStatusSchema.options, "unsupported", "not_requested"])
|
|
.describe(
|
|
"unknown when the producer could not tell how much of the facet it covered; omitted is then null.",
|
|
),
|
|
reason: z.string().nullable(),
|
|
examined: z.int().nonnegative(),
|
|
omitted: z
|
|
.int()
|
|
.nonnegative()
|
|
.nullable()
|
|
.describe("Omitted items; null when the count is unknown."),
|
|
});
|
|
|
|
export const nativeInvestigationProviderSchema = z.strictObject({
|
|
id: z.string().min(1),
|
|
version: z.string().nullable(),
|
|
tool_version: z.string().min(1),
|
|
});
|
|
|
|
/** Complete provider-neutral graph bound to one immutable target identity. */
|
|
export const nativeInvestigationGraphSchema = z.strictObject({
|
|
target_sha256: z
|
|
.string()
|
|
.regex(/^[a-f0-9]{64}$/u)
|
|
.nullable(),
|
|
provider: nativeInvestigationProviderSchema,
|
|
nodes: z.array(nativeInvestigationNodeSchema),
|
|
edges: z.array(nativeInvestigationEdgeSchema),
|
|
coverage: z.array(nativeInvestigationCoverageSchema),
|
|
truncated: z.boolean(),
|
|
});
|
|
|
|
export type NativeInvestigationGraph = z.infer<
|
|
typeof nativeInvestigationGraphSchema
|
|
>;
|
|
|
|
/** Caller-controlled hard limits for a bounded relationship trace. */
|
|
export const nativeInvestigationTraceLimitsSchema = z.strictObject({
|
|
max_depth: z.int().min(0).max(32).default(8),
|
|
max_nodes: z.int().min(1).max(2000).default(250),
|
|
max_edges: z.int().min(1).max(5000).default(500),
|
|
});
|
|
|
|
export type NativeInvestigationTraceLimits = z.infer<
|
|
typeof nativeInvestigationTraceLimitsSchema
|
|
>;
|
|
|
|
/** Exact graph route and any unresolved edges encountered along the route. */
|
|
export const nativeInvestigationTraceSchema = z.strictObject({
|
|
target_sha256: z
|
|
.string()
|
|
.regex(/^[a-f0-9]{64}$/u)
|
|
.nullable(),
|
|
provider: nativeInvestigationProviderSchema,
|
|
start: z.string().min(1),
|
|
direction: z.enum(["forward", "backward"]),
|
|
nodes: z.array(nativeInvestigationNodeSchema),
|
|
edges: z.array(nativeInvestigationEdgeSchema),
|
|
unresolved: z.array(nativeInvestigationEdgeSchema),
|
|
reached_depth: z.int().nonnegative(),
|
|
truncated: z
|
|
.boolean()
|
|
.describe(
|
|
"The supplied graph was truncated or a local trace bound stopped traversal; source omissions remain unknown.",
|
|
),
|
|
reason: z
|
|
.string()
|
|
.nullable()
|
|
.describe(
|
|
"Local trace cutoff or missing start when observed; source_graph_truncated otherwise identifies an already truncated source. Source truncation is also retained in limitations when a local reason takes precedence.",
|
|
),
|
|
coverage: z.array(nativeInvestigationCoverageSchema),
|
|
limitations: z.array(z.string().min(1)),
|
|
});
|
|
|
|
export type NativeInvestigationTrace = z.infer<
|
|
typeof nativeInvestigationTraceSchema
|
|
>;
|
|
|
|
/** Trace known relationships while retaining unknown indirect dispatch edges. */
|
|
export const traceNativeInvestigationGraph = (
|
|
graph: NativeInvestigationGraph,
|
|
input: {
|
|
readonly start: string;
|
|
readonly direction?: "forward" | "backward";
|
|
readonly limits?: Partial<NativeInvestigationTraceLimits>;
|
|
},
|
|
): NativeInvestigationTrace => {
|
|
const sourceLimitations = graph.truncated
|
|
? [
|
|
"The supplied graph was truncated; relationships omitted from that source remain unknown.",
|
|
]
|
|
: [];
|
|
const start = graph.nodes.find(({ id }) => id === input.start);
|
|
if (start === undefined)
|
|
return {
|
|
target_sha256: graph.target_sha256,
|
|
provider: graph.provider,
|
|
start: input.start,
|
|
direction: input.direction ?? "forward",
|
|
nodes: [],
|
|
edges: [],
|
|
unresolved: [],
|
|
reached_depth: 0,
|
|
truncated: graph.truncated,
|
|
reason: "start_node_missing",
|
|
coverage: graph.coverage,
|
|
limitations: [
|
|
...sourceLimitations,
|
|
"The requested start node is absent from the supplied graph.",
|
|
],
|
|
};
|
|
|
|
const limits = nativeInvestigationTraceLimitsSchema.parse(input.limits ?? {});
|
|
const direction = input.direction ?? "forward";
|
|
const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));
|
|
const visited = new Set([start.id]);
|
|
const selectedEdges = new Map<string, NativeInvestigationEdge>();
|
|
const unresolved = new Map<string, NativeInvestigationEdge>();
|
|
const queue: Array<{ id: string; depth: number }> = [
|
|
{ id: start.id, depth: 0 },
|
|
];
|
|
let reachedDepth = 0;
|
|
let truncated = false;
|
|
let reason: string | null = null;
|
|
const adjacency = new Map<string, NativeInvestigationEdge[]>();
|
|
for (const edge of graph.edges) {
|
|
const nodeId = direction === "forward" ? edge.from : edge.to;
|
|
if (nodeId === null) continue;
|
|
const entries = adjacency.get(nodeId);
|
|
if (entries === undefined) adjacency.set(nodeId, [edge]);
|
|
else entries.push(edge);
|
|
}
|
|
|
|
while (queue.length > 0) {
|
|
const current = queue.shift();
|
|
if (current === undefined) break;
|
|
const adjacent = adjacency.get(current.id) ?? [];
|
|
|
|
for (const edge of adjacent) {
|
|
if (selectedEdges.size + unresolved.size >= limits.max_edges) {
|
|
truncated = true;
|
|
reason = "max_edges_reached";
|
|
break;
|
|
}
|
|
if (edge.resolution === "unresolved") {
|
|
unresolved.set(edge.id, edge);
|
|
continue;
|
|
}
|
|
const nextId = direction === "forward" ? edge.to : edge.from;
|
|
const alreadyVisited = visited.has(nextId);
|
|
if (!alreadyVisited && current.depth >= limits.max_depth) {
|
|
truncated = true;
|
|
reason ??= "max_depth_reached";
|
|
continue;
|
|
}
|
|
// Check destination capacity before retaining its edge. Otherwise the node
|
|
// bound leaves a resolved edge pointing outside the returned trace.
|
|
if (!alreadyVisited && visited.size >= limits.max_nodes) {
|
|
truncated = true;
|
|
reason = "max_nodes_reached";
|
|
break;
|
|
}
|
|
selectedEdges.set(edge.id, edge);
|
|
if (alreadyVisited) continue;
|
|
if (!nodeById.has(nextId)) {
|
|
truncated = true;
|
|
reason ??= "edge_target_missing_from_graph";
|
|
continue;
|
|
}
|
|
visited.add(nextId);
|
|
// A retained node has already been reached even if a later sibling
|
|
// exhausts a budget before this node is dequeued for expansion.
|
|
reachedDepth = Math.max(reachedDepth, current.depth + 1);
|
|
queue.push({ id: nextId, depth: current.depth + 1 });
|
|
}
|
|
if (reason === "max_edges_reached" || reason === "max_nodes_reached") break;
|
|
}
|
|
|
|
return {
|
|
target_sha256: graph.target_sha256,
|
|
provider: graph.provider,
|
|
start: start.id,
|
|
direction,
|
|
nodes: [...visited].flatMap((id) => {
|
|
const node = nodeById.get(id);
|
|
return node === undefined ? [] : [node];
|
|
}),
|
|
edges: [...selectedEdges.values()],
|
|
unresolved: [...unresolved.values()],
|
|
reached_depth: reachedDepth,
|
|
truncated: truncated || graph.truncated,
|
|
reason: reason ?? (graph.truncated ? "source_graph_truncated" : null),
|
|
coverage: graph.coverage,
|
|
limitations: [
|
|
...sourceLimitations,
|
|
"Static analysis does not prove that an authored UI action is reachable or executed at runtime.",
|
|
"Provider call graphs may omit unresolved indirect dispatch.",
|
|
],
|
|
};
|
|
};
|
|
|
|
/** Join authored UI actions to exact Objective-C method symbols when known. */
|
|
export const joinInterfaceBuilderDispatch = (
|
|
graph: NativeInvestigationGraph,
|
|
metadata: ObjcSwiftMetadata,
|
|
): NativeInvestigationGraph => {
|
|
const nodes = new Map(graph.nodes.map((node) => [node.id, node]));
|
|
const edges = [...graph.edges];
|
|
const existingEdgeIds = new Set(edges.map(({ id }) => id));
|
|
const selectorNodesByAction = new Map<string, string>();
|
|
for (const edge of edges) {
|
|
if (
|
|
edge.resolution === "observed" &&
|
|
edge.relation === "target_action" &&
|
|
nodes.get(edge.to)?.kind === "objc_selector"
|
|
)
|
|
selectorNodesByAction.set(edge.from, edge.to);
|
|
}
|
|
|
|
let examined = 0;
|
|
let resolved = 0;
|
|
let inferredWithoutOwnerClass = 0;
|
|
for (const action of nodes.values()) {
|
|
if (action.kind !== "action") continue;
|
|
const selector = action.attributes.selector;
|
|
if (typeof selector !== "string" || selector.length === 0) continue;
|
|
const selectorNodeId = selectorNodesByAction.get(action.id);
|
|
if (selectorNodeId === undefined) continue;
|
|
examined += 1;
|
|
const destinationEdge = edges.find(
|
|
(edge) =>
|
|
edge.resolution === "observed" &&
|
|
edge.relation === "target_action" &&
|
|
edge.from === action.id &&
|
|
edge.to !== selectorNodeId &&
|
|
nodes.has(edge.to),
|
|
);
|
|
if (
|
|
destinationEdge === undefined ||
|
|
destinationEdge.resolution !== "observed"
|
|
) {
|
|
const edgeId = `dispatch:${selectorNodeId}:${action.id}:receiver`;
|
|
if (!existingEdgeIds.has(edgeId)) {
|
|
existingEdgeIds.add(edgeId);
|
|
edges.push({
|
|
id: edgeId,
|
|
from: selectorNodeId,
|
|
to: null,
|
|
relation: "objc_dispatch",
|
|
resolution: "unresolved",
|
|
reason: "authored_action_receiver_unresolved",
|
|
evidence: action.evidence,
|
|
limitations: [
|
|
"The authored action has no resolved receiver; a selector match alone cannot establish its implementation.",
|
|
],
|
|
});
|
|
}
|
|
continue;
|
|
}
|
|
const owner = nodes.get(destinationEdge.to);
|
|
const declaredClass = owner?.attributes.class_name;
|
|
const className =
|
|
typeof declaredClass === "string" &&
|
|
declaredClass.length > 0 &&
|
|
owner?.kind !== "placeholder" &&
|
|
owner?.kind !== "external_object"
|
|
? declaredClass
|
|
: null;
|
|
const candidates = metadata.objc_dispatch_implementations.filter(
|
|
(candidate) =>
|
|
candidate.method_type === "instance" &&
|
|
candidate.selector === selector &&
|
|
(className === null || candidate.class_name === className),
|
|
);
|
|
const implementation = candidates.length === 1 ? candidates[0] : undefined;
|
|
const edgeId = `dispatch:${selectorNodeId}:${className ?? owner?.id ?? "unknown"}:${selector}`;
|
|
if (existingEdgeIds.has(edgeId)) continue;
|
|
existingEdgeIds.add(edgeId);
|
|
if (
|
|
implementation === undefined ||
|
|
implementation.implementation_address === null
|
|
) {
|
|
edges.push({
|
|
id: edgeId,
|
|
from: selectorNodeId,
|
|
to: null,
|
|
relation: "objc_dispatch",
|
|
resolution: "unresolved",
|
|
reason:
|
|
candidates.length > 1
|
|
? "selector_has_multiple_candidate_implementations"
|
|
: "implementation_not_resolved_from_binary_metadata_or_provider_symbols",
|
|
evidence: [
|
|
...action.evidence,
|
|
...candidates.flatMap(({ evidence }) => evidence),
|
|
],
|
|
limitations: [
|
|
"A missing or ambiguous symbol match does not prove that the runtime implementation is absent.",
|
|
],
|
|
});
|
|
continue;
|
|
}
|
|
|
|
const functionId = `native:function:${implementation.implementation_address}`;
|
|
if (!nodes.has(functionId))
|
|
nodes.set(functionId, {
|
|
id: functionId,
|
|
kind: "function",
|
|
name: `${implementation.class_name} ${selector}`,
|
|
location: {
|
|
address: implementation.implementation_address,
|
|
// The implementation location identifies the method record, not its code.
|
|
file_offset: null,
|
|
},
|
|
attributes: {
|
|
class_name: implementation.class_name,
|
|
selector,
|
|
method_type: implementation.method_type,
|
|
},
|
|
evidence: implementation.evidence,
|
|
});
|
|
edges.push({
|
|
id: edgeId,
|
|
from: selectorNodeId,
|
|
to: functionId,
|
|
relation: "objc_dispatch",
|
|
resolution:
|
|
className !== null && implementation.decode.status === "decoded"
|
|
? "resolved"
|
|
: "inferred",
|
|
evidence: [...action.evidence, ...implementation.evidence],
|
|
limitations:
|
|
className === null
|
|
? [
|
|
"The selector uniquely matches a encoded or symbolized method, but the Interface Builder receiver is an unresolved placeholder; runtime dispatch was not observed.",
|
|
]
|
|
: [
|
|
"The Interface Builder target and encoded or symbolized method agree on class and selector; runtime dispatch and dynamically supplied targets were not observed.",
|
|
],
|
|
});
|
|
resolved += 1;
|
|
if (className === null) inferredWithoutOwnerClass += 1;
|
|
}
|
|
|
|
return nativeInvestigationGraphSchema.parse({
|
|
...graph,
|
|
provider: {
|
|
id: "rea-native-investigation",
|
|
version: null,
|
|
tool_version: "rea-native-investigation/1",
|
|
},
|
|
nodes: [...nodes.values()],
|
|
edges,
|
|
coverage: [
|
|
...graph.coverage,
|
|
{
|
|
facet: "ui_to_objc_dispatch",
|
|
status:
|
|
examined === resolved && inferredWithoutOwnerClass === 0
|
|
? "complete"
|
|
: "partial",
|
|
reason:
|
|
examined === resolved && inferredWithoutOwnerClass === 0
|
|
? null
|
|
: inferredWithoutOwnerClass > 0
|
|
? "some_action_receivers_remain_placeholders"
|
|
: "some_action_implementations_not_resolved",
|
|
examined,
|
|
omitted: examined - resolved + inferredWithoutOwnerClass,
|
|
},
|
|
],
|
|
});
|
|
};
|