Skip to content

Commit 61cb4a7

Browse files
committed
Merge remote-tracking branch 'origin/main' into change-plan-feedback-modal
2 parents cc9615d + 886429b commit 61cb4a7

File tree

756 files changed

+4620
-1436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

756 files changed

+4620
-1436
lines changed

.changeset/config.json

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,13 @@
77
}
88
],
99
"commit": false,
10-
"fixed": [
11-
[
12-
"@trigger.dev/*",
13-
"trigger.dev"
14-
]
15-
],
10+
"fixed": [["@trigger.dev/*", "trigger.dev"]],
1611
"linked": [],
1712
"access": "public",
1813
"baseBranch": "main",
1914
"updateInternalDependencies": "patch",
20-
"ignore": [
21-
"webapp",
22-
"emails",
23-
"proxy",
24-
"@trigger.dev/database",
25-
"coordinator",
26-
"docker-provider",
27-
"kubernetes-provider",
28-
"@trigger.dev/otlp-importer"
29-
],
15+
"ignore": ["webapp", "proxy", "coordinator", "docker-provider", "kubernetes-provider"],
3016
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
3117
"onlyUpdatePeerDependentsWhenOutOfRange": true
3218
}
33-
}
19+
}

.github/workflows/unit-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@ jobs:
2727
- name: 📥 Download deps
2828
run: pnpm install --frozen-lockfile
2929

30+
- name: 📀 Generate Prisma Client
31+
run: pnpm run generate
32+
3033
- name: 🧪 Run Unit Tests
3134
run: pnpm run test

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "packages/otlp-importer/protos"]
2-
path = packages/otlp-importer/protos
1+
[submodule "internal-packages/otlp-importer/protos"]
2+
path = internal-packages/otlp-importer/protos
33
url = https://github.com/open-telemetry/opentelemetry-proto.git
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export function TimedOutIcon({ className }: { className?: string }) {
2+
return (
3+
<svg
4+
className={className}
5+
width="20"
6+
height="20"
7+
viewBox="0 0 20 20"
8+
fill="none"
9+
xmlns="http://www.w3.org/2000/svg"
10+
>
11+
<path
12+
fillRule="evenodd"
13+
clipRule="evenodd"
14+
d="M9 2H8V3H9V4.07089C5.60771 4.55612 3 7.47353 3 11C3 14.866 6.13401 18 10 18C13.866 18 17 14.866 17 11C17 7.47353 14.3923 4.55612 11 4.07089V3H12V2H11H9ZM13.7603 3.36575C14.7218 2.40422 16.2807 2.40422 17.2422 3.36575C18.2038 4.32727 18.2038 5.8862 17.2422 6.84772L17.1462 6.94375C17.1251 6.96488 17.0908 6.96488 17.0697 6.94375L13.6642 3.53831C13.6431 3.51717 13.6431 3.4829 13.6642 3.46177L13.7603 3.36575ZM6.28876 3.58524C6.33584 3.53816 6.33584 3.46184 6.28876 3.41476L6.23971 3.36571C5.27819 2.40419 3.71925 2.40419 2.75773 3.36571C1.79621 4.32723 1.79621 5.88616 2.75773 6.84769L2.80678 6.89674C2.85386 6.94382 2.93019 6.94381 2.97726 6.89674L6.28876 3.58524ZM14.5858 17L16 15.5858L16.7071 16.2929C17.0976 16.6834 17.0976 17.3166 16.7071 17.7071C16.3166 18.0976 15.6834 18.0976 15.2929 17.7071L14.5858 17ZM5.42297 17L4.00875 15.5858L3.30165 16.2929C2.91112 16.6834 2.91112 17.3166 3.30165 17.7071C3.69217 18.0977 4.32534 18.0977 4.71586 17.7071L5.42297 17ZM6.29289 7.29289C6.68342 6.90237 7.31658 6.90237 7.70711 7.29289L10 9.58579L12.2929 7.29289C12.6834 6.90237 13.3166 6.90237 13.7071 7.29289C14.0976 7.68342 14.0976 8.31658 13.7071 8.70711L11.4142 11L13.7071 13.2929C14.0976 13.6834 14.0976 14.3166 13.7071 14.7071C13.3166 15.0976 12.6834 15.0976 12.2929 14.7071L10 12.4142L7.70711 14.7071C7.31658 15.0976 6.68342 15.0976 6.29289 14.7071C5.90237 14.3166 5.90237 13.6834 6.29289 13.2929L8.58579 11L6.29289 8.70711C5.90237 8.31658 5.90237 7.68342 6.29289 7.29289Z"
15+
fill="currentColor"
16+
/>
17+
</svg>
18+
);
19+
}

apps/webapp/app/components/primitives/Select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ export function SelectPopover({
613613
"z-50 flex flex-col overflow-clip rounded border border-charcoal-700 bg-background-bright shadow-md outline-none animate-in fade-in-40",
614614
"min-w-[max(180px,calc(var(--popover-anchor-width)+0.5rem))]",
615615
"max-w-[min(480px,var(--popover-available-width))]",
616-
"max-h-[min(480px,var(--popover-available-height))]",
616+
"max-h-[min(520px,var(--popover-available-height))]",
617617
"origin-[var(--popover-transform-origin)]",
618618
className
619619
)}

apps/webapp/app/components/primitives/TreeView/TreeView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,11 @@ export function useTree<TData, TFilterValue>({
235235
getItemKey: (index) => state.visibleNodeIds[index],
236236
getScrollElement: () => parentRef.current,
237237
estimateSize: (index: number) => {
238+
const treeItem = tree[index];
239+
if (!treeItem) return 0;
238240
return estimatedRowHeight({
239-
node: tree[index],
240-
state: state.nodes[tree[index].id],
241+
node: treeItem,
242+
state: state.nodes[treeItem.id],
241243
index,
242244
});
243245
},

apps/webapp/app/components/runs/v3/RunInspector.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ export function RunInspector({
324324
</Property.Value>
325325
</Property.Item>
326326
)}
327+
<Property.Item>
328+
<Property.Label>Max duration</Property.Label>
329+
<Property.Value>
330+
{run.maxDurationInSeconds ? `${run.maxDurationInSeconds}s` : "–"}
331+
</Property.Value>
332+
</Property.Item>
327333
<Property.Item>
328334
<Property.Label>Run invocation cost</Property.Label>
329335
<Property.Value>

apps/webapp/app/components/runs/v3/TaskRunStatus.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import {
88
NoSymbolIcon,
99
PauseCircleIcon,
1010
RectangleStackIcon,
11+
StopIcon,
1112
TrashIcon,
1213
XCircleIcon,
1314
} from "@heroicons/react/20/solid";
1415
import { TaskRunStatus } from "@trigger.dev/database";
1516
import assertNever from "assert-never";
1617
import { SnowflakeIcon } from "lucide-react";
18+
import { TimedOutIcon } from "~/assets/icons/TimedOutIcon";
1719
import { Spinner } from "~/components/primitives/Spinner";
1820
import { cn } from "~/utils/cn";
1921

@@ -27,6 +29,7 @@ export const allTaskRunStatuses = [
2729
"COMPLETED_SUCCESSFULLY",
2830
"CANCELED",
2931
"COMPLETED_WITH_ERRORS",
32+
"TIMED_OUT",
3033
"CRASHED",
3134
"PAUSED",
3235
"INTERRUPTED",
@@ -44,6 +47,7 @@ export const filterableTaskRunStatuses = [
4447
"COMPLETED_SUCCESSFULLY",
4548
"CANCELED",
4649
"COMPLETED_WITH_ERRORS",
50+
"TIMED_OUT",
4751
"CRASHED",
4852
"INTERRUPTED",
4953
"SYSTEM_FAILURE",
@@ -65,6 +69,7 @@ const taskRunStatusDescriptions: Record<TaskRunStatus, string> = {
6569
PAUSED: "Task has been paused by the user",
6670
CRASHED: "Task has crashed and won't be retried",
6771
EXPIRED: "Task has surpassed its ttl and won't be executed",
72+
TIMED_OUT: "Task has failed because it exceeded its maxDuration",
6873
};
6974

7075
export const QUEUED_STATUSES = [
@@ -140,6 +145,8 @@ export function TaskRunStatusIcon({
140145
return <FireIcon className={cn(runStatusClassNameColor(status), className)} />;
141146
case "EXPIRED":
142147
return <TrashIcon className={cn(runStatusClassNameColor(status), className)} />;
148+
case "TIMED_OUT":
149+
return <TimedOutIcon className={cn(runStatusClassNameColor(status), className)} />;
143150

144151
default: {
145152
assertNever(status);
@@ -174,6 +181,8 @@ export function runStatusClassNameColor(status: TaskRunStatus): string {
174181
return "text-error";
175182
case "CRASHED":
176183
return "text-error";
184+
case "TIMED_OUT":
185+
return "text-error";
177186
default: {
178187
assertNever(status);
179188
}
@@ -210,6 +219,8 @@ export function runStatusTitle(status: TaskRunStatus): string {
210219
return "Crashed";
211220
case "EXPIRED":
212221
return "Expired";
222+
case "TIMED_OUT":
223+
return "Timed out";
213224
default: {
214225
assertNever(status);
215226
}

apps/webapp/app/components/runs/v3/TaskRunsTable.tsx

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import { BeakerIcon, BookOpenIcon, CheckIcon } from "@heroicons/react/24/solid";
99
import { useLocation } from "@remix-run/react";
1010
import { formatDuration, formatDurationMilliseconds } from "@trigger.dev/core/v3";
1111
import { useCallback, useRef } from "react";
12+
import { Badge } from "~/components/primitives/Badge";
1213
import { Button, LinkButton } from "~/components/primitives/Buttons";
1314
import { Checkbox } from "~/components/primitives/Checkbox";
1415
import { Dialog, DialogTrigger } from "~/components/primitives/Dialog";
1516
import { Header3 } from "~/components/primitives/Headers";
1617
import { useSelectedItems } from "~/components/primitives/SelectedItemsProvider";
18+
import { SimpleTooltip } from "~/components/primitives/Tooltip";
1719
import { useEnvironments } from "~/hooks/useEnvironments";
1820
import { useFeatures } from "~/hooks/useFeatures";
1921
import { useOrganization } from "~/hooks/useOrganizations";
@@ -39,9 +41,12 @@ import {
3941
import { CancelRunDialog } from "./CancelRunDialog";
4042
import { LiveTimer } from "./LiveTimer";
4143
import { ReplayRunDialog } from "./ReplayRunDialog";
42-
import { TaskRunStatusCombo } from "./TaskRunStatus";
4344
import { RunTag } from "./RunTag";
44-
import { Badge } from "~/components/primitives/Badge";
45+
import {
46+
descriptionForTaskRunStatus,
47+
filterableTaskRunStatuses,
48+
TaskRunStatusCombo,
49+
} from "./TaskRunStatus";
4550

4651
type RunsTableProps = {
4752
total: number;
@@ -126,7 +131,27 @@ export function TaskRunsTable({
126131
<TableHeaderCell>Env</TableHeaderCell>
127132
<TableHeaderCell>Task</TableHeaderCell>
128133
<TableHeaderCell>Version</TableHeaderCell>
129-
<TableHeaderCell>Status</TableHeaderCell>
134+
<TableHeaderCell
135+
tooltip={
136+
<div className="flex flex-col divide-y divide-grid-dimmed">
137+
{filterableTaskRunStatuses.map((status) => (
138+
<div
139+
key={status}
140+
className="grid grid-cols-[8rem_1fr] gap-x-2 py-2 first:pt-1 last:pb-1"
141+
>
142+
<div className="mb-0.5 flex items-center gap-1.5 whitespace-nowrap">
143+
<TaskRunStatusCombo status={status} />
144+
</div>
145+
<Paragraph variant="extra-small" className="!text-wrap text-text-dimmed">
146+
{descriptionForTaskRunStatus(status)}
147+
</Paragraph>
148+
</div>
149+
))}
150+
</div>
151+
}
152+
>
153+
Status
154+
</TableHeaderCell>
130155
<TableHeaderCell>Started</TableHeaderCell>
131156
<TableHeaderCell
132157
colSpan={3}
@@ -287,7 +312,11 @@ export function TaskRunsTable({
287312
</TableCell>
288313
<TableCell to={path}>{run.version ?? "–"}</TableCell>
289314
<TableCell to={path}>
290-
<TaskRunStatusCombo status={run.status} />
315+
<SimpleTooltip
316+
content={descriptionForTaskRunStatus(run.status)}
317+
disableHoverableContent
318+
button={<TaskRunStatusCombo status={run.status} />}
319+
/>
291320
</TableCell>
292321
<TableCell to={path}>
293322
{run.startedAt ? <DateTime date={run.startedAt} /> : "–"}

apps/webapp/app/database-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const TaskRunStatus = {
4242
CRASHED: "CRASHED",
4343
DELAYED: "DELAYED",
4444
EXPIRED: "EXPIRED",
45+
TIMED_OUT: "TIMED_OUT",
4546
} as const satisfies Record<TaskRunStatusType, TaskRunStatusType>;
4647

4748
export const JobRunStatus = {

apps/webapp/app/db.server.ts

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,51 @@
1-
import { Prisma, PrismaClient } from "@trigger.dev/database";
1+
import {
2+
Prisma,
3+
PrismaClient,
4+
PrismaClientOrTransaction,
5+
PrismaReplicaClient,
6+
PrismaTransactionClient,
7+
PrismaTransactionOptions,
8+
} from "@trigger.dev/database";
29
import invariant from "tiny-invariant";
310
import { z } from "zod";
411
import { env } from "./env.server";
512
import { logger } from "./services/logger.server";
613
import { isValidDatabaseUrl } from "./utils/db";
714
import { singleton } from "./utils/singleton";
15+
import { $transaction as transac } from "@trigger.dev/database";
816

9-
export type PrismaTransactionClient = Omit<
10-
PrismaClient,
11-
"$connect" | "$disconnect" | "$on" | "$transaction" | "$use" | "$extends"
12-
>;
13-
14-
export type PrismaClientOrTransaction = PrismaClient | PrismaTransactionClient;
15-
16-
function isTransactionClient(prisma: PrismaClientOrTransaction): prisma is PrismaTransactionClient {
17-
return !("$transaction" in prisma);
18-
}
19-
20-
function isPrismaKnownError(error: unknown): error is Prisma.PrismaClientKnownRequestError {
21-
return (
22-
typeof error === "object" && error !== null && "code" in error && typeof error.code === "string"
23-
);
24-
}
25-
26-
export type PrismaTransactionOptions = {
27-
/** The maximum amount of time (in ms) Prisma Client will wait to acquire a transaction from the database. The default value is 2000ms. */
28-
maxWait?: number;
29-
30-
/** The maximum amount of time (in ms) the interactive transaction can run before being canceled and rolled back. The default value is 5000ms. */
31-
timeout?: number;
32-
33-
/** Sets the transaction isolation level. By default this is set to the value currently configured in your database. */
34-
isolationLevel?: Prisma.TransactionIsolationLevel;
35-
36-
swallowPrismaErrors?: boolean;
17+
export type {
18+
PrismaTransactionClient,
19+
PrismaClientOrTransaction,
20+
PrismaTransactionOptions,
21+
PrismaReplicaClient,
3722
};
3823

3924
export async function $transaction<R>(
4025
prisma: PrismaClientOrTransaction,
4126
fn: (prisma: PrismaTransactionClient) => Promise<R>,
4227
options?: PrismaTransactionOptions
4328
): Promise<R | undefined> {
44-
if (isTransactionClient(prisma)) {
45-
return fn(prisma);
46-
}
47-
48-
try {
49-
return await (prisma as PrismaClient).$transaction(fn, options);
50-
} catch (error) {
51-
if (isPrismaKnownError(error)) {
29+
return transac(
30+
prisma,
31+
fn,
32+
(error) => {
5233
logger.error("prisma.$transaction error", {
5334
code: error.code,
5435
meta: error.meta,
5536
stack: error.stack,
5637
message: error.message,
5738
name: error.name,
5839
});
59-
60-
if (options?.swallowPrismaErrors) {
61-
return;
62-
}
63-
}
64-
65-
throw error;
66-
}
40+
},
41+
options
42+
);
6743
}
6844

6945
export { Prisma };
7046

7147
export const prisma = singleton("prisma", getClient);
7248

73-
export type PrismaReplicaClient = Omit<PrismaClient, "$transaction">;
74-
7549
export const $replica: PrismaReplicaClient = singleton(
7650
"replica",
7751
() => getReplicaClient() ?? prisma

apps/webapp/app/env.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ const EnvironmentSchema = z.object({
213213
TASK_PAYLOAD_OFFLOAD_THRESHOLD: z.coerce.number().int().default(524_288), // 512KB
214214
TASK_PAYLOAD_MAXIMUM_SIZE: z.coerce.number().int().default(3_145_728), // 3MB
215215
TASK_RUN_METADATA_MAXIMUM_SIZE: z.coerce.number().int().default(4_096), // 4KB
216+
217+
MAXIMUM_DEV_QUEUE_SIZE: z.coerce.number().int().optional(),
218+
MAXIMUM_DEPLOYED_QUEUE_SIZE: z.coerce.number().int().optional(),
216219
});
217220

218221
export type Environment = z.infer<typeof EnvironmentSchema>;

apps/webapp/app/models/taskRun.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export function batchTaskRunItemStatusForRunStatus(
119119
case TaskRunStatus.SYSTEM_FAILURE:
120120
case TaskRunStatus.CRASHED:
121121
case TaskRunStatus.EXPIRED:
122+
case TaskRunStatus.TIMED_OUT:
122123
return BatchTaskRunItemStatus.FAILED;
123124
case TaskRunStatus.PENDING:
124125
case TaskRunStatus.WAITING_FOR_DEPLOY:

apps/webapp/app/presenters/v3/ApiRetrieveRunPresenter.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ export class ApiRetrieveRunPresenter extends BasePresenter {
270270
case "EXPIRED": {
271271
return "EXPIRED";
272272
}
273+
case "TIMED_OUT": {
274+
return "TIMED_OUT";
275+
}
273276
default: {
274277
assertNever(status);
275278
}

apps/webapp/app/presenters/v3/ApiRunListPresenter.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ export class ApiRunListPresenter extends BasePresenter {
310310
case "EXPIRED": {
311311
return "EXPIRED";
312312
}
313+
case "TIMED_OUT": {
314+
return "TIMED_OUT";
315+
}
313316
default: {
314317
assertNever(status);
315318
}

0 commit comments

Comments
 (0)