test_walk_policy_real_knobs.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. """M8E:walk_policy 真开关——max_depth / 总闸 解包为纯 int 且生效,max_reseed_rounds 已删。"""
  2. from content_agent.integrations.walk_graph_json import WalkGraphStore
  3. def _policy():
  4. return WalkGraphStore().load_policy()
  5. def test_global_knobs_unwrap_to_plain_int():
  6. glob = _policy()["global"]
  7. assert glob["max_depth"] == 5
  8. assert isinstance(glob["max_depth"], int)
  9. assert glob["max_total_actions_per_run"] == 30
  10. assert isinstance(glob["max_total_actions_per_run"], int)
  11. def test_max_reseed_rounds_removed_and_loader_ok():
  12. # 删除 max_reseed_rounds 后 loader 不应报错,且 global 不再含该键。
  13. glob = _policy()["global"]
  14. assert "max_reseed_rounds" not in glob
  15. def test_edge_budgets_are_m8_values():
  16. budgets = _policy()["edge_budgets_by_id"]
  17. assert budgets["hashtag_to_query"]["max_total_actions"] == 20
  18. assert budgets["author_to_works"]["max_total_actions"] == 20
  19. assert budgets["author_to_works"]["max_works_per_author"] == 5
  20. def test_frontier_reads_global_knobs():
  21. # 真生效:run_bounded_walk 的 frontier 直接读 policy["global"];这里钉死 loader 暴露的契约,
  22. # 深游走真跑的 depth/总闸生效由 test_walk_engine_deep_frontier 覆盖。
  23. glob = _policy()["global"]
  24. assert glob["max_depth"] >= 1
  25. assert glob["max_total_actions_per_run"] >= glob["max_depth"]