Skip to content

Commit 840acef

Browse files
betegonclaude
andauthored
test(init): regression test for only-Tracing blurb bug (#983)
## Summary After #982 landed, `sentry init` showed only "Tracing" in the blurbs table regardless of which features were enabled. The root cause was server-side (fixed in getsentry/cli-init-api#159) — the LLM was echoing human-readable labels ("Error Monitoring") in the `feature` field instead of canonical IDs ("errorMonitoring"), so the CLI Map lookup only found the one entry that happened to match (`performanceMonitoring` → "Tracing"). This PR adds a CLI-side regression test that documents the fix and guards against a recurrence: verifies all blurbs render when the server returns canonical feature IDs. ## Test Plan `bun test test/lib/init/formatters.test.ts` — new test passes. Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 58ac61e commit 840acef

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

test/lib/init/formatters.test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,43 @@ describe("formatResult with featureBlurbs", () => {
247247
expect(summary?.fields.some((f) => f.label === "Features")).toBe(true);
248248
});
249249

250+
test("regression: all blurbs render when server returns canonical feature IDs", () => {
251+
// Regression for the 'only Tracing' bug: the LLM was echoing human-readable
252+
// labels ("Error Monitoring") in the feature field instead of canonical IDs
253+
// ("errorMonitoring"). The server-side fix now maps blurbs positionally so
254+
// canonical IDs are always in the feature field. This test verifies the CLI
255+
// renders all blurbs when the server returns canonical IDs correctly — not
256+
// just the one feature that happened to have a matching ID.
257+
const { ui, calls } = createMockUI();
258+
formatResult(
259+
{
260+
status: "success",
261+
result: {
262+
platform: "Next.js",
263+
features: [
264+
"errorMonitoring",
265+
"performanceMonitoring",
266+
"sessionReplay",
267+
],
268+
featureBlurbs: [
269+
{ feature: "errorMonitoring", blurb: "Captures exceptions." },
270+
{ feature: "performanceMonitoring", blurb: "Traces requests." },
271+
{ feature: "sessionReplay", blurb: "Records sessions." },
272+
],
273+
},
274+
},
275+
ui
276+
);
277+
278+
const summary = summaryCall(calls);
279+
expect(summary?.featureBlurbs).toHaveLength(3);
280+
expect(summary?.featureBlurbs?.map((b) => b.label)).toEqual([
281+
"Error Monitoring",
282+
"Session Replay",
283+
"Tracing",
284+
]);
285+
});
286+
250287
test("labels use canonical feature IDs — agent echoing wrong IDs omits the blurb rather than mislabelling", () => {
251288
const { ui, calls } = createMockUI();
252289
formatResult(

0 commit comments

Comments
 (0)