115 lines
2.8 KiB
Python
115 lines
2.8 KiB
Python
"""Pure approach selection tests (REIN-A-0002-T02)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from rein_aharness.approaches import (
|
|
APPROACH_AGENT_SESSION,
|
|
APPROACH_BRIEF_DAILY,
|
|
APPROACH_BRIEF_WEEKLY,
|
|
APPROACH_FI_RESEARCH_BRIEF,
|
|
APPROACH_MAIL_PIPELINE,
|
|
APPROACH_UNMATCHED,
|
|
select_approach,
|
|
)
|
|
from rein_aharness.ops_run_client import OpsRun
|
|
|
|
|
|
def _run(**kwargs) -> OpsRun:
|
|
base = dict(
|
|
id="r",
|
|
activity_definition_id="",
|
|
idempotency_key="k",
|
|
target_repo="x",
|
|
title="",
|
|
description="",
|
|
labels=[],
|
|
)
|
|
base.update(kwargs)
|
|
return OpsRun(**base)
|
|
|
|
|
|
def test_select_fi_by_label() -> None:
|
|
assert (
|
|
select_approach(
|
|
_run(labels=["automated", "research-brief", "freedom-intelligence"])
|
|
)
|
|
== APPROACH_FI_RESEARCH_BRIEF
|
|
)
|
|
|
|
|
|
def test_select_fi_by_blob() -> None:
|
|
assert (
|
|
select_approach(
|
|
_run(
|
|
labels=["automated"],
|
|
activity_definition_id="fi-daily-research-brief",
|
|
title="FI daily research brief",
|
|
)
|
|
)
|
|
== APPROACH_FI_RESEARCH_BRIEF
|
|
)
|
|
|
|
|
|
def test_select_binky_rhythm() -> None:
|
|
assert (
|
|
select_approach(_run(labels=["binky", "rhythm", "automated"]))
|
|
== APPROACH_BRIEF_DAILY
|
|
)
|
|
|
|
|
|
def test_select_binky_weekly_review_requires_binky_and_weekly_label() -> None:
|
|
assert (
|
|
select_approach(
|
|
_run(labels=["binky", "weekly-review", "automated"])
|
|
)
|
|
== APPROACH_BRIEF_WEEKLY
|
|
)
|
|
|
|
|
|
def test_select_binky_weekly_review_by_definition() -> None:
|
|
assert (
|
|
select_approach(
|
|
_run(activity_definition_id="binky-weekly-review-prep")
|
|
)
|
|
== APPROACH_BRIEF_WEEKLY
|
|
)
|
|
|
|
|
|
def test_weekly_review_label_alone_is_unmatched() -> None:
|
|
assert select_approach(_run(labels=["weekly-review"])) == APPROACH_UNMATCHED
|
|
|
|
|
|
def test_select_mail_intake() -> None:
|
|
assert (
|
|
select_approach(_run(labels=["mail-intake", "automated"]))
|
|
== APPROACH_MAIL_PIPELINE
|
|
)
|
|
|
|
|
|
def test_select_agent_session() -> None:
|
|
assert (
|
|
select_approach(_run(labels=["agent-session", "automated"]))
|
|
== APPROACH_AGENT_SESSION
|
|
)
|
|
|
|
|
|
def test_select_hint_overrides() -> None:
|
|
assert (
|
|
select_approach(
|
|
_run(labels=["automated"], approach_hint="fi-research-brief")
|
|
)
|
|
== APPROACH_FI_RESEARCH_BRIEF
|
|
)
|
|
|
|
|
|
def test_unmatched() -> None:
|
|
assert select_approach(_run(labels=["automated"], title="misc hygiene")) == (
|
|
APPROACH_UNMATCHED
|
|
)
|
|
|
|
|
|
def test_fi_before_generic_automated() -> None:
|
|
"""research-brief must not fall through to unmatched when only automated."""
|
|
assert (
|
|
select_approach(_run(labels=["research-brief"])) == APPROACH_FI_RESEARCH_BRIEF
|
|
)
|