From a9708fc9b5c99880a49edac6f83d9d40ce613433 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Sirois Date: Tue, 30 Jun 2026 13:06:32 -0400 Subject: [PATCH] fix(reporters): keep new-query bullets on separate lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new-queries loop in success.md.j2 ended each line on a `{% endif %}` block tag. With nunjucks `trimBlocks: true`, the newline separating iterations was stripped, gluing consecutive bullets together so Markdown rendered them as one line (`… no index suggestion- SELECT …`). End the line with `{{""}}` so the trailing newline survives, matching the existing guard on the "improves queries" loop. Fixes #158 Co-Authored-By: Claude Opus 4.8 (1M context) --- src/reporters/github/github.test.ts | 30 +++++++++++++++++++++++++++++ src/reporters/github/success.md.j2 | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/reporters/github/github.test.ts b/src/reporters/github/github.test.ts index bf24c2d..3d8d31f 100644 --- a/src/reporters/github/github.test.ts +++ b/src/reporters/github/github.test.ts @@ -247,6 +247,36 @@ describe("buildViewModel", () => { expect(output).toContain("cost 42 · no index suggestion"); }); + test("renders multiple new queries as separate list items (#158)", () => { + const ctx = makeContext({ + comparison: makeComparison({ + newQueries: [ + { + hash: "new-sessions", + query: 'SELECT "id" FROM "sessions"', + formattedQuery: 'SELECT "id" FROM "sessions"', + nudges: [], tags: [], tableReferences: [], + optimization: { state: "no_improvement_found", cost: 1, indexesUsed: ["sessions_pkey"] }, + }, + { + hash: "new-item-watches", + query: 'SELECT "id" FROM "item_watches"', + formattedQuery: 'SELECT "id" FROM "item_watches"', + nudges: [], tags: [], tableReferences: [], + optimization: { state: "no_improvement_found", cost: 1, indexesUsed: ["item_watches_pkey"] }, + }, + ], + }), + }); + const output = renderTemplate(ctx); + // trimBlocks strips the newline after a trailing block tag, which used to + // glue consecutive bullets together (`… no index suggestion- SELECT …`). + expect(output).not.toMatch(/no index suggestion-\s*/); + expect(output).toContain( + 'no index suggestion\n- SELECT "id" FROM "item_watches"', + ); + }); + test("regressions surface in displayRegressed", () => { const ctx = makeContext({ comparison: makeComparison({ diff --git a/src/reporters/github/success.md.j2 b/src/reporters/github/success.md.j2 index ec6f755..ee979b7 100644 --- a/src/reporters/github/success.md.j2 +++ b/src/reporters/github/success.md.j2 @@ -83,7 +83,7 @@ {% for q in displayNewQueries %} {% set link = queryLinks[q.hash] %} -- {% if link %}[{{ q.queryPreview }}]({{ link }}){% else %}{{ q.queryPreview }}{% endif %}{% if q.costLabel %}
{{ q.costLabel }} · no index suggestion{% endif %} +- {% if link %}[{{ q.queryPreview }}]({{ link }}){% else %}{{ q.queryPreview }}{% endif %}{% if q.costLabel %}
{{ q.costLabel }} · no index suggestion{% endif %}{{""}} {% endfor %} {% endif %}