Harden framework: tests, VRAM Python, dashboard spec, security, CI
- Rewrite vram_detect in Python with fixed config parsing and 10KB read limit
- Add pytest suite (72 tests) covering dashboard core, app security, and VRAM
- Standardize all prompts to .automaton/tasks/{task-name}/ path
- Reconcile dashboard spec with web implementation; remove themes.py
- Remove half-implemented refresh.py file watcher
- Harden dashboard static-file serving and task-name validation
- Add uncommitted-change guard to update.sh and real Gitea URLs
- Add AGENTS.md, Gitea CI workflow, and template documentation
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
"""Tests for automaton.dashboard.core.board."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from automaton.dashboard.core.board import KanbanBoard
|
||||
from automaton.dashboard.core.task import determine_task_state
|
||||
|
||||
|
||||
def _task(name: str, tmp_path: Path, artifacts: dict[str, str]) -> object:
|
||||
from automaton.dashboard.core.task import Task
|
||||
|
||||
task_dir = tmp_path / name
|
||||
task_dir.mkdir(parents=True)
|
||||
for filename, content in artifacts.items():
|
||||
(task_dir / filename).write_text(content)
|
||||
state, artifact_map = determine_task_state(task_dir)
|
||||
return Task(name=name, folder_path=task_dir, state=state, artifacts=artifact_map)
|
||||
|
||||
|
||||
def test_board_columns(tmp_path: Path) -> None:
|
||||
tasks = [
|
||||
_task("research", tmp_path, {"SPEC.md": "# Spec"}),
|
||||
_task("done", tmp_path, {"VERDICT.md": "## Status: PASS"}),
|
||||
]
|
||||
board = KanbanBoard(tasks)
|
||||
assert board.columns[tasks[0].state] == [tasks[0]]
|
||||
assert board.columns[tasks[1].state] == [tasks[1]]
|
||||
|
||||
|
||||
def test_board_filter_by_phase(tmp_path: Path) -> None:
|
||||
research = _task("research", tmp_path, {"SPEC.md": "# Spec"})
|
||||
done = _task("done", tmp_path, {"VERDICT.md": "## Status: PASS"})
|
||||
board = KanbanBoard([research, done])
|
||||
filtered = board.filter_columns(phase_filter=research.state)
|
||||
assert research in filtered[research.state]
|
||||
assert done not in filtered[research.state]
|
||||
|
||||
|
||||
def test_board_search(tmp_path: Path) -> None:
|
||||
apple = _task("apple-task", tmp_path, {"SPEC.md": "# Spec"})
|
||||
banana = _task("banana-task", tmp_path, {"SPEC.md": "# Spec"})
|
||||
board = KanbanBoard([apple, banana])
|
||||
filtered = board.filter_columns(search_query="apple")
|
||||
assert apple in filtered[apple.state]
|
||||
assert banana not in filtered[banana.state]
|
||||
|
||||
|
||||
def test_board_wip_count(tmp_path: Path) -> None:
|
||||
research = _task("research", tmp_path, {"SPEC.md": "# Spec"})
|
||||
done = _task("done", tmp_path, {"VERDICT.md": "## Status: PASS"})
|
||||
board = KanbanBoard([research, done])
|
||||
assert board.get_wip_count() == 1
|
||||
Reference in New Issue
Block a user