Skip to content

Refactor core owner contracts for Remote SSH and MCP#684

Merged
limityan merged 2 commits into
GCWing:mainfrom
limityan:yanzhn/refactor
May 12, 2026
Merged

Refactor core owner contracts for Remote SSH and MCP#684
limityan merged 2 commits into
GCWing:mainfrom
limityan:yanzhn/refactor

Conversation

@limityan
Copy link
Copy Markdown
Collaborator

@limityan limityan commented May 12, 2026

Summary

This PR continues the core decomposition work by moving behavior-neutral Remote SSH and MCP contract helpers out of bitfun-core and into bitfun-services-integrations.

The intent is to reduce core ownership of integration-specific pure contracts while preserving the existing runtime behavior, wire formats, config compatibility, and tool registration semantics.

What Changed

Remote SSH

  • Moved workspace identity/path helper logic into services-integrations.
  • Kept the existing bitfun-core call surface as a compatibility facade.
  • Added contract coverage for legacy auth mapping, default workspace values, and current workspace identity/path behavior.

MCP

  • Moved pure MCP JSON-RPC request builders into services-integrations.
  • Moved MCP server config types, transport defaults, and validation contracts into services-integrations.
  • Moved Cursor-format config parsing/serialization helpers into services-integrations.
  • Kept core-side wrappers only where core-specific error mapping or runtime orchestration is still required.

Tool Registry Guardrails

  • Strengthened registry tests around built-in tool ordering and runtime collection order.
  • Added coverage for dynamic provider metadata and descriptor registration order.
  • Expanded snapshot-wrapper coverage so mutation tools stay wrapped while read-only tools remain unchanged.

Boundary Enforcement and Docs

  • Extended scripts/check-core-boundaries.mjs to prevent migrated MCP contracts from being reintroduced into bitfun-core.
  • Updated core decomposition docs to reflect the new owner-crate responsibilities and remaining core boundaries.

Why

bitfun-core should keep product/runtime orchestration, but not own pure integration contracts that can live in owner crates. This PR moves contract-only pieces to services-integrations so later decomposition work can continue with clearer module boundaries and less dependency pressure in core.

Behavior / Compatibility

No product behavior change is intended.

The moved code is covered by contract tests for:

  • Remote SSH workspace identity/path compatibility.
  • MCP JSON-RPC wire shape.
  • MCP server config defaults and validation behavior.
  • MCP Cursor-format compatibility.
  • Tool registry ordering, metadata, and snapshot wrapping behavior.

Core still owns the runtime-sensitive MCP pieces such as config service orchestration, transport/process management, auth, adapter behavior, and dynamic tool integration.

Risk

Main risk is accidental behavior drift from moving helpers across crate boundaries. The PR mitigates this with focused contract tests plus boundary checks that lock the new ownership direction.

No CLI, desktop UI, or frontend behavior is changed directly.

Validation

  • node scripts/check-core-boundaries.mjs
  • cargo --config "http.proxy=''" test --locked -p bitfun-services-integrations --features product-full
  • cargo --config "http.proxy=''" test --locked -p bitfun-core agentic::tools::registry::tests --features product-full -- --nocapture
  • cargo --config "http.proxy=''" test --locked -p bitfun-core mcp --features product-full -- --nocapture

Commit Range

Based on the latest two commits on yanzhn/refactor:

  • 3980b722 refactor(remote-ssh): move workspace identity helpers
  • 8611fb07 refactor(mcp): extract pure contracts and harden registry

@limityan limityan changed the title Refactor remote SSH workspace helper boundaries Refactor core owner contracts for Remote SSH and MCP May 12, 2026
@limityan limityan marked this pull request as ready for review May 12, 2026 12:46
@limityan limityan merged commit ee5d59c into GCWing:main May 12, 2026
4 checks passed
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.

1 participant