Skip to content

Commit 6a3cf51

Browse files
committed
numerous fixes and tests
1 parent 2366dd5 commit 6a3cf51

39 files changed

Lines changed: 814 additions & 232 deletions
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Plan: Fix 8 Failing Integration Tests in WorkflowExecutor.test.ts
2+
3+
## Context
4+
5+
Integration tests ran: **20 passed, 2 failed** (286/295 tests pass). The 8 failures are all in the "Execute with Return Strategy and Consistency" describe block of `WorkflowExecutor.test.ts`. The 1 `ServiceRegistryClient.test.ts` failure is deferred.
6+
7+
**Root cause:** The 3 complex workflow definitions use HTTP tasks calling `http://httpbin:8081/api/hello?name=test1`. The `httpbin` hostname is a Docker service only available in Docker Compose environments. Locally, DNS fails → HTTP tasks fail → workflows FAIL → YIELD tasks never reached → signals can't work → `responseType` is `undefined`.
8+
9+
## Fix
10+
11+
Change `optional: false``optional: true` on the HTTP task in each of the 3 workflow metadata files. This lets workflows continue past failed HTTP tasks to reach YIELD tasks. The tests only care about signal/return strategy behavior, not HTTP results.
12+
13+
### Files to modify (1 line each)
14+
15+
1. **`src/integration-tests/metadata/complex_wf_signal_test.ts`** line 25
16+
2. **`src/integration-tests/metadata/complex_wf_signal_test_subworkflow_1.ts`** line 25
17+
3. **`src/integration-tests/metadata/complex_wf_signal_test_subworkflow_2.ts`** line 25
18+
19+
Only the HTTP tasks get `optional: true`. YIELD and SUB_WORKFLOW tasks remain `optional: false`.
20+
21+
Add a comment: `// optional so tests work without httpbin Docker service`
22+
23+
## Why this is safe
24+
25+
- When httpbin IS available (CI/Docker): HTTP task succeeds normally, `optional: true` has no effect
26+
- When httpbin is NOT available (local): HTTP task fails gracefully, workflow continues
27+
- No other tests reference these metadata files
28+
- Test assertions check workflow/task fields that are still populated regardless of HTTP task status
29+
30+
## Verification
31+
32+
```bash
33+
npm run test:integration:orkes-v5 -- --testPathPatterns=WorkflowExecutor
34+
```
35+
36+
All 8 previously-failing tests should pass. Then re-run full suite to confirm no regressions.

.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ CONDUCTOR_SERVER_URL=""
33
CONDUCTOR_AUTH_KEY=""
44
CONDUCTOR_AUTH_SECRET=""
55

6-
CONDUCTOR_MAX_HTTP2_CONNECTIONS=
6+
CONDUCTOR_MAX_HTTP2_CONNECTIONS=
7+
8+
CONDUCTOR_TLS_INSECURE=
9+
CONDUCTOR_DISABLE_HTTP2=

AGENTS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ src/integration-tests/ # E2E tests against real Conductor server
4545
## Commands
4646

4747
```bash
48-
npm test # Unit tests (469 tests)
48+
npm test # Unit tests (482+ tests)
4949
npm run build # tsup (ESM + CJS dual output)
5050
npm run lint # ESLint
5151
npm run generate-openapi-layer # Regenerate from OpenAPI spec
@@ -61,12 +61,12 @@ npm run test:integration:orkes-v5
6161

6262
After every code change, you **must** run the following before considering the work complete:
6363

64-
1. **Lint**fix all lint errors in files you changed:
64+
1. **Lint****MANDATORY at the end of every session**. Run the linter and fix ALL errors before finishing:
6565
```bash
66-
npm run lint # Check all files
66+
npm run lint # Check all files — must show 0 errors
6767
npx eslint --fix src/path/to/file.ts # Auto-fix a specific file
6868
```
69-
You must fix all lint errors in files you modified. Do not introduce new lint violations.
69+
You must fix all lint errors in files you modified. Do not introduce new lint violations. **Do not end a session with lint errors remaining.**
7070

7171
2. **Unit tests** — all must pass:
7272
```bash
@@ -232,4 +232,4 @@ When adding new client methods, builders, worker features, or examples:
232232
| ConductorWorkflow DSL | Yes | 100% | |
233233
| Worker + Metrics + Context | Yes | 100% | |
234234
| Error paths | - | 35 tests | |
235-
| **Total** | **469** | **191** | **660** |
235+
| **Total** | **482+** | **191** | **673+** |

SDK_NEW_LANGUAGE_GUIDE.md

Lines changed: 494 additions & 123 deletions
Large diffs are not rendered by default.

examples/advanced/human-tasks.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ async function main() {
110110
}
111111

112112
const humanTaskEntry = pendingTasks[0];
113-
const humanTaskId = humanTaskEntry.taskId!;
113+
const humanTaskId = humanTaskEntry?.taskId;
114+
if (!humanTaskId) {
115+
console.log(" Human task has no taskId. Exiting.");
116+
await handler.stopWorkers();
117+
process.exit(1);
118+
}
114119
console.log(` Found human task: ${humanTaskId}`);
115120
console.log(` State: ${humanTaskEntry.state}`);
116121
console.log(` Display name: ${humanTaskEntry.humanTaskDef?.displayName}\n`);

examples/api-journeys/applications.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ async function main() {
2626

2727
// Create application
2828
const app = await appClient.createApplication(appName);
29-
applicationId = app.id!;
29+
if (!app.id) throw new Error("Expected application id");
30+
applicationId = app.id;
3031
console.log(`1. Created application: ${app.name} (id: ${applicationId})`);
3132

3233
// Get application

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"name": "James Stuart Milne"
2828
}
2929
],
30+
"sideEffects": false,
3031
"engines": {
3132
"node": ">=18"
3233
},

src/integration-tests/ConductorWorkflow.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ import {
88
} from "@jest/globals";
99
import {
1010
TaskType,
11-
type WorkflowDef,
1211
type Client,
1312
} from "../open-api";
1413
import {
1514
ConductorWorkflow,
1615
MetadataClient,
1716
WorkflowExecutor,
1817
orkesConductorClient,
19-
simpleTask,
2018
setVariableTask,
2119
llmChatCompleteTask,
2220
Role,

src/integration-tests/E2EFiveTaskWorkflow.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe("E2E: 5-task workflow × 50 executions", () => {
4747

4848
worker({ taskDefName: taskName, pollInterval: 100, concurrency: 5 })(
4949
async function taskWorker(task: Task) {
50-
executionCounts[taskName]!++;
50+
executionCounts[taskName] = (executionCounts[taskName] ?? 0) + 1;
5151
return {
5252
status: "COMPLETED" as const,
5353
outputData: {
@@ -121,15 +121,19 @@ describe("E2E: 5-task workflow × 50 executions", () => {
121121
expect(results.length).toBe(WORKFLOW_COUNT);
122122

123123
for (let w = 0; w < results.length; w++) {
124-
const wf = results[w]!;
124+
const wf = results[w];
125+
if (!wf) throw new Error(`Expected result at index ${w}`);
125126
expect(wf.status).toBe("COMPLETED");
126127

127128
// Each workflow should have exactly 5 tasks
128129
expect(wf.tasks?.length).toBe(TASK_COUNT);
129130

130131
// Validate each task's output
131132
for (let t = 0; t < TASK_COUNT; t++) {
132-
const task = wf.tasks![t]!;
133+
const tasks = wf.tasks;
134+
if (!tasks) throw new Error(`Expected tasks for workflow at index ${w}`);
135+
const task = tasks[t];
136+
if (!task) throw new Error(`Expected task at index ${t}`);
133137
expect(task.status).toBe("COMPLETED");
134138
expect(task.outputData?.taskNumber).toBe(t + 1);
135139
expect(task.outputData?.message).toBe(

src/integration-tests/IntegrationClient.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, describe, test, jest, beforeAll, beforeEach, afterAll } from "@jest/globals";
1+
import { expect, describe, test, jest, beforeAll, afterAll } from "@jest/globals";
22
import {
33
orkesConductorClient,
44
OrkesClients,

0 commit comments

Comments
 (0)