fix(gpu): keep unknown targets out of exact filters

Fixes #6599
This commit is contained in:
morluto committed 2026-10-23 18:08:46 +08:00
1 parent 6442329717
commit 0205f870db
2 files changed
+36 -5

No files matched your search

@@ -344,17 +344,19 @@ export const projectGpuCodeObjectsView = (
: view.collection === "targets"
? targetRows
: report.kernels;
const matchesTarget = (row: (typeof rows)[number]): boolean => {
if (targets === undefined) return true;
const target =
"target" in row ? row.target : byId.get(row.object_id)?.target;
return target !== null && target !== undefined && targets.has(target);
};
const matches = rows.filter(
(row) =>
(ids === undefined || ids.has(row.id)) &&
(objectIds === undefined ||
("object_id" in row && objectIds.has(row.object_id))) &&
(names === undefined || ("name" in row && names.has(row.name))) &&
(targets === undefined ||
targets.has(
("target" in row ? row.target : byId.get(row.object_id)?.target) ??
"",
)),
matchesTarget(row),
);
const defaults =
view.collection === "kernels"
@@ -334,6 +334,35 @@ it("keeps unknown target discovery visible in the default MCP summary", async ()
);
expect(result.summary.coverage.discovery).toBe("partial");
expect(result.summary.counts).toMatchObject({ objects: 1, targets: 0 });
const detailedReply = await call("inspect_gpu_code_objects", {
path,
analysis: "kernels",
view: { collection: "objects" },
});
expect(detailedReply.isError, JSON.stringify(detailedReply)).not.toBe(true);
const detailed = gpuCodeObjectsPageViewResultSchema.parse(
parseEvidence(detailedReply.structuredContent).normalized_result,
);
expect(detailed.items).toHaveLength(1);
const source = {
kind: "retained-evidence",
evidence_id: detailed.parent_evidence_id,
} as const;
for (const collection of ["objects", "targets", "kernels"] as const) {
const filteredReply = await call("inspect_analysis_view", {
source,
view: {
kind: "gpu-code-objects",
collection,
targets: [""],
},
});
expect(filteredReply.isError, JSON.stringify(filteredReply)).not.toBe(true);
const filtered = gpuCodeObjectsPageViewResultSchema.parse(
parseEvidence(filteredReply.structuredContent).normalized_result,
);
expect(filtered.items).toEqual([]);
}
});
it("retains selected kernel facts and complete PTX for historical MCP pages after source removal", async () => {