Skip to content

Query API and SDK#3060

Draft
matt-aitken wants to merge 10 commits intomainfrom
query-api
Draft

Query API and SDK#3060
matt-aitken wants to merge 10 commits intomainfrom
query-api

Conversation

@matt-aitken
Copy link
Member

Summary

  • Add API endpoint to run TRQL queries
  • Implement SDK function for executing queries

@changeset-bot
Copy link

changeset-bot bot commented Feb 14, 2026

⚠️ No Changeset found

Latest commit: f105b8f

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

Walkthrough

Adds a query execution feature end-to-end: new query schemas and types in core (request/response shapes, runs table row types, and RunFriendlyStatus), a new ApiClient.executeQuery method, SDK-level query.execute with JSON/CSV overloads and re-exports, a Remix action route to run queries and return JSON or CSV, and a small UI update adding a "query" icon case and re-exporting run-friendly status from core.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 3
❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete. It lacks required sections: testing steps, proper changelog entry, issue reference, and confirmation of the contributing guide and testing checklist. Complete the PR template by adding: issue reference (Closes #), testing section with specific steps, detailed changelog, checklist confirmations, and any relevant screenshots.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (22 files):

⚔️ apps/webapp/app/components/Shortcuts.tsx (content)
⚔️ apps/webapp/app/components/code/ChartConfigPanel.tsx (content)
⚔️ apps/webapp/app/components/code/QueryResultsChart.tsx (content)
⚔️ apps/webapp/app/components/code/TSQLResultsTable.tsx (content)
⚔️ apps/webapp/app/components/metrics/QueryWidget.tsx (content)
⚔️ apps/webapp/app/components/metrics/SaveToDashboardDialog.tsx (content)
⚔️ apps/webapp/app/components/primitives/ClientTabs.tsx (content)
⚔️ apps/webapp/app/components/primitives/SegmentedControl.tsx (content)
⚔️ apps/webapp/app/components/primitives/ShortcutKey.tsx (content)
⚔️ apps/webapp/app/components/primitives/charts/BigNumberCard.tsx (content)
⚔️ apps/webapp/app/components/primitives/charts/Card.tsx (content)
⚔️ apps/webapp/app/components/primitives/charts/ChartBar.tsx (content)
⚔️ apps/webapp/app/components/primitives/charts/ChartLegendCompound.tsx (content)
⚔️ apps/webapp/app/components/query/QueryEditor.tsx (content)
⚔️ apps/webapp/app/components/runs/v3/RunIcon.tsx (content)
⚔️ apps/webapp/app/components/runs/v3/TaskRunStatus.tsx (content)
⚔️ apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/AITabContent.tsx (content)
⚔️ docs/realtime/react-hooks/subscribe.mdx (content)
⚔️ docs/troubleshooting.mdx (content)
⚔️ packages/core/src/v3/apiClient/index.ts (content)
⚔️ packages/core/src/v3/schemas/index.ts (content)
⚔️ packages/trigger-sdk/src/v3/index.ts (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Query API and SDK' is clear and specific, directly referencing the main changes: adding a query API endpoint and SDK implementation.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch query-api
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch query-api
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
packages/core/src/v3/schemas/query.ts (2)

1-1: Unused import: TypeOf is never referenced in this file.

TypeOf is imported but z.infer is used everywhere instead.

🧹 Proposed fix
-import { TypeOf, z } from "zod";
+import { z } from "zod";

88-179: Use type instead of interface for RunsTableRow.

♻️ Proposed fix
-export interface RunsTableRow {
+export type RunsTableRow = {
   /** Unique run ID (e.g. `run_cm1a2b3c4d5e6f7g8h9i`) */
   run_id: string;
   // ... all fields ...
   /** Bulk action group IDs that operated on this run */
   bulk_action_group_ids: string[];
-}
+};

As per coding guidelines, **/*.{ts,tsx}: "Use types over interfaces for TypeScript".

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6b662b and f105b8f.

📒 Files selected for processing (1)
  • packages/core/src/v3/schemas/query.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{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

**/*.{ts,tsx}: Always import tasks from @trigger.dev/sdk, never use @trigger.dev/sdk/v3 or deprecated client.defineJob pattern
Every Trigger.dev task must be exported and have a unique id property with no timeouts in the run function

Files:

  • packages/core/src/v3/schemas/query.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/schemas/query.ts
**/*.{ts,tsx,js,jsx}

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

Use function declarations instead of default exports

Import from @trigger.dev/core using subpaths only, never import from root

Files:

  • packages/core/src/v3/schemas/query.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/core/src/v3/schemas/query.ts
**/*.{js,ts,jsx,tsx,json,md,yaml,yml}

📄 CodeRabbit inference engine (AGENTS.md)

Format code using Prettier before committing

Files:

  • packages/core/src/v3/schemas/query.ts
{packages,integrations}/**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Add a changeset when modifying any public package in packages/* or integrations/* using pnpm run changeset:add

Files:

  • packages/core/src/v3/schemas/query.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: The SDK at packages/trigger-sdk is an isomorphic TypeScript SDK
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to {packages/core,apps/webapp}/**/*.{ts,tsx} : Use zod for validation in packages/core and apps/webapp

Applied to files:

  • packages/core/src/v3/schemas/query.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `schemaTask()` from `trigger.dev/sdk/v3` with Zod schema for payload validation

Applied to files:

  • packages/core/src/v3/schemas/query.ts
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to internal-packages/database/**/*.{ts,tsx} : Use Prisma for database interactions in internal-packages/database with PostgreSQL

Applied to files:

  • packages/core/src/v3/schemas/query.ts
🧬 Code graph analysis (1)
packages/core/src/v3/schemas/query.ts (2)
apps/webapp/app/components/runs/v3/TaskRunStatus.tsx (2)
  • runFriendlyStatus (254-254)
  • RunFriendlyStatus (254-254)
packages/trigger-sdk/src/v3/query.ts (3)
  • RunFriendlyStatus (10-10)
  • RunsTableRow (10-10)
  • QueryTable (10-10)
⏰ 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). (28)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • 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 / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: sdk-compat / Cloudflare Workers
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: sdk-compat / Bun Runtime
  • GitHub Check: sdk-compat / Deno Runtime
  • GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
  • GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
packages/core/src/v3/schemas/query.ts (3)

9-16: LGTM!

Schema is well-defined with sensible defaults for scope and format. Using .nullish() for optional temporal fields is appropriate.


20-44: LGTM!

Response schemas and discriminated union are correctly defined. The QueryExecuteJSONResponseBody type now properly infers from the JSON-only schema.


206-209: LGTM!

QueryTable is a clean, well-documented generic utility type with useful example usage in the JSDoc.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

🤖 Fix all issues with AI agents
In `@apps/webapp/app/routes/api.v1.query.ts`:
- Around line 42-53: The handler currently returns status 400 for all
non-success queryResult cases; change it to return 400 only when
queryResult.error is an instance of QueryError and return 500 for all other
unexpected errors. In the block that checks !queryResult.success (using symbols
queryResult and QueryError), keep the existing message logic and logger.error
call, but set the response status passed to json(...) to 400 when
queryResult.error instanceof QueryError, otherwise 500.

In `@packages/core/src/v3/schemas/query.ts`:
- Line 28: The exported type QueryExecuteJSONResponseBody is incorrectly
inferred from the discriminated union QueryExecuteResponseBody; update the type
alias to infer from the JSON-only Zod schema (replace z.infer<typeof
QueryExecuteResponseBody> with z.infer<typeof <the JSON-only schema>), i.e.,
point QueryExecuteJSONResponseBody at the JSON-only schema (e.g.,
QueryExecuteJSONResponseBodySchema or the actual JSON variant schema name)
instead of QueryExecuteResponseBody so the alias represents only the JSON
variant.
🧹 Nitpick comments (7)
packages/core/src/v3/schemas/query.ts (2)

1-1: Unused import: TypeOf.

TypeOf is imported from zod but never used in this file.

🧹 Proposed fix
-import { TypeOf, z } from "zod";
+import { z } from "zod";

88-179: RunsTableRow uses interface instead of type.

Coding guidelines prefer types over interfaces for TypeScript. Consider converting to a type alias, though given the size this is a low-priority nit.

As per coding guidelines: "Use types over interfaces for TypeScript".

packages/core/src/v3/apiClient/index.ts (2)

33-35: Unused imports: QueryExecuteRequestBody and QueryExecuteCSVResponseBody.

Only QueryExecuteResponseBody is referenced in executeQuery. The other two are imported but never used.

🧹 Proposed fix
   QueryExecuteRequestBody,
   QueryExecuteResponseBody,
-  QueryExecuteCSVResponseBody,
+  // Remove unused: QueryExecuteCSVResponseBody

If QueryExecuteRequestBody is also unused:

-  QueryExecuteRequestBody,
   QueryExecuteResponseBody,

1432-1432: Dead code: format variable is assigned but never read.

This appears to be a leftover from a prior iteration. The format is already included in the body object on line 1429.

🧹 Proposed fix
-    const format = options?.format ?? "json";
-    // For JSON, use zodfetch
     return zodfetch(
apps/webapp/app/routes/api.v1.query.ts (1)

9-16: Schema duplicates QueryExecuteRequestBody from @trigger.dev/core/v3.

BodySchema is identical to the QueryExecuteRequestBody schema defined in packages/core/src/v3/schemas/query.ts. Consider importing and reusing it to keep the contract in sync.

♻️ Proposed fix
-const BodySchema = z.object({
-  query: z.string(),
-  scope: z.enum(["organization", "project", "environment"]).default("environment"),
-  period: z.string().nullish(),
-  from: z.string().nullish(),
-  to: z.string().nullish(),
-  format: z.enum(["json", "csv"]).default("json"),
-});
+import { QueryExecuteRequestBody } from "@trigger.dev/core/v3";
+
+// Use the shared schema from core
+const BodySchema = QueryExecuteRequestBody;
packages/trigger-sdk/src/v3/query.ts (2)

1-6: Unused import: QueryExecuteCSVResponseBody.

This type is imported but not referenced anywhere in the file.

🧹 Proposed fix
 import type {
   ApiRequestOptions,
   Prettify,
   QueryExecuteResponseBody,
-  QueryExecuteCSVResponseBody,
 } from "@trigger.dev/core/v3";

156-158: No-op .then() can be removed.

The .then((response) => { return response; }) is a passthrough that adds no value.

🧹 Proposed fix
-  return apiClient.executeQuery(tsql, options, $requestOptions).then((response) => {
-    return response;
-  }) as Promise<{ format: "json"; results: Array<TRow> } | { format: "csv"; results: string }>;
+  return apiClient.executeQuery(tsql, options, $requestOptions) as Promise<
+    { format: "json"; results: Array<TRow> } | { format: "csv"; results: string }
+  >;
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d744fa and 8c10ef8.

⛔ Files ignored due to path filters (1)
  • references/hello-world/src/trigger/query.ts is excluded by !references/**
📒 Files selected for processing (8)
  • apps/webapp/app/components/runs/v3/RunIcon.tsx
  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • apps/webapp/app/routes/api.v1.query.ts
  • packages/core/src/v3/apiClient/index.ts
  • packages/core/src/v3/schemas/index.ts
  • packages/core/src/v3/schemas/query.ts
  • packages/trigger-sdk/src/v3/index.ts
  • packages/trigger-sdk/src/v3/query.ts
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{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

**/*.{ts,tsx}: Always import tasks from @trigger.dev/sdk, never use @trigger.dev/sdk/v3 or deprecated client.defineJob pattern
Every Trigger.dev task must be exported and have a unique id property with no timeouts in the run function

Files:

  • packages/core/src/v3/schemas/index.ts
  • apps/webapp/app/routes/api.v1.query.ts
  • packages/core/src/v3/apiClient/index.ts
  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/core/src/v3/schemas/query.ts
  • apps/webapp/app/components/runs/v3/RunIcon.tsx
  • packages/trigger-sdk/src/v3/query.ts
  • packages/trigger-sdk/src/v3/index.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/schemas/index.ts
  • apps/webapp/app/routes/api.v1.query.ts
  • packages/core/src/v3/apiClient/index.ts
  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/core/src/v3/schemas/query.ts
  • apps/webapp/app/components/runs/v3/RunIcon.tsx
**/*.{ts,tsx,js,jsx}

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

Use function declarations instead of default exports

Import from @trigger.dev/core using subpaths only, never import from root

Files:

  • packages/core/src/v3/schemas/index.ts
  • apps/webapp/app/routes/api.v1.query.ts
  • packages/core/src/v3/apiClient/index.ts
  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/core/src/v3/schemas/query.ts
  • apps/webapp/app/components/runs/v3/RunIcon.tsx
  • packages/trigger-sdk/src/v3/query.ts
  • packages/trigger-sdk/src/v3/index.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/core/src/v3/schemas/index.ts
  • apps/webapp/app/routes/api.v1.query.ts
  • packages/core/src/v3/apiClient/index.ts
  • packages/core/src/v3/schemas/query.ts
  • packages/trigger-sdk/src/v3/query.ts
  • packages/trigger-sdk/src/v3/index.ts
**/*.{js,ts,jsx,tsx,json,md,yaml,yml}

📄 CodeRabbit inference engine (AGENTS.md)

Format code using Prettier before committing

Files:

  • packages/core/src/v3/schemas/index.ts
  • apps/webapp/app/routes/api.v1.query.ts
  • packages/core/src/v3/apiClient/index.ts
  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/core/src/v3/schemas/query.ts
  • apps/webapp/app/components/runs/v3/RunIcon.tsx
  • packages/trigger-sdk/src/v3/query.ts
  • packages/trigger-sdk/src/v3/index.ts
{packages,integrations}/**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Add a changeset when modifying any public package in packages/* or integrations/* using pnpm run changeset:add

Files:

  • packages/core/src/v3/schemas/index.ts
  • packages/core/src/v3/apiClient/index.ts
  • packages/core/src/v3/schemas/query.ts
  • packages/trigger-sdk/src/v3/query.ts
  • packages/trigger-sdk/src/v3/index.ts
apps/webapp/app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

Access all environment variables through the env export of env.server.ts instead of directly accessing process.env in the Trigger.dev webapp

Files:

  • apps/webapp/app/routes/api.v1.query.ts
  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • apps/webapp/app/components/runs/v3/RunIcon.tsx
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

apps/webapp/**/*.{ts,tsx}: When importing from @trigger.dev/core in the webapp, use subpath exports from the package.json instead of importing from the root path
Follow the Remix 2.1.0 and Express server conventions when updating the main trigger.dev webapp

Access environment variables via env export from apps/webapp/app/env.server.ts, never use process.env directly

Files:

  • apps/webapp/app/routes/api.v1.query.ts
  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • apps/webapp/app/components/runs/v3/RunIcon.tsx
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/query.ts
  • packages/trigger-sdk/src/v3/index.ts
🧠 Learnings (21)
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use function declarations instead of default exports

Applied to files:

  • packages/core/src/v3/schemas/index.ts
📚 Learning: 2025-11-27T16:26:58.661Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-11-27T16:26:58.661Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : Follow the Remix 2.1.0 and Express server conventions when updating the main trigger.dev webapp

Applied to files:

  • apps/webapp/app/routes/api.v1.query.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Export tasks with unique IDs within the project to enable proper task discovery and execution

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2026-01-15T11:50:06.067Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-15T11:50:06.067Z
Learning: Applies to **/*.{ts,tsx} : Every Trigger.dev task must be exported and have a unique `id` property with no timeouts in the run function

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
📚 Learning: 2026-01-15T11:50:06.067Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-15T11:50:06.067Z
Learning: Applies to **/*.{ts,tsx} : Always import tasks from `trigger.dev/sdk`, never use `trigger.dev/sdk/v3` or deprecated `client.defineJob` pattern

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/trigger-sdk/src/v3/query.ts
  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `trigger.dev/sdk/v3` for all imports in Trigger.dev tasks

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/trigger-sdk/src/v3/query.ts
  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Export every task, including subtasks

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use the `task()` function from `trigger.dev/sdk/v3` to define tasks with id and run properties

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/trigger-sdk/src/v3/query.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Subscribe to run updates using `runs.subscribeToRun()` for realtime monitoring of task execution

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Attach metadata to task runs using the metadata option when triggering, and access/update it inside runs using metadata functions

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `tasks.trigger()` with type-only imports to trigger tasks from backend code without importing the task implementation

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2025-11-27T16:26:58.661Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-11-27T16:26:58.661Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : When importing from `trigger.dev/core` in the webapp, use subpath exports from the package.json instead of importing from the root path

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Use `useRun`, `useRealtimeRun` and other SWR/realtime hooks from `trigger.dev/react-hooks` for data fetching

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
📚 Learning: 2024-10-18T15:41:52.352Z
Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 1418
File: packages/core/src/v3/errors.ts:364-371
Timestamp: 2024-10-18T15:41:52.352Z
Learning: In `packages/core/src/v3/errors.ts`, within the `taskRunErrorEnhancer` function, `error.message` is always defined, so it's safe to directly call `error.message.includes("SIGTERM")` without additional checks.

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
📚 Learning: 2026-02-11T16:37:32.429Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3019
File: apps/webapp/app/components/primitives/charts/Card.tsx:26-30
Timestamp: 2026-02-11T16:37:32.429Z
Learning: In projects using react-grid-layout, avoid relying on drag-handle class to imply draggability. Ensure drag-handle elements only affect dragging when the parent grid item is configured draggable in the layout; conditionally apply cursor styles based on the draggable prop. This improves correctness and accessibility.

Applied to files:

  • apps/webapp/app/components/runs/v3/TaskRunStatus.tsx
  • apps/webapp/app/components/runs/v3/RunIcon.tsx
📚 Learning: 2026-02-03T18:27:49.039Z
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 2994
File: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsx:553-555
Timestamp: 2026-02-03T18:27:49.039Z
Learning: In apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsx, the menu buttons (like the Edit button with PencilSquareIcon) intentionally have no text labels - only icons are shown in the TableCellMenu. This is a deliberate UI design pattern for compact icon-only menu items.

Applied to files:

  • apps/webapp/app/components/runs/v3/RunIcon.tsx
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `schemaTask()` from `trigger.dev/sdk/v3` with Zod schema for payload validation

Applied to files:

  • packages/trigger-sdk/src/v3/query.ts
  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to packages/trigger-sdk/**/*.{ts,tsx} : In the Trigger.dev SDK (packages/trigger-sdk), prefer isomorphic code like fetch and ReadableStream instead of Node.js-specific code

Applied to files:

  • packages/trigger-sdk/src/v3/query.ts
  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: The SDK at packages/trigger-sdk is an isomorphic TypeScript SDK

Applied to files:

  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Configure OpenTelemetry instrumentations and exporters in trigger.config.ts for enhanced logging

Applied to files:

  • packages/trigger-sdk/src/v3/index.ts
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to internal-packages/database/**/*.{ts,tsx} : Use Prisma for database interactions in internal-packages/database with PostgreSQL

Applied to files:

  • packages/trigger-sdk/src/v3/index.ts
🧬 Code graph analysis (3)
apps/webapp/app/routes/api.v1.query.ts (3)
packages/core/src/v3/apiClient/index.ts (1)
  • executeQuery (1412-1444)
packages/trigger-sdk/src/v3/query.ts (1)
  • QueryScope (12-12)
apps/webapp/app/utils/dataExport.ts (1)
  • rowsToCSV (36-50)
packages/core/src/v3/apiClient/index.ts (2)
packages/core/src/v3/apiClient/core.ts (2)
  • ZodFetchOptions (31-39)
  • zodfetch (71-78)
packages/core/src/v3/schemas/query.ts (2)
  • QueryExecuteResponseBody (40-43)
  • QueryExecuteResponseBody (44-44)
packages/core/src/v3/schemas/query.ts (2)
apps/webapp/app/components/runs/v3/TaskRunStatus.tsx (2)
  • runFriendlyStatus (254-254)
  • RunFriendlyStatus (254-254)
packages/trigger-sdk/src/v3/query.ts (3)
  • RunFriendlyStatus (10-10)
  • RunsTableRow (10-10)
  • QueryTable (10-10)
⏰ 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). (26)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: sdk-compat / Cloudflare Workers
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
  • GitHub Check: sdk-compat / Deno Runtime
  • GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
apps/webapp/app/components/runs/v3/TaskRunStatus.tsx (1)

15-15: LGTM — re-export from core with local usage is clean.

The import on line 15 supplies runFriendlyStatus for local runtime use (e.g., isRunFriendlyStatus), and the re-export on line 254 preserves the public API for existing consumers. Subpath import from @trigger.dev/core/v3 aligns with the coding guidelines.

Also applies to: 252-254

apps/webapp/app/components/runs/v3/RunIcon.tsx (1)

7-7: LGTM — TableCellsIcon import and streams formatting.

The new import and the minor whitespace adjustment on the "streams" case are fine.

Also applies to: 116-116

packages/core/src/v3/schemas/index.ts (1)

18-18: LGTM!

Re-export of ./query.js is consistent with the existing pattern in this barrel file.

packages/core/src/v3/apiClient/index.ts (1)

1412-1444: LGTM on the executeQuery method structure.

The method correctly follows the existing zodfetch pattern used throughout the class, with proper header injection, body serialization, and request option merging.

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

60-158: Well-designed overloads and type-safe API surface.

The CSV/JSON overloads with discriminated return types provide excellent DX. The generic TRow parameter for JSON queries and the Prettify wrapper are nice touches.

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

20-20: LGTM!

Re-export of ./query.js follows the established pattern and surfaces the new query API from the SDK's public entry point.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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