Skip to content

Conversation

@galligan
Copy link
Contributor

@galligan galligan commented Jan 23, 2026

Add transport harnesses for integration testing:

  • createMcpHarness(): In-memory MCP transport for testing
  • createCliHarness(): CLI execution with exit code capture
  • TestTransport: Bidirectional message passing
  • Memory sink for capturing CLI output
  • Comprehensive test coverage (29 tests)

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

Resolves #47

Copy link
Contributor Author

galligan commented Jan 23, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps
Copy link

greptile-apps bot commented Jan 23, 2026

Greptile Summary

  • Implements comprehensive testing harnesses (createMcpHarness and createCliHarness) for transport-agnostic integration testing of MCP servers and CLI commands
  • Adds fixtures module with utilities for test data factories, temporary directories, and environment variable isolation
  • Creates complete test suite with 29 tests following the project's TDD-first approach where tests define expected behavior

Important Files Changed

Filename Overview
packages/testing/src/index.ts New entry point exporting all testing utilities with comprehensive JSDoc documentation
packages/testing/src/mcp-harness.ts New MCP test harness providing tool invocation, search, and fixture loading capabilities
packages/testing/src/cli-harness.ts New CLI test harness for executing commands and capturing stdout/stderr/exit codes

Confidence score: 4/5

  • This PR is safe to merge with high confidence as it implements well-structured testing infrastructure
  • Score reflects comprehensive test coverage and follows established patterns, but deducted one point due to test files being written before implementation (TDD approach means some tests may initially fail)
  • Pay close attention to packages/testing/src/__tests__/fixtures.test.ts which references fixture files that may not exist yet

Sequence Diagram

sequenceDiagram
    participant User
Loading

@galligan galligan changed the base branch from p3-17/testing/fixtures to graphite-base/80 January 23, 2026 21:43
@galligan galligan force-pushed the p3-18/testing/harnesses branch from 119f070 to 0161544 Compare January 23, 2026 21:47
@galligan galligan changed the base branch from graphite-base/80 to p3-17/testing/fixtures January 23, 2026 21:47
@galligan
Copy link
Contributor Author

Reviewed the CLI harness concerns: stdin is closed immediately and signal-based exits are mapped to 128+signal; tests passed in the pre-push run.

@galligan
Copy link
Contributor Author

Verified CLI harness now closes stdin to allow EOF and maps signal termination to non-zero exit codes (128+signal). Restacked/checked and submitted with gt.

@galligan galligan force-pushed the p3-17/testing/fixtures branch from a33da83 to cddc577 Compare January 23, 2026 23:09
@galligan galligan force-pushed the p3-18/testing/harnesses branch from 0161544 to 12987e1 Compare January 23, 2026 23:09
@galligan
Copy link
Contributor Author

Restacked after downstack update (formatRelative test stabilization); no additional changes in this PR.

@galligan galligan changed the base branch from p3-17/testing/fixtures to graphite-base/80 January 24, 2026 02:58
@galligan galligan force-pushed the p3-18/testing/harnesses branch from 12987e1 to b8a6bab Compare January 24, 2026 02:59
@galligan galligan changed the base branch from graphite-base/80 to p3-17/testing/fixtures January 24, 2026 02:59
@galligan
Copy link
Contributor Author

CLI harness already closes stdin immediately and maps signal terminations to non-zero (128+signal) exit codes. Resubmitted after restack.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants