chore: [workflow] 提交工作区代码

This commit is contained in:
wangyunlong committed 2026-09-30 10:46:15 +08:00
1 parent 2ff588a65d
commit 01f3d7aaf7
131 files changed
+24306 -1320

No files matched your search

+47 -1
View File
@@ -2,9 +2,12 @@ from __future__ import annotations
import io
import json
import os
from datetime import date
from pathlib import Path
from types import SimpleNamespace
import gyxx_flow.cli as cli
from gyxx_flow.catalog import WorkflowCatalog
from gyxx_flow.cli import (
EXIT_CONFIGURATION,
@@ -51,7 +54,7 @@ def test_default_cli_registry_exposes_all_project_scheduled_workflows(
scheduled_ids = {
entry.workflow_id for entry in registry.catalog.scheduled_workflows()
}
assert len(scheduled_ids) == 29
assert len(scheduled_ids) == 35
assert scheduled_ids == {
schedule.workflow_id for schedule in registry.catalog.schedules
}
@@ -271,6 +274,49 @@ def test_backfill_runs_each_business_date_and_aggregates_final_exit_code(
]
def test_jd_after_sales_backfill_executes_one_range_and_restores_end_env(
tmp_path: Path, monkeypatch,
) -> None:
settings = Settings(project_root=tmp_path, data_root=tmp_path / "runtime")
workflow = SimpleNamespace(workflow_id=cli.JD_AFTER_SALES_ISSUES_WORKFLOW_ID)
registry = SimpleNamespace(resolve=lambda _workflow_id: SimpleNamespace(definition=workflow))
seen: list[tuple[date, str | None, bool]] = []
def fake_execute_once(
_workflow,
*,
business_date: date,
shadow: bool,
dry_run: bool,
settings: Settings,
) -> tuple[int, dict[str, object]]:
del shadow, settings
seen.append((business_date, os.environ.get("GYXX_JD_AFTER_SALES_TO"), dry_run))
return EXIT_SUCCESS, {"business_date": business_date.isoformat()}
monkeypatch.delenv("GYXX_JD_AFTER_SALES_TO", raising=False)
monkeypatch.setattr(cli, "_execute_once", fake_execute_once)
arguments = SimpleNamespace(
workflow_id=cli.JD_AFTER_SALES_ISSUES_WORKFLOW_ID,
from_date="2026-06-01",
to_date="2026-09-15",
shadow=False,
execute=True,
rerun_step=None,
resume_from=None,
)
output = io.StringIO()
code = cli._backfill_command(arguments, registry, settings, output)
assert code == EXIT_SUCCESS
assert seen == [(date(2026, 6, 1), "2026-09-15", False)]
assert "GYXX_JD_AFTER_SALES_TO" not in os.environ
payload = json.loads(output.getvalue())
assert payload["execution_mode"] == "single_range"
assert payload["runs"][0]["business_date_end"] == "2026-09-15"
def test_step_rerun_and_resume_select_only_the_requested_execution_slice(
tmp_path: Path,
) -> None: