mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
The Head of Marketing now markets features, not just releases: a default-off x_feature_spotlight loop periodically spawns the HoM to investigate what shipped (CHANGELOG, feature flags, docs/map, KB) and draft ONE held marketing post via propose_feature_spotlight, reviewed in the X post queue. - New x_feature source (distinct from x_post, fixing panel mislabeling) + a panel Feature-spotlight branch. - brand_voice column on company_goals (migration 061, single head) as the CEO-editable voice source, surfaced in Settings and injected into the HoM briefing; a VOICE GUIDE baseline in head-marketing.md. - propose_feature_spotlight verb (HoM-only), mirroring propose_roadmap. Gated by x_feature_spotlight_enabled (default off; flag-off dormancy proven). Also fixed two real bugs found mid-build: company_goals API schemas dropped brand_voice on GET/PUT; the live charter UI is goals-tab.tsx, not the unmounted company-goals-card.tsx. Full suite green (2935); migration single-head verified.
65 lines
2.3 KiB
Python
65 lines
2.3 KiB
Python
"""Company-goals API route tests: GET open to any agent, PUT CEO-only."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from http import HTTPStatus
|
|
from typing import Any
|
|
from unittest.mock import MagicMock
|
|
from uuid import uuid4
|
|
|
|
import pytest
|
|
from fastapi import HTTPException
|
|
from roboco.api.routes.company_goals import get_company_goals, update_company_goals
|
|
from roboco.api.schemas.company_goals import CompanyGoalsUpdate
|
|
from roboco.models import AgentRole
|
|
from roboco.models.permissions import AgentContext
|
|
|
|
|
|
def _agent(role: AgentRole) -> AgentContext:
|
|
return AgentContext(agent_id=uuid4(), role=role, team=None)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_returns_charter_to_any_agent(db_session: Any) -> None:
|
|
resp = await get_company_goals(db_session, _agent(AgentRole.DEVELOPER))
|
|
assert resp.north_star == ""
|
|
assert resp.objectives == []
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_ceo_can_update_and_persist(db_session: Any) -> None:
|
|
ceo = _agent(AgentRole.CEO)
|
|
resp = await update_company_goals(
|
|
CompanyGoalsUpdate(north_star="Win the market"), db_session, ceo
|
|
)
|
|
assert resp.north_star == "Win the market"
|
|
assert resp.updated_by == str(ceo.agent_id)
|
|
# Persisted and readable by a non-CEO agent.
|
|
again = await get_company_goals(db_session, _agent(AgentRole.QA))
|
|
assert again.north_star == "Win the market"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_ceo_can_update_and_persist_brand_voice(db_session: Any) -> None:
|
|
ceo = _agent(AgentRole.CEO)
|
|
resp = await update_company_goals(
|
|
CompanyGoalsUpdate(brand_voice="Confident, dry wit."), db_session, ceo
|
|
)
|
|
assert resp.brand_voice == "Confident, dry wit."
|
|
# Persisted and readable by a non-CEO agent (round-trips through the
|
|
# Pydantic response schema, not just the service-layer dict).
|
|
again = await get_company_goals(db_session, _agent(AgentRole.QA))
|
|
assert again.brand_voice == "Confident, dry wit."
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_non_ceo_cannot_update() -> None:
|
|
# The CEO check fires before any DB access, so a dummy session suffices.
|
|
with pytest.raises(HTTPException) as exc:
|
|
await update_company_goals(
|
|
CompanyGoalsUpdate(north_star="nope"),
|
|
MagicMock(),
|
|
_agent(AgentRole.DEVELOPER),
|
|
)
|
|
assert exc.value.status_code == HTTPStatus.FORBIDDEN
|