Skip to content

Memory v2 PR-11: E2E test — flat-plugin swap proves contract works - #2742

Merged
HongmingWang-Rabbit merged 2 commits into
stagingfrom
feat/memory-v2-pr11-e2e-swap
May 4, 2026
Merged

Memory v2 PR-11: E2E test — flat-plugin swap proves contract works#2742
HongmingWang-Rabbit merged 2 commits into
stagingfrom
feat/memory-v2-pr11-e2e-swap

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Final implementation PR. Builds on PR-1..10.

Tracking issue: #2728
Task: #285

Summary

Proves the central design property of the plugin contract: ANY plugin satisfying the v1 OpenAPI spec works as a drop-in replacement for the built-in postgres plugin.

A deliberately minimal "flat-memory" stub plugin (~50 LOC, single map, zero capabilities) is wired into a real MCPHandler, and every memory tool is driven through the dispatcher.

If this test fails after a refactor, the contract has drifted in a way that breaks ecosystem plugins.

Five E2E tests

  • TestE2E_FlatPluginRoundTrip: full lifecycle (list → commit → search → commit_summary → forget → search-after-forget)
  • TestE2E_LegacyShimRoutesThroughFlatPlugin: PR-6 shim ends up in plugin storage; legacy response shapes preserved
  • TestE2E_OrgMemoriesDelimiterWrap: prompt-injection mitigation applied on org-memory reads + audit INSERT verified
  • TestE2E_StubPluginCapabilitiesAreEmpty: capability negotiation gracefully degrades when plugin reports nothing
  • TestE2E_PluginUnreachable_AgentSeesClearError: failure surface returns informative error, no nil-pointer crashes

Small handler change

  • MCPHandler.Dispatch — exported wrapper around dispatch so out-of-package E2E tests can drive tools by name. Forwards directly to dispatch; no behavior change.

Test plan

  • All 5 E2E tests pass
  • Stub plugin satisfies contract; no special-casing in handler

🤖 Generated with Claude Code

Final implementation PR. Builds on PR-1..10 (all merged or queued).

Proves the central design property of the plugin contract: ANY
plugin satisfying the v1 OpenAPI spec works as a drop-in replacement
for the built-in postgres plugin. If this test fails after a refactor,
the contract has drifted in a way that breaks ecosystem plugins.

What ships:
  * internal/memory/e2e/swap_test.go — five E2E tests against a
    deliberately minimal "flat-memory" stub plugin (~50 LOC, single
    map, zero capabilities)
  * MCPHandler.Dispatch — small exported wrapper around dispatch so
    out-of-package E2E tests can drive tools by name without
    duplicating the whole MCP RPC stack

E2E coverage:
  * TestE2E_FlatPluginRoundTrip: full lifecycle
    - list_writable_namespaces returns 3 entries
    - commit_memory_v2 writes through plugin
    - search_memory finds it back
    - commit_summary writes a summary
    - forget_memory deletes
    - search after forget excludes the deleted memory

  * TestE2E_LegacyShimRoutesThroughFlatPlugin: PR-6 shim wired up
    - Legacy commit_memory(scope=LOCAL) ends up in plugin storage
    - Legacy recall_memory finds it back through plugin search
    - Response shapes preserved (scope:LOCAL stays scope:LOCAL)

  * TestE2E_OrgMemoriesDelimiterWrap: prompt-injection mitigation
    - Org-namespace memory committed
    - Audit INSERT into activity_logs verified
    - Search returns content with [MEMORY id=... scope=ORG ns=...]
      prefix applied

  * TestE2E_StubPluginCapabilitiesAreEmpty: capability negotiation
    - Stub plugin reports zero capabilities
    - Client.SupportsCapability returns false for FTS, embedding
    - Confirms graceful degradation when plugin doesn't support a
      feature

  * TestE2E_PluginUnreachable_AgentSeesClearError: failure surface
    - Plugin URL pointing at bogus port
    - commit_memory_v2 returns informative error
    - No nil-pointer dereference; error message is actionable

The flat plugin is intentionally minimal — it has no namespaces table
distinct from memory records, no FTS, no semantic search, no TTL. The
test proves operators can drop in a 50-line plugin and the agent
behavior is identical (modulo capability-gated features).
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🔒 Auto-merge disabled — new commit (b07575c) pushed after auto-merge was enabled. The merge queue locks SHAs at entry, so subsequent pushes can race. Verify the new commit and re-enable with gh pr merge --auto.

@HongmingWang-Rabbit
HongmingWang-Rabbit added this pull request to the merge queue May 4, 2026
Merged via the queue into staging with commit 059962a May 4, 2026
23 checks passed
@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the feat/memory-v2-pr11-e2e-swap branch May 4, 2026 15:34
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