@@ -1231,3 +1231,38 @@ def test_smart_gateway_unknown_exception_never_leaks_internals(monkeypatch):
12311231 assert parsed ["error" ]["code" ] == "E_INTERNAL"
12321232 assert "SECRET" not in parsed ["error" ]["message" ]
12331233 assert "/home/user" not in parsed ["error" ]["message" ]
1234+
1235+
1236+ def test_classic_remember_persists_subject_key_and_claim_kind_to_chain (monkeypatch ):
1237+ """Classic engraphis_remember must persist subject_key/claim_kind to the chain.
1238+
1239+ Regression guard for the class binding that powers every direct Command Code
1240+ caller: the SMART gateway now carries subject_key/claim_kind (PR #171) but the
1241+ classic binding had no end-to-end test that exercised these parameters. A
1242+ direct call must (a) return a memory id, not a delegation envelope, and
1243+ (b) round-trip the subject/claim metadata through the inspect chain.
1244+ """
1245+ srv = _module_with_memory_db (monkeypatch )
1246+
1247+ response = srv .engraphis_remember (
1248+ content = "The deployment timeout is 30 seconds." ,
1249+ workspace = "w" ,
1250+ subject_key = "deploy.timeout" ,
1251+ claim_kind = "configured_value" ,
1252+ )
1253+ assert not response .startswith ("Error:" ), response
1254+ payload = json .loads (response )
1255+ assert payload ["op" ] == "add"
1256+ assert isinstance (payload .get ("id" ), str ) and payload ["id" ]
1257+ # The id must be a memory id, not a Smart gateway delegation envelope.
1258+ assert not payload ["id" ].startswith ("del_" ), payload ["id" ]
1259+
1260+ fetched = srv .engraphis_get_memory (memory_id = payload ["id" ], workspace = "w" )
1261+ assert not fetched .startswith ("Error:" ), fetched
1262+ fetched_payload = json .loads (fetched )
1263+ assert fetched_payload ["id" ] == payload ["id" ]
1264+ assert fetched_payload ["chain" ], "inspect must return a non-empty chain"
1265+ head = fetched_payload ["chain" ][0 ]
1266+ assert head ["id" ] == payload ["id" ]
1267+ assert head ["subject_key" ] == "deploy.timeout"
1268+ assert head ["claim_kind" ] == "configured_value"
0 commit comments