Files
echo-core/tests/test_dashboard_no_emoji.py
Marius Mutu 5e930ade02 feat(dashboard): unified workspace hub — cookie auth, 9-state projects, planning chat
Merges workspace.html + ralph.html into a single unified project hub with:
- Cookie-based auth (DASHBOARD_TOKEN, HttpOnly, SameSite=Strict)
- 9-state project badge system (running-ralph/manual, planning, approved,
  pending, blocked, failed, complete, idle) with BUTTONS_FOR_STATE matrix
- SSE realtime + polling fallback, version-based optimistic concurrency (If-Match)
- Planning chat modal (phase stepper, markdown bubbles, 50s+ wait state, auto-resume)
- Propose modal (Variant B: inline Plan-with-Echo checkbox)
- 5-type toast taxonomy (success/info/warning/busy/error, 3px colored left-bar)
- Inter font self-hosted + shared tokens.css design system + DESIGN.md
- src/jsonlock.py (flock helper, sidecar .lock for stable inode)
- src/approved_tasks_cli.py (shell-safe wrapper for cron/ralph.sh)
- 55 new tests (T#1–T#30) + real jsonlock bug fix caught by T#16/T#28
- No emoji anywhere (enforced by test_dashboard_no_emoji.py)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 07:26:19 +00:00

46 lines
1.7 KiB
Python

"""T#30 — guard the new dashboard pages against emoji creep.
Design pillar (`dashboard/DESIGN.md`): the unified Echo dashboard uses Lucide
icons exclusively, no emojis in the chrome. This test asserts that no emoji
codepoints sneak into the static HTML files we ship.
"""
from __future__ import annotations
import re
from pathlib import Path
import pytest
# Symbols + emoticons + transport + miscellaneous + dingbats. Covers the
# common emoji blocks; not exhaustive but matches what the spec asked for.
EMOJI_RE = re.compile(
r'[\U0001F300-\U0001F9FF\U0001FA00-\U0001FAFF☀-➿]'
)
DASHBOARD_DIR = Path(__file__).resolve().parent.parent / "dashboard"
# Pages that the unified-dashboard initiative declares emoji-free.
# index.html is excluded for now: it's the legacy unified panel page that
# predates DESIGN.md and still contains historical emoji (👤👷🤖🔴…). It
# will be migrated separately; that cleanup gets its own follow-up.
_UNIFIED_PAGES = ["workspace.html", "login.html"]
def _emoji_files():
"""Only run the test for pages that exist on disk.
workspace.html may not be in place during partial rollouts; skip silently
so the suite doesn't hard-fail during the unified-dashboard migration.
"""
return [name for name in _UNIFIED_PAGES if (DASHBOARD_DIR / name).is_file()]
@pytest.mark.parametrize("html_file", _emoji_files() or ["__skip__"])
def test_no_emoji_in_dashboard_html(html_file):
if html_file == "__skip__":
pytest.skip("no unified dashboard pages are present yet")
content = (DASHBOARD_DIR / html_file).read_text(encoding="utf-8")
found = EMOJI_RE.findall(content)
assert not found, f"Emoji found in {html_file}: {found}"