Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Nov 24, 2025

Generated with mux

Refactors the sendMessage integration test suite for better organization, maintainability, and performance.

Changes

Test Organization

Split monolithic sendMessage.test.ts (1628 lines) into 5 thematic files:

  • sendMessage.basic.test.ts — core send/receive, interrupt, reconnection
  • sendMessage.context.test.ts — editing, history truncation, multi-turn conversations
  • sendMessage.errors.test.ts — validation, API key errors, model not found
  • sendMessage.heavy.test.ts — context limit / auto-truncation
  • sendMessage.images.test.ts — vision model tests

Shared Workspace Helper

Added sendMessageTestHelpers.ts with:

  • withSharedWorkspace(provider, testFn) — creates one git repo per test file instead of per-test
  • withSharedWorkspaceNoProvider(testFn) — for tests that verify behavior without provider config

Setup Improvements

  • setupWorkspace and setupWorkspaceWithoutProvider now accept optional existingRepoPath for repo reuse
  • buildLargeHistory writes directly to chat.jsonl instead of sequential appends (30s → <1s)

Results

  • Better test isolation and faster failure diagnosis
  • Reduced I/O overhead from shared git repo pattern
  • Prevents CI timeouts from monolithic test file

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent ammar-agent force-pushed the optimize-integration-tests branch 3 times, most recently from e3c4ff2 to 0fdf64e Compare November 24, 2025 19:17
- Split sendMessage.test.ts into 5 smaller files to improve parallelism and prevent timeouts
- Optimize setupWorkspace to support shared git repo reuse across tests
- Optimize buildLargeHistory to write directly to disk instead of using HistoryService loop
- Fix flexible image description matching in image tests
- Update setupWorkspaceWithoutProvider to support existing repo reuse
- Add withSharedWorkspaceNoProvider helper
- Update basic and context tests to use shared repo helpers
- Remove duplicate metadata test in context suite
- Cleanup unused imports in all suites
@ammar-agent ammar-agent force-pushed the optimize-integration-tests branch from 0fdf64e to 9739068 Compare November 24, 2025 20:17
@ammar-agent ammar-agent changed the title 🤖 bench: optimize integration tests 🤖 refactor: split and optimize sendMessage integration tests Nov 24, 2025
@ammario ammario changed the title 🤖 refactor: split and optimize sendMessage integration tests 🤖 ci: reorganize integration tests Nov 24, 2025
@ammario ammario merged commit db9ecdb into main Nov 24, 2025
13 checks passed
@ammario ammario deleted the optimize-integration-tests branch November 24, 2025 20:32
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.

2 participants