File tree Expand file tree Collapse file tree 4 files changed +10
-11
lines changed
Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -52,10 +52,12 @@ function splitLogIds(arg: string): string[] {
5252 * Parse positional arguments for log view.
5353 * Handles:
5454 * - `<log-id>` — single log ID (auto-detect org/project)
55- * - `<log-id1> <log-id2> ...` — multiple log IDs (auto-detect)
5655 * - `<target> <log-id> [<log-id>...]` — explicit target + one or more log IDs
5756 * - `<org>/<project>/<log-id>` — single slash-separated arg
5857 *
58+ * When two or more args are provided, the first is always treated as the
59+ * target (org/project specifier) and the rest as log IDs.
60+ *
5961 * Arguments containing newlines are split into multiple IDs.
6062 *
6163 * @param args - Positional arguments from CLI
Original file line number Diff line number Diff line change @@ -89,13 +89,11 @@ export function parsePositionalArgs(args: string[]): {
8989 throw new ContextError ( "Trace ID" , USAGE_HINT ) ;
9090 }
9191
92- validateTraceId ( traceId ) ;
93- return { traceId, orgArg } ;
92+ return { traceId : validateTraceId ( traceId ) , orgArg } ;
9493 }
9594
9695 // Plain trace ID — org will be auto-detected
97- validateTraceId ( first ) ;
98- return { traceId : first , orgArg : undefined } ;
96+ return { traceId : validateTraceId ( first ) , orgArg : undefined } ;
9997 }
10098
10199 // Two or more args — first is org, second is trace ID
@@ -106,8 +104,7 @@ export function parsePositionalArgs(args: string[]): {
106104 throw new ContextError ( "Trace ID" , USAGE_HINT ) ;
107105 }
108106
109- validateTraceId ( traceId ) ;
110- return { traceId, orgArg } ;
107+ return { traceId : validateTraceId ( traceId ) , orgArg } ;
111108}
112109
113110export const logsCommand = buildCommand ( {
Original file line number Diff line number Diff line change @@ -1802,8 +1802,8 @@ export async function getLogs(
18021802 dataset : "logs" ,
18031803 field : DETAILED_LOG_FIELDS ,
18041804 query,
1805- // per_page must match the number of IDs so the API returns all matches
1806- per_page : logIds . length ,
1805+ // Cap at API_MAX_PER_PAGE — the API silently truncates larger values
1806+ per_page : Math . min ( logIds . length , API_MAX_PER_PAGE ) ,
18071807 statsPeriod : "90d" ,
18081808 } ,
18091809 } ) ;
Original file line number Diff line number Diff line change @@ -57,10 +57,10 @@ describe("parsePositionalArgs", () => {
5757 expect ( result . orgArg ) . toBeUndefined ( ) ;
5858 } ) ;
5959
60- test ( "accepts mixed-case hex trace ID" , ( ) => {
60+ test ( "normalizes mixed-case hex trace ID to lowercase " , ( ) => {
6161 const mixedCase = "AAAA1111bbbb2222CCCC3333dddd4444" ;
6262 const result = parsePositionalArgs ( [ mixedCase ] ) ;
63- expect ( result . traceId ) . toBe ( mixedCase ) ;
63+ expect ( result . traceId ) . toBe ( mixedCase . toLowerCase ( ) ) ;
6464 expect ( result . orgArg ) . toBeUndefined ( ) ;
6565 } ) ;
6666 } ) ;
You can’t perform that action at this time.
0 commit comments