-
Notifications
You must be signed in to change notification settings - Fork 55.8k
Open
Labels
status:in-linearIssue or PR is now in LinearIssue or PR is now in Lineartriage:pendingWaiting to be triagedWaiting to be triaged
Description
Bug Description
The GET /workflows/:workflowId/test-runs/:id endpoint makes two separate database queries when fetching a single test run - one for authorization check and one for retrieving the data. This is inefficient and can be optimized to use a single query.
To Reproduce
- Make a GET request to
/workflows/:workflowId/test-runs/:idendpoint - Observe that two database queries are executed:
- First query:
findOneingetTestRun()method for authorization - Second query:
getTestRunSummaryById()to fetch the data with relations
- First query:
Expected behavior
The endpoint should fetch the test run with a single database query that also handles authorization check.
Add a new repository method getTestRunSummaryByIdWithAuthorization that combines:
- Fetching the test run with relations (testCaseExecutions)
- Authorization check against allowed workflow IDs
- Calculation of finalResult
This reduces the endpoint from 2 database queries to 1.
Debug Info
The issue is in:
packages/cli/src/evaluation.ee/test-runs.controller.ee.ts- Line 57 (before fix)packages/@n8n/db/src/repositories/test-run.repository.ee.ts-getTestRunSummaryByIdmethod
Operating System
Windows (development environment)
n8n Version
2.12.0
Node.js Version
24.14.0
Database
SQLite (default)
Execution mode
main (default)
Hosting
self hosted
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status:in-linearIssue or PR is now in LinearIssue or PR is now in Lineartriage:pendingWaiting to be triagedWaiting to be triaged