@@ -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