fix(analysis): resolve procedure identities and preserve literal queries

This commit is contained in:
morluto
2026-10-09 02:42:39 +08:00
parent f2e22e13a6
commit d830cb79b3
9 changed files with 117 additions and 116 deletions
+29 -32
View File
@@ -71,40 +71,37 @@ const literalMatches = async (
signal?: AbortSignal,
): Promise<Result<{ matches: TraceMatch[] }, AnalysisError>> => {
const matches: TraceMatch[] = [];
const needles = [...new Set(input.query.trim().split(/\s+/u))];
const matched = new Set<string>();
for (const needle of needles) {
for (const [tool, type] of sources) {
const result = await call(
tool,
{
pattern: needle,
mode: "literal",
case_sensitive: input.case_sensitive,
},
signal,
for (const [tool, type] of sources) {
const result = await call(
tool,
{
pattern: input.query,
mode: "literal",
case_sensitive: input.case_sensitive,
},
signal,
);
if (!result.ok) return result;
const items = z
.array(z.object({ address: z.string(), value: z.string() }))
.safeParse(result.value);
if (!items.success)
return err(
new AnalysisOutputError(
tool,
"provider returned an invalid search result",
),
);
if (!result.ok) return result;
const items = z
.array(z.object({ address: z.string(), value: z.string() }))
.safeParse(result.value);
if (!items.success)
return err(
new AnalysisOutputError(
tool,
"provider returned an invalid search result",
),
);
addPageMatches({
items: items.data.map(({ address, value: name }) => ({
address,
name,
})),
type,
matches,
matched,
});
}
addPageMatches({
items: items.data.map(({ address, value: name }) => ({
address,
name,
})),
type,
matches,
matched,
});
}
return ok({ matches });
};