6 Commits

Author SHA1 Message Date
greatmengqi
6beea682d2 refactor(config): Phase 2 final cleanup — delete AppConfig.current() shim
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.
2026-04-17 11:42:27 +08:00
greatmengqi
6f5226a538 docs(config-refactor): mark P2-1..P2-5 as shipped with commits 2026-04-17 00:28:05 +08:00
greatmengqi
edbff21f8a docs(config-refactor): add Phase 2 — pure explicit parameter passing
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.
2026-04-16 22:15:05 +08:00
greatmengqi
7656d6399d docs(config-refactor): rewrite design and plan to reflect shipped architecture
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.
2026-04-16 14:20:17 +08:00
greatmengqi
9040e49e4a refactor(config): eliminate global mutable state, wire DeerFlowContext into runtime 2026-04-15 21:28:15 +08:00
totoyang
2d1f90d5dc
feat(tracing): add optional Langfuse support (#1717)
* feat(tracing): add optional Langfuse support

* Fix tracing fail-fast behavior for explicitly enabled providers

* fix(lint)
2026-04-02 13:06:10 +08:00