test(integration#34): real MCP session over-the-wire — peer-ACL + GLOBAL memory-scope (internal#765) #50
Reference in New Issue
Block a user
Delete Branch "test/issue-34-integration-clean"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #34.
What
Adds the FIRST real integration-layer regression test for this repo (SOP rule internal#765, P15). The repo was otherwise 100% fetch-mocked Jest; the security-bearing peer-ACL boundary, the GLOBAL memory-scope write boundary, and the highest-frequency list_peers / async_delegate / commit_memory / reply paths had no real over-the-wire gate, and had zero tests.
Why this is the REAL layer (not mock-only)
Coverage
Watch-fail intent
Each assertion fails against a regression of the covered behavior: drop / from the delegate body, drop from , stop threading into the registry path, or remove the platform-side GLOBAL/peer-ACL gate -> the corresponding assertion goes red. It passes against current-correct source.
Wiring
Verification
[04:58:51.504] [31mERROR[39m: [36mMolecule AI API error (GET /workspaces)[39m
[35mplatformUrl[39m: "http://172.31.4.202:8080"
err: {
"type": "Object",
"message": "ECONNREFUSED",
"stack":
Error: ECONNREFUSED
at mockFetchThrow (/workspace/molecule-mcp-server/src/tests/index.test.ts:115:38)
at Object. (/workspace/molecule-mcp-server/src/tests/index.test.ts:375:20)
at Promise.finally.completed (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1557:28)
at new Promise ()
at callAsyncCircusFn (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1497:10)
at _callCircusTest (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1007:40)
at _runTest (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:947:3)
at /workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:849:7
at _runTestsForDescribeBlock (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:862:11)
at _runTestsForDescribeBlock (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:857:11)
at run (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:761:3)
at runAndTransformResultsToJestFormat (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1918:21)
at jestAdapter (/workspace/molecule-mcp-server/node_modules/jest-circus/build/runner.js:101:19)
at runTestInternal (/workspace/molecule-mcp-server/node_modules/jest-runner/build/index.js:275:16)
at runTest (/workspace/molecule-mcp-server/node_modules/jest-runner/build/index.js:343:7)
"name": "Error"
}
[04:58:52.160] [33mWARN[39m: [36mrecreate_workspace: CP-admin hard redeploy (destructive)[39m
[35maudit[39m: true
[35moperation[39m: "recreate_workspace"
[35mactor[39m: "agents-team"
[35mreason[39m: null
[35mslug[39m: "agents-team"
[35mworkspace_id[39m: null
[35mruntime[39m: "claude-code"
[35mruntime_source[39m: "explicit"
[35mrecreate[39m: true
[35mdry_run[39m: false
[04:58:52.164] [33mWARN[39m: [36mrecreate_workspace: CP-admin hard redeploy (destructive)[39m
[35maudit[39m: true
[35moperation[39m: "recreate_workspace"
[35mactor[39m: "agents-team"
[35mreason[39m: null
[35mslug[39m: "agents-team"
[35mworkspace_id[39m: null
[35mruntime[39m: "codex"
[35mruntime_source[39m: "explicit"
[35mrecreate[39m: true
[35mdry_run[39m: false
[04:58:52.165] [33mWARN[39m: [36mrecreate_workspace: CP-admin hard redeploy (destructive)[39m
[35maudit[39m: true
[35moperation[39m: "recreate_workspace"
[35mactor[39m: "agents-team"
[35mreason[39m: null
[35mslug[39m: "other/team"
[35mworkspace_id[39m: null
[35mruntime[39m: "codex"
[35mruntime_source[39m: "explicit"
[35mrecreate[39m: true
[35mdry_run[39m: false
[04:58:52.167] [33mWARN[39m: [36mrecreate_workspace: CP-admin hard redeploy (destructive)[39m
[35maudit[39m: true
[35moperation[39m: "recreate_workspace"
[35mactor[39m: "agents-team"
[35mreason[39m: null
[35mslug[39m: "agents-team"
[35mworkspace_id[39m: "w1"
[35mruntime[39m: "hermes"
[35mruntime_source[39m: "workspace_lookup"
[35mrecreate[39m: true
[35mdry_run[39m: false
[04:58:52.173] [33mWARN[39m: [36mrecreate_workspace: CP-admin hard redeploy (destructive)[39m
[35maudit[39m: true
[35moperation[39m: "recreate_workspace"
[35mactor[39m: "agents-team"
[35mreason[39m: null
[35mslug[39m: "agents-team"
[35mworkspace_id[39m: null
[35mruntime[39m: null
[35mruntime_source[39m: "all_runtimes"
[35mrecreate[39m: true
[35mdry_run[39m: false
[04:58:52.175] [33mWARN[39m: [36mrecreate_workspace: CP-admin hard redeploy (destructive)[39m
[35maudit[39m: true
[35moperation[39m: "recreate_workspace"
[35mactor[39m: "devops-engineer"
[35mreason[39m: "onto promoted pin per cp#245"
[35mslug[39m: "agents-team"
[35mworkspace_id[39m: null
[35mruntime[39m: "claude-code"
[35mruntime_source[39m: "explicit"
[35mrecreate[39m: true
[35mdry_run[39m: false
[04:58:52.177] [33mWARN[39m: [36mrecreate_workspace: CP-admin hard redeploy (destructive)[39m
[35maudit[39m: true
[35moperation[39m: "recreate_workspace"
[35mactor[39m: "cr2-fleet-bot"
[35mreason[39m: null
[35mslug[39m: "agents-team"
[35mworkspace_id[39m: null
[35mruntime[39m: "codex"
[35mruntime_source[39m: "explicit"
[35mrecreate[39m: true
[35mdry_run[39m: false
[04:58:52.181] [33mWARN[39m: [36mrecreate_workspace: CP-admin hard redeploy (destructive)[39m
[35maudit[39m: true
[35moperation[39m: "recreate_workspace"
[35mactor[39m: "agents-team"
[35mreason[39m: null
[35mslug[39m: "ghost"
[35mworkspace_id[39m: null
[35mruntime[39m: "codex"
[35mruntime_source[39m: "explicit"
[35mrecreate[39m: true
[35mdry_run[39m: false
[04:58:53.528] [31mERROR[39m: [36mMolecule AI API error (GET /workspaces)[39m
[35mplatformUrl[39m: "http://172.31.4.202:8080"
err: {
"type": "Object",
"message": "Failed to fetch",
"stack":
TypeError: Failed to fetch
at Object. (/workspace/molecule-mcp-server/tests/tests/api.test.ts:144:48)
at Promise.finally.completed (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1557:28)
at new Promise ()
at callAsyncCircusFn (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1497:10)
at _callCircusTest (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1007:40)
at _runTest (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:947:3)
at /workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:849:7
at _runTestsForDescribeBlock (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:862:11)
at _runTestsForDescribeBlock (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:857:11)
at run (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:761:3)
at runAndTransformResultsToJestFormat (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1918:21)
at jestAdapter (/workspace/molecule-mcp-server/node_modules/jest-circus/build/runner.js:101:19)
at runTestInternal (/workspace/molecule-mcp-server/node_modules/jest-runner/build/index.js:275:16)
at runTest (/workspace/molecule-mcp-server/node_modules/jest-runner/build/index.js:343:7)
"name": "TypeError"
}
[04:58:53.544] [31mERROR[39m: [36mMolecule AI API error (GET /workspaces)[39m
[35mplatformUrl[39m: "http://172.31.4.202:8080"
err: {
"type": "Object",
"message": "ECONNREFUSED",
"stack":
Error: ECONNREFUSED
at Object. (/workspace/molecule-mcp-server/tests/tests/api.test.ts:217:48)
at Promise.finally.completed (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1557:28)
at new Promise ()
at callAsyncCircusFn (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1497:10)
at _callCircusTest (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1007:40)
at _runTest (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:947:3)
at /workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:849:7
at _runTestsForDescribeBlock (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:862:11)
at _runTestsForDescribeBlock (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:857:11)
at run (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:761:3)
at runAndTransformResultsToJestFormat (/workspace/molecule-mcp-server/node_modules/jest-circus/build/jestAdapterInit.js:1918:21)
at jestAdapter (/workspace/molecule-mcp-server/node_modules/jest-circus/build/runner.js:101:19)
at runTestInternal (/workspace/molecule-mcp-server/node_modules/jest-runner/build/index.js:275:16)
at runTest (/workspace/molecule-mcp-server/node_modules/jest-runner/build/index.js:343:7)
"name": "Error"
} (unit): 263 passed, 1 skipped, 9 suites — no regression.
Scope boundary
This PR adds the test + config only. No CI workflow changes, no branch-protection changes, no merge-queue changes, no source-code auth changes, no tool removals. The deliverable is a CI-green scoped PR ready for review; merge-queue operator-block (BP-read 403) noted separately.
APPROVED molecule-mcp-server#50 @f0ae91f1f97eaeed7d2fd8a775f351731f39862f. Fetched live current head before review. Diff is limited to test/config only: src/tests/a2a_session.integration.test.ts, jest.integration.cjs, jest.config.cjs, and package.json test:integration script. None of PR#35's dangerous scope leaked in: no workflow/merge-queue changes, no auth-header or auth-preflight source changes, no cp_admin recreate/pause/resume cascade changes. The integration test is substantive: real createServer + real MCP Client over linked InMemoryTransport, real node:http fake platform, peer-ACL list_peers denial, async_delegate success/denial/Zod validation, LOCAL/GLOBAL commit_memory authorization, and notify_user over the wire. CI / test is green on this head. CLEAN+APPROVE; PR#50 is the canonical #34 PR ready pending BP-403, and PR#35 should be closed.
APPROVED molecule-mcp-server#50 @f0ae91f1f97eaeed7d2fd8a775f351731f39862f. Verified diff vs merge-base is limited to test/config/package integration-script files; no gate/auth/merge-queue/registry changes. Integration test is substantive: real MCP Client + real server over InMemoryTransport against a real node:http fake platform, covering #34 peer ACL, async_delegate, GLOBAL memory scope, and notify_user paths. Ready as clean canonical #34 PR; merge remains BP-403 operator-side.