Skip to content

Commit a5e9b1c

Browse files
refactor(profile): rename fixture to transaction-profile-v1 and use numeric active_thread_id
Co-Authored-By: David Cramer <dcramer@gmail.com>
1 parent 705b5f7 commit a5e9b1c

7 files changed

Lines changed: 36 additions & 25 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from "vitest";
22
import {
33
profileChunkFixture,
4-
profileDetailsFixture,
4+
transactionProfileV1Fixture,
55
} from "@sentry/mcp-server-mocks";
66
import {
77
ClientKeySchema,
@@ -663,11 +663,11 @@ describe("TransactionProfileSampleSchema", () => {
663663

664664
describe("profile fixtures", () => {
665665
it("parses the V1 transaction profile fixture through TransactionProfileSchema", () => {
666-
// profile-details.json mirrors what vroom emits for legacy/V1 transaction
667-
// profiles: numeric uint64 thread_id, elapsed_since_start_ns timing, and
668-
// a required transaction block with active_thread_id.
666+
// transaction-profile-v1.json mirrors what vroom emits for legacy/V1
667+
// transaction profiles: numeric uint64 thread_id, elapsed_since_start_ns
668+
// timing, and a required transaction block with active_thread_id.
669669
const profile = TransactionProfileSchema.parse(
670-
structuredClone(profileDetailsFixture),
670+
structuredClone(transactionProfileV1Fixture),
671671
);
672672

673673
expect(profile.transaction?.active_thread_id).toBeTypeOf("string");

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { describe, it, expect } from "vitest";
22
import { http, HttpResponse } from "msw";
3-
import { mswServer, profileDetailsFixture } from "@sentry/mcp-server-mocks";
3+
import {
4+
mswServer,
5+
transactionProfileV1Fixture,
6+
} from "@sentry/mcp-server-mocks";
47
import getProfileDetails from "./get-profile-details";
58

69
const baseContext = {
@@ -16,7 +19,7 @@ describe("get_profile_details", () => {
1619
it("fetches and formats a transaction profile from profileUrl", async () => {
1720
const result = await getProfileDetails.handler(
1821
{
19-
profileUrl: `https://sentry-mcp-evals.sentry.io/explore/profiling/profile/backend/${profileDetailsFixture.profile_id}/flamegraph/`,
22+
profileUrl: `https://sentry-mcp-evals.sentry.io/explore/profiling/profile/backend/${transactionProfileV1Fixture.profile_id}/flamegraph/`,
2023
regionUrl: null,
2124
focusOnUserCode: true,
2225
},
@@ -72,14 +75,16 @@ describe("get_profile_details", () => {
7275
{
7376
organizationSlug: "sentry-mcp-evals",
7477
projectSlugOrId: "backend",
75-
profileId: profileDetailsFixture.profile_id,
78+
profileId: transactionProfileV1Fixture.profile_id,
7679
regionUrl: null,
7780
focusOnUserCode: false,
7881
},
7982
baseContext,
8083
);
8184

82-
expect(result).toContain(`# Profile ${profileDetailsFixture.profile_id}`);
85+
expect(result).toContain(
86+
`# Profile ${transactionProfileV1Fixture.profile_id}`,
87+
);
8388
expect(result).toContain("**Project**: backend");
8489
expect(result).toContain("cursor.execute");
8590
});
@@ -135,7 +140,7 @@ describe("get_profile_details", () => {
135140
await expect(
136141
getProfileDetails.handler(
137142
{
138-
profileUrl: `https://other-org.sentry.io/explore/profiling/profile/backend/${profileDetailsFixture.profile_id}/flamegraph/`,
143+
profileUrl: `https://other-org.sentry.io/explore/profiling/profile/backend/${transactionProfileV1Fixture.profile_id}/flamegraph/`,
139144
organizationSlug: "sentry-mcp-evals",
140145
projectSlugOrId: "backend",
141146
regionUrl: null,
@@ -152,7 +157,7 @@ describe("get_profile_details", () => {
152157
await expect(
153158
getProfileDetails.handler(
154159
{
155-
profileUrl: `https://sentry-mcp-evals.sentry.io/explore/profiling/profile/frontend/${profileDetailsFixture.profile_id}/flamegraph/`,
160+
profileUrl: `https://sentry-mcp-evals.sentry.io/explore/profiling/profile/frontend/${transactionProfileV1Fixture.profile_id}/flamegraph/`,
156161
organizationSlug: "sentry-mcp-evals",
157162
projectSlugOrId: "backend",
158163
regionUrl: null,

‎packages/mcp-core/src/tools/get-sentry-resource.test.ts‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { http, HttpResponse } from "msw";
33
import {
44
mswServer,
55
organizationFixture,
6-
profileDetailsFixture,
6+
transactionProfileV1Fixture,
77
replayDetailsFixture,
88
traceMetaFixture,
99
traceFixture,
@@ -192,20 +192,24 @@ describe("get_sentry_resource", () => {
192192
describe("URL mode — profile URLs", () => {
193193
it("dispatches transaction profile URLs to get_profile_details", async () => {
194194
const result = await callHandler({
195-
url: `https://my-org.sentry.io/explore/profiling/profile/backend/${profileDetailsFixture.profile_id}/flamegraph/`,
195+
url: `https://my-org.sentry.io/explore/profiling/profile/backend/${transactionProfileV1Fixture.profile_id}/flamegraph/`,
196196
});
197197

198-
expect(result).toContain(`# Profile ${profileDetailsFixture.profile_id}`);
198+
expect(result).toContain(
199+
`# Profile ${transactionProfileV1Fixture.profile_id}`,
200+
);
199201
expect(result).toContain("**Project**: backend");
200202
expect(result).toContain("**Transaction**: /api/users");
201203
});
202204

203205
it("dispatches transaction profile URLs with organizations path", async () => {
204206
const result = await callHandler({
205-
url: `https://sentry.io/organizations/my-org/profiling/profile/backend/${profileDetailsFixture.profile_id}/flamegraph/?frameName=handle_request`,
207+
url: `https://sentry.io/organizations/my-org/profiling/profile/backend/${transactionProfileV1Fixture.profile_id}/flamegraph/?frameName=handle_request`,
206208
});
207209

208-
expect(result).toContain(`# Profile ${profileDetailsFixture.profile_id}`);
210+
expect(result).toContain(
211+
`# Profile ${transactionProfileV1Fixture.profile_id}`,
212+
);
209213
expect(result).toContain(
210214
"**Trace ID**: a4d1aae7216b47ff8117cf4e09ce9d0a",
211215
);
@@ -226,7 +230,7 @@ describe("get_sentry_resource", () => {
226230
await expect(
227231
getSentryResource.handler(
228232
{
229-
url: `https://my-org.sentry.io/explore/profiling/profile/frontend/${profileDetailsFixture.profile_id}/flamegraph/`,
233+
url: `https://my-org.sentry.io/explore/profiling/profile/frontend/${transactionProfileV1Fixture.profile_id}/flamegraph/`,
230234
},
231235
{
232236
...baseContext,

‎packages/mcp-core/src/tools/profile/formatter.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { profileDetailsFixture } from "@sentry/mcp-server-mocks";
1+
import { transactionProfileV1Fixture } from "@sentry/mcp-server-mocks";
22
import { describe, expect, it } from "vitest";
33
import { TransactionProfileSchema } from "../../api-client/schema";
44
import type {
@@ -159,7 +159,9 @@ function createMockTransactionProfile(): TransactionProfile {
159159
// numeric thread_id and active_thread_id to strings). This keeps test
160160
// fixtures in sync with what production code actually receives after the
161161
// API client validates the response.
162-
return TransactionProfileSchema.parse(structuredClone(profileDetailsFixture));
162+
return TransactionProfileSchema.parse(
163+
structuredClone(transactionProfileV1Fixture),
164+
);
163165
}
164166

165167
describe("formatter", () => {

packages/mcp-server-mocks/src/fixtures/profile-details.json renamed to packages/mcp-server-mocks/src/fixtures/transaction-profile-v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"name": "/api/users",
7373
"trace_id": "a4d1aae7216b47ff8117cf4e09ce9d0a",
7474
"id": "7ca573c0f4814912aaa9bdc77d1a7d51",
75-
"active_thread_id": "1",
75+
"active_thread_id": 1,
7676
"relative_start_ns": 0,
7777
"relative_end_ns": 120000000
7878
},

‎packages/mcp-server-mocks/src/index.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import eventsSpansFixture from "./fixtures/events-spans.json" with {
5656
import flamegraphFixture from "./fixtures/flamegraph.json" with {
5757
type: "json",
5858
};
59-
import profileDetailsFixture from "./fixtures/profile-details.json" with {
59+
import transactionProfileV1Fixture from "./fixtures/transaction-profile-v1.json" with {
6060
type: "json",
6161
};
6262
import profileChunkFixture from "./fixtures/profile-chunk.json" with {
@@ -1086,7 +1086,7 @@ export const restHandlers = buildHandlers([
10861086
fetch: ({ params }) => {
10871087
const profileId = String(params.profileId);
10881088
return HttpResponse.json({
1089-
...profileDetailsFixture,
1089+
...transactionProfileV1Fixture,
10901090
event_id: profileId,
10911091
profile_id: profileId,
10921092
});
@@ -1411,7 +1411,7 @@ export {
14111411
traceMixedFixture,
14121412
traceEventFixture,
14131413
flamegraphFixture,
1414-
profileDetailsFixture,
1414+
transactionProfileV1Fixture,
14151415
organizationFixture,
14161416
releaseFixture,
14171417
clientKeyFixture,

‎packages/mcp-server-mocks/src/payloads.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import eventsSpansFixture from "./fixtures/events-spans.json" with {
2929
import flamegraphFixture from "./fixtures/flamegraph.json" with {
3030
type: "json",
3131
};
32-
import profileDetailsFixture from "./fixtures/profile-details.json" with {
32+
import transactionProfileV1Fixture from "./fixtures/transaction-profile-v1.json" with {
3333
type: "json",
3434
};
3535
import issueFixture from "./fixtures/issue.json" with { type: "json" };
@@ -101,7 +101,7 @@ export {
101101
eventsSpansEmptyFixture,
102102
eventsSpansFixture,
103103
flamegraphFixture,
104-
profileDetailsFixture,
104+
transactionProfileV1Fixture,
105105
issueFixture,
106106
issueFixture2,
107107
issueTagValuesFixture,

0 commit comments

Comments
 (0)