mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-24 02:36:27 +00:00
33a145a669
## 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)
140 lines
5.5 KiB
Python
140 lines
5.5 KiB
Python
"""Test: CSV table rendering (#485)"""
|
|
import re
|
|
|
|
|
|
def test_csv_extension_regex():
|
|
"""Verify _CSV_EXTS regex is defined."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
assert '_CSV_EXTS' in src, "Missing _CSV_EXTS regex"
|
|
assert '.csv' in src, "CSV regex should match .csv extension"
|
|
|
|
|
|
def test_csv_fence_block_handler():
|
|
"""Verify fenced ```csv blocks are handled."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
assert "lang==='csv'" in src, "Missing csv language detection in fence handler"
|
|
assert 'csv-table' in src, "Missing csv-table class for fenced CSV rendering"
|
|
assert 'csv-table-wrap' in src, "Missing csv-table-wrap class"
|
|
|
|
|
|
def test_csv_fence_renders_table_structure():
|
|
"""Verify fenced CSV blocks produce proper table HTML."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
# Should have thead, tbody, th, td
|
|
assert '<thead>' in src, "CSV table should have <thead>"
|
|
assert '<tbody>' in src, "CSV table should have <tbody>"
|
|
# In the fence handler section
|
|
fence_section = src[src.find("lang==='csv'"):src.find("lang==='csv'") + 800]
|
|
assert '<th>' in fence_section, "CSV headers should use <th>"
|
|
assert '<td>' in fence_section, "CSV body should use <td>"
|
|
|
|
|
|
def test_csv_fence_fallback_for_insufficient_rows():
|
|
"""Verify CSV with < 2 rows falls back to code block."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
fence_section = src[src.find("lang==='csv'"):src.find("lang==='csv'") + 800]
|
|
assert 'rows.length>=2' in fence_section, "Should check for at least 2 rows"
|
|
assert '<pre><code' in fence_section, "Fallback should render as <pre><code>"
|
|
|
|
|
|
def test_csv_media_file_handler():
|
|
"""Verify MEDIA: CSV files trigger inline loading."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
assert 'csv-inline-load' in src, "Missing csv-inline-load class for MEDIA: CSV"
|
|
assert 'csv_loading' in src, "Missing csv_loading i18n key usage"
|
|
|
|
|
|
def test_loadCsvInline_function():
|
|
"""Verify loadCsvInline lazy-load function exists."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
assert 'function loadCsvInline()' in src, "Missing loadCsvInline function"
|
|
|
|
|
|
def test_csv_inline_max_size():
|
|
"""Verify CSV inline rendering has a size cap."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
csv_section = src[src.find('function loadCsvInline()'):src.find('function loadCsvInline()') + 2000]
|
|
assert 'CSV_MAX_SIZE' in csv_section, "Should have CSV_MAX_SIZE constant"
|
|
assert 'csv_too_large' in csv_section, "Should use csv_too_large i18n for oversized files"
|
|
|
|
|
|
def test_csv_auto_detect_separator():
|
|
"""Verify CSV handler auto-detects separator."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
csv_section = src[src.find('function loadCsvInline()'):src.find('function loadCsvInline()') + 2000]
|
|
assert 'separators' in csv_section, "Should have separator detection"
|
|
assert ';' in csv_section, "Should detect semicolon separator"
|
|
assert 'tab' in csv_section.lower() or '\\t' in csv_section, "Should detect tab separator"
|
|
|
|
|
|
def test_csv_quote_stripping():
|
|
"""Verify CSV handler strips surrounding quotes from fields."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
assert "replace(/^[\"']|[\"']$/g,'')" in src, "Should strip quotes from CSV fields"
|
|
|
|
|
|
def test_csv_error_handling():
|
|
"""Verify CSV error and empty data handling."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
csv_section = src[src.find('function loadCsvInline()'):src.find('function loadCsvInline()') + 2500]
|
|
assert 'csv_error' in csv_section, "Should use csv_error i18n on fetch failure"
|
|
assert 'csv_no_data' in csv_section, "Should use csv_no_data i18n for insufficient data"
|
|
|
|
|
|
def test_csv_loadCsvInline_called_after_render():
|
|
"""Verify loadCsvInline is called in requestAnimationFrame after rendering."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
assert src.count('loadCsvInline()') >= 2, \
|
|
"loadCsvInline should be called at least twice (initial render + cache restore)"
|
|
|
|
|
|
def test_csv_line_ending_normalization():
|
|
"""Verify CSV handler normalizes line endings."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
csv_section = src[src.find('function loadCsvInline()'):src.find('function loadCsvInline()') + 2000]
|
|
assert '\\r\\n' in csv_section, "Should handle \\r\\n line endings"
|
|
assert '\\r' in csv_section, "Should handle \\r line endings"
|
|
|
|
|
|
def test_csv_i18n_keys():
|
|
"""Verify CSV i18n keys exist in all 7 locales."""
|
|
with open('static/i18n.js') as f:
|
|
src = f.read()
|
|
required_keys = ['csv_loading', 'csv_too_large', 'csv_no_data', 'csv_error']
|
|
for key in required_keys:
|
|
count = src.count(f"{key}:")
|
|
assert count == 7, f"Key '{key}' found {count} times, expected 7"
|
|
|
|
|
|
def test_csv_css_classes():
|
|
"""Verify CSV table CSS classes are defined."""
|
|
with open('static/style.css') as f:
|
|
src = f.read()
|
|
required_classes = ['csv-table-wrap', 'csv-table', 'csv-table th', 'csv-table td']
|
|
for cls in required_classes:
|
|
assert cls in src, f"Missing CSS: {cls}"
|
|
# Check for hover effect
|
|
assert 'csv-table tbody tr:hover' in src, "Missing hover effect for CSV rows"
|
|
|
|
|
|
def test_csv_not_matched_by_image_exts():
|
|
"""Verify .csv is NOT in _IMAGE_EXTS."""
|
|
with open('static/ui.js') as f:
|
|
src = f.read()
|
|
match = re.search(r"const _IMAGE_EXTS=/([^/]+)/i", src)
|
|
assert match
|
|
exts = match.group(1)
|
|
assert 'csv' not in exts.lower(), ".csv should NOT be in _IMAGE_EXTS"
|