Skip to content

feat(sdk): replace maxDuration with maxComputeSeconds (user-facing rename) [TRI-9126]#3533

Draft
matt-aitken wants to merge 6 commits intomainfrom
max-compute-seconds
Draft

feat(sdk): replace maxDuration with maxComputeSeconds (user-facing rename) [TRI-9126]#3533
matt-aitken wants to merge 6 commits intomainfrom
max-compute-seconds

Conversation

@matt-aitken
Copy link
Copy Markdown
Member

Summary

User-facing rename of maxDurationmaxComputeSeconds on defineConfig, task definitions, and trigger options. The legacy maxDuration field stays in place but is JSDoc-deprecated; if both are set, maxComputeSeconds wins. Internal SDK/CLI/run-engine code (~380 references to maxDurationInSeconds) is not touched — translation happens at the user-facing boundary only.

Linear: TRI-9126

Why

maxDuration is in seconds but users frequently pass milliseconds by mistake (e.g. maxDuration: 300000 thinking "5 minutes"). The new name makes the unit unambiguous at the call site.

What changed

  • @trigger.dev/core — added maxComputeSeconds?: number and JSDoc-deprecated maxDuration on TriggerConfig, CommonTaskOptions, and TriggerOptions.
  • @trigger.dev/sdkdefineConfig collapses maxComputeSeconds ?? maxDuration into the existing maxDuration slot. New resolveMaxComputeSeconds helper applied at all 16 user-input sites in shared.ts (task definitions, trigger, triggerAndWait, batchTrigger, batchTriggerAndWait).
  • trigger.dev CLI — six init templates updated (trigger.config.ts/.mjs, examples/simple.ts/.mjs, examples/schedule.ts/.mjs).
  • references/hello-worldtrigger.config.ts and example.ts (maxDurationTask per-task value + maxDurationParentTask per-trigger override) updated for manual testing.
  • Tests — 9 new precedence tests for defineConfig and the resolver helper.
  • Changeset — patch on @trigger.dev/core, @trigger.dev/sdk, trigger.dev.

Out of scope

  • Internal maxDurationInSeconds field (DB, ClickHouse, run engine, MarQS, dashboard presenters) — unchanged.
  • The getMaxDuration() precedence helper in packages/core/src/v3/isomorphic/maxDuration.ts — unchanged.
  • Public docs at docs/ — separate dedicated pass.
  • rules/ and .claude/skills/trigger-dev-tasks/ — explicitly excluded by repo conventions.
  • Runtime warning when maxDuration is used — out of scope; deprecation is JSDoc-only for now.

Test plan

  • pnpm run build --filter @trigger.dev/core — clean
  • pnpm run build --filter @trigger.dev/sdk — clean
  • Core test suite — 442/442 pass
  • SDK test suite — 19/19 pass (incl. 9 new)
  • Manual: cd references/hello-world && pnpm exec trigger dev, trigger max-duration task, confirm 5s timeout still kicks in
  • Manual: trigger max-duration-parent and confirm { maxComputeSeconds: timeout.None } overrides the task's per-task limit
  • Manual: fresh trigger init in a temp dir, confirm generated trigger.config.ts and example task use maxComputeSeconds

🤖 Generated with Claude Code

- defineConfig: resolves maxComputeSeconds ?? maxDuration into maxDuration
- new resolveMaxComputeSeconds helper for shared.ts
- task definitions, trigger and batchTrigger options funnel through helper

Internal references to maxDuration (run engine, queues, DB) are unchanged.
…sting

- trigger.config.ts: top-level maxComputeSeconds
- example.ts: per-task maxComputeSeconds on maxDurationTask
- example.ts: per-trigger override on triggerAndWait

Variable name maxDurationTask kept since it labels the legacy fixture concept;
the payload.maxDuration field is unrelated to the SDK property and untouched.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack

Walkthrough

This PR introduces maxComputeSeconds as the primary user-facing API for configuring task compute-time limits across the Trigger.dev SDK, replacing the legacy maxDuration. The change spans type definitions, configuration handling, SDK implementations, and project templates. A new resolveMaxComputeSeconds helper ensures backward compatibility by accepting both options and applying precedence rules where maxComputeSeconds takes priority. The implementation normalizes both options into a single maxDuration value propagated internally through task creation, single-task triggers, batch triggers, and streaming transformations. All CLI v3 initialization templates and examples are updated to use the new naming convention.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description is comprehensive and well-structured, covering summary, rationale, detailed changes by package, test status, and out-of-scope items. However, it does not follow the required template structure with checklist items and explicit Testing/Changelog sections. Follow the repository's PR description template: include the checklist items (contributing guide, title convention, testing), and fill in explicit Testing and Changelog sections rather than embedding them in free-form text.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main change: a user-facing rename of maxDuration to maxComputeSeconds across the SDK, which is the central objective of this changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch max-compute-seconds

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts (1)

1-20: ⚡ Quick win

Consider adding a test for 0 (falsy-but-valid) to guard against || regression.

The current suite doesn't cover maxComputeSeconds: 0 or maxDuration: 0. If a future refactor accidentally changes ?? to ||, the falsy-zero case would silently fall back to the other field (or undefined) and no test would catch it.

➕ Suggested additional test cases
   it("returns undefined when neither is set", () => {
     expect(resolveMaxComputeSeconds({})).toBeUndefined();
   });
+
+  it("returns 0 when maxComputeSeconds is explicitly 0", () => {
+    expect(resolveMaxComputeSeconds({ maxComputeSeconds: 0 })).toBe(0);
+  });
+
+  it("returns 0 when maxDuration is explicitly 0", () => {
+    expect(resolveMaxComputeSeconds({ maxDuration: 0 })).toBe(0);
+  });
 });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts` around lines 1 - 20,
Add tests to cover falsy-but-valid zero values so we don't regress to using ||
instead of ??; specifically, in the resolveMaxComputeSeconds test suite add
cases asserting that resolveMaxComputeSeconds({ maxComputeSeconds: 0 }) returns
0, resolveMaxComputeSeconds({ maxDuration: 0 }) returns 0, and that when both
are set and maxComputeSeconds is 0 (e.g., { maxComputeSeconds: 0, maxDuration:
999 }) the function still prefers maxComputeSeconds (returns 0); use the
resolveMaxComputeSeconds symbol to locate where to add these test cases.
packages/trigger-sdk/src/v3/config.ts (1)

12-20: ⚡ Quick win

Use the shared resolver here to avoid precedence drift.

defineConfig re-implements logic that already exists in resolveMaxComputeSeconds. Reusing the helper keeps all precedence behavior centralized.

♻️ Proposed refactor
 import type { TriggerConfig } from "@trigger.dev/core/v3";
+import { resolveMaxComputeSeconds } from "./maxComputeSeconds.js";
@@
-  const resolved = maxComputeSeconds ?? maxDuration;
+  const resolved = resolveMaxComputeSeconds({ maxComputeSeconds, maxDuration });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/trigger-sdk/src/v3/config.ts` around lines 12 - 20, The config
merging in defineConfig duplicates precedence logic — replace the manual
collapse of maxComputeSeconds/maxDuration with the shared helper by calling
resolveMaxComputeSeconds(config) (or the exported resolveMaxComputeSeconds
function) to compute the resolved value, then spread the rest of config and set
maxDuration from that resolved value when defined; update references to the
local consts ({ maxComputeSeconds, maxDuration, ...rest } and resolved) to
instead use the helper so all precedence behavior is centralized in
resolveMaxComputeSeconds.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/trigger-sdk/src/v3/config.ts`:
- Around line 12-20: The config merging in defineConfig duplicates precedence
logic — replace the manual collapse of maxComputeSeconds/maxDuration with the
shared helper by calling resolveMaxComputeSeconds(config) (or the exported
resolveMaxComputeSeconds function) to compute the resolved value, then spread
the rest of config and set maxDuration from that resolved value when defined;
update references to the local consts ({ maxComputeSeconds, maxDuration, ...rest
} and resolved) to instead use the helper so all precedence behavior is
centralized in resolveMaxComputeSeconds.

In `@packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts`:
- Around line 1-20: Add tests to cover falsy-but-valid zero values so we don't
regress to using || instead of ??; specifically, in the resolveMaxComputeSeconds
test suite add cases asserting that resolveMaxComputeSeconds({
maxComputeSeconds: 0 }) returns 0, resolveMaxComputeSeconds({ maxDuration: 0 })
returns 0, and that when both are set and maxComputeSeconds is 0 (e.g., {
maxComputeSeconds: 0, maxDuration: 999 }) the function still prefers
maxComputeSeconds (returns 0); use the resolveMaxComputeSeconds symbol to locate
where to add these test cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: afcef383-95ed-4c81-ba9b-5ae60c86a983

📥 Commits

Reviewing files that changed from the base of the PR and between 62e0066 and b25ed4c.

⛔ Files ignored due to path filters (2)
  • references/hello-world/src/trigger/example.ts is excluded by !references/**
  • references/hello-world/trigger.config.ts is excluded by !references/**
📒 Files selected for processing (14)
  • .changeset/max-compute-seconds.md
  • packages/cli-v3/templates/examples/schedule.mjs.template
  • packages/cli-v3/templates/examples/schedule.ts.template
  • packages/cli-v3/templates/examples/simple.mjs.template
  • packages/cli-v3/templates/examples/simple.ts.template
  • packages/cli-v3/templates/trigger.config.mjs.template
  • packages/cli-v3/templates/trigger.config.ts.template
  • packages/core/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/trigger-sdk/src/v3/shared.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: typecheck / typecheck
🧰 Additional context used
📓 Path-based instructions (15)
packages/trigger-sdk/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

In the Trigger.dev SDK (packages/trigger-sdk), prefer isomorphic code like fetch and ReadableStream instead of Node.js-specific code

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/trigger-sdk/src/v3/shared.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use function declarations instead of default exports

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use vitest for all tests in the Trigger.dev repository

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)

**/*.ts: When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
Do not use high-cardinality attributes in OTEL metrics such as UUIDs/IDs (envId, userId, runId, projectId, organizationId), unbounded integers (itemCount, batchSize, retryCount), timestamps (createdAt, startTime), or free-form strings (errorMessage, taskName, queueName)
When exporting OTEL metrics via OTLP to Prometheus, be aware that the exporter automatically adds unit suffixes to metric names (e.g., 'my_duration_ms' becomes 'my_duration_ms_milliseconds', 'my_counter' becomes 'my_counter_total'). Account for these transformations when writing Grafana dashboards or Prometheus queries

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
packages/trigger-sdk/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (packages/trigger-sdk/CLAUDE.md)

Always import from @trigger.dev/sdk. Never use @trigger.dev/sdk/v3 (deprecated path alias)

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/trigger-sdk/src/v3/shared.ts
packages/**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (CLAUDE.md)

Use pnpm run build to verify changes in public packages (packages/*)

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.test.{ts,tsx,js}: Use vitest exclusively for testing and never mock anything - use testcontainers instead
Place test files next to source files using the pattern MyService.ts -> MyService.test.ts

**/*.test.{ts,tsx,js}: Use vitest for unit testing and run tests with pnpm run test
Test files should live beside the files under test with descriptive describe and it blocks
Tests should avoid mocks or stubs and use helpers from @internal/testcontainers when Redis or Postgres are needed

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use testcontainers with redisTest, postgresTest, or containerTest from @internal/testcontainers for testing with Redis/PostgreSQL dependencies

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
{packages,integrations}/**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (CLAUDE.md)

When modifying any public package (packages/* or integrations/*), add a changeset using pnpm run changeset:add

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
{package.json,**/*.{ts,tsx,js}}

📄 CodeRabbit inference engine (CLAUDE.md)

Pin Zod to version 3.25.76 exactly across the entire monorepo - never use a different version or version range

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js}: Import from @trigger.dev/core using subpaths only, never the root export
Always import tasks from @trigger.dev/sdk, never from @trigger.dev/sdk/v3 or deprecated client.defineJob
Add crumbs to code using // @Crumbs comments or `// `#region` `@crumbs blocks for debug tracing during development

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
**/*.{ts,tsx,js,jsx,json,md,css,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Code formatting is enforced using Prettier. Run pnpm run format before committing

Files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use zod for validation in packages/core and apps/webapp

Files:

  • packages/core/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
packages/core/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (packages/core/CLAUDE.md)

Never import the root package (@trigger.dev/core). Always use subpath imports such as @trigger.dev/core/v3, @trigger.dev/core/v3/utils, @trigger.dev/core/logger, or @trigger.dev/core/schemas

Files:

  • packages/core/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
🧠 Learnings (3)
📚 Learning: 2026-03-22T13:26:12.060Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3244
File: apps/webapp/app/components/code/TextEditor.tsx:81-86
Timestamp: 2026-03-22T13:26:12.060Z
Learning: In the triggerdotdev/trigger.dev codebase, do not flag `navigator.clipboard.writeText(...)` calls for `missing-await`/`unhandled-promise` issues. These clipboard writes are intentionally invoked without `await` and without `catch` handlers across the project; keep that behavior consistent when reviewing TypeScript/TSX files (e.g., usages like in `apps/webapp/app/components/code/TextEditor.tsx`).

Applied to files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
📚 Learning: 2026-03-22T19:24:14.403Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3187
File: apps/webapp/app/v3/services/alerts/deliverErrorGroupAlert.server.ts:200-204
Timestamp: 2026-03-22T19:24:14.403Z
Learning: In the triggerdotdev/trigger.dev codebase, webhook URLs are not expected to contain embedded credentials/secrets (e.g., fields like `ProjectAlertWebhookProperties` should only hold credential-free webhook endpoints). During code review, if you see logging or inclusion of raw webhook URLs in error messages, do not automatically treat it as a credential-leak/secrets-in-logs issue by default—first verify the URL does not contain embedded credentials (for example, no username/password in the URL, no obvious secret/token query params or fragments). If the URL is credential-free per this project’s conventions, allow the logging.

Applied to files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/core/src/v3/config.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/core/src/v3/types/tasks.ts
  • packages/trigger-sdk/src/v3/shared.ts
📚 Learning: 2026-03-31T21:37:27.212Z
Learnt from: isshaddad
Repo: triggerdotdev/trigger.dev PR: 3283
File: docs/migration-n8n.mdx:19-21
Timestamp: 2026-03-31T21:37:27.212Z
Learning: When reviewing code in `packages/trigger-sdk/src/v3`, treat `tasks.triggerAndWait()` and `tasks.batchTriggerAndWait()` as real exported APIs. They are defined in `shared.ts` and re-exported via the `tasks` object in `tasks.ts`, and they take the task ID string as their first argument (not a task instance). This is distinct from the instance methods `yourTask.triggerAndWait()` and `yourTask.batchTriggerAndWait()`. Do not flag calls to `tasks.triggerAndWait()` or `tasks.batchTriggerAndWait()` as non-existent or incorrectly invoked.

Applied to files:

  • packages/trigger-sdk/src/v3/maxComputeSeconds.test.ts
  • packages/trigger-sdk/src/v3/config.test.ts
  • packages/trigger-sdk/src/v3/maxComputeSeconds.ts
  • packages/trigger-sdk/src/v3/config.ts
  • packages/trigger-sdk/src/v3/shared.ts
🔇 Additional comments (11)
packages/cli-v3/templates/trigger.config.ts.template (1)

7-10: Same stale doc link as in trigger.config.mjs.template.

Line 9's // See https://trigger.dev/docs/runs/max-duration has the same issue noted in the .mjs counterpart — the URL slug will become stale once the docs page is updated for the maxComputeSeconds rename.

packages/cli-v3/templates/examples/schedule.ts.template (1)

7-8: LGTM.

Straightforward rename with updated inline comment.

packages/cli-v3/templates/examples/simple.ts.template (1)

5-6: LGTM.

packages/cli-v3/templates/examples/schedule.mjs.template (1)

7-8: LGTM.

packages/trigger-sdk/src/v3/config.test.ts (1)

1-29: LGTM.

Good coverage of all precedence cases, including the important "strips maxComputeSeconds" assertion at Line 25–28. The type-cast approach to verify key absence from the returned type is idiomatic here.

packages/cli-v3/templates/examples/simple.mjs.template (1)

5-6: LGTM.

.changeset/max-compute-seconds.md (1)

1-8: Changeset scope and messaging look correct.

Package bump coverage and the migration/precedence note are clear and consistent with the implementation intent.

packages/trigger-sdk/src/v3/maxComputeSeconds.ts (1)

8-13: Helper implementation is clean and correct.

The nullish-coalescing precedence exactly matches the intended maxComputeSeconds-first behavior.

packages/core/src/v3/config.ts (1)

168-189: Type-level rename/deprecation contract looks good.

The new field plus explicit deprecation/preference semantics preserve backward compatibility while steering users to the clearer option name.

packages/core/src/v3/types/tasks.ts (1)

274-289: Task and trigger option typing updates are consistent.

Both surfaces now document the rename and precedence rule clearly, which helps avoid ambiguity for consumers.

Also applies to: 888-907

packages/trigger-sdk/src/v3/shared.ts (1)

34-35: Resolution wiring is consistently applied across all trigger paths.

Nice job applying resolveMaxComputeSeconds through task metadata registration plus single/batch, wait/non-wait, and streaming flows.

Also applies to: 239-240, 371-372, 647-648, 904-905, 1163-1164, 1425-1426, 1827-1828, 1880-1881, 1930-1931, 1982-1983, 2034-2035, 2095-2096, 2145-2146, 2229-2230, 2402-2403, 2504-2505

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 potential issues.

View 3 additional findings in Devin Review.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant