Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Ruff lint (F/E9/B/C4)
run: uvx ruff check backend/app backend/scripts deerflow_bridge
- name: Ruff lint (F/E9)
run: uvx ruff check --select F,E9 --ignore F401,F841,F541 backend/app backend/scripts deerflow_bridge
- name: .env.example <-> Config drift
run: python3 backend/scripts/check_env_drift.py --strict

Expand Down
7 changes: 5 additions & 2 deletions backend/tests/test_actor_context_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,11 @@ def test_sparse_legacy_dossier_gets_a_safe_pack_without_fake_report_coverage():
assert "Sparse Legacy Actor" in pack["bounded_context"]


def test_role_context_reaches_real_reddit_and_twitter_oasis_system_messages(tmp_path):
from oasis import generate_reddit_agent_graph, generate_twitter_agent_graph
def test_role_context_reaches_real_reddit_and_twitter_oasis_system_messages(tmp_path, monkeypatch):
monkeypatch.setenv("OPENAI_API_KEY", "test-key")
oasis = pytest.importorskip("oasis")
generate_reddit_agent_graph = oasis.generate_reddit_agent_graph
generate_twitter_agent_graph = oasis.generate_twitter_agent_graph

dossier = _dossier()
actor = dossier["actors"][0]
Expand Down
24 changes: 24 additions & 0 deletions backend/tests/test_deerflow_bridge_sync_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,18 @@ async def _aexecute(self, task: str, result_holder: SubagentResult | None = None
) == once


@pytest.mark.skipif(
not (
Path(__file__).resolve().parents[2]
/ "deer-flow-2.0.0"
/ "backend"
/ "packages"
/ "harness"
/ "deerflow"
/ "client.py"
).is_file(),
reason="vendored deer-flow harness snapshot is not present in this checkout",
)
def test_subagent_overlay_preserves_current_vendor_observability(tmp_path):
repo_root = Path(__file__).resolve().parents[2]
vendor_root = repo_root / "deer-flow-2.0.0"
Expand Down Expand Up @@ -588,6 +600,18 @@ def test_subagent_overlay_preserves_current_vendor_observability(tmp_path):
assert preserved in executor_source


@pytest.mark.skipif(
not (
Path(__file__).resolve().parents[2]
/ "deer-flow-2.0.0"
/ "backend"
/ "packages"
/ "harness"
/ "deerflow"
/ "client.py"
).is_file(),
reason="vendored deer-flow harness snapshot is not present in this checkout",
)
def test_subagent_overlay_fails_closed_on_model_inheritance_drift(tmp_path):
repo_root = Path(__file__).resolve().parents[2]
vendor_harness = (
Expand Down
10 changes: 7 additions & 3 deletions backend/tests/test_drf2_skills_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
"prediction-markets",
}

def _resolve_skills_path(path_value: str | Path) -> Path:
path = Path(path_value)
return path.resolve() if path.is_absolute() else (REPO_ROOT / path).resolve()

# 引擎 MCP 工具名(与 drf2/engines/*/server.py 实际注册的名字一致;技能 allowed-tools /
# 子代理 tools 白名单都据此校验。TestEngineToolNameDrift 再把这两个集合与引擎源码
# 提取出的真名对表 —— 引擎改名会先让测试红,再同步技能与配置)。
Expand Down Expand Up @@ -366,8 +370,8 @@ def test_prediction_market_tool_registered(self, cfg):
"drf2.config.market_tools:prediction_market_search_tool")

def test_skills_path_points_at_drf2_skills(self, cfg):
path = Path(cfg["skills"]["path"])
assert path == SKILLS_ROOT, f"skills.path {path} != {SKILLS_ROOT}"
path = _resolve_skills_path(cfg["skills"]["path"])
assert path == SKILLS_ROOT.resolve(), f"skills.path {path} != {SKILLS_ROOT.resolve()}"
# loader 扫 {public,custom} —— custom 必须存在且非空
assert (path / "custom").is_dir() and any((path / "custom").iterdir())

Expand All @@ -387,7 +391,7 @@ def test_config_yaml_loads_via_real_appconfig(self, deerflow_config_modules):
assert cfg.subagents.custom_agents["researcher"].timeout_seconds == 2700
assert cfg.subagents.custom_agents["sim-configurer"].timeout_seconds == 900
assert cfg.tool_search.enabled is True
assert Path(cfg.skills.path) == SKILLS_ROOT
assert _resolve_skills_path(cfg.skills.path) == SKILLS_ROOT.resolve()

def test_extensions_json_loads_via_real_schema(self, deerflow_config_modules):
_, extensions_config = deerflow_config_modules
Expand Down
10 changes: 5 additions & 5 deletions backend/tests/test_report_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ def test_prepare_forecast_revision_series_does_not_treat_target_year_as_vintage(

COMPARISON = {
"dimensions": [
{"name": "总动作量", "baseline": 100, "scenario": 120, "delta": "+20", "verdict": "更高"},
{"name": "执行轮数", "baseline": 5, "scenario": 6, "delta": "+1", "verdict": "更长"},
{"name": "峰值轮次", "baseline": "round 3 (12)", "scenario": "round 2 (18)",
"delta": "-1 轮", "verdict": "更早"}, # 数值可从字符串抽取
{"name": "Total actions", "baseline": 100, "scenario": 120, "delta": "+20", "verdict": "higher"},
{"name": "Execution rounds", "baseline": 5, "scenario": 6, "delta": "+1", "verdict": "longer"},
{"name": "Peak round", "baseline": "round 3 (12)", "scenario": "round 2 (18)",
"delta": "-1 round", "verdict": "earlier"}, # 数值可从字符串抽取
],
}

Expand Down Expand Up @@ -603,7 +603,7 @@ def test_comparison_numeric_extraction(tmp_path):
viz = ReportVisualizer()
charts = str(tmp_path / "charts")
# 只含字符串数值的维度也可解析
comp = {"dimensions": [{"name": "峰值", "baseline": "round 3 (12)", "scenario": "round 2 (18)"}]}
comp = {"dimensions": [{"name": "Peak", "baseline": "round 3 (12)", "scenario": "round 2 (18)"}]}
rel = viz.build_comparison_bars(comp, charts)
assert rel is not None and os.path.exists(str(tmp_path / rel))

Expand Down
2 changes: 1 addition & 1 deletion drf2/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ subagents:
# ============================================================================

skills:
path: /Users/rogerlin/Downloads/DeepResearchForecast/drf2/skills
path: drf2/skills
container_path: /mnt/skills

title:
Expand Down
Loading