From e4d05d4d2a7e91803d103e8aed5c2c3dd3a1ddf3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Aug 2026 23:20:02 +0000 Subject: [PATCH 1/2] Initial plan From c559894ff738b641907fa1832170f9956898ee51 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Aug 2026 23:24:27 +0000 Subject: [PATCH 2/2] test: move Unified MCP specs to the correct file Co-authored-by: sonnyt <183387+sonnyt@users.noreply.github.com> --- spec/bundleup/mcp_spec.rb | 57 --------------------------------- spec/bundleup/unify/mcp_spec.rb | 12 +++---- 2 files changed, 6 insertions(+), 63 deletions(-) diff --git a/spec/bundleup/mcp_spec.rb b/spec/bundleup/mcp_spec.rb index 2b99ab0..1021a5c 100644 --- a/spec/bundleup/mcp_spec.rb +++ b/spec/bundleup/mcp_spec.rb @@ -265,60 +265,3 @@ def json_response(payload) end end end - -RSpec.describe BundleUp::Unify::MCP do - subject(:unified) { described_class.new(api_key, connection_id) } - - let(:api_key) { 'test-api-key' } - let(:connection_id) { 'conn_123' } - let(:url) { 'https://unify.bundleup.io/v1/mcp' } - let(:tool) { { 'name' => 'send_message' } } - - def rpc(id, result) - { 'jsonrpc' => '2.0', 'id' => id, 'result' => result } - end - - # Handshake plus whatever follows, on one stub — a second stub_request for - # the same verb and URL would shadow this one. - def stub_session(*responses) - stub_request(:post, url).to_return( - { body: rpc(1, { 'protocolVersion' => '2025-06-18' }).to_json, - headers: { 'Content-Type' => 'application/json' } }, - { body: '', status: 202 }, - *responses - ) - end - - describe '#hosted' do - it 'targets the Unified server with a composite token' do - expect(unified.hosted).to eq(url: url, token: "#{api_key}.#{connection_id}") - end - end - - describe '#list_tools' do - it 'lists tools against the Unified server' do - stub_session({ body: rpc(2, { 'tools' => [tool] }).to_json, - headers: { 'Content-Type' => 'application/json' } }) - - expect(unified.list_tools).to eq([tool]) - end - end - - describe '#call_tool' do - it 'requires a tool name' do - expect { unified.call_tool('') }.to raise_error(ArgumentError, /Tool name is required/) - end - - it 'reuses one session across calls' do - stub_session( - { body: rpc(2, { 'tools' => [] }).to_json, headers: { 'Content-Type' => 'application/json' } }, - { body: rpc(3, { 'content' => [] }).to_json, headers: { 'Content-Type' => 'application/json' } } - ) - - unified.list_tools - unified.call_tool('send_message') - - expect(a_request(:post, url).with(body: /"method":"initialize"/)).to have_been_made.once - end - end -end diff --git a/spec/bundleup/unify/mcp_spec.rb b/spec/bundleup/unify/mcp_spec.rb index ff7f7f7..4506fe7 100644 --- a/spec/bundleup/unify/mcp_spec.rb +++ b/spec/bundleup/unify/mcp_spec.rb @@ -31,18 +31,18 @@ def stub_session(*responses) end end - describe '#tools' do + describe '#list_tools' do it 'lists tools against the Unified server' do stub_session({ body: rpc(2, { 'tools' => [tool] }).to_json, headers: { 'Content-Type' => 'application/json' } }) - expect(unified.tools).to eq([tool]) + expect(unified.list_tools).to eq([tool]) end end - describe '#tool' do + describe '#call_tool' do it 'requires a tool name' do - expect { unified.tool('') }.to raise_error(ArgumentError, /Tool name is required/) + expect { unified.call_tool('') }.to raise_error(ArgumentError, /Tool name is required/) end it 'reuses one session across calls' do @@ -51,8 +51,8 @@ def stub_session(*responses) { body: rpc(3, { 'content' => [] }).to_json, headers: { 'Content-Type' => 'application/json' } } ) - unified.tools - unified.tool('send_message') + unified.list_tools + unified.call_tool('send_message') expect(a_request(:post, url).with(body: /"method":"initialize"/)).to have_been_made.once end