Skip to content

Add Jest E2E tests for trueforge-core - #431

Open
ramantehlan wants to merge 3 commits into
mainfrom
sd/e2e-test
Open

Add Jest E2E tests for trueforge-core#431
ramantehlan wants to merge 3 commits into
mainfrom
sd/e2e-test

Conversation

@ramantehlan

@ramantehlanramantehlan commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Adds a Jest E2E harness for @truefoundry/trueforge-core with a mocked LLM and a first orchestrator loop test.

Changes

  • Separate tests/e2e tree and jest.e2e.config.cjs, kept out of unit Jest
  • pnpm test:e2e / pnpm test:trueforge-core:e2e; core pnpm test runs units then E2E
  • Sample test: mocked text LLM, no tools, send + execute through AgentThreadOrchestrator

How was this tested?

  • pnpm --filter @truefoundry/trueforge-core test:e2e
  • pnpm --filter @truefoundry/trueforge-core typecheck

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Low Risk
Changes are limited to test configuration, scripts, and new E2E tests; no production runtime or auth/data paths are modified.

Overview
Introduces a separate Jest E2E suite under packages/trueforge-core/tests/e2e that exercises AgentThreadOrchestrator and AgentThread with mocked ILLM streams and no session store, mirroring production’s sendexecute turn flow without HTTP or persistence.

Tooling:jest.e2e.config.cjs (60s timeout, single worker); unit jest.config.cjs now ignorestests/e2e/. Root and package scripts add test:e2e / test:trueforge-core:e2e; default @truefoundry/trueforge-coretest runs unit Jest then E2E.

Tests:orchestration.test.ts asserts a text-only happy path (events, terminal result, thread snapshot). orchestrationWithTools.test.ts drives create_sub_agent → child thread → parent resume, with logging only (assertions called out as TODO in the README). Shared helpers.ts builds scripted streaming LLMs. A long tests/e2e/README.md documents design, event sequences, and planned programs 3–5.

Reviewed by Cursor Bugbot for commit a3b6b85. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-botBot commented Aug 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a3b6b85

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

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a3b6b85. Configure here.

type: 'function',
function: {
name: 'create_sub_agent',
arguments: JSON.stringify({ name: 'worker', input: 'do the delegated task [output]' }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mock tool-call arguments disagree

Medium Severity

createSubAgentStream streams create_sub_agent arguments with input do the delegated task, but the generator return uses do the delegated task [output]. AgentThread persists and executes result.value.output, so the child is spawned with a different task than the streamed delta. The [output] suffix looks like a leftover debug marker rather than a real completion.

Fix in CursorFix in Web

Reviewed by Cursor Bugbot for commit a3b6b85. Configure here.

import { NOOP_AGENT_TRACING } from '../../src/core/tracing/NoopAgentTracing';
import { makeDummyLogger, makeRootLLM, makeTextLLM } from './helpers';

function makeMainLLMThread(threadId: string, reply: string, title: string): AgentThread {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helper takes three string parameters

Low Severity

makeMainLLMThread takes three positional string arguments (threadId, reply, title). The repo rule requires a single options object when more than one parameter shares the same type, so callers can swap reply and title without a type error.

Fix in CursorFix in Web

Triggered by project rule: TrueForge review rules

Reviewed by Cursor Bugbot for commit a3b6b85. Configure here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ramantehlan@chiragjn