Tail-end of Phase 2:
- Migrate ~70 remaining test sites off AppConfig.current(): drop
dead monkey-patches (production no longer calls current), hoist the
mocked config into a local variable and pass it explicitly. Verified
with `grep -rn 'AppConfig\.current' backend/tests` → empty.
- Delete the AppConfig.current() classmethod entirely. The transitional
raise-only shim is no longer needed now that no test references it.
- Update docs: plan marked shipped (P2-6..P2-10 in commit 84dccef2);
backend/CLAUDE.md Config Lifecycle rewritten to describe the
explicit-parameter design; gateway/deps.py docstrings no longer point
at the removed current() surface.
AppConfig is now a pure Pydantic value object. Every consumer holds its
own captured instance — Gateway (app.state.config via Depends(get_config)),
DeerFlowClient (self._app_config), agent runtime (DeerFlowContext.app_config),
LangGraph Server bootstrap (AppConfig.from_file() inside make_lead_agent).
2337 non-e2e tests pass.
Phase 1 (PR #2271) shipped a 3-tier AppConfig.current() lifecycle. Phase 2
proposes eliminating that surface entirely: delete _global, _override, init,
current, set_override, reset_override. AppConfig reduces to a pure Pydantic
value object; every consumer receives config as an explicit parameter.
Design doc §8 documents the target architecture: FastAPI Depends(get_config)
for routers, constructor-captured config for DeerFlowClient, thread through
make_lead_agent for agent construction, closure-captured config for memory
Timer callbacks. Covers trade-offs and scope (~97 prod + ~91 test sites).
Plan doc adds Tasks P2-1 through P2-10, one per category, each independently
mergeable. P2-10 is the final deletion after grep verifies zero callers.
Bring the design and plan docs in line with what actually shipped in #2271.
The original plan specified a simple "single ContextVar + ConfigNotInitializedError"
lifecycle in a new context.py module; the shipped lifecycle is a 3-tier fallback
(process-global + ContextVar override + auto-load warning) attached to AppConfig
itself, because ContextVar alone could not propagate config updates across
Gateway async request boundaries.
Design doc: replace the lifecycle section with the shipped 3-tier model,
document DeerFlowContext + resolve_context() in deer_flow_context.py, add an
access-pattern matrix (typed middleware vs dict-legacy vs non-agent), and a
post-mortem section explaining the three material divergences from the plan
with commit references (7a11e925, 4df595b0, a934a822).
Plan doc: collapse the historical TDD step-by-step into a task log with
checkboxes marked complete, add a top-of-file post-mortem table, and update
the file-structure tables to match shipped call-site migrations. All 16 tasks
retained; commit SHAs added for the divergent ones.