Files
ThothII/harness/tests/test_decision_min_phase.py

38 lines
1.2 KiB
Python

"""decision_min_phase must cover every substantive decision type (data-driven via emits).
The reference bug: only the ~5 types referenced in prerequisites had a min phase; all
others (table_promoted, cte_approved, value_grounded, concept_formula_*, ...) defaulted
to phase 1, so require_phase_or_exit would accept them far too early. workflow.yaml now
declares `emits` per phase as the source of truth.
"""
import pytest
from tht.workflow import load_workflow
@pytest.mark.parametrize(
"dtype,expected",
[
("concept_clarified", 1),
("memory_rejected", 2),
("question_rewritten", 3),
("table_promoted", 4),
("column_corrected", 4),
("evidence_accepted", 4),
("value_grounded", 4),
("concept_formula_approved", 4),
("concept_formula_rejected", 4),
("cte_approved", 6),
("sql_approved", 7),
("sql_revised", 7),
("datamart_requested", 8),
],
)
def test_decision_min_phase_from_emits(dtype, expected):
assert load_workflow().decision_min_phase(dtype) == expected
@pytest.mark.parametrize("meta", ["phase_approved", "phase_reopened", "decision_retracted"])
def test_meta_types_not_phase_gated(meta):
assert load_workflow().decision_min_phase(meta) == 1