Files
roboco/tests/unit/runtime/test_feature_spotlight_loop_dormant.py
T
Renn F da17c49f2d feat(marketing): HoM feature-spotlight X drafts + brand-voice charter (v0.18.0 B)
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.
2026-07-04 07:34:40 +02:00

61 lines
2.3 KiB
Python

"""The feature-spotlight orchestrator loop is fully dormant unless BOTH the X
engine and the feature-spotlight sub-switch are enabled (both default off).
With either flag off, ``_x_feature_spotlight_loop`` must return immediately —
no sleep, no HTTP, no DB, no Head-of-Marketing spawn — so a standard
deployment (or one running only release posts / mention replies) behaves
exactly as today.
"""
from __future__ import annotations
import asyncio
import types
from typing import cast
import pytest
from roboco.config import settings as cfg
from roboco.runtime.orchestrator import AgentOrchestrator
@pytest.mark.asyncio
async def test_x_feature_spotlight_loop_returns_immediately_when_disabled(
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setattr(cfg, "x_engine_enabled", False)
monkeypatch.setattr(cfg, "x_feature_spotlight_enabled", False)
stub = cast("AgentOrchestrator", types.SimpleNamespace(_running=True))
# Gated off -> returns at once. If the gate were missing it would sleep the
# full interval and this wait_for would time out.
await asyncio.wait_for(
AgentOrchestrator._x_feature_spotlight_loop(stub), timeout=1.0
)
@pytest.mark.asyncio
async def test_x_feature_spotlight_loop_dormant_when_only_subswitch_disabled(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""x_engine_enabled on but the feature-spotlight sub-switch off: still
dormant — the engine still runs release posts/mention replies via their
own loops, unaffected."""
monkeypatch.setattr(cfg, "x_engine_enabled", True)
monkeypatch.setattr(cfg, "x_feature_spotlight_enabled", False)
stub = cast("AgentOrchestrator", types.SimpleNamespace(_running=True))
await asyncio.wait_for(
AgentOrchestrator._x_feature_spotlight_loop(stub), timeout=1.0
)
@pytest.mark.asyncio
async def test_x_feature_spotlight_loop_dormant_when_only_engine_disabled(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""The subswitch alone is not enough — x_engine_enabled must also be on."""
monkeypatch.setattr(cfg, "x_engine_enabled", False)
monkeypatch.setattr(cfg, "x_feature_spotlight_enabled", True)
stub = cast("AgentOrchestrator", types.SimpleNamespace(_running=True))
await asyncio.wait_for(
AgentOrchestrator._x_feature_spotlight_loop(stub), timeout=1.0
)