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