Skip to content

fix(core): define RunEvent schema and update ApiClient validation#3215

Closed
bharathkumar39293 wants to merge 1 commit intotriggerdotdev:mainfrom
bharathkumar39293:fix/run-event-schema-v3
Closed

fix(core): define RunEvent schema and update ApiClient validation#3215
bharathkumar39293 wants to merge 1 commit intotriggerdotdev:mainfrom
bharathkumar39293:fix/run-event-schema-v3

Conversation

@bharathkumar39293
Copy link
Contributor

@bharathkumar39293 bharathkumar39293 commented Mar 14, 2026

Resolves the internal TODO in
ApiClient
regarding missing schema validation for task run events.

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • ran and tested the code works

Testing
I added a comprehensive suite of unit tests for the newly defined
RunEvent
schema in
packages/core/src/v3/schemas/api-type.test.ts
.

Steps taken:

  1. Defined the
    RunEvent
    schema based on the backend event structures.
  2. Updated the
    ApiClient
    to use this schema.
  3. Ran the unit tests using: npx vitest run src/v3/schemas/api-type.test.ts

Verification details:

  • Verified that valid event data is correctly parsed and coerced (e.g., startTime ISO string → Date object).
  • Verified that missing required fields or invalid enum values correctly trigger Zod validation errors.
  • Verified that optional fields like parentId are handled correctly.

Changelog
@trigger.dev/core: Added
RunEvent
Zod schema and
TaskEventLevel
enum to
packages/core/src/v3/schemas/api.ts
.
@trigger.dev/core: Updated ApiClient.listRunEvents to validate responses against the new schema, replacing the previous z.any() placeholder.

Screenshots
N/A (Logic/SDK changes verified via automated unit tests)

@changeset-bot
Copy link

changeset-bot bot commented Mar 14, 2026

⚠️ No Changeset found

Latest commit: d763cb8

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

@github-actions
Copy link
Contributor

Hi @bharathkumar39293, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions bot closed this Mar 14, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3591df36-4ba3-4a29-b7f5-93c66b67a0a2

📥 Commits

Reviewing files that changed from the base of the PR and between 440c16c and d763cb8.

📒 Files selected for processing (3)
  • packages/core/src/v3/apiClient/index.ts
  • packages/core/src/v3/schemas/api-type.test.ts
  • packages/core/src/v3/schemas/api.ts

Walkthrough

This pull request introduces a new RunEvent schema to the core API client. The changes add a TaskEventLevel enum and a RunEvent composite schema with fields for span identification, messaging, timing, and event status (error, partial, cancelled flags). The API client's listRunEvents method is updated to validate responses using the new RunEvent.array() schema instead of generic validation. Comprehensive tests are added to validate the schema's parsing, coercion, and validation behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can customize the high-level summary generated by CodeRabbit.

Configure the reviews.high_level_summary_instructions setting to provide custom instructions for generating the high-level summary.

Copy link
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 2 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

@bharathkumar39293
Copy link
Contributor Author

Hi @triggerdotdev maintainers! My PR was auto-closed because I'm not in the vouched list. However, I have previously contributed and had PR #2874 merged in January using my other email account. Could you please vouch for me so I can continue with this SDK improvement? Thank you!

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