- Sidebar: the entry joins SIDEBAR_NAV (same chrome, active state, data-tour handle as the other rows) instead of a one-off Button below the rail; i18n moves to sidebar.nav['session-import']. - Reuse common.retry / common.refresh / common.back instead of duplicating them under sessionImport in six locales. - hermes_cli/foreign_session_browser.py -> foreign_sessions_browser.py so it sorts as a sibling of the foreign_sessions module it extends.
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
"""Discovery keeps readable sessions available when a neighboring log is inaccessible."""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from hermes_cli.foreign_sessions_browser import list_foreign_sessions
|
|
|
|
|
|
@pytest.mark.parametrize("operation", ["resolve", "stat"])
|
|
def test_discovery_skips_inaccessible_log(tmp_path, monkeypatch, operation):
|
|
monkeypatch.setattr(Path, "home", lambda: tmp_path)
|
|
monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
|
|
folder = tmp_path / ".codex" / "sessions"
|
|
folder.mkdir(parents=True)
|
|
for name in ("readable", "inaccessible"):
|
|
(folder / f"rollout-{name}.jsonl").write_text(json.dumps({
|
|
"type": "response_item", "payload": {"type": "message", "role": "user",
|
|
"content": [{"type": "input_text", "text": name}]},
|
|
}), encoding="utf-8")
|
|
|
|
original = getattr(Path, operation)
|
|
|
|
def access(path, *args, **kwargs):
|
|
if path.name == "rollout-inaccessible.jsonl":
|
|
raise PermissionError("Log access denied")
|
|
return original(path, *args, **kwargs)
|
|
|
|
monkeypatch.setattr(Path, operation, access)
|
|
page = list_foreign_sessions("codex")
|
|
assert [session["title"] for session in page["sessions"]] == ["readable"]
|