Skip to content

Commit 4f44b9d

Browse files
committed
refactor: change testId type from string to number across RCA-related modules
1 parent b442528 commit 4f44b9d

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/tools/rca-agent-utils/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { TestStatus } from "./types.js";
33

44
export const FETCH_RCA_PARAMS = {
55
testId: z
6-
.array(z.string())
6+
.array(z.number().int())
77
.max(3)
88
.describe(
9-
"Array of test IDs to fetch RCA data for (maximum 3 IDs). If not provided, use the listTestIds tool get all failed testcases. If more than 3 IDs are provided, only the first 3 will be processed.",
9+
"Array of integer test IDs to fetch RCA data for (maximum 3 IDs). These must be numeric test IDs, not session IDs or strings. If not provided, use the listTestIds tool to get all failed testcases. If more than 3 IDs are provided, only the first 3 will be processed.",
1010
),
1111
};
1212

src/tools/rca-agent-utils/rca-data.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ async function updateProgress(
9797
}
9898

9999
async function fetchInitialRCA(
100-
testId: string,
100+
testId: number,
101101
headers: Record<string, string>,
102102
baseUrl: string,
103103
): Promise<RCATestCase> {
104-
const url = baseUrl.replace("{testId}", testId);
104+
const url = baseUrl.replace("{testId}", testId.toString());
105105

106106
try {
107107
const response = await fetch(url, { headers });
@@ -179,7 +179,7 @@ async function pollRCAResults(
179179
await Promise.allSettled(
180180
inProgressCases.map(async (tc) => {
181181
try {
182-
const pollUrl = baseUrl.replace("{testId}", tc.id);
182+
const pollUrl = baseUrl.replace("{testId}", tc.id.toString());
183183
const response = await fetch(pollUrl, { headers });
184184
if (!response.ok) {
185185
const errorText = await response.text();
@@ -240,7 +240,7 @@ async function pollRCAResults(
240240
}
241241

242242
export async function getRCAData(
243-
testIds: string[],
243+
testIds: number[],
244244
authString: string,
245245
context?: ScanProgressContext,
246246
): Promise<RCAResponse> {

src/tools/rca-agent-utils/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface TestRun {
2121
}
2222

2323
export interface FailedTestInfo {
24-
test_id: string;
24+
test_id: number;
2525
test_name: string;
2626
}
2727

@@ -39,8 +39,8 @@ export enum RCAState {
3939
}
4040

4141
export interface RCATestCase {
42-
id: string;
43-
testRunId: string;
42+
id: number;
43+
testRunId: number;
4444
state: RCAState;
4545
rcaData?: any;
4646
}

src/tools/rca-agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export async function getBuildIdTool(
6060

6161
// Tool function that fetches RCA data
6262
export async function fetchRCADataTool(
63-
args: { testId: string[] },
63+
args: { testId: number[] },
6464
config: BrowserStackConfig,
6565
): Promise<CallToolResult> {
6666
try {

0 commit comments

Comments
 (0)