fix(wiki): keep status and browse metadata on verified identities (#4375)

This commit is contained in:
Rod Boev authored and nesquena-hermes committed 2026-06-19 21:11:10 +00:00
1 parent 0542d91824
commit 9a75a85d59
3 files changed
+103 -17

No files matched your search

+29
View File
@@ -184,10 +184,39 @@ def test_llm_wiki_status_last_writer_rechecks_identity(monkeypatch, tmp_path):
status = routes._build_llm_wiki_status()
assert status["page_count"] == 0
assert status["last_updated"] is None
assert status["last_writer"] == "ai-agent"
assert "hidden-author" not in repr(status)
def test_llm_wiki_status_log_heading_rechecks_identity(monkeypatch, tmp_path):
import os as _os
import api.routes as routes
wiki = tmp_path / "wiki"
_write(wiki / "log.md", "## [2026-06-19] update | safe\n",)
_write(wiki / ".env", "## [2026-06-19] leak | hidden\n")
monkeypatch.setenv("WIKI_PATH", str(wiki))
original_open = routes.os.open
swapped = {"done": False}
def fake_open(path, flags, mode=0o777):
if not swapped["done"] and Path(path) == wiki / "log.md":
swapped["done"] = True
(wiki / "log.md").unlink()
(wiki / "log.md").symlink_to(_os.path.join(".env"))
return original_open(path, flags, mode)
monkeypatch.setattr(routes.os, "open", fake_open)
status = routes._build_llm_wiki_status()
assert status["last_writer"] == "ai-agent"
def test_last_writer_rejects_symlink_outside_wiki(tmp_path):
"""#3455 review (Codex): a symlinked .md page resolving OUTSIDE the wiki must
not be read — its frontmatter must never leak into the status card."""