summaryrefslogtreecommitdiff
path: root/tests/mcp_protocol_test.py
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-07-04 17:21:32 +0900
committertanaka takashi <isazaka@gmail.com>2026-07-04 17:21:32 +0900
commit0634f2048c7c9a474aab1d8104b964b3bf70a064 (patch)
tree508c305a64cbd3b01f5146776e22865d283d5dbb /tests/mcp_protocol_test.py
parenteb5e9d9f37bda7d78f69614da70402357794168a (diff)
feat(P1-002): migrate offline JSONL import/export to dedicated CLI
- Replace the MCP import_messages tool with standalone CLI commands: iny-convmem-mcp --data-dir <path> --import <file> iny-convmem-mcp --data-dir <path> --export <file> - Add src/cli/{import,export,cli.h} and a CTest process test (tiny-convmem-mcp.cli) covering round-trip, manifest generation, overwrite/reject policies, and include_deleted export. - Fix Debug heap corruption in iny_store_import() by deep-copying imported messages instead of taking ownership of caller-allocated records, which were later freed by the caller. - Remove the now-redundant src/mcp/tools/import_messages.c and keep the tool registry at 7 MCP tools. - Update docs/development-plan.md (P1-002 complete) and docs/implementation-status.md with CLI test coverage.
Diffstat (limited to 'tests/mcp_protocol_test.py')
-rw-r--r--tests/mcp_protocol_test.py22
1 files changed, 1 insertions, 21 deletions
diff --git a/tests/mcp_protocol_test.py b/tests/mcp_protocol_test.py
index ec4f350..9074d9b 100644
--- a/tests/mcp_protocol_test.py
+++ b/tests/mcp_protocol_test.py
@@ -134,7 +134,6 @@ def main() -> None:
"delete_message",
"rebuild_index",
"get_system_health",
- "import_messages",
}
expected_descriptions = {
"write_message": "Append and durably persist a conversation message. Use it to store information that should remain available after server restarts.",
@@ -144,7 +143,6 @@ def main() -> None:
"delete_message": "Delete a persisted message so it is immediately excluded from reads and searches. Physical removal occurs after rebuild_index compacts the store.",
"rebuild_index": "Compact the store and rebuild its snapshot and in-memory indexes. Use it for maintenance or to physically remove logically deleted records; it may block other requests while running.",
"get_system_health": "Inspect storage health, recovery state, message counts, and file sizes. Use it to diagnose persistence or recovery problems.",
- "import_messages": "Atomically import a JSONL export from read_messages view=export. The manifest line is required; subsequent lines are PUT messages or DEL tombstones. Conflicting message IDs are resolved by the policy argument.",
}
assert {name: tool["description"] for name, tool in tools.items()} == expected_descriptions
expected_property_descriptions = {
@@ -155,7 +153,7 @@ def main() -> None:
"metadata_json": "Optional JSON object string containing tool_call_id, tags, memory_tier, memory_kind, importance, summary, relations, and/or source_message_ids; defaults to {}.",
},
"read_messages": {
- "view": "Read view: history (default), context, sessions, or export.",
+ "view": "Read view: history (default), context, or sessions.",
"session_id": "Conversation session whose chronological history to read.",
"message_id": "Message ULID required by the context view.",
"before": "Context messages before the target, from 0 to 10.",
@@ -164,7 +162,6 @@ def main() -> None:
"relation_types_json": "Optional JSON array string of relation types to follow.",
"limit": "Maximum messages to return in this page, from 1 to 1000; defaults to 100.",
"cursor": "Opaque nextCursor returned by a previous read_messages call; omit for the first page.",
- "include_deleted": "When true, export view includes deleted records as DEL lines; other views ignore this option.",
},
"search_messages": {
"query": "UTF-8 text to match against persisted message content and tags.",
@@ -184,10 +181,6 @@ def main() -> None:
"metadata_json": "Replacement metadata JSON; omit to retain metadata.",
"expected_revision": "Optional positive revision for optimistic concurrency.",
},
- "import_messages": {
- "jsonl": "JSONL string containing a manifest line followed by PUT message lines and optional DEL tombstone lines.",
- "policy": "Conflict policy: overwrite (default) replaces existing message IDs, reject refuses duplicate IDs.",
- },
}
for tool_name, descriptions in expected_property_descriptions.items():
properties = tools[tool_name]["inputSchema"]["properties"]
@@ -274,19 +267,6 @@ def main() -> None:
)
next_id += 1
assert any(item["session_id"] == "target" for item in sessions_view["sessions"])
- exported = tool_payload(
- tool_call(
- server,
- next_id,
- "read_messages",
- {"view": "export", "session_id": "target", "limit": 100},
- )
- )
- next_id += 1
- export_lines = exported["jsonl"].splitlines()
- assert json.loads(export_lines[0])["format_version"] == 2
- assert len(export_lines) == 21
- assert all(json.loads(line)["session_id"] == "target" for line in export_lines[1:])
io_after_views = tool_payload(tool_call(server, next_id, "get_system_health", {}))["io"]
next_id += 1
assert io_after_views == io_before