Skip to content

Commit 4a86da7

Browse files
authored
Merge branch 'main' into plain-customer-cards
2 parents d0de363 + 3e6458f commit 4a86da7

1,204 files changed

Lines changed: 143835 additions & 14837 deletions

File tree

Some content is hidden

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

.changeset/ai-sdk-v6-support.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

.changeset/bright-keys-shine.md

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@trigger.dev/core": patch
3+
"trigger.dev": patch
4+
---
5+
6+
Fix dev workers spinning at 100% CPU after the parent CLI disconnects. Orphaned `trigger-dev-run-worker` (and indexer) processes were caught in an `uncaughtException` feedback loop: a periodic IPC send via `process.send` would throw `ERR_IPC_CHANNEL_CLOSED` once the parent closed the channel, which re-entered the same handler that itself called `process.send`, scheduled via `setImmediate` and amplified by source-map-support's `prepareStackTrace`. Fixed by (1) silently dropping packets in `ZodIpcConnection` when the channel is disconnected, (2) adding a `process.on("disconnect", ...)` handler in dev workers so they exit cleanly when the CLI closes the IPC channel, and (3) wrapping all `uncaughtException`-path `process.send` calls in a `safeSend` guard that checks `process.connected` and swallows synchronous throws.

.changeset/gentle-streams-flow.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/thirty-trainers-reflect.md

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"trigger.dev": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
Fail attempts on uncaught exceptions instead of hanging to `MAX_DURATION_EXCEEDED`. A Node `EventEmitter` (e.g. `node-redis`) emitting `"error"` with no `.on("error", ...)` listener escalates to `uncaughtException`, which the worker previously reported but did not act on — runs drifted to maxDuration with empty attempts. They now fail fast with the original error and status `FAILED`, and respect the task's normal retry policy. You should still attach `.on("error", ...)` listeners to long-lived clients to handle errors gracefully.

.claude/rules/database-safety.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
paths:
3+
- "internal-packages/database/**"
4+
---
5+
6+
# Database Migration Safety
7+
8+
- When adding indexes to **existing tables**, use `CREATE INDEX CONCURRENTLY IF NOT EXISTS` to avoid table locks. These must be in their own separate migration file (one index per file).
9+
- Indexes on **newly created tables** (same migration as `CREATE TABLE`) do not need CONCURRENTLY.
10+
- When indexing a **new column on an existing table**, split into two migrations: first `ADD COLUMN IF NOT EXISTS`, then `CREATE INDEX CONCURRENTLY IF NOT EXISTS` in a separate file.
11+
- After generating a migration with Prisma, remove extraneous lines for: `_BackgroundWorkerToBackgroundWorkerFile`, `_BackgroundWorkerToTaskQueue`, `_TaskRunToTaskRunTag`, `_WaitpointRunConnections`, `_completedWaitpoints`, `SecretStore_key_idx`, and unrelated TaskRun indexes.
12+
- Never drop columns or tables without explicit approval.
13+
- New code should target `RunEngineVersion.V2` only.

.claude/rules/docs-writing.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
paths:
3+
- "docs/**"
4+
---
5+
6+
# Documentation Writing Rules
7+
8+
- Use Mintlify MDX format. Frontmatter: `title`, `description`, `sidebarTitle` (optional).
9+
- After creating a new page, add it to `docs.json` navigation under the correct group.
10+
- Use Mintlify components: `<Note>`, `<Warning>`, `<Info>`, `<Tip>`, `<CodeGroup>`, `<Expandable>`, `<Steps>`/`<Step>`.
11+
- Code examples should be complete and runnable where possible.
12+
- Always import from `@trigger.dev/sdk`, never `@trigger.dev/sdk/v3`.
13+
- Keep paragraphs short. Use headers to break up content.
14+
- Link to related pages using relative paths (e.g., `[Tasks](/tasks/overview)`).

.claude/rules/legacy-v3-code.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
paths:
3+
- "apps/webapp/app/v3/**"
4+
---
5+
6+
# Legacy V1 Engine Code in `app/v3/`
7+
8+
The `v3/` directory name is misleading - most code here is actively used by the current V2 engine. Only the specific files below are legacy V1-only code.
9+
10+
## V1-Only Files - Never Modify
11+
12+
- `marqs/` directory (entire MarQS queue system: sharedQueueConsumer, devQueueConsumer, fairDequeuingStrategy, devPubSub)
13+
- `legacyRunEngineWorker.server.ts` (V1 background job worker)
14+
- `services/triggerTaskV1.server.ts` (deprecated V1 task triggering)
15+
- `services/cancelTaskRunV1.server.ts` (deprecated V1 cancellation)
16+
- `authenticatedSocketConnection.server.ts` (V1 dev WebSocket using DevQueueConsumer)
17+
- `sharedSocketConnection.ts` (V1 shared queue socket using SharedQueueConsumer)
18+
19+
## V1/V2 Branching Pattern
20+
21+
Some services act as routers that branch on `RunEngineVersion`:
22+
- `services/cancelTaskRun.server.ts` - calls V1 service or `engine.cancelRun()` for V2
23+
- `services/batchTriggerV3.server.ts` - uses marqs for V1 path, run-engine for V2
24+
25+
When editing these shared services, only modify V2 code paths.
26+
27+
## V2 Modern Stack
28+
29+
- **Run lifecycle**: `@internal/run-engine` (internal-packages/run-engine)
30+
- **Background jobs**: `@trigger.dev/redis-worker` (not graphile-worker/zodworker)
31+
- **Queue operations**: RunQueue inside run-engine (not MarQS)
32+
- **V2 engine singleton**: `runEngine.server.ts`, `runEngineHandlers.server.ts`
33+
- **V2 workers**: `commonWorker.server.ts`, `alertsWorker.server.ts`, `batchTriggerWorker.server.ts`

.claude/rules/sdk-packages.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
paths:
3+
- "packages/**"
4+
---
5+
6+
# Public Package Rules
7+
8+
- Changes to `packages/` are **customer-facing**. Always add a changeset: `pnpm run changeset:add`
9+
- Default to **patch**. Get maintainer approval for minor. Never select major without explicit approval.
10+
- `@trigger.dev/core`: **Never import the root**. Always use subpath imports (e.g., `@trigger.dev/core/v3`).
11+
- Do NOT update `rules/` or `.claude/skills/trigger-dev-tasks/` unless explicitly asked. These are maintained in separate dedicated passes.
12+
- Test changes using `references/hello-world` reference project.

0 commit comments

Comments
 (0)