Skip to content

Commit 4fea93f

Browse files
betegoncodex
andcommitted
test(tools): align suspect commit coverage with backend responses
Replace unreachable transaction success cases with the actual lookup failure in the existing transaction test. Cover the commit author email fallback and nullable message with a realistic response, and clarify that lookup returns the current issue suspect commit. Co-Authored-By: GPT-6 <noreply@openai.com>
1 parent 85aed79 commit 4fea93f

2 files changed

Lines changed: 24 additions & 10 deletions

File tree

‎packages/mcp-core/src/api-client/client.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,8 @@ export class SentryApiService {
27952795
}
27962796

27972797
/**
2798-
* Retrieves the suspect commits for a specific event, grouped by committer.
2798+
* Retrieves the current suspect commit for the event's issue, grouped by committer.
2799+
* This reflects the issue's current suspect commit, not its state when the event occurred.
27992800
* Unlike release commits, this response actually populates `suspectCommitType`.
28002801
*/
28012802
async getEventCommitters(

‎packages/mcp-core/src/tools/catalog/get-issue-details.test.ts‎

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,22 +2413,28 @@ describe("structuredContent", () => {
24132413
it("keeps transactions on the local path so the performance trace survives", async () => {
24142414
// the shared body carries no performance trace; that is fetched separately and only
24152415
// rendered for transactions, so a transaction must not take the structured path
2416+
const event = createDefaultEvent();
24162417
mswServer.use(
24172418
http.get(
24182419
"https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/6507376925/events/latest/",
24192420
() =>
24202421
HttpResponse.json({
2421-
...createDefaultEvent(),
2422+
...event,
24222423
type: "transaction",
24232424
formatted: { format: "json", content: FORMATTER_JSON },
24242425
}),
24252426
),
2427+
http.get(
2428+
`https://sentry.io/api/0/projects/sentry-mcp-evals/CLOUDFLARE-MCP/events/${event.id}/committers/`,
2429+
() => HttpResponse.json({ detail: "Issue not found" }, { status: 404 }),
2430+
),
24262431
);
24272432

24282433
const result = await getIssueDetails.handler(params, baseContext);
24292434

24302435
expect(result).not.toHaveProperty("structuredContent");
24312436
expect(result).toContain("CLOUDFLARE-MCP-41");
2437+
expect(result).not.toContain("## Suspect Commit");
24322438
});
24332439

24342440
it("keeps the attached replay, which lives on the event not the related list", async () => {
@@ -2711,12 +2717,6 @@ describe("suspect commits", () => {
27112717
formatted: undefined,
27122718
structured: false,
27132719
},
2714-
{
2715-
mode: "Markdown for transactions",
2716-
type: "transaction",
2717-
formatted,
2718-
structured: false,
2719-
},
27202720
])("$mode", ({ type, formatted, structured }) => {
27212721
it.each([
27222722
{ selection: "latest event", eventId: undefined },
@@ -2776,12 +2776,23 @@ describe("suspect commits", () => {
27762776
);
27772777
});
27782778

2779-
it("omits unavailable optional commit fields from Markdown", async () => {
2779+
it("uses the author's email and omits a null commit message from Markdown", async () => {
27802780
mockEvent({ formatted: undefined });
27812781
mswServer.use(
27822782
http.get(committersUrl, () =>
27832783
HttpResponse.json({
2784-
committers: [{ author: null, commits: [{ id: sha, message: null }] }],
2784+
committers: [
2785+
{
2786+
author: { name: null, email: "dev@example.com" },
2787+
commits: [
2788+
{
2789+
id: sha,
2790+
message: null,
2791+
suspectCommitType: "via commit in release",
2792+
},
2793+
],
2794+
},
2795+
],
27852796
}),
27862797
),
27872798
);
@@ -2791,6 +2802,8 @@ describe("suspect commits", () => {
27912802
expect(result).toContain(`## Suspect Commit
27922803
27932804
**SHA**: \`${sha}\`
2805+
**Author**: dev@example.com
2806+
**Source**: via commit in release
27942807
27952808
## Event Details`);
27962809
});

0 commit comments

Comments
 (0)