Skip to content

Commit d48db90

Browse files
committed
fix(trace/list): differentiate empty page from no results in formatter
Restore hasMore check in formatTraceListHuman so the primary message says 'No traces on this page.' when more pages exist, consistent with the hint that suggests the next-page command. Previously, the formatter always said 'No traces found.' which contradicted the hint.
1 parent 1e6cfd4 commit d48db90

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/commands/trace/list.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,16 @@ export function parseSort(value: string): SortValue {
118118
/**
119119
* Format trace list data for human-readable terminal output.
120120
*
121-
* Handles two display states:
122-
* - Empty list → "No traces found." (next-page hint is in CommandOutput.hint)
121+
* Handles three display states:
122+
* - Empty list with more pages → "No traces on this page."
123+
* - Empty list, no more pages → "No traces found."
123124
* - Non-empty → header line + formatted table
124125
*/
125126
function formatTraceListHuman(result: TraceListResult): string {
126-
const { traces, org, project } = result;
127+
const { traces, hasMore, org, project } = result;
127128

128129
if (traces.length === 0) {
129-
return "No traces found.";
130+
return hasMore ? "No traces on this page." : "No traces found.";
130131
}
131132

132133
return `Recent traces in ${org}/${project}:\n\n${formatTraceTable(traces)}`;
@@ -267,7 +268,7 @@ export const listCommand = buildListCommand("trace", {
267268
// Build footer hint based on result state
268269
let hint: string | undefined;
269270
if (traces.length === 0 && hasMore) {
270-
hint = `No traces on this page. Try the next page: ${nextPageHint(org, project, flags)}`;
271+
hint = `Try the next page: ${nextPageHint(org, project, flags)}`;
271272
} else if (traces.length > 0) {
272273
const countText = `Showing ${traces.length} trace${traces.length === 1 ? "" : "s"}.`;
273274
hint = hasMore

0 commit comments

Comments
 (0)