You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8b9843b
Browse filesBrowse the repository at this point in the historyBrowse files
mcp tests: keep the real Zulip adapter out of above-port tests (#9)
## What
Audits the above-the-port unit tests (`server.test.ts`,
`server.integration.test.ts`, tools tests) and the `disconnect-exit`
fixture to confirm the **real Zulip adapter does not appear** in them —
they drive the substrate through hand-rolled port fakes and the
in-memory adapter only. Documents the rule and concentrates the residual
Zulip coupling into a single seam.
## Audit finding
These tests were already compliant *behaviourally*: only
`server.live.test.ts` constructs `zulipAdapter()` (the live suite, out
of scope), and `bootstrap.test.ts` wires the real adapter *from config*
(it tests wiring, not I/O — exempt). The above-port targets exercise
only `buildFakeAdapter` / harness overrides and the real
`memoryAdapter()`.
The residual `@commy/zulip` references were the `ZulipAdapter` *type*
(the `SubstrateAdapter` port is currently typed as `ZulipAdapter`) and
the `UserUploadPath` brand (`decodeUserUploadPathSync`) — type/brand
coupling, not adapter behaviour — duplicated across three sites that
each completed an `AgentComms` core to the Zulip-shaped aggregate.
## Change
- **`packages/mcp/memory-substrate.ts`** (new) —
`completeAsSubstrate(base, overrides?)`, the single seam that completes
an `AgentComms` core (in-memory adapter or a port fake) to the
`ZulipAdapter` shape. It owns the lone `UserUploadPath` brand mint and
re-exports the `ZulipAdapter` type, so `@commy/zulip` now appears in
exactly **one** test-side module.
- The three completion sites (`server.test.ts` ×2,
`server.integration.test.ts`, `disconnect-exit.fixture.ts`) now call the
helper instead of inlining the Zulip-shaped members.
- **`docs/architecture.md`** — new *Test architecture* section
documenting the rule (above-port unit tests use the memory adapter /
port fakes only, never the real Zulip adapter), why the memory adapter
is a *proven* contract-equivalent, and the two legitimate exceptions.
Substrate-neutralising the `SubstrateAdapter` port itself (so above-port
code names no Zulip type at all) is epic-level and tracked separately;
this keeps the boundary self-enforcing in the meantime.
Closes comms-e5vm.4 (epic comms-e5vm).
0 commit comments