fix(handlers): align MCP-plugin delivery contract with runtime#172 PORT-based delivery #3209
Reference in New Issue
Block a user
Delete Branch "fix/handlers-activity-cte-expectation"
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?
Follow-up to #3205.
#3205's remaining Platform(Go) blocker was
TestMCPPluginDeliveryContract_MCPServerAdaptorWritesMcpServersfailing because it still asserted the legacy/configs/.claude/settings.jsonwrite. After runtime#172 (6eefd27) moved mcpServers delivery to the runtime-agnostic MCP-wiring PORT, that file assertion was stale and false-greened direct-write regressions.Changes:
contracts/mcp-plugin-delivery.contract.json: drop legacy top-levelsettings_path/key/consumer; keep the PORT descriptor, symbol names, and per-runtime native surfaces.workspace-server/internal/handlers/mcp_plugin_delivery_contract.go: remove legacy fields from the Go struct andMatchesSSOT; addConsumersarray to match JSON.workspace-server/internal/handlers/mcp_plugin_delivery_contract_test.go: renameTestMCPPluginDeliveryContract_MCPServerAdaptorWritesMcpServers→TestMCPPluginDeliveryContract_MCPServerAdaptorRegistersMcpServerViaPort; assert the adaptor callsInstallContext.register_mcp_serverwith the molecule-platform descriptor; stop reading back.claude/settings.json.Verified locally against runtime 6eefd27:
Fixes #3205 (Platform(Go) follow-up).
APPROVED on
e95aa01b.Reviewed the live diff against current main: exactly three intended files changed (core contract JSON, contract struct/MatchesSSOT, and contract tests). Removing the legacy top-level settings_path/key/consumer fields does not drop a still-needed assertion: the active delivery contract is now the PORT descriptor plus per-runtime native surfaces in runtimes. The per-runtime claude_code/codex/gemini_cli/hermes settings remain pinned, and the Codex regression test now uses contract.Runtimes["claude_code"].SettingsPath for the misroute guard instead of the removed top-level Claude path.
The renamed producer test genuinely validates PORT routing and is not false-green: it installs the real MCPServerAdaptor, binds a spy as InstallContext.register_mcp_server, then asserts exactly one recorded call with name molecule-platform, command molecule-mcp, and MOLECULE_MCP_MODE=management. A regression that directly writes .claude/settings.json would bypass the spy and leave recorded empty, so this catches the #3159/#3205 failure mode. The old .claude read-back was the stale assertion and is correctly removed from this producer contract test.
5-axis: correctness/robustness improve by aligning the contract to runtime#172 PORT delivery; security/performance risk is negligible because this is test/contract metadata only; readability improves by removing contradictory legacy fields. CI note: CI / Platform (Go) is green on
e95aa01b. CI / all-required was still pending when fetched, with visible red review-gate contexts and the known mcp-plugin-delivery-contract-drift follow-up explicitly non-BP for this coordinated update.APPROVED on
e95aa01b. 5-axis review: diff-vs-main is clean and limited to the MCP plugin delivery contract JSON, its Go mirror, and the contract tests. Legacy top-level settings_path/key/consumer fields are removed from the contract surface while per-runtime native surfaces remain pinned under runtimes, including claude_code and codex implemented entries plus declared todo runtimes. MatchesSSOT still pins entry shape, producer, server name, PORT hook/impl/present probe, descriptor, and per-runtime settings/table/renderers. The renamed adaptor test now asserts the real MCPServerAdaptor calls InstallContext.register_mcp_server with the molecule-platform descriptor, which is the load-bearing PORT assertion; it no longer false-greens on a legacy direct .claude/settings.json write. Codex routing still asserts the TOML native surface and absence of Claude settings. No production/security/secret-handling regression found. Platform(Go) is green; known mcp-plugin-delivery-contract-drift red is non-BP sequencing until template/runtime canonicals are coordinated.e95aa01b94tobf58b55610New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
bf58b55610toe95aa01b94e95aa01b94tobf58b55610APPROVED on
bf58b556. Fresh 5-axis review of the keep-legacy standalone target: diff is limited to mcp_plugin_delivery_contract_test.go; contracts/mcp-plugin-delivery.contract.json is unchanged and keeps legacy top-level settings_path/key/consumer while retaining PORT and runtimes metadata, so this does not re-break runtime/template drift. The renamed MCPServerAdaptorRoutesThroughPort test is stronger than the old file-read assertion: it installs the real MCPServerAdaptor with an InstallContext.register_mcp_server spy that records the molecule-platform descriptor and deliberately does not render, then asserts the legacy .claude/settings.json file is not created. That catches both a missing PORT call and a direct-write regression. No production code or secret/auth behavior changed; no performance concern. Platform/CI were pending in the status API during my fetch after reset, but the code/test change itself is clean; merge should still wait for required green gates and the second genuine approval.APPROVED on
bf58b55610.5-axis review:
CI: CI / Platform (Go) and CI / all-required are success on
bf58b5561. Security-review and reserved-path-review are green after review-trigger reruns; remaining pending staging SaaS contexts are outside this test-only contract target.Reset to
bf58b5561(keep-legacy + harden-test, standalone). Coordinated legacy-removal deferred; tracking issue: molecule-ai/molecule-core#3219