mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 19:20:16 +00:00
test: tighten compression snapshot preservation coverage
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
### Fixed
|
||||
|
||||
- **PR #2285** by @dso2ng (refs #2230) — Context-compression preservation now marks old pre-compression session files with `pre_compression_snapshot: true` and hides those preserved snapshots from the active sidebar list while keeping the JSON files available for lineage traversal. This keeps long-running conversations from accumulating duplicate active sidebar rows after repeated compressions without reusing the manual archive flag for an internal snapshot lifecycle state.
|
||||
- **PR #2285** by @dso2ng (refs #2230) - Context-compression preservation now marks old pre-compression session files with `pre_compression_snapshot: true` and hides those preserved snapshots from the active sidebar list while keeping the JSON files available for lineage traversal. This keeps long-running conversations from accumulating duplicate active sidebar rows after repeated compressions without reusing the manual archive flag for an internal snapshot lifecycle state.
|
||||
|
||||
## [v0.51.64] — 2026-05-14 — Release AN (stage-357 — 3-PR small batch — docker_init k8s whoami fallback + PWA manifest session routes (closes #2226) + aux title test coverage)
|
||||
|
||||
|
||||
+4
-1
@@ -1605,12 +1605,15 @@ def _preserve_pre_compression_snapshot(s, old_sid: str) -> None:
|
||||
existing_msgs = len(existing.get('messages') or [])
|
||||
existing_snapshot = bool(existing.get('pre_compression_snapshot'))
|
||||
except (json.JSONDecodeError, ValueError):
|
||||
# Treat corrupt/malformed old JSON as missing history and rewrite it
|
||||
# from the in-memory pre-compression messages below. That is safer
|
||||
# than leaving an unreadable recovery snapshot behind.
|
||||
existing_msgs = -1
|
||||
existing_snapshot = False
|
||||
if len(s.messages) <= existing_msgs and existing_snapshot:
|
||||
return
|
||||
if len(s.messages) > existing_msgs:
|
||||
# In-memory messages are newer than the file — save the full old
|
||||
# In-memory messages are newer than the file; save the full old
|
||||
# snapshot from the current session object while preserving its
|
||||
# pre-existing parent_session_id lineage.
|
||||
saved_sid = s.session_id
|
||||
|
||||
@@ -117,6 +117,10 @@ class TestNoRenameDuringCompression:
|
||||
assert old_payload["pre_compression_snapshot"] is True
|
||||
assert old_payload["parent_session_id"] == "fork_parent"
|
||||
assert len(old_payload["messages"]) == 2
|
||||
index = json.loads((session_dir / "_index.json").read_text(encoding="utf-8"))
|
||||
index_by_id = {entry["session_id"]: entry for entry in index}
|
||||
assert index_by_id["old_sid"]["pre_compression_snapshot"] is True
|
||||
assert "new_sid" not in index_by_id
|
||||
assert continuation.session_id == "new_sid"
|
||||
assert continuation.parent_session_id == "fork_parent"
|
||||
assert not continuation.pre_compression_snapshot
|
||||
|
||||
Reference in New Issue
Block a user