[PR #4737] [MERGED] perf(tests): reuse MCP connections within source matrices #6380

Closed
opened 2026-10-31 01:14:01 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4737
Author: @N0zoM1z0
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @N0zoM1z0

Base: main ← Head: perf/tests-mcp-matrix-lifetime-20261017


📝 Commits (1)

  • 37c6b59 perf(tests): reuse MCP connections within source matrices

📊 Changes

2 files changed (+26 additions, -4 deletions)

View changed files

📝 tests/boundary/cli/electronWrappedCallPaths.test.ts (+23 -2)
📝 tests/support/cli/javascriptApplication.ts (+3 -2)

📄 Description

Summary

Reuse one test-owned stdio MCP connection within each of two stateless JavaScript source-analysis matrices. The early-return matrix previously started four servers and retained them until test completion; the adjacent spread/control comparison started two. All original scenarios, fresh compiled CLI calls, schema validation, Evidence/coverage assertions and test-finished cleanup remain. New input-path and content-identity checks reject cross-input result replay.

The helper accepts an optional typed caller; existing consumers retain their default connection behavior. This is a two-file test optimization with no runtime/API/provider authority change. No separate issue is linked for this measured test-cost improvement; the independent worker OOM diagnosis remains tracked in #4713.

Validation performed

  • npm run test:focused -- tests/boundary/cli/electronWrappedCallPaths.test.ts tests/acceptance/applications/emptyImportNameCli.test.ts tests/acceptance/applications/packageSubpathsCli.test.ts — 23/23 passed, including the entire 19-case boundary file and default CLI/MCP consumers.
  • npm run check:ci — passed, including typecheck, lint, formatting, Knip, module boundaries and architecture guards.
  • Controlled negative replay: later inputs received the first actual MCP response; the new input-path assertion failed. Injection removed before the complete passing selection.
  • After runner completion, no compiled CLI/MCP processes remained in the test-owned worktree.

Performance evidence

Pinned latest-main base: e09a503f44fba1639b71907a018d71161360f5ae. One completed before/after pair uses the same four CLI plus four stdio MCP scenarios; the optimized version also checks input identity.

Complete focused task Wall s Reaped CPU s Peak family GiB
Base 47.55 46.54 2.59
Change 28.90 32.18 1.17

An earlier alternating four-run prototype on a040533470 supported the same direction (median 40.21→26.45 s wall; 47.48→31.19 s CPU; 2.53→1.18 GiB). Those measurements remain attributed to that older revision.

Linux x64, pinned Node24.18.0/npm11.16.0/Vitest5.0.3; serial local heavy jobs, two cores, 3 GiB default Node heap and the existing 384 MiB boundary worker limit. Process-fresh trials use uncontrolled OS/dependency caches; no machine-cold, full-CI speedup or model-token reduction is claimed. RSS is sampled at 200 ms, may double-count shared pages/miss short processes and excludes assistant/shared services; CPU covers reaped descendants. Complete static checks peaked at 4.90 GiB, without an OOM or resource stop.

These are actual compiled CLI/stdio MCP workflows over test-owned static sources. Electron execution and native provider behavior are unverified. No test, deadline, worker bound or coverage gate was removed or relaxed. No directly related cleanup remains in these two matrices.

Author readiness

Human owner: @N0zoM1z0

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4737 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `perf/tests-mcp-matrix-lifetime-20261017` --- ### 📝 Commits (1) - [`37c6b59`](https://github.com/morluto/rea/commit/37c6b593789c015445f454e2e419dba5b9e10c60) perf(tests): reuse MCP connections within source matrices ### 📊 Changes **2 files changed** (+26 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `tests/boundary/cli/electronWrappedCallPaths.test.ts` (+23 -2) 📝 `tests/support/cli/javascriptApplication.ts` (+3 -2) </details> ### 📄 Description ## Summary Reuse one test-owned stdio MCP connection within each of two stateless JavaScript source-analysis matrices. The early-return matrix previously started four servers and retained them until test completion; the adjacent spread/control comparison started two. All original scenarios, fresh compiled CLI calls, schema validation, Evidence/coverage assertions and test-finished cleanup remain. New input-path and content-identity checks reject cross-input result replay. The helper accepts an optional typed caller; existing consumers retain their default connection behavior. This is a two-file test optimization with no runtime/API/provider authority change. No separate issue is linked for this measured test-cost improvement; the independent worker OOM diagnosis remains tracked in #4713. ## Validation performed - `npm run test:focused -- tests/boundary/cli/electronWrappedCallPaths.test.ts tests/acceptance/applications/emptyImportNameCli.test.ts tests/acceptance/applications/packageSubpathsCli.test.ts` — **23/23 passed**, including the entire 19-case boundary file and default CLI/MCP consumers. - `npm run check:ci` — passed, including typecheck, lint, formatting, Knip, module boundaries and architecture guards. - Controlled negative replay: later inputs received the first actual MCP response; the new input-path assertion failed. Injection removed before the complete passing selection. - After runner completion, no compiled CLI/MCP processes remained in the test-owned worktree. ## Performance evidence Pinned latest-main base: `e09a503f44fba1639b71907a018d71161360f5ae`. One completed before/after pair uses the same four CLI plus four stdio MCP scenarios; the optimized version also checks input identity. | Complete focused task | Wall s | Reaped CPU s | Peak family GiB | |---|---:|---:|---:| | Base | 47.55 | 46.54 | 2.59 | | Change | 28.90 | 32.18 | 1.17 | An earlier alternating four-run prototype on `a040533470` supported the same direction (median 40.21→26.45 s wall; 47.48→31.19 s CPU; 2.53→1.18 GiB). Those measurements remain attributed to that older revision. Linux x64, pinned Node24.18.0/npm11.16.0/Vitest5.0.3; serial local heavy jobs, two cores, 3 GiB default Node heap and the existing 384 MiB boundary worker limit. Process-fresh trials use uncontrolled OS/dependency caches; no machine-cold, full-CI speedup or model-token reduction is claimed. RSS is sampled at 200 ms, may double-count shared pages/miss short processes and excludes assistant/shared services; CPU covers reaped descendants. Complete static checks peaked at 4.90 GiB, without an OOM or resource stop. These are actual compiled CLI/stdio MCP workflows over test-owned static sources. Electron execution and native provider behavior are unverified. No test, deadline, worker bound or coverage gate was removed or relaxed. No directly related cleanup remains in these two matrices. ## Author readiness Human owner: @N0zoM1z0 - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:14:01 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6380
No description provided.