"""Ślad audytowy jest artefaktem CI - nie może wynosić sekretów.""" from agentic_codemod.observability.audit import redact def test_redakcja_tokenow(): assert "glpat-" not in redact("token: glpat-ABCDEFGHIJKLMNOP") assert "supersecret" not in redact('api_key="supersecret123"') assert "***REDACTED***" in redact("Authorization: Bearer abcdefghijklmnop") def test_redakcja_nie_niszczy_zwyklego_tekstu(): text = "Zmieniono plik src/acme_app/notifier.py, 9 podmian." assert redact(text) == text def test_log_zapisuje_wpisy_do_pliku(audit): audit.record("read_file", {"path": "a.py"}, detail="ok") audit.event("intake", package="acme-sdk") assert (audit.run_dir / "trace.jsonl").read_text(encoding="utf-8").count("\n") == 2 assert audit.tool_call_count == 1