fix(retro): persist recommendations so the next retro detects follow-through

/retro produced "3 Things to Improve" but never saved them in its JSON
snapshot, so the next retro could not tell whether last week's
recommendations were acted on. Step 13 now drafts the items before saving
and always writes a `recommendations` array ({category, text}, [] when
empty); Step 12 scores each prior recommendation addressed/partial/open
against this window's commits, files and metrics and renders a
follow-through line, skipping silently for snapshots without the key. The
report format ties the items to the saved array. Global mode is unchanged.

Adopts #1853 (rewritten on current main). Refs #1834.

Co-authored-by: Jayesh Betala <jayesh.betala7@gmail.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
committed 2026-10-08 06:36:28 +00:00
1 parent 8fb37a72c0
commit 7e2a6e6ccd
5 files changed
+72 -6

No files matched your search

@@ -0,0 +1,52 @@
/**
* Regression tests for #1834: /retro wrote "3 Things to Improve" as prose only,
* so the next retro could not tell whether last week's recommendations were
* acted on. The Step 13 snapshot now saves them and Step 12 scores them.
*/
import { describe, expect, test } from "bun:test";
import * as fs from "node:fs";
import * as path from "node:path";
const ROOT = path.resolve(import.meta.dir, "..");
const SKILL = fs.readFileSync(path.join(ROOT, "retro", "SKILL.md"), "utf-8");
const REPORT = fs.readFileSync(path.join(ROOT, "retro", "sections", "report-format.md"), "utf-8");
function step(heading: string, next: string): string {
const start = SKILL.indexOf(heading);
expect(start).toBeGreaterThanOrEqual(0);
const end = SKILL.indexOf(next, start + heading.length);
expect(end).toBeGreaterThan(start);
return SKILL.slice(start, end);
}
describe("#1834 retro persists recommendations and detects follow-through", () => {
const step12 = step("### Step 12: Load History & Compare", "### Step 13:");
const step13 = step("### Step 13: Save Retro History", "### Step 14:");
test("Step 13 schema always saves the 3 Things to Improve as recommendations", () => {
const schema = step13.match(/```json\n(\{[\s\S]*?\n\})\n```/)?.[1] ?? "";
const parsed = JSON.parse(schema);
expect(Array.isArray(parsed.recommendations)).toBe(true);
expect(Object.keys(parsed.recommendations[0]).sort()).toEqual(["category", "text"]);
expect(step13).toContain("**Always include `recommendations`:**");
expect(step13).toContain("Write `[]` when there are none");
expect(step13).toContain('draft the tweetable summary and the "3 Things to Improve" items');
});
test("Step 12 scores prior recommendations and skips older snapshots silently", () => {
expect(step12).toContain("**Recommendation follow-through:**");
expect(step12).toMatch(/`addressed`, `partial` or `open`/);
expect(step12).toContain("2 of 3 prior recommendations addressed");
expect(step12).toContain("If the snapshot has no `recommendations` key, skip this silently.");
});
test("report format ties the 3 Things to Improve to the saved items", () => {
const improve = REPORT.slice(REPORT.indexOf("### 3 Things to Improve"), REPORT.indexOf("### 3 Habits for Next Week"));
expect(improve).toContain("saved as `recommendations` in the Step 13 snapshot");
expect(REPORT).toContain("Include the Recommendation follow-through line when Step 12 produced one.");
});
test("global mode snapshot is unchanged", () => {
expect(step("## Global Retrospective Mode", "## Compare Mode")).not.toContain("recommendations");
});
});