feat: expand module workflows, dynamic config, notifications and console API

This commit is contained in:
2026-09-04 09:49:37 +08:00
parent 8df5266abb
commit b124d757b0
309 changed files with 89358 additions and 6232 deletions
+33 -2
View File
@@ -5,6 +5,7 @@ from pathlib import Path
from gyxx_flow.adapters.native import DeferredModuleCommandStep
from gyxx_flow.catalog import WorkflowCatalog
from gyxx_flow.modules.content_marketing import (
CONTENT_COMMENT_TIMEOUT_SECONDS,
CONTENT_RESOURCE,
CONTENT_SCHEDULED_WORKFLOW_IDS,
CONTENT_TIMEOUT_SECONDS,
@@ -22,7 +23,7 @@ def test_content_module_registers_only_scheduled_entries() -> None:
definitions = module.workflow_definitions()
assert tuple(item.workflow_id for item in definitions) == CONTENT_WORKFLOW_IDS
assert len(CONTENT_SCHEDULED_WORKFLOW_IDS) == 8
assert len(CONTENT_SCHEDULED_WORKFLOW_IDS) == 9
def test_content_workflows_use_project_owned_module_commands() -> None:
@@ -34,12 +35,42 @@ def test_content_workflows_use_project_owned_module_commands() -> None:
assert definition.steps
for step in definition.steps:
assert isinstance(step.action, DeferredModuleCommandStep)
assert step.timeout_seconds == CONTENT_TIMEOUT_SECONDS == 4 * 60 * 60
expected_timeout = (
CONTENT_COMMENT_TIMEOUT_SECONDS
if definition.workflow_id == "content.comments.weekly"
else CONTENT_TIMEOUT_SECONDS
)
assert step.timeout_seconds == expected_timeout
assert CONTENT_TIMEOUT_SECONDS == 4 * 60 * 60
assert CONTENT_COMMENT_TIMEOUT_SECONDS == 6 * 60 * 60
assert step.max_attempts == 1
if definition.workflow_id == "content.comments.weekly":
assert step.resources == (f"{CONTENT_RESOURCE}:{step.step_id}",)
elif definition.workflow_id == "content.metrics.daily":
assert step.resources == (
f"{CONTENT_RESOURCE}:content.metrics.daily:{step.step_id}",
)
else:
assert step.resources == (CONTENT_RESOURCE,) == (
"module:content_marketing",
)
assert step.production_sink is True
def test_daily_content_steps_have_independent_resources() -> None:
module = ContentMarketingModule.from_catalog(
WorkflowCatalog.load(PROJECT_ROOT / "config")
)
daily = next(
item for item in module.workflow_definitions()
if item.workflow_id == "content.metrics.daily"
)
assert {step.step_id for step in daily.steps} == {
"collect_collaborators",
"refresh_self_mapping",
"collect_self_bilibili",
"collect_self_douyin",
"sync",
}
assert len({step.resources for step in daily.steps}) == len(daily.steps)