Files
hermes-webui/tests/test_sprint49.py
T
nesquena-hermes 33a145a669 release: v0.50.240
## Release v0.50.240

Batch release of 13 PRs that passed full triage + code review + test suite (3199 tests, 0 failures).

---

### Added

- **Compact tool activity mode** (`simplified_tool_calling`, default on) — groups tool calls and thinking traces into a single collapsed "Activity" disclosure card per assistant turn. Also adds a new **Calm Console** theme with earth/slate palette and serif prose. @Michaelyklam — #1282
- **PDF first-page preview** — `MEDIA:` `.pdf` files render a canvas thumbnail via PDF.js CDN (4 MB cap). **HTML sandbox iframe** — `.html`/`.htm` files render inline in a sandboxed `<iframe srcdoc>` (256 KB cap). 10 i18n keys × 7 locales. @bergeouss — #1280, closes #480 #482
- **Inline Excalidraw diagram preview** — `.excalidraw` files render as pure SVG (no external deps; rectangles, ellipses, diamonds, text, lines, arrows, freehand; 512 KB cap). @bergeouss — #1279, closes #479
- **Inline CSV table rendering** — fenced `csv` blocks and `MEDIA:` CSV files render as scrollable HTML tables with auto-separator detection. @bergeouss — #1277, closes #485
- **Inline SVG, audio, and video rendering** — SVG as `<img>`, audio as `<audio controls>`, video as `<video controls>`. @bergeouss — #1276, closes #481
- **Batch session select mode** — multi-select sessions for bulk Archive/Delete/Move. 11 i18n keys × 7 locales. @bergeouss — #1275, closes #568
- **Collapsible skill category headers** — click to collapse/expand without re-render; state persists across filter cycles. @bergeouss — #1281
- **`providers.only_configured` setting** — opt-in flag to restrict the model picker to explicitly configured providers. @KingBoyAndGirl — #1268
- **OpenCode Go model catalog** — adds Kimi K2.6, DeepSeek V4 Pro/Flash, MiMo V2.5/Pro, Qwen3.6/3.5 Plus. @nesquena-hermes — #1284, closes #1269

### Fixed

- **Profile `TERMINAL_CWD` TypeError** — `_build_agent_thread_env()` helper merges env before `_set_thread_env()` call. @hi-friday — #1266
- **Service worker subpath cache bypass** — regex now matches `/api/*` under any mount prefix. @Michaelyklam — #1278
- **SSE client disconnect leaks** — `TimeoutError`/`OSError` treated as clean disconnects; server backlog 64, threads daemonized; session list renders before saved-session restore. @KayZz69 — #1267
- **i18n locale corrections** — Korean MCP strings (23), Chinese MCP strings (23), zh-Hant missing keys (41), de missing keys (229). @bergeouss — #1274, closes #1273

---

### Test results

```
3199 passed, 2 skipped, 3 xpassed in 72.79s
```

### PRs on hold (not included)

#1265 (draft), #1271 (superseded by #1266), #1272 (skipped XSS tests), #1232 (partial test run), #1222 (review questions open), #1134 (live-server tests), #1132 (superseded by #1134), #1108 (negative UX review), #1084 (empty description)
2026-04-29 17:42:32 -07:00

108 lines
4.8 KiB
Python

"""Tests for sprint 49 timestamp footer polish — v0.50.97.
Covers:
- #680: assistant messages now render footer timestamps, not just user messages
- messages from prior days render a fuller date+time string in the footer
- timestamp/action footer stays attached to visible response segments only
- user and assistant footer chrome is hover-only by default
- last assistant turn keeps cumulative usage visible and reveals time/actions on hover
- unchanged historical messages preserve their original timestamps across turns
"""
import pathlib
import re
from api.streaming import _restore_reasoning_metadata
REPO = pathlib.Path(__file__).parent.parent
UI_JS = (REPO / "static" / "ui.js").read_text(encoding="utf-8")
UI_CSS = (REPO / "static" / "style.css").read_text(encoding="utf-8")
STREAMING_PY = (REPO / "api" / "streaming.py").read_text(encoding="utf-8")
def test_footer_timestamp_is_not_limited_to_user_messages():
assert "const timeHtml = tsTime ?" in UI_JS
assert "isUser && tsTime" not in UI_JS, (
"Timestamp footer should no longer be gated to user messages only"
)
def test_footer_timestamp_uses_richer_format_for_older_messages():
assert "function _formatMessageFooterTimestamp(tsVal)" in UI_JS
assert "month:'short'" in UI_JS or 'month: "short"' in UI_JS
assert "day:'numeric'" in UI_JS or 'day: "numeric"' in UI_JS
assert "hour:'numeric'" in UI_JS or 'hour: "numeric"' in UI_JS
assert "minute:'2-digit'" in UI_JS or 'minute: "2-digit"' in UI_JS
def test_timestamp_footer_stays_on_visible_response_segments():
assert "if(hasVisibleBody){" in UI_JS
assert 'seg.insertAdjacentHTML(\'beforeend\', `${filesHtml}<div class="msg-body">${bodyHtml}</div>${footHtml}`);' in UI_JS, (
"Footer timestamp should stay attached to visible response segments"
)
assert "assistantThinking.set(rawIdx, thinkingText);" in UI_JS, (
"Thinking-only assistant segments should preserve thinking for the shared activity dropdown without rendering a footer"
)
assert "seg.classList.add('assistant-segment-anchor');" in UI_JS, (
"Empty assistant anchor segments should stay footerless while anchoring activity metadata"
)
def test_footer_chrome_is_hover_only_for_user_and_assistant_messages():
assert ".msg-row[data-role=\"user\"] .msg-foot {\n opacity: 0;" in UI_CSS
assert ".msg-row[data-role=\"user\"]:hover .msg-foot," in UI_CSS
assert ".msg-row[data-role=\"assistant\"] .msg-foot," in UI_CSS
assert ".assistant-turn .msg-foot {" in UI_CSS
assert ".assistant-turn:hover .msg-foot," in UI_CSS
def test_last_assistant_keeps_usage_visible_and_reveals_time_and_actions_on_hover():
assert "usage.className='msg-usage-inline';" in UI_JS
assert "targetFoot.classList.add('msg-foot-with-usage');" in UI_JS
assert "targetFoot.insertBefore(usage, targetFoot.firstChild);" in UI_JS
assert ".assistant-turn .msg-foot-with-usage," in UI_CSS
assert ".msg-row[data-role=\"assistant\"] .msg-foot-with-usage {\n opacity: 1;" in UI_CSS
assert ".msg-foot-with-usage .msg-time,\n.msg-foot-with-usage .msg-actions {\n opacity: 0;" in UI_CSS
assert ".assistant-turn:hover .msg-foot-with-usage .msg-time," in UI_CSS
def test_restore_reasoning_metadata_preserves_existing_timestamps():
assert "def _restore_reasoning_metadata(previous_messages, updated_messages):" in STREAMING_PY
assert "if prev_msg.get('timestamp') and not cur_msg.get('timestamp'):" in STREAMING_PY
assert "cur_msg['timestamp'] = prev_msg['timestamp']" in STREAMING_PY
assert "elif prev_msg.get('_ts') and not cur_msg.get('_ts') and not cur_msg.get('timestamp'):" in STREAMING_PY
assert "cur_msg['_ts'] = prev_msg['_ts']" in STREAMING_PY
def test_restore_reasoning_metadata_preserves_timestamp_on_reload_for_unchanged_messages():
previous_messages = [
{"role": "user", "content": "hello", "timestamp": 1713500000},
{"role": "assistant", "content": "world", "timestamp": 1713500060},
]
updated_messages = [
{"role": "user", "content": "hello"},
{"role": "assistant", "content": "world"},
]
restored = _restore_reasoning_metadata(previous_messages, updated_messages)
assert restored[0]["timestamp"] == 1713500000
assert restored[1]["timestamp"] == 1713500060
def test_restore_reasoning_metadata_does_not_preserve_timestamp_for_changed_messages():
previous_messages = [
{"role": "user", "content": "hello", "timestamp": 1713500000},
{"role": "assistant", "content": "old answer", "timestamp": 1713500060},
]
updated_messages = [
{"role": "user", "content": "hello"},
{"role": "assistant", "content": "new answer"},
]
restored = _restore_reasoning_metadata(previous_messages, updated_messages)
assert restored[0]["timestamp"] == 1713500000
assert "timestamp" not in restored[1]