Skip to content

Docs: Fixes incorrect retrieving runs from batchTrigger #2427

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
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

samejr
Copy link
Member

@samejr samejr commented Aug 20, 2025

Main change

  • Updates the migrating-from-v3 docs page batchTrigger section with the correct way to retrieve runs.
  • Initially flagged from this discussion: Bug in v4 upgrade docs? #2423

Additional changes

  • Corrects the max number of tags from 5 to 10
  • Removes the old "upgrade-to-v4" docs page. It's a dupe as we now have "migrating-from-v3" and there's a redirect in place to handle it.

Copy link

changeset-bot bot commented Aug 20, 2025

⚠️ No Changeset found

Latest commit: 97d2286

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Aug 20, 2025

Walkthrough

This PR updates documentation and snippets related to v4 migration and tags. It changes the pattern for accessing batch runs: instead of batchHandle.runs.list(), you now call batch.retrieve(batchHandle.batchId) and read batch.runs. Snippets are updated to reflect this flow. The tags docs increase the per-run tag limit from 5 to 10 and clarify error behavior when exceeding 10. The v4 upgrade guide (docs/upgrade-to-v4.mdx) is removed entirely. The snippets doc notes a retrieve(batchId) method and a runs property on Batch, and deprecates the batchHandle.runs.list() access pattern.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs-retrieve-runs-from-batch-fix

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/migrating-from-v3.mdx (1)

293-305: Rename local batch to avoid shadowing the batch module

Same issue as in the snippet file: using batch as a variable name conflicts with the imported batch module/namespace.

Apply this diff:

-// Now you need to retrieve the batch to get the runs
-const batch = await batch.retrieve(batchHandle.batchId);
-console.log(batch.runs);
+// Now you need to retrieve the batch to get the runs
+const retrievedBatch = await batch.retrieve(batchHandle.batchId);
+console.log(retrievedBatch.runs);

Consider also showing the relevant import in the example or nearby docs to make origin explicit:

import { batch } from "@trigger.dev/sdk";
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8483900 and 97d2286.

📒 Files selected for processing (4)
  • docs/migrating-from-v3.mdx (2 hunks)
  • docs/snippets/migrate-v4-using-ai.mdx (1 hunks)
  • docs/tags.mdx (1 hunks)
  • docs/upgrade-to-v4.mdx (0 hunks)
💤 Files with no reviewable changes (1)
  • docs/upgrade-to-v4.mdx
⏰ 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). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
docs/tags.mdx (1)

78-78: Limit update and behavior note look good

The 10-tag limit and the "log-and-ignore" behavior are clearly stated and consistent with the PR intent.

Comment on lines +203 to 205
const batch = await batch.retrieve(batchHandle.batchId); // Use batch.retrieve()
console.log(batch.runs);

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Variable name collision: batch shadows the imported module

const batch = await batch.retrieve(...) shadows the module/namespace and will either be invalid TS or highly confusing. Rename the local variable.

Apply this diff:

-const batch = await batch.retrieve(batchHandle.batchId); // Use batch.retrieve()
-console.log(batch.runs);
+const retrievedBatch = await batch.retrieve(batchHandle.batchId); // Use batch.retrieve()
+console.log(retrievedBatch.runs);

Additionally, ensure the snippet (or surrounding text) shows where batch comes from, e.g.:

import { batch } from "@trigger.dev/sdk";
🤖 Prompt for AI Agents
In docs/snippets/migrate-v4-using-ai.mdx around lines 203-205, the local
declaration "const batch = await batch.retrieve(...)" shadows the imported
"batch" module; rename the local variable (e.g., batchRecord or batchInstance)
and update subsequent references (console.log) to use the new name, and add or
ensure the snippet shows the module import (import { batch } from
"@trigger.dev/sdk";) earlier in the snippet so it's clear where the module comes
from.

@@ -75,7 +75,7 @@ export const myTask = task({
});
```

Reminder: you can only have up to 5 tags per run. If you call `tags.add()` and the total number of tags will be more than 5 we log an error and ignore the new tags. That includes tags from triggering and from inside the run function.
Reminder: you can only have up to 10 tags per run. If you call `tags.add()` and the total number of tags will be more than 10 we log an error and ignore the new tags. That includes tags from triggering and from inside the run function.
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify there are no remaining references to a 5-tag limit elsewhere

To avoid conflicting guidance, scan the repo for stale mentions of a 5-tag maximum.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look for common phrasings of the old 5-tag limit across docs
rg -n -C2 -S -g '!**/node_modules/**' -g '!**/dist/**' -e \
$'up to 5 tags|maximum of 5 tags|max(imum)? 5 tags|5 tags per run|no more than 5 tags|limit of 5 tags|only 5 tags' || true

Length of output: 1342


Update stale 5-tag references in the OpenAPI spec

We still have lingering “5 tags” limits in the v3 OpenAPI YAML. Please update them to reflect the new 10-tag maximum.

• docs/v3-openapi.yaml:1610
• docs/v3-openapi.yaml:1831
• docs/v3-openapi.yaml:2008

Suggested diffs:

--- a/docs/v3-openapi.yaml
+++ b/docs/v3-openapi.yaml
@@ -1608,7 +1608,7 @@
-                You can set up to 5 tags per run, they must be less than 64 characters each.
+                You can set up to 10 tags per run, they must be less than 64 characters each.

@@ -1831,7 +1831,7 @@
-            description: A tag must be between 1 and 64 characters, a run can have up to 5 tags attached to it.
+            description: A tag must be between 1 and 64 characters, a run can have up to 10 tags attached to it.

@@ -2008,7 +2008,7 @@
-            description: A tag must be between 1 and 64 characters, a run can have up to 5 tags attached to it.
+            description: A tag must be between 1 and 64 characters, a run can have up to 10 tags attached to it.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Reminder: you can only have up to 10 tags per run. If you call `tags.add()` and the total number of tags will be more than 10 we log an error and ignore the new tags. That includes tags from triggering and from inside the run function.
++ b/docs/v3-openapi.yaml
@@ -1608,7 +1608,7 @@
You can set up to 10 tags per run, they must be less than 64 characters each.
@@ -1831,7 +1831,7 @@
description: A tag must be between 1 and 64 characters, a run can have up to 10 tags attached to it.
@@ -2008,7 +2008,7 @@
description: A tag must be between 1 and 64 characters, a run can have up to 10 tags attached to it.

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