Skip to content

Commit 0967cad

Browse files
authored
Merge branch 'main' into fix/prevent-closed-stream-enqueue
2 parents e56bc39 + 0e82698 commit 0967cad

File tree

574 files changed

+42204
-13409
lines changed

Some content is hidden

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

574 files changed

+42204
-13409
lines changed

.changeset/config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
"access": "public",
1313
"baseBranch": "main",
1414
"updateInternalDependencies": "patch",
15-
"ignore": ["webapp", "proxy", "coordinator", "docker-provider", "kubernetes-provider"],
15+
"ignore": [
16+
"webapp",
17+
"coordinator",
18+
"docker-provider",
19+
"kubernetes-provider",
20+
"supervisor"
21+
],
1622
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
1723
"onlyUpdatePeerDependentsWhenOutOfRange": true
1824
}

.changeset/red-wasps-cover.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
Suppress external instrumentation for fetch calls from ApiClient

.changeset/weak-jobs-hide.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"trigger.dev": patch
4+
"@trigger.dev/core": patch
5+
---
6+
7+
v4: New lifecycle hooks

.cursor/mcp.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mcpServers": {
3+
"trigger.dev": {
4+
"url": "http://localhost:3333/sse"
5+
}
6+
}
7+
}

.cursor/rules/executing-commands.mdc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: how to run commands in the monorepo
3+
globs:
4+
alwaysApply: true
5+
---
6+
Almost all commands in the monorepo should be executed when `pnpm run ...` from the root of the monorepo. For example, running tests for the `@internal/run-engine` internal package:
7+
8+
```
9+
pnpm run dev --filter webapp
10+
```
11+
12+
But often, when running tests, it's better to `cd` into the directory and then run tests:
13+
14+
```
15+
cd apps/webapp
16+
pnpm run test --run
17+
```
18+
19+
This way you can run for a single file easily:
20+
21+
```
22+
cd internal-packages/run-engine
23+
pnpm run test ./src/engine/tests/ttl.test.ts --run
24+
```

.cursor/rules/repo.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
description: understanding the structure of the monorepo
3+
globs:
4+
alwaysApply: true
5+
---
6+
We've documented the structure of our monorepo here: [repo.md](mdc:ai/references/repo.md)

.cursor/rules/webapp.mdc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
description: Making updates to the main trigger.dev remix webapp
3+
globs: apps/webapp/**/*.tsx,apps/webapp/**/*.ts
4+
alwaysApply: false
5+
---
6+
7+
The main trigger.dev webapp, which powers it's API and dashboard and makes up the docker image that is produced as an OSS image, is a Remix 2.1.0 app that uses an express server, written in TypeScript. The following subsystems are either included in the webapp or are used by the webapp in another part of the monorepo:
8+
9+
- `@trigger.dev/database` exports a Prisma 5.4.1 client that is used extensively in the webapp to access a PostgreSQL instance. The schema file is [schema.prisma](mdc:internal-packages/database/prisma/schema.prisma)
10+
- `@trigger.dev/core` is a published package and is used to share code between the `@trigger.dev/sdk` and the webapp. It includes functionality but also a load of Zod schemas for data validation. When importing from `@trigger.dev/core` in the webapp, we never import the root `@trigger.dev/core` path, instead we favor one of the subpath exports that you can find in [package.json](mdc:packages/core/package.json)
11+
- `@internal/run-engine` has all the code needed to trigger a run and take it through it's lifecycle to completion.
12+
- `@trigger.dev/redis-worker` is a custom redis based background job/worker system that's used in the webapp and also used inside the run engine.
13+
14+
## Environment variables and testing
15+
16+
In the webapp, all environment variables are accessed through the `env` export of [env.server.ts](mdc:apps/webapp/app/env.server.ts), instead of directly accessing `process.env`.
17+
18+
Ideally, the `env.server.ts` file would never be imported into a test file, either directly or indirectly. Tests should only imported classes and functions from a file matching `app/**/*.ts` of the webapp, and that file should not use environment variables, everything should be passed through as options instead. This "service/configuration" separation is important, and can be seen in a few places in the code for examples:
19+
20+
- [realtimeClient.server.ts](mdc:apps/webapp/app/services/realtimeClient.server.ts) is the testable service, and [realtimeClientGlobal.server.ts](mdc:apps/webapp/app/services/realtimeClientGlobal.server.ts) is the configuration
21+
22+
Also for writing tests in the webapp, checkout our [tests.md](mdc:ai/references/tests.md) guide
23+
24+
## Legacy run engine vs Run Engine 2.0
25+
26+
We originally the Trigger.dev "Run Engine" not as a single system, but just spread out all over the codebase, with no real separate or encapsulation. And we didn't even call it a "Run Engine". With Run Engine 2.0, we've completely rewritten big parts of the way the system works, and moved it over to an internal package called `@internal/run-engine`. So we've retroactively named the previous run engine "Legacy run engine". We're focused almost exclusively now on moving to Run Engine 2.0 and will be deprecating and removing the legacy run engine code eventually.
27+
28+
## Where to look for code
29+
30+
- The trigger API endpoint is [api.v1.tasks.$taskId.trigger.ts](mdc:apps/webapp/app/routes/api.v1.tasks.$taskId.trigger.ts)
31+
- The batch trigger API endpoint is [api.v1.tasks.batch.ts](mdc:apps/webapp/app/routes/api.v1.tasks.batch.ts)
32+
- Setup code for the prisma client is in [db.server.ts](mdc:apps/webapp/app/db.server.ts)
33+
- The run engine is configured in [runEngine.server.ts](mdc:apps/webapp/app/v3/runEngine.server.ts)
34+
- All the "services" that are found in app/v3/services/**/*.server.ts
35+
- The code for the TaskEvent data, which is the otel data sent from tasks to our servers, is in both the [eventRepository.server.ts](mdc:apps/webapp/app/v3/eventRepository.server.ts) and also the [otlpExporter.server.ts](mdc:apps/webapp/app/v3/otlpExporter.server.ts). The otel endpoints which are hit from production and development otel exporters is [otel.v1.logs.ts](mdc:apps/webapp/app/routes/otel.v1.logs.ts) and [otel.v1.traces.ts](mdc:apps/webapp/app/routes/otel.v1.traces.ts)
36+
- We use "presenters" to move more complex loader code into a class, and you can find those are app/v3/presenters/**/*.server.ts
37+

0 commit comments

Comments
 (0)