from __future__ import annotations from memory_gateway_plugin.output import dumps_safe, redact, short_id def test_output_redaction_hides_secret_fields(): payload = { "api_key": "sk-test", "headers": {"Authorization": "Bearer abc"}, "nested": {"cookie": "sid=abc"}, "safe": "value", } text = dumps_safe(payload) assert "sk-test" not in text assert "Bearer abc" not in text assert "sid=abc" not in text assert "value" in text assert redact("password=abc") == "" def test_output_redaction_shortens_memory_ids(): assert short_id("mem_1234567890abcdef") == "mem_1234...cdef"