feat: consolidate legacy workflows into gyxx-flow

This commit is contained in:
2026-07-28 14:51:15 +08:00
commit c23b62a8c8
374 changed files with 132990 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
from __future__ import annotations
from pathlib import Path
import pytest
from gyxx_flow.ops.effects import (
EffectAlreadyApplied,
EffectLedger,
EffectStateAmbiguous,
)
def test_effect_ledger_blocks_applied_and_ambiguous_replays(tmp_path: Path) -> None:
ledger = EffectLedger(tmp_path)
first = ledger.begin(
workflow_id="product.daily",
business_date="2026-07-27",
step_id="legacy_execute",
run_id="run-001",
)
ledger.mark_applied(first)
with pytest.raises(EffectAlreadyApplied):
ledger.begin(
workflow_id="product.daily",
business_date="2026-07-27",
step_id="legacy_execute",
run_id="run-002",
)
ambiguous = ledger.begin(
workflow_id="product.daily",
business_date="2026-07-28",
step_id="legacy_execute",
run_id="run-003",
)
ledger.mark_ambiguous(ambiguous, reason="nonzero-exit")
with pytest.raises(EffectStateAmbiguous):
ledger.begin(
workflow_id="product.daily",
business_date="2026-07-28",
step_id="legacy_execute",
run_id="run-004",
)
def test_effect_ledger_leaves_in_progress_claim_ambiguous_after_crash(
tmp_path: Path,
) -> None:
ledger = EffectLedger(tmp_path)
ledger.begin(
workflow_id="shop.metrics.weekly",
business_date="2026-07-27",
step_id="legacy_collect",
run_id="run-001",
)
with pytest.raises(EffectStateAmbiguous):
ledger.begin(
workflow_id="shop.metrics.weekly",
business_date="2026-07-27",
step_id="legacy_collect",
run_id="run-002",
)