refactor(constants): initialize LEAD_TEMPLATE_MAP as an empty dictionary

refactor(page): clean up import statements for better readability
fix(tests): update assertions for clarity and consistency
This commit is contained in:
Abhimanyu Saharan
2026-02-15 00:53:27 +05:30
parent 2084405593
commit a55664810c
5 changed files with 17 additions and 14 deletions

View File

@@ -110,8 +110,7 @@ BOARD_SHARED_TEMPLATE_MAP = {
"TOOLS.md": "BOARD_TOOLS.md.j2",
}
LEAD_TEMPLATE_MAP = {
}
LEAD_TEMPLATE_MAP: dict[str, str] = {}
_TOOLS_KV_RE = re.compile(r"^(?P<key>[A-Z0-9_]+)=(?P<value>.*)$")
_NON_TRANSIENT_GATEWAY_ERROR_MARKERS = ("unsupported file",)

View File

@@ -10,9 +10,9 @@ import pytest
import app.services.openclaw.internal.agent_key as agent_key_mod
import app.services.openclaw.provisioning as agent_provisioning
from app.services.souls_directory import SoulRef
from app.services.openclaw.provisioning_db import AgentLifecycleService
from app.services.openclaw.shared import GatewayAgentIdentity
from app.services.souls_directory import SoulRef
def test_slugify_normalizes_and_trims():
@@ -67,7 +67,7 @@ def test_templates_root_points_to_repo_templates_dir():
root = agent_provisioning._templates_root()
assert root.name == "templates"
assert root.parent.name == "backend"
assert (root / "AGENTS.md").exists()
assert (root / "BOARD_AGENTS.md.j2").exists()
@dataclass
@@ -372,7 +372,9 @@ def test_select_role_soul_ref_prefers_exact_slug() -> None:
@pytest.mark.asyncio
async def test_resolve_role_soul_markdown_returns_best_effort(monkeypatch: pytest.MonkeyPatch) -> None:
async def test_resolve_role_soul_markdown_returns_best_effort(
monkeypatch: pytest.MonkeyPatch,
) -> None:
refs = [SoulRef(handle="team", slug="data-scientist")]
async def _fake_list_refs() -> list[SoulRef]:

View File

@@ -4,8 +4,8 @@ from uuid import uuid4
import pytest
from fastapi import HTTPException
from sqlmodel import col, select, SQLModel
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine
from sqlmodel import SQLModel, col, select
from sqlmodel.ext.asyncio.session import AsyncSession
from app.api import tasks as tasks_api
@@ -165,7 +165,10 @@ async def test_non_lead_agent_forbidden_without_assigned_task() -> None:
assert exc.value.status_code == 403
assert isinstance(exc.value.detail, dict)
assert exc.value.detail["code"] == "task_assignee_required"
assert exc.value.detail["message"] == "Agents can only change status on tasks assigned to them."
assert (
exc.value.detail["message"]
== "Agents can only change status on tasks assigned to them."
)
finally:
await engine.dispose()
@@ -247,7 +250,10 @@ async def test_non_lead_agent_forbidden_when_task_assigned_to_other_agent() -> N
assert exc.value.status_code == 403
assert isinstance(exc.value.detail, dict)
assert exc.value.detail["code"] == "task_assignee_mismatch"
assert exc.value.detail["message"] == "Agents can only change status on tasks assigned to them."
assert (
exc.value.detail["message"]
== "Agents can only change status on tasks assigned to them."
)
finally:
await engine.dispose()

View File

@@ -11,9 +11,7 @@ TEMPLATES_DIR = Path(__file__).resolve().parents[1] / "templates"
def test_heartbeat_templates_fit_in_injected_context_limit() -> None:
"""Heartbeat templates must stay under gateway injected-context truncation limit."""
targets = (
"BOARD_HEARTBEAT.md.j2",
)
targets = ("BOARD_HEARTBEAT.md.j2",)
for name in targets:
size = (TEMPLATES_DIR / name).stat().st_size
assert (

View File

@@ -31,9 +31,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import {
DEFAULT_IDENTITY_PROFILE,
} from "@/lib/agent-templates";
import { DEFAULT_IDENTITY_PROFILE } from "@/lib/agent-templates";
type IdentityProfile = {
role: string;