Skip to content

Commit 79bdbaa

Browse files
author
B3
committed
test(mcp_server): regression test for classic engraphis_remember subject_key/claim_kind chain persistence
1 parent 29c3f4f commit 79bdbaa

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

tests/test_mcp_server.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,3 +1222,38 @@ def test_smart_gateway_unknown_exception_never_leaks_internals(monkeypatch):
12221222
assert parsed["error"]["code"] == "E_INTERNAL"
12231223
assert "SECRET" not in parsed["error"]["message"]
12241224
assert "/home/user" not in parsed["error"]["message"]
1225+
1226+
1227+
def test_classic_remember_persists_subject_key_and_claim_kind_to_chain(monkeypatch):
1228+
"""Classic engraphis_remember must persist subject_key/claim_kind to the chain.
1229+
1230+
Regression guard for the class binding that powers every direct Command Code
1231+
caller: the SMART gateway now carries subject_key/claim_kind (PR #171) but the
1232+
classic binding had no end-to-end test that exercised these parameters. A
1233+
direct call must (a) return a memory id, not a delegation envelope, and
1234+
(b) round-trip the subject/claim metadata through the inspect chain.
1235+
"""
1236+
srv = _module_with_memory_db(monkeypatch)
1237+
1238+
response = srv.engraphis_remember(
1239+
content="The deployment timeout is 30 seconds.",
1240+
workspace="w",
1241+
subject_key="deploy.timeout",
1242+
claim_kind="configured_value",
1243+
)
1244+
assert not response.startswith("Error:"), response
1245+
payload = json.loads(response)
1246+
assert payload["op"] == "add"
1247+
assert isinstance(payload.get("id"), str) and payload["id"]
1248+
# The id must be a memory id, not a Smart gateway delegation envelope.
1249+
assert not payload["id"].startswith("del_"), payload["id"]
1250+
1251+
fetched = srv.engraphis_get_memory(memory_id=payload["id"], workspace="w")
1252+
assert not fetched.startswith("Error:"), fetched
1253+
fetched_payload = json.loads(fetched)
1254+
assert fetched_payload["id"] == payload["id"]
1255+
assert fetched_payload["chain"], "inspect must return a non-empty chain"
1256+
head = fetched_payload["chain"][0]
1257+
assert head["id"] == payload["id"]
1258+
assert head["subject_key"] == "deploy.timeout"
1259+
assert head["claim_kind"] == "configured_value"

0 commit comments

Comments
 (0)