Skip to content

Run engine: Using root queue timestamp to prioritize completing runs #1818

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

Merged
merged 3 commits into from
Mar 26, 2025

Conversation

ericallam
Copy link
Member

@ericallam ericallam commented Mar 25, 2025

This PR uses the queueTimestamp filed on TaskRun to propagate the original timestamp of the root run across all descendent runs. This queueTimestamp is then used whenever enqueuing a run to executing in the RunQueue, for all initial, resumes, and retry enqueuings. This means that run hierarchies will complete quicker and not be blocked by new runs.

Summary by CodeRabbit

  • New Features

    • Introduced a new task triggering service with improved tag management and flexible timestamp handling.
    • Added new asynchronous tasks for tag testing.
  • Refactor

    • Replaced the previous batch processing service with an updated version.
    • Updated timestamp management for more consistent scheduling.
  • Tests

    • Enhanced testing to validate correct task execution order based on both priority and queuing timestamps.

Copy link

changeset-bot bot commented Mar 25, 2025

⚠️ No Changeset found

Latest commit: 73cb766

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 Mar 25, 2025

Walkthrough

This pull request refactors several batch and task triggering services. The main change replaces the BatchTriggerV4Service with the RunEngineBatchTriggerService and updates related import paths and job keys. A new RunEngineTriggerTaskService is introduced for managing task triggers with added validation and idempotency logic. Additionally, modifications have been made to the RunEngine’s timestamp management—introducing a queueTimestamp parameter—and corresponding test cases have been updated to validate execution order based on both priority and timestamp. Minor adjustments are also made to error handling functions.

Changes

Files Change Summary
apps/webapp/app/routes/api.v2.tasks.batch.ts Updated service instantiation, replacing BatchTriggerV4Service with RunEngineBatchTriggerService for batch processing.
apps/webapp/app/runEngine/services/batchTrigger.server.ts
apps/webapp/app/services/worker.server.ts
Updated import paths and class name from BatchTriggerV4Service to RunEngineBatchTriggerService; changed job key from "v3.processBatchTaskRunV3" to "runengine.processBatchTaskRun".
apps/webapp/app/runEngine/services/triggerTask.server.ts
apps/webapp/app/v3/services/triggerTask.server.ts
Introduced new file with RunEngineTriggerTaskService including a robust call method for triggering tasks, and updated the v3 service to use this new class instead of TriggerTaskServiceV2.
internal-packages/run-engine/src/engine/index.ts
internal-packages/run-engine/src/engine/types.ts
Added a new optional queueTimestamp property to TriggerParams and updated the trigger method to accept a queueTimestamp parameter, using it to enqueue task runs instead of calculating the timestamp from Date.now() minus priorityMs.
internal-packages/run-engine/src/engine/systems/* (checkpointSystem.ts, delayedRunSystem.ts, enqueueSystem.ts, pendingVersionSystem.ts, waitpointSystem.ts) Removed or adjusted timestamp calculations in various systems. Timestamp parameters previously derived from run.createdAt and adjusted by priorityMs have been removed or refactored—either handled via a locally computed variable or omitted from the method signature.
internal-packages/run-engine/src/engine/tests/priority.test.ts Modified test cases to validate run execution order based on both priorityMs and the new queueTimestamp property; updated function signatures to accept a more complex structure for runs.
references/test-tasks/src/trigger/helpers.ts Updated the handleError function signature to use a single destructured object (containing ctx, payload, and error) instead of separate parameters.
apps/webapp/app/models/taskRunTag.server.ts Introduced a new parameter to createTag function for prismaClient, added createTags function for batch tag creation, and defined a new TagRecord type.
references/hello-world/src/trigger/tags.ts Added a new file containing two tasks: tagsTester and tagsChildTask, which handle triggering tasks with specific tags.

Sequence Diagram(s)

Batch Processing Flow

sequenceDiagram
    participant Client as API Client
    participant API as Batch API Endpoint
    participant BatchService as RunEngineBatchTriggerService
    participant Worker as Worker Server

    Client->>API: Sends batch task request
    API->>BatchService: Instantiate and initiate batch processing
    Worker->>BatchService: Process batch task run (using updated job key)
    BatchService-->>Worker: Return batch processing result
Loading

Triggered Task Flow

sequenceDiagram
    participant Client as API Client
    participant API as Trigger Endpoint
    participant TriggerService as RunEngineTriggerTaskService
    participant Engine as RunEngine
    participant Queue as Job Queue

    Client->>API: Request task trigger
    API->>TriggerService: Instantiate service and call trigger
    TriggerService->>Engine: Call trigger method with queueTimestamp
    Engine->>Engine: Determine effective timestamp (from parameter or default)
    Engine->>Queue: Enqueue task run with new timestamp logic
    Queue-->>Engine: Acknowledge task run enqueued
    Engine-->>TriggerService: Return task run details
    TriggerService-->>API: Respond with execution status
Loading

Possibly related PRs

  • Move run ttl and delays from graphile to redis worker #1672: The changes in the main PR, which involve replacing BatchTriggerV4Service with RunEngineBatchTriggerService, are directly related to the modifications in the retrieved PR, where BatchTriggerV4Service is renamed to RunEngineBatchTriggerService, indicating a shared codebase and functionality.
  • Run Engine 2: reschedule heartbeats and added a test to check it works #1765: The changes in the main PR, which involve replacing BatchTriggerV4Service with RunEngineBatchTriggerService, are related to the modifications in the retrieved PR where BatchTriggerV4Service is renamed to RunEngineBatchTriggerService, indicating a direct connection at the code level.
  • Associate child runs with the parent span ID #1352: The changes in the main PR, which involve replacing the BatchTriggerV4Service with RunEngineBatchTriggerService, are related to the modifications in the retrieved PR that also involve the RunEngineBatchTriggerService, indicating a direct connection at the code level.

Suggested reviewers

  • matt-aitken

Poem

I'm a rabbit in the code meadow, hopping with delight,
New services bloom in the digital light.
Batch tasks and triggers now dance in a line,
With timestamps and logic perfectly aligned.
Hop on, dear coder, let our changes take flight!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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: 1

🧹 Nitpick comments (3)
apps/webapp/app/runEngine/services/batchTrigger.server.ts (1)

646-649: Consider updating the jobKey to match the new queue name.

The queue name is "runengine.processBatchTaskRun", but the jobKey retains BatchTriggerV3Service.process:.... Renaming it to something like RunEngineBatchTriggerService.process:... would help maintain naming consistency.

- jobKey: `BatchTriggerV3Service.process:${options.batchId}:${options.processingId}`,
+ jobKey: `RunEngineBatchTriggerService.process:${options.batchId}:${options.processingId}`,
internal-packages/run-engine/src/engine/tests/priority.test.ts (1)

13-26: Refactor time-based logic to minimize test flakiness

These test lines rely on real-time delays and sleeps. While it appears consistent overall, consider using time mocking or a faster approach to reduce potential flakiness on slower or loaded CI environments.

internal-packages/run-engine/src/engine/index.ts (1)

337-338: New queueTimestamp property

By introducing the queueTimestamp parameter, you’ve improved scheduling flexibility. However, if priorityMs and queueTimestamp are both supplied, ensure that the system’s ordering logic is clear to avoid confusion.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 82251e2 and ea8e9dc.

📒 Files selected for processing (14)
  • apps/webapp/app/routes/api.v2.tasks.batch.ts (2 hunks)
  • apps/webapp/app/runEngine/services/batchTrigger.server.ts (3 hunks)
  • apps/webapp/app/runEngine/services/triggerTask.server.ts (1 hunks)
  • apps/webapp/app/services/worker.server.ts (3 hunks)
  • apps/webapp/app/v3/services/triggerTask.server.ts (2 hunks)
  • internal-packages/run-engine/src/engine/index.ts (2 hunks)
  • internal-packages/run-engine/src/engine/systems/checkpointSystem.ts (0 hunks)
  • internal-packages/run-engine/src/engine/systems/delayedRunSystem.ts (0 hunks)
  • internal-packages/run-engine/src/engine/systems/enqueueSystem.ts (1 hunks)
  • internal-packages/run-engine/src/engine/systems/pendingVersionSystem.ts (0 hunks)
  • internal-packages/run-engine/src/engine/systems/waitpointSystem.ts (0 hunks)
  • internal-packages/run-engine/src/engine/tests/priority.test.ts (1 hunks)
  • internal-packages/run-engine/src/engine/types.ts (1 hunks)
  • references/test-tasks/src/trigger/helpers.ts (1 hunks)
💤 Files with no reviewable changes (4)
  • internal-packages/run-engine/src/engine/systems/delayedRunSystem.ts
  • internal-packages/run-engine/src/engine/systems/waitpointSystem.ts
  • internal-packages/run-engine/src/engine/systems/checkpointSystem.ts
  • internal-packages/run-engine/src/engine/systems/pendingVersionSystem.ts
🧰 Additional context used
🧬 Code Definitions (2)
apps/webapp/app/routes/api.v2.tasks.batch.ts (1)
apps/webapp/app/runEngine/services/batchTrigger.server.ts (1)
  • RunEngineBatchTriggerService (52-683)
apps/webapp/app/v3/services/triggerTask.server.ts (1)
apps/webapp/app/runEngine/services/triggerTask.server.ts (1)
  • RunEngineTriggerTaskService (43-567)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: units / 🧪 Unit Tests
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (28)
internal-packages/run-engine/src/engine/types.ts (1)

90-90: Added new queueTimestamp parameter to support run prioritization

The addition of an optional queueTimestamp parameter to the TriggerParams type aligns with the PR objective of propagating the original timestamp of the root run to all descendant runs. This will allow the system to prioritize run completion based on this timestamp.

references/test-tasks/src/trigger/helpers.ts (1)

79-79: Function parameter structure improved for better readability

The handleError function signature has been updated to use object destructuring instead of separate parameters. This improves readability and makes the code more maintainable, especially when adding more parameters in the future.

apps/webapp/app/routes/api.v2.tasks.batch.ts (1)

15-15:

❓ Verification inconclusive

Migrating to RunEngineBatchTriggerService for better run prioritization

This change replaces the old BatchTriggerV4Service with the new RunEngineBatchTriggerService, which will use the newly added queueTimestamp parameter to properly prioritize runs. This migration is a critical part of implementing the PR's objective of using root queue timestamp for run prioritization.

Also applies to: 77-77


🏁 Script executed:

#!/bin/bash
# Check if there are any remaining references to BatchTriggerV4Service that might need updating
rg "BatchTriggerV4Service" --type ts

Length of output: 36


Action Required: Verify Complete Migration to RunEngineBatchTriggerService

The updated code now imports and uses RunEngineBatchTriggerService (with the new queueTimestamp parameter) in place of BatchTriggerV4Service. An automated search for BatchTriggerV4Service produced no results; however, this outcome is slightly inconclusive. Please manually verify that all legacy references have been removed, especially in the primary context (line 15) and the related area (line 77).

internal-packages/run-engine/src/engine/systems/enqueueSystem.ts (1)

82-82: Ensure priorityMs is non-negative or handled gracefully.

Subtracting priorityMs from (run.queueTimestamp ?? run.createdAt).getTime() is valid to prioritize runs. However, if priorityMs were uninitialized or unexpectedly large, the resulting timestamp might become negative or otherwise skewed. Ensure that priorityMs is guaranteed a safe range or defaulted to 0 where appropriate.

apps/webapp/app/runEngine/services/batchTrigger.server.ts (2)

18-21: Imports look consistent with the new RunEngine structure.

The updated imports align with the refactoring to RunEngine-based services.


52-52:

✅ Verification successful

Class renaming aligns with the new naming scheme.

Renaming from a previous “BatchTriggerV4Service” to RunEngineBatchTriggerService is clear and consistent with the run engine approach. To ensure no stale references exist, please verify any references to BatchTriggerV4Service are fully removed.


🏁 Script executed:

#!/bin/bash
ast-grep --pattern $'class BatchTriggerV4Service {
  $$$
}' 

Length of output: 60


I'll run an additional verification using a ripgrep search to double‐check that there are no lingering references to BatchTriggerV4Service in the repository:


🏁 Script executed:

#!/bin/bash
rg "BatchTriggerV4Service" .

Length of output: 28


Review Approved: Class Renaming Confirmed
The verification using both ast-grep and ripgrep did not detect any lingering references to BatchTriggerV4Service. This confirms that the renaming to RunEngineBatchTriggerService aligns with the new naming scheme and that stale references have been fully removed.

apps/webapp/app/services/worker.server.ts (3)

32-34: New imports for RunEngine batch processing.

Using the renamed BatchProcessingOptions and RunEngineBatchTriggerService ensures a clear separation from older v3 services.


102-102: New queue configuration for RunEngine batch processing.

Declaring "runengine.processBatchTaskRun": RunEngineBatchProcessingOptions in the worker catalog properly integrates the run engine batch flow into the existing queue system.


348-348: Instantiate new RunEngine-based batch trigger service.

Creating the RunEngineBatchTriggerService with payload.strategy here is consistent with the architectural shift away from the older batch service.

apps/webapp/app/runEngine/services/triggerTask.server.ts (15)

1-42: Imports and preliminary constants.

All newly introduced imports and constants align with the run-engine approach.


43-56: Well-defined RunEngineTriggerTaskService constructor and call signature.

The class extends WithRunEngine, and the method signature is descriptive with environment, options, and an optional attempt. No immediate issues.


57-79: Max attempts and delay logic.

The attempt check against MAX_ATTEMPTS plus the parseDelay usage are a solid approach for fail-fast and delaying runs when requested. This logic looks good.


80-179: Idempotency key handling and existing run checks.

Robust logic for detecting existing runs, handling expired idempotency keys, and blocking the parent run if needed. The approach is coherent and ensures no duplicate runs under the same key.


181-206: Entitlement and queue size checks.

Verifying entitlement for non-development environments and enforcing queue size limits through guardQueueSizeLimitsForEnv helps keep resource usage in check.


208-216: Limiting the number of tags per run.

Ensuring no more than MAX_TAGS_PER_RUN fosters data cleanliness and prevents excessive tagging overhead.


218-248: Payload packet creation and parent run validation.

Creating a payloadPacket and rejecting triggers for terminal parent runs is a good approach to maintain safe run lineages.


251-411: Main event trace block with auto-increment logic.

The event-based tracing with a locked counter ensures unique run numbering. The usage of traceEvent provides good observability, and storing tags in the DB is well-executed.


414-448: Error handling with retries and unique constraint detection.

Catching RunDuplicateIdempotencyKeyError to retry is practical, and handling Prisma unique constraints for one-time use tokens prevents repeated usage.


452-471: #getMasterQueueForEnvironment method.

Ensures a default worker group queue is found for production environments. Throwing a ServiceValidationError if absent is appropriate to fail fast.


473-521: #getQueueName method.

Looks up a queue name from the environment’s worker/task records if available; otherwise defaults to task/<slug>. Balances flexibility with a fallback.


523-554: #handlePayloadPacket for offloading large payloads.

Nicely leverages packetRequiresOffloading to store oversized payloads in object storage. Minimizes DB overhead and keeps runs efficient.


556-566: #createPayloadPacket for type-based payload handling.

This method correctly handles JSON vs. string payload types, defaulting to an empty packet if data is missing. Straightforward and robust.


569-575: getMaximumSizeForEnvironment.

This utility returns a consistent maximum queue size for dev vs. deployed environments. Straightforward approach.


577-596: guardQueueSizeLimitsForEnv ensures environment queue constraints.

The function calculates projected queue size properly, returning a helpful object with limit info. Good usage in call() for pre-trigger checks.

internal-packages/run-engine/src/engine/tests/priority.test.ts (3)

58-100: Validate the negative priority flow

The test sequence correctly verifies that negative priorities cause a delayed dequeue. Just ensure that in environments under heavier load, a 2-second delay is always sufficient to demonstrate the intended behavior.


106-194: Thorough coverage of queueTimestamp ordering

This test sequence effectively checks run ordering by timestamp. It offers solid coverage for the newly introduced queueTimestamp. Great job validating multiple distinct timestamps.


200-241: Validate combined usage of priorityMs and queueTimestamp

The updated triggerRuns function now supports runs with both priorityMs and queueTimestamp. Ensure edge cases are tested if a single run object specifies both fields, and confirm the desired ordering logic is preserved in that scenario.

Do you have any test that exercises both fields together in a single run?

internal-packages/run-engine/src/engine/index.ts (1)

418-418: Defaulting to delayUntil ?? new Date()

This fallback logic is sensible. Just verify that when a negative or small priorityMs is used, we don’t unintentionally overshadow it due to a later queueTimestamp fallback.

@@ -4,7 +4,7 @@ import { AuthenticatedEnvironment } from "~/services/apiAuth.server";
import { determineEngineVersion } from "../engineVersion.server";
import { WithRunEngine } from "./baseService.server";
import { TriggerTaskServiceV1 } from "./triggerTaskV1.server";
import { TriggerTaskServiceV2 } from "./triggerTaskV2.server";
import { RunEngineTriggerTaskService } from "~/runEngine/services/triggerTask.server";
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

Updated task service to support queue timestamp prioritization

The code has been updated to use the new RunEngineTriggerTaskService instead of the previous TriggerTaskServiceV2, incorporating the system for using queue timestamps to prioritize runs. The service is now initialized with both Prisma and the run engine instance, providing better integration with the run engine.

Also applies to: 81-84


🏁 Script executed:

#!/bin/bash
# Check to ensure there are no references to the old TriggerTaskServiceV2 that might need updating
rg "TriggerTaskServiceV2" --type ts

Length of output: 145


Action Required: Resolve Remaining Reference to Deprecated Service

  • The service update in apps/webapp/app/v3/services/triggerTask.server.ts correctly imports and uses RunEngineTriggerTaskService for queue timestamp prioritization.
  • However, the search output shows that TriggerTaskServiceV2 still exists in apps/webapp/app/v3/services/triggerTaskV2.server.ts. Please verify whether this file should be updated or removed.
  • Also, ensure that any usages of TriggerTaskServiceV2 in the referenced code (e.g., lines 81-84) are also updated to the new service implementation.

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: 0

🧹 Nitpick comments (2)
apps/webapp/app/models/taskRunTag.server.ts (1)

33-68: Consider using Promise.all for better performance

The implementation of createTags is correct, but it processes tags sequentially. For better performance, especially with multiple tags, consider using Promise.all to create tags in parallel.

-  const tagRecords: TagRecord[] = [];
-  for (const tag of tagsArray) {
-    const tagRecord = await createTag(
-      {
-        tag,
-        projectId,
-      },
-      prismaClient
-    );
-    if (tagRecord) {
-      tagRecords.push({ id: tagRecord.id, name: tagRecord.name });
-    }
-  }
+  const tagRecordsPromises = tagsArray.map(tag => 
+    createTag(
+      {
+        tag,
+        projectId,
+      },
+      prismaClient
+    )
+  );
+  
+  const completedTagRecords = await Promise.all(tagRecordsPromises);
+  const tagRecords: TagRecord[] = completedTagRecords
+    .filter(Boolean)
+    .map(tagRecord => ({ id: tagRecord.id, name: tagRecord.name }));
references/hello-world/src/trigger/tags.ts (1)

1-1: Remove unused import

The wait function is imported but not used in the code. Consider removing it to keep imports clean.

-import { logger, task, wait } from "@trigger.dev/sdk";
+import { logger, task } from "@trigger.dev/sdk";
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ea8e9dc and 73cb766.

📒 Files selected for processing (3)
  • apps/webapp/app/models/taskRunTag.server.ts (2 hunks)
  • apps/webapp/app/runEngine/services/triggerTask.server.ts (4 hunks)
  • references/hello-world/src/trigger/tags.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/webapp/app/runEngine/services/triggerTask.server.ts
🧰 Additional context used
🧬 Code Definitions (1)
references/hello-world/src/trigger/tags.ts (1)
apps/webapp/app/runEngine/services/triggerTask.server.ts (2)
  • payload (516-547)
  • payload (549-559)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: units / 🧪 Unit Tests
🔇 Additional comments (6)
apps/webapp/app/models/taskRunTag.server.ts (4)

3-3: Good addition of Prisma transaction support

Adding PrismaClientOrTransaction import is a good addition that will enable transactional tag creation, which is important for maintaining data consistency.


7-10: LGTM: Function signature improvement

Modifying the createTag function to accept a custom Prisma client or transaction improves flexibility and allows for atomic operations when creating tags within a larger transaction.


12-12: Good update to use the provided Prisma client

Using the passed prismaClient parameter correctly implements the transaction support.


28-31: Clean type definition

The TagRecord type is well-defined and clearly represents the structure of tag records returned by the functions.

references/hello-world/src/trigger/tags.ts (2)

3-15: LGTM: Well-defined task for testing tags

The tagsTester task is properly defined and demonstrates how to trigger a child task with different tag configurations.


17-22: LGTM: Child task implementation

The tagsChildTask is well-defined and correctly logs the payload.

@ericallam ericallam merged commit d6fd7f5 into main Mar 26, 2025
13 checks passed
@ericallam ericallam deleted the ea-branch-22 branch March 26, 2025 10:25
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.

3 participants