---
id: 10686
title: 'Test Isolation: Environment-based OpenAPI injection to prevent parallel test interference'
state: CLOSED
labels:
  - enhancement
  - ai
  - testing
assignees:
  - neo-gemini-pro
createdAt: '2026-05-04T10:13:41Z'
updatedAt: '2026-05-09T21:23:45Z'
githubUrl: 'https://github.com/neomjs/neo/issues/10686'
author: neo-gemini-pro
commentsCount: 0
parentIssue: null
subIssues: []
subIssuesCompleted: 0
subIssuesTotal: 0
blockedBy: []
blocking: []
closedAt: '2026-05-04T11:34:00Z'
---
# Test Isolation: Environment-based OpenAPI injection to prevent parallel test interference

### Description
The `test/playwright/unit/ai/mcp/client/McpServersIsolation.spec.mjs` test previously mutated `ai/mcp/server/knowledge-base/openapi.yaml` directly to simulate a corrupted OpenAPI file. This caused intermittent race conditions and YAML parsing errors in other parallel tests (like `OpenApiValidatorCompliance.spec.mjs`) that depended on a valid OpenAPI spec.

### Acceptance Criteria
- Replace physical file mutation in the test with environment-variable injection (`TEST_CORRUPT_OPENAPI`).
- Update `toolService.mjs` to respect `TEST_CORRUPT_OPENAPI` if it is set.
- Ensure test isolation and verify that parallel test execution succeeds without race conditions.

## Timeline

- 2026-05-04T10:14:23Z @neo-gemini-pro cross-referenced by PR #10687
- 2026-05-04T10:20:06Z @neo-gemini-pro added the `enhancement` label
- 2026-05-04T10:20:06Z @neo-gemini-pro added the `ai` label
- 2026-05-04T10:20:06Z @neo-gemini-pro added the `testing` label
- 2026-05-04T10:20:15Z @neo-gemini-pro referenced in commit `e9233a7` - "test(ai): implement review polish for test isolation (#10686)"
- 2026-05-04T11:02:10Z @neo-gemini-pro referenced in commit `816eb3a` - "refactor(mcp): rename test env var to NEO_AI_MCP_KB_OPENAPI_PATH (#10686)

Addresses merge-blocking feedback from @tobiu to follow established NEO_AI_* namespacing and provide scalability for future MCP server tests."
- 2026-05-04T11:34:00Z @tobiu closed this issue
- 2026-05-04T11:34:00Z @tobiu referenced in commit `4773051` - "test(ai): implement environment-based OpenAPI injection for isolation (#10686) (#10687)

* test(ai): implement environment-based OpenAPI injection for isolation (#10686)

* test(ai): implement review polish for test isolation (#10686)

* refactor(mcp): rename test env var to NEO_AI_MCP_KB_OPENAPI_PATH (#10686)

Addresses merge-blocking feedback from @tobiu to follow established NEO_AI_* namespacing and provide scalability for future MCP server tests.

---------

Co-authored-by: neo-gemini-pro <neo-gemini-pro@users.noreply.github.com>"
- 2026-05-09T21:23:45Z @neo-gemini-pro assigned to @neo-gemini-pro

