Revert "refactor: remove legacy history and proxy migrations (#6518)"
This reverts commit cb3ba45317.
Keep JSONL history and legacy proxy migration available throughout 0.4.x. Mark their removal for 0.5.0 in code and release guidance, preserving later context graph, archive and recovery changes.
This commit is contained in:
1 parent
3918ece17f
commit
812b92d734
47 files changed
+1932
-204
No files matched your search
@@ -57,7 +57,9 @@ async def test_session_tools_find_old_matches_in_full_session(
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("state", ["canonical", "transcript", "mixed"])
|
||||
async def test_session_tools_use_canonical_records_after_restart(history, state):
|
||||
async def test_session_tools_use_canonical_records_after_restart(history, tmp_path, monkeypatch, state):
|
||||
webui_dir = tmp_path / "webui"
|
||||
monkeypatch.setattr("nanobot.webui.history.get_webui_dir", lambda: webui_dir)
|
||||
manager = history.sessions
|
||||
key = "websocket:history"
|
||||
if state != "transcript":
|
||||
@@ -71,10 +73,16 @@ async def test_session_tools_use_canonical_records_after_restart(history, state)
|
||||
})
|
||||
history.append(key, {"event": "turn_end", "chat_id": "history"})
|
||||
|
||||
original_messages = manager.read_session_file(key)["messages"]
|
||||
original_display_facts = manager.project_history(key, lambda reader: reader.all_facts())
|
||||
def durable_files():
|
||||
return {
|
||||
path: path.read_bytes()
|
||||
for root in (manager.sessions_dir, webui_dir)
|
||||
for path in root.rglob("*.jsonl")
|
||||
}
|
||||
|
||||
original = durable_files()
|
||||
for _ in range(2):
|
||||
manager = SessionManager(history.sessions.workspace)
|
||||
manager = history.sessions
|
||||
with request_context(RequestContext(
|
||||
channel="websocket", chat_id="current", session_key="websocket:current",
|
||||
)):
|
||||
@@ -89,6 +97,4 @@ async def test_session_tools_use_canonical_records_after_restart(history, state)
|
||||
assert search["results"][0]["excerpts"][0]["content"] == "canonical needle"
|
||||
assert [item["content"] for item in json.loads(read)["messages"]] == ["canonical needle"]
|
||||
assert display_search["results"] == []
|
||||
assert manager.read_session_file(key)["messages"] == original_messages
|
||||
assert manager.project_history(key, lambda reader: reader.all_facts()) == original_display_facts
|
||||
await manager.state.aclose()
|
||||
assert durable_files() == original
|
||||
Reference in new issue
Block a user