Skip to content

Commit d529210

Browse files
authored
Run Route root_execution_id -> run_id (#1084)
## Description <!-- Please provide a brief description of the changes made in this pull request. Include any relevant context or reasoning for the changes. --> Changes the default routing on the run route to use `run_id` instead of `root_execution_id`. The order of checking ids when fetching the run data has been reversed so it now checks `run_id` first. ## Related Issue and Pull requests <!-- Link to any related issues using the format #<issue-number> --> Closes [#128](#128 ) ## Type of Change <!-- Please delete options that are not relevant --> - [x] New feature - [x] Improvement - [x] Cleanup/Refactor - [x] Breaking change ## Checklist <!-- Please ensure the following are completed before submitting the PR --> - [ ] I have tested this does not break current pipelines / runs functionality - [ ] I have tested the changes on staging ## Screenshots (if applicable) <!-- Include any screenshots that might help explain the changes or provide visual context --> ## Test Instructions <!-- Detail steps and prerequisites for testing the changes in this PR --> Validate that all methods of accessing the run route work as intended and use the `run_id`. ## Additional Comments <!-- Add any additional context or information that reviewers might need to know regarding this PR -->
1 parent 59b7126 commit d529210

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

src/components/Home/RunSection/RunRow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const RunRow = ({ run }: { run: PipelineRunResponse }) => {
2727
const navigate = useNavigate();
2828
const notify = useToastNotification();
2929

30-
const executionId = `${run.root_execution_id}`;
30+
const runId = `${run.id}`;
3131

3232
const name = run.pipeline_name ?? "Unknown pipeline";
3333

@@ -48,7 +48,7 @@ const RunRow = ({ run }: { run: PipelineRunResponse }) => {
4848
run.execution_status_stats,
4949
);
5050

51-
const clickThroughUrl = `${APP_ROUTES.RUNS}/${executionId}`;
51+
const clickThroughUrl = `${APP_ROUTES.RUNS}/${runId}`;
5252

5353
const LinkProps = {
5454
to: clickThroughUrl,
@@ -89,7 +89,7 @@ const RunRow = ({ run }: { run: PipelineRunResponse }) => {
8989
<TableCell className="text-sm flex items-center gap-2">
9090
<StatusIcon status={getRunStatus(statusCounts)} />
9191
<Link {...LinkProps}>{name}</Link>
92-
<span>{`#${executionId}`}</span>
92+
<span>{`#${runId}`}</span>
9393
</TableCell>
9494
<TableCell>
9595
<HoverCard openDelay={100}>

src/components/PipelineRun/components/RerunPipelineButton.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe("<RerunPipelineButton/>", () => {
131131

132132
test("calls submitPipelineRun on click", async () => {
133133
mockSubmitPipelineRun.mockImplementation(async (_, __, { onSuccess }) => {
134-
onSuccess({ root_execution_id: 123 });
134+
onSuccess({ id: 123 });
135135
});
136136

137137
await act(async () => {
@@ -161,7 +161,7 @@ describe("<RerunPipelineButton/>", () => {
161161

162162
test("handles successful rerun", async () => {
163163
mockSubmitPipelineRun.mockImplementation(async (_, __, { onSuccess }) => {
164-
onSuccess({ root_execution_id: 123 });
164+
onSuccess({ id: 123 });
165165
});
166166

167167
await act(async () => {
@@ -235,7 +235,7 @@ describe("<RerunPipelineButton/>", () => {
235235
});
236236

237237
await act(async () => {
238-
resolveSubmit!({ root_execution_id: 123 });
238+
resolveSubmit!({ id: 123 });
239239
});
240240
});
241241

@@ -244,7 +244,7 @@ describe("<RerunPipelineButton/>", () => {
244244
mockIsAuthorized.mockReturnValue(false);
245245
mockAwaitAuthorization.mockResolvedValue("new-token");
246246
mockSubmitPipelineRun.mockImplementation(async (_, __, { onSuccess }) => {
247-
onSuccess({ root_execution_id: 123 });
247+
onSuccess({ id: 123 });
248248
});
249249

250250
await act(async () => {
@@ -279,7 +279,7 @@ describe("<RerunPipelineButton/>", () => {
279279
mockIsAuthorized.mockReturnValue(false);
280280
mockAwaitAuthorization.mockResolvedValue(null);
281281
mockSubmitPipelineRun.mockImplementation(async (_, __, { onSuccess }) => {
282-
onSuccess({ root_execution_id: 123 });
282+
onSuccess({ id: 123 });
283283
});
284284

285285
await act(async () => {

src/components/PipelineRun/components/RerunPipelineButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const RerunPipelineButton = ({
2929
const { getToken } = useAuthLocalStorage();
3030

3131
const onSuccess = useCallback((response: PipelineRun) => {
32-
navigate({ to: `${APP_ROUTES.RUNS}/${response.root_execution_id}` });
32+
navigate({ to: `${APP_ROUTES.RUNS}/${response.id}` });
3333
}, []);
3434

3535
const onError = useCallback(

src/components/shared/ReactFlow/FlowSidebar/components/RecentExecutions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const RecentExecutions = ({ pipelineName }: { pipelineName?: string }) => {
1515
const runOverviews = useMemo(
1616
() =>
1717
recentRuns.map((run) => (
18-
<a key={run.id} href={`/runs/${run.root_execution_id}`} tabIndex={0}>
18+
<a key={run.id} href={`/runs/${run.id}`} tabIndex={0}>
1919
<RunOverview
2020
run={run}
2121
config={{

src/components/shared/RunOverview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const RunOverview = ({ run, config, className = "" }: RunOverviewProps) => {
4242
<div
4343
onClick={(e) => {
4444
e.stopPropagation();
45-
navigate({ to: `${APP_ROUTES.RUNS}/${run.root_execution_id}` });
45+
navigate({ to: `${APP_ROUTES.RUNS}/${run.id}` });
4646
}}
4747
className={cn(
4848
"flex flex-col p-2 text-sm hover:bg-gray-50 cursor-pointer",
@@ -55,7 +55,7 @@ const RunOverview = ({ run, config, className = "" }: RunOverviewProps) => {
5555
<div className="flex items-center gap-3">
5656
{combinedConfig?.showStatus && <StatusIcon status={run.status} />}
5757
{combinedConfig?.showExecutionId && (
58-
<div className="text-xs">{`#${run.root_execution_id}`}</div>
58+
<div className="text-xs">{`#${run.id}`}</div>
5959
)}
6060
</div>
6161
{combinedConfig?.showCreatedAt && run.created_at && (

src/components/shared/Submitters/Oasis/OasisSubmitter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ const OasisSubmitter = ({
7676
setSubmitSuccess(true);
7777
setCooldownTime(3);
7878
onSubmitComplete?.();
79-
showSuccessNotification(response.root_execution_id);
79+
showSuccessNotification(response.id);
8080

8181
if (isAutoRedirect) {
82-
handleViewRun(response.root_execution_id, true);
82+
handleViewRun(response.id, true);
8383
}
8484
},
8585
[

src/hooks/usePipelineRunData.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ export const usePipelineRunData = (id: string) => {
3838
} = useQuery({
3939
queryKey: ["pipeline-run", id],
4040
queryFn: async () => {
41-
// id is root_execution_id
42-
const executionDetails = await fetchPipelineExecutionInfo(
43-
id,
44-
backendUrl,
45-
).catch((_) => undefined);
46-
47-
if (executionDetails?.rootExecutionId) {
48-
return executionDetails;
49-
}
50-
5141
// id is run_id
5242
const executionDetailsDerivedFromRun = await fetchPipelineRun(
5343
id,
@@ -62,6 +52,16 @@ export const usePipelineRunData = (id: string) => {
6252
return executionDetailsDerivedFromRun;
6353
}
6454

55+
// id is root_execution_id
56+
const executionDetailsDerivedFromExecution =
57+
await fetchPipelineExecutionInfo(id, backendUrl).catch(
58+
(_) => undefined,
59+
);
60+
61+
if (executionDetailsDerivedFromExecution?.rootExecutionId) {
62+
return executionDetailsDerivedFromExecution;
63+
}
64+
6565
throw new Error("No pipeline run or execution details found");
6666
},
6767
});

0 commit comments

Comments
 (0)