From b0dbda898e0e617b9690dba586eac474f3c75fa2 Mon Sep 17 00:00:00 2001 From: betegon Date: Wed, 20 May 2026 11:26:26 +0200 Subject: [PATCH] test(init): add regression test for only-Tracing blurb bug Documents the fix: the LLM was echoing human-readable labels in the feature field instead of canonical IDs, so only performanceMonitoring (Tracing) matched the Map lookup. The server-side fix maps blurbs positionally so canonical IDs are guaranteed. This test verifies all blurbs render when the server returns canonical IDs correctly. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- test/lib/init/formatters.test.ts | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/lib/init/formatters.test.ts b/test/lib/init/formatters.test.ts index 723573332..f95a1f443 100644 --- a/test/lib/init/formatters.test.ts +++ b/test/lib/init/formatters.test.ts @@ -247,6 +247,43 @@ describe("formatResult with featureBlurbs", () => { expect(summary?.fields.some((f) => f.label === "Features")).toBe(true); }); + test("regression: all blurbs render when server returns canonical feature IDs", () => { + // Regression for the 'only Tracing' bug: the LLM was echoing human-readable + // labels ("Error Monitoring") in the feature field instead of canonical IDs + // ("errorMonitoring"). The server-side fix now maps blurbs positionally so + // canonical IDs are always in the feature field. This test verifies the CLI + // renders all blurbs when the server returns canonical IDs correctly — not + // just the one feature that happened to have a matching ID. + const { ui, calls } = createMockUI(); + formatResult( + { + status: "success", + result: { + platform: "Next.js", + features: [ + "errorMonitoring", + "performanceMonitoring", + "sessionReplay", + ], + featureBlurbs: [ + { feature: "errorMonitoring", blurb: "Captures exceptions." }, + { feature: "performanceMonitoring", blurb: "Traces requests." }, + { feature: "sessionReplay", blurb: "Records sessions." }, + ], + }, + }, + ui + ); + + const summary = summaryCall(calls); + expect(summary?.featureBlurbs).toHaveLength(3); + expect(summary?.featureBlurbs?.map((b) => b.label)).toEqual([ + "Error Monitoring", + "Session Replay", + "Tracing", + ]); + }); + test("labels use canonical feature IDs — agent echoing wrong IDs omits the blurb rather than mislabelling", () => { const { ui, calls } = createMockUI(); formatResult(