WIP: test(integration#34): real MCP session over-the-wire — peer-ACL + GLOBAL memory-scope (internal#765) #35
Closed
molecule-code-reviewer
wants to merge 6 commits from
test/issue-34-integration-a2a-acl-memory into main
pull from: test/issue-34-integration-a2a-acl-memory
merge into: molecule-ai:main
molecule-ai:main
molecule-ai:fix/a2a-2251-ts-canonical-builder
molecule-ai:feat/migrate-workspace-provider
molecule-ai:fix/mgmt-create-request-collision
molecule-ai:feat/management-create-approval
molecule-ai:fix/mcp-58-confirm-name-destructive-actions
molecule-ai:fix/audit-server-url-replace-lexer
molecule-ai:feat/unified-requests-inbox-p5-shims
molecule-ai:feat/unified-requests-inbox-p2-mcp
molecule-ai:ci/absorb-queue-schedule-into-conductor
molecule-ai:chore/bump-1.5.0
molecule-ai:feat/create-issue-tool
molecule-ai:fix/mcp-audit-force-merge
molecule-ai:fix/mcp-inject-org-header
molecule-ai:fix/mcp-inject-org-header-v2
molecule-ai:fix/48-reject-unknown-actor
molecule-ai:test/issue-34-integration-clean
molecule-ai:fix/cp-admin-reject-unknown-actor
molecule-ai:fix/mcp-server-merge-queue-plus-cleanup
molecule-ai:feat/2355-merge-queue-mcp-server
molecule-ai:fix/mcp-server-delete-obsolete-auto-promote
molecule-ai:chore/mcp-server-distinct-names-38
molecule-ai:feat/recreate-workspace-mcp-579
molecule-ai:fix/remote-auth-and-esm-logger
molecule-ai:fix/mcp-pause-resume-cascade-param-2122-followup
molecule-ai:fix/36-auth-headers
molecule-ai:feat/management-mcp
molecule-ai:fix/qs-dos-audit
molecule-ai:pr32
molecule-ai:chore/cursor-store-nits
molecule-ai:feat/session-cursor-module
molecule-ai:fix/upload-resolution-timeout
molecule-ai:chore/bump-1.3.0
molecule-ai:feat/poll-uploads-resolved-contract-test-layer-d
molecule-ai:feat/inbox-uploads-rfc640-layer-b
molecule-ai:ssot/external-workspace-tool-schemas
molecule-ai:fix/use-package-token-for-npm-publish
molecule-ai:fix/gitea-npm-publish-install
molecule-ai:ssot/workspace-targets-contract
molecule-ai:fix/claude-88th-tool
molecule-ai:feat/provision-workspace-tool-failclosed
molecule-ai:docs/fix-sdk-reference-in-platform-integration
molecule-ai:docs/sync-ki-007-kpi-009-resolution
molecule-ai:fix/merge-queue-mcp
molecule-ai:fix/ki007-stale-path-ref
molecule-ai:fix/merge-queue-required-contexts
molecule-ai:chore/add-merge-queue-workflow
molecule-ai:fix/remote-agent-setup-command
molecule-ai:docs/readme-add-npm-install
molecule-ai:fix/kind-ki006-anyof-workspaces
molecule-ai:feat/api-request-timeouts
molecule-ai:fix/ci-all-required-sentinel
molecule-ai:chore/sop-checklist-gate
molecule-ai:docs/regenerate-readme-from-source
No Reviewers
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
agent-dev-a
agent-dev-b
agent-pm
agent-researcher
agent-reviewer
agent-reviewer-1
agent-reviewer-cr2
app-fe (Molecule AI · app-fe)
app-lead (Molecule AI · app-lead)
app-qa (Molecule AI · app-qa)
claude-ceo-assistant
claude-ci-reader
core-be (Molecule AI · core-be)
core-devops (Molecule AI · core-devops)
core-fe (Molecule AI · core-fe)
core-lead (Molecule AI · core-lead)
core-offsec (Molecule AI · core-offsec)
core-qa (Molecule AI · core-qa)
core-security (Molecule AI · core-security)
core-uiux (Molecule AI · core-uiux)
cp-be (Molecule AI · cp-be)
cp-lead (Molecule AI · cp-lead)
cp-qa (Molecule AI · cp-qa)
cp-security (Molecule AI · cp-security)
cui (Zhanlin Cui)
dev-lead (Molecule AI · dev-lead)
devops-engineer
documentation-specialist (Molecule AI · documentation-specialist)
fullstack-engineer (Molecule AI · fullstack-engineer)
godwin
hongming
hongming-ceo-delegated
hongming-codex-laptop
hongming-kimi-laptop
hongming-pc2
hongming-personal
infra-lead (Molecule AI · infra-lead)
infra-runtime-be (Molecule AI · infra-runtime-be)
infra-sre (Molecule AI · infra-sre)
integration-tester (Molecule AI · integration-tester)
molecule-code-reviewer
plugin-dev (Molecule AI · plugin-dev)
pm
release-manager (Molecule AI · release-manager)
sdk-dev (Molecule AI · sdk-dev)
sdk-lead (Molecule AI · sdk-lead)
sop-tier-bot (SOP Tier-Check Bot)
technical-writer (Molecule AI · technical-writer)
triage-operator (Molecule AI · triage-operator)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: molecule-ai/molecule-mcp-server#35
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "test/issue-34-integration-a2a-acl-memory"
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 / delegate / commit_memory / reply paths had no real over-the-wire gate, and
async_delegatehad zero tests.Why this is the REAL layer (not mock-only)
createServer()— realMcpServer, real tool registration, real Zod validation, real handlers, realapi.tsapiCall()/platformGet()-> realfetch. No SDK mock, no fetch mock (contrastindex.test.tswhichjest.mock()s both).InMemoryTransportlinked pair — every tool call is genuine JSON-RPC serialized over-the-wire through the transport boundary, exercising the sameclient -> Protocol -> Server -> handler -> fetchloop a stdio host drives. InMemory (not a spawned child) keeps CI hermetic while still crossing the real transport.node:httpfake-but-real platform — speaks the actual REST contractapi.tstargets and enforces the same authorization the Go control plane does:GET /registry/:id/peersreturns only reachable peers; unknown/cross-org -> 403.POST /workspaces/:id/memorieswithscope=GLOBALsucceeds only for a tier-0 root; non-root -> 403AUTH_ERROR.Coverage
list_peers: ACL-scoped peer set; cross-org (ws-foreign) denial surfaces asHTTP 403;ws-foreignnever leaks into the peer set.async_delegate(was zero tests): asserts{target_id, task}actually reachPOST /workspaces/:id/delegate; reachable target returns adelegation_id; unreachable target is ACL-denied and records no delegation; missing required args rejected by real Zod validation before any platform call.commit_memory: LOCAL ok for non-root +scopecarried on the wire; GLOBAL ok for tier-0 root; GLOBAL from a non-root is rejected and persists nothing.notify_user: the canvas reply primitive (this server's surface analog ofreply_to_workspace) delivers over the wire.Watch-fail intent
Each assertion fails against a regression of the covered behavior: drop
target_id/taskfrom the delegate body, dropscopefromcommit_memory, stop threadingworkspace_idinto the registry path, or remove the platform-side GLOBAL/peer-ACL gate -> the corresponding assertion goes red. It passes against current-correct source.Wiring / gating
jest.integration.cjs(maps the real, non-mocked SDKclient/inMemory/typesto their CJS builds for ts-jest).npm run test:integrationscript.jest.config.cjsnow ignores*.integration.test.tsso unit and integration runs stay separated..gitea/workflows/ci.ymlgains a separate merge-gatingintegrationjob so a regression fails CI loudly instead of hiding behind the fetch-mocked unit suite.DRAFT — what CI + CR2 must confirm (cannot compile/run locally)
dist/cjs/client/index.js,dist/cjs/inMemory.js,dist/cjs/types.js. If the dual-package layout differs, adjustmoduleNameMapperinjest.integration.cjs(the unit config already proves thedist/cjs/server/*layout).jest.isolateModules(() => require("../index.js"))re-readsMOLECULE_API_URLso the server'sPLATFORM_URL(a module-load-time const inapi.ts) points at the fake platform. Confirm the env override lands before module load.🤖 Generated with Claude Code
The real MCP client resolves with an {isError:true} result when Zod validation fails; it does not throw. Update the assertion to match the actual SDK contract. All 10 integration tests now pass.Closed: superseded by #50 (clean integration test); #35 removed required merge-queue workflow + auth — unsafe.
Pull request closed