-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(sdk): replace maxDuration with maxComputeSeconds (user-facing rename) [TRI-9126]
#3533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
matt-aitken
wants to merge
8
commits into
main
Choose a base branch
from
max-compute-seconds
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
995c3f4
feat(core): add maxComputeSeconds, deprecate maxDuration in user-faci…
matt-aitken 15a36bf
feat(sdk): resolve maxComputeSeconds at user-facing boundaries
matt-aitken 78acea6
test(sdk): cover maxComputeSeconds precedence in defineConfig and helper
matt-aitken 328a348
feat(cli): use maxComputeSeconds in init templates
matt-aitken 49a0a0e
chore: changeset for maxComputeSeconds
matt-aitken ce718f3
chore(references): use maxComputeSeconds in hello-world for manual te…
matt-aitken 174c9a3
Updated the error and link to the docs
matt-aitken 5d8e259
fix(cli): resolve maxComputeSeconds in validateConfig for bypass cases
matt-aitken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@trigger.dev/core": patch | ||
| "@trigger.dev/sdk": patch | ||
| "trigger.dev": patch | ||
| --- | ||
|
|
||
| Add `maxComputeSeconds` as the user-facing replacement for `maxDuration` on `defineConfig`, task definitions, and trigger options. The new name makes the unit (compute-time seconds) unambiguous at the call site. `maxDuration` is JSDoc-deprecated and still accepted; if both are set, `maxComputeSeconds` wins. The `init` templates have been updated to use the new name. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { defineConfig } from "./config.js"; | ||
|
|
||
| describe("defineConfig - maxComputeSeconds", () => { | ||
| it("uses maxComputeSeconds when only maxComputeSeconds is set", () => { | ||
| const cfg = defineConfig({ project: "p", maxComputeSeconds: 600 }); | ||
| expect(cfg.maxDuration).toBe(600); | ||
| }); | ||
|
|
||
| it("uses maxDuration when only maxDuration is set", () => { | ||
| const cfg = defineConfig({ project: "p", maxDuration: 600 }); | ||
| expect(cfg.maxDuration).toBe(600); | ||
| }); | ||
|
|
||
| it("prefers maxComputeSeconds when both are set", () => { | ||
| const cfg = defineConfig({ project: "p", maxComputeSeconds: 600, maxDuration: 9999 }); | ||
| expect(cfg.maxDuration).toBe(600); | ||
| }); | ||
|
|
||
| it("leaves maxDuration unset when neither is provided", () => { | ||
| const cfg = defineConfig({ project: "p" }); | ||
| expect(cfg.maxDuration).toBeUndefined(); | ||
| }); | ||
|
|
||
| it("strips maxComputeSeconds from the returned config", () => { | ||
| const cfg = defineConfig({ project: "p", maxComputeSeconds: 600 }); | ||
| expect((cfg as { maxComputeSeconds?: number }).maxComputeSeconds).toBeUndefined(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { resolveMaxComputeSeconds } from "./maxComputeSeconds.js"; | ||
|
|
||
| describe("resolveMaxComputeSeconds", () => { | ||
| it("returns maxComputeSeconds when only maxComputeSeconds is set", () => { | ||
| expect(resolveMaxComputeSeconds({ maxComputeSeconds: 300 })).toBe(300); | ||
| }); | ||
|
|
||
| it("returns maxDuration when only maxDuration is set", () => { | ||
| expect(resolveMaxComputeSeconds({ maxDuration: 300 })).toBe(300); | ||
| }); | ||
|
|
||
| it("prefers maxComputeSeconds when both are set", () => { | ||
| expect(resolveMaxComputeSeconds({ maxComputeSeconds: 300, maxDuration: 999 })).toBe(300); | ||
| }); | ||
|
|
||
| it("returns undefined when neither is set", () => { | ||
| expect(resolveMaxComputeSeconds({})).toBeUndefined(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /** | ||
| * Collapse the user-facing `maxComputeSeconds` (new name) and `maxDuration` (deprecated) | ||
| * into a single value. If both are provided, `maxComputeSeconds` wins. | ||
| * | ||
| * Internal SDK/CLI/platform code only reads `maxDuration`, so all call sites that | ||
| * accept user input should funnel through this helper before forwarding the value. | ||
| */ | ||
| export function resolveMaxComputeSeconds(input: { | ||
| maxComputeSeconds?: number; | ||
| maxDuration?: number; | ||
| }): number | undefined { | ||
| return input.maxComputeSeconds ?? input.maxDuration; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lower-bound validation is missing for
maxComputeSeconds.On Line 348,
if (!resolvedMaxDuration)only rejects falsy values. Values1..4pass, even though the error on Line 350 states the minimum is 5 seconds.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents