Skip to content

Commit 4276d31

Browse files
committed
fix(cli): t3 feedback list shows "1 turn (1 entry)", not "1 turns (1 entries)"
Use singular "turn" and "entry" when the respective trace count is 1, while keeping plurals for 0 and counts greater than 1.
1 parent 939b0f9 commit 4276d31

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎apps/server/src/cli/feedback.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,22 @@ it.effect("points to Labs only when the server hides the feedback tool", () =>
208208
sent: true,
209209
},
210210
]);
211+
212+
const before = (yield* TestConsole.logLines).length;
213+
const list = Command.runWith(feedbackCommand, { version: "0.0.0" });
214+
const traceDb = new NodeSqlite.DatabaseSync(dbPath);
215+
const setTrace = traceDb.prepare("UPDATE agent_feedback SET trace = ? WHERE id = 'r1'");
216+
for (const next of [trace, { ...trace, turns: 0, entries: [] }, { ...trace, turns: 2 }]) {
217+
setTrace.run(JSON.stringify(next));
218+
yield* list(["list", "--base-dir", baseDir]);
219+
}
220+
traceDb.close();
221+
const lines = (yield* TestConsole.logLines).slice(before).map(String);
222+
expect(lines.filter((line) => line.startsWith(" trace: "))).toEqual([
223+
" trace: outline of 1 turn (1 entry), text of 0",
224+
" trace: outline of 0 turns (0 entries), text of 0",
225+
" trace: outline of 2 turns (1 entry), text of 0",
226+
]);
211227
}).pipe(
212228
Effect.scoped,
213229
Effect.provide(

‎apps/server/src/cli/feedback.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ const feedbackListCommand = Command.make("list", { ...authLocationFlags, json: j
9898
if (report.workaround) yield* Console.log(` workaround: ${report.workaround}`);
9999
if (report.trace) {
100100
const { turns, textTurns, entries } = report.trace;
101+
const turnLabel = turns === 1 ? "turn" : "turns";
102+
const entryLabel = entries.length === 1 ? "entry" : "entries";
101103
yield* Console.log(
102-
` trace: outline of ${turns} turns (${entries.length} entries), text of ${textTurns}`,
104+
` trace: outline of ${turns} ${turnLabel} (${entries.length} ${entryLabel}), text of ${textTurns}`,
103105
);
104106
}
105107
}

0 commit comments

Comments
 (0)