feat: move dashboard to apps/ so we can share ws proto
This commit is contained in:
@@ -750,5 +750,5 @@ def test_curator_slot_is_canonical_aux_task():
|
||||
assert "curator" in _AUX_TASK_SLOTS, \
|
||||
"curator missing from _AUX_TASK_SLOTS (dashboard REST API)"
|
||||
|
||||
# 4. web/src/pages/ModelsPage.tsx is checked at build time; the tsx
|
||||
# 4. apps/dashboard/src/pages/ModelsPage.tsx is checked at build time; the tsx
|
||||
# array and this tuple share a ``Must match _AUX_TASK_SLOTS`` comment.
|
||||
|
||||
@@ -106,10 +106,11 @@ class TestCmdUpdateBranchFallback:
|
||||
pull_cmds = [c for c in commands if "pull" in c]
|
||||
assert len(pull_cmds) == 0
|
||||
|
||||
@patch("hermes_cli.main._web_ui_build_needed", return_value=True)
|
||||
@patch("shutil.which")
|
||||
@patch("subprocess.run")
|
||||
def test_update_refreshes_repo_and_tui_node_dependencies(
|
||||
self, mock_run, mock_which, mock_args
|
||||
self, mock_run, mock_which, _mock_web_ui_build_needed, mock_args
|
||||
):
|
||||
mock_which.side_effect = {"uv": "/usr/bin/uv", "npm": "/usr/bin/npm"}.get
|
||||
mock_run.side_effect = _make_run_side_effect(
|
||||
@@ -127,7 +128,7 @@ class TestCmdUpdateBranchFallback:
|
||||
# cmd_update runs npm commands in three locations:
|
||||
# 1. repo root — slash-command / TUI bridge deps
|
||||
# 2. ui-tui/ — Ink TUI deps
|
||||
# 3. web/ — install + "npm run build" for the web frontend
|
||||
# 3. apps/dashboard/ — install + "npm run build" for the web frontend
|
||||
full_flags = [
|
||||
"/usr/bin/npm",
|
||||
"ci",
|
||||
@@ -135,12 +136,21 @@ class TestCmdUpdateBranchFallback:
|
||||
"--no-fund",
|
||||
"--no-audit",
|
||||
"--progress=false",
|
||||
"--workspaces=false",
|
||||
]
|
||||
app_flags = [
|
||||
"/usr/bin/npm",
|
||||
"ci",
|
||||
"--silent",
|
||||
"--no-fund",
|
||||
"--no-audit",
|
||||
"--progress=false",
|
||||
]
|
||||
assert npm_calls == [
|
||||
(full_flags, PROJECT_ROOT),
|
||||
(full_flags, PROJECT_ROOT / "ui-tui"),
|
||||
(["/usr/bin/npm", "ci", "--silent"], PROJECT_ROOT / "web"),
|
||||
(["/usr/bin/npm", "run", "build"], PROJECT_ROOT / "web"),
|
||||
(app_flags, PROJECT_ROOT / "ui-tui"),
|
||||
(["/usr/bin/npm", "ci", "--silent"], PROJECT_ROOT / "apps" / "dashboard"),
|
||||
(["/usr/bin/npm", "run", "build"], PROJECT_ROOT / "apps" / "dashboard"),
|
||||
]
|
||||
|
||||
def test_update_non_interactive_skips_migration_prompt(self, mock_args, capsys):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Tests for _web_ui_build_needed — staleness check for the web UI dist.
|
||||
|
||||
Critical invariant: the Vite build outputs to hermes_cli/web_dist/
|
||||
(vite.config.ts: outDir: "../hermes_cli/web_dist"), NOT web/dist/.
|
||||
Critical invariant: the dashboard Vite build outputs to hermes_cli/web_dist/
|
||||
(vite.config.ts: outDir: "../../hermes_cli/web_dist"), NOT apps/dashboard/dist/.
|
||||
The sentinel must be checked in the correct output directory or the
|
||||
freshness check is a no-op and the OOM rebuild always runs.
|
||||
"""
|
||||
@@ -26,8 +26,8 @@ def _touch(path: Path, offset: float = 0.0) -> None:
|
||||
|
||||
def _make_web_dir(tmp_path: Path) -> tuple[Path, Path]:
|
||||
"""Return (web_dir, dist_dir) matching real repo layout."""
|
||||
web_dir = tmp_path / "web"
|
||||
web_dir.mkdir()
|
||||
web_dir = tmp_path / "apps" / "dashboard"
|
||||
web_dir.mkdir(parents=True)
|
||||
(web_dir / "package.json").touch()
|
||||
dist_dir = tmp_path / "hermes_cli" / "web_dist"
|
||||
return web_dir, dist_dir
|
||||
@@ -58,10 +58,10 @@ class TestWebUIBuildNeeded:
|
||||
assert _web_ui_build_needed(web_dir) is False
|
||||
|
||||
def test_web_dist_dir_not_web_dist_subdir(self, tmp_path):
|
||||
"""Regression: sentinel must be in hermes_cli/web_dist/, NOT web/dist/."""
|
||||
"""Regression: sentinel must be in hermes_cli/web_dist/, NOT apps/dashboard/dist/."""
|
||||
web_dir, dist_dir = _make_web_dir(tmp_path)
|
||||
_touch(web_dir / "src" / "App.tsx", offset=-10)
|
||||
# Place manifest in wrong location (web/dist/) — should NOT count as fresh
|
||||
# Place manifest in wrong location (apps/dashboard/dist/) — should NOT count as fresh
|
||||
wrong_dist = web_dir / "dist" / ".vite" / "manifest.json"
|
||||
_touch(wrong_dist)
|
||||
# Correct location is empty → still needs build
|
||||
@@ -89,7 +89,7 @@ class TestWebUIBuildNeeded:
|
||||
|
||||
def test_ignores_dist_subdir_under_web(self, tmp_path):
|
||||
web_dir, dist_dir = _make_web_dir(tmp_path)
|
||||
# package.json older than manifest; only web/dist file is newer
|
||||
# package.json older than manifest; only apps/dashboard/dist file is newer
|
||||
_touch(web_dir / "package.json", offset=-20)
|
||||
_touch(dist_dir / ".vite" / "manifest.json", offset=-10)
|
||||
_touch(web_dir / "dist" / "assets" / "index.js")
|
||||
|
||||
Reference in New Issue
Block a user