greatmengqi f8738d1e3e refactor(config): DeerFlowClient captures config in constructor
Phase 2 Task P2-3 (Category H): the client now owns its AppConfig for its
lifetime via self._app_config, instead of routing through the process-global
AppConfig.current() / AppConfig.init() path.

Constructor resolution priority:
1. Explicit config= parameter (new; enables multi-client isolation)
2. Explicit config_path= parameter (reads file directly, no process-global write)
3. AppConfig.current() (legacy fallback; removed in P2-10)

All 7 method-level AppConfig.current() reads are replaced with self._app_config.
_reload_config() no longer mutates the process-global — only the client's own
config is rebuilt, so concurrent clients' configs remain isolated.

New test: test_client_multi_isolation.py pins the key invariant — two clients
with different configs coexist without contention. Before this refactor the
second client's init() would clobber the first.

Test updates: ~8 test_client.py sites that formerly relied on
patch.object(AppConfig, "current", ...) now set client._app_config directly
to the mock. test_custom_config_path no longer asserts AppConfig.init() was
called because the client no longer touches it.

All 141 test_client.py + 46 test_client_e2e.py/multi_isolation tests pass.
2026-04-16 23:57:11 +08:00
..