moo.agent.tests.test_brain_plans

Tests for moo/agent/brain_plans.py — plan persistence helpers.

All four functions are pure in the sense that their only side effects are (a) mutating the passed BrainState, (b) writing files under config_dir, and (c) calling on_thought with error/notice messages. The tests drive them with tmp_path fixtures and a list-capturing on_thought stub.

Functions

test_clear_dispatch_state_missing_file_noops(...)

test_clear_dispatch_state_removes_file(tmp_path)

test_load_dispatch_state_discards_stale_file(...)

A dispatch.json from yesterday is ignored — the chain is long dead.

test_load_dispatch_state_no_file_noops(tmp_path)

test_load_dispatch_state_restores_target(...)

Foreman restart: dispatch.json from a few seconds ago restores who held the token.

test_load_latest_build_plan_empty_builds_dir_noops(...)

test_load_latest_build_plan_no_builds_dir_noops(...)

test_load_latest_build_plan_picks_latest_by_name(...)

test_load_latest_build_plan_sets_plan_from_disk(...)

test_load_traversal_plan_empty_file_noops(...)

test_load_traversal_plan_missing_file_noops(...)

test_load_traversal_plan_no_config_dir_noops()

test_load_traversal_plan_restores_plan(tmp_path)

test_save_build_plan_duplicate_ignored(tmp_path)

test_save_build_plan_no_config_dir_noops()

test_save_build_plan_oserror_logs_thought(...)

test_save_build_plan_overrides_id_only_plan(...)

A plan of bare room IDs (from a token page) is overridable.

test_save_build_plan_overrides_plan_from_disk(...)

A plan loaded from disk is overridable by a fresh BUILD_PLAN:.

test_save_build_plan_sets_memory_summary(...)

test_save_build_plan_writes_yaml_and_extracts_rooms(...)

test_save_dispatch_state_noops_when_no_target(...)

test_save_dispatch_state_writes_file(tmp_path)

test_save_traversal_plan_no_config_dir_noops()

test_save_traversal_plan_oserror_logs_thought(...)

test_save_traversal_plan_writes_file(tmp_path)