LightRAG/lightrag/kg
BukeLy fe1576943f fix: Add default workspace support for backward compatibility
Fixes two compatibility issues in workspace isolation:

1. Problem: lightrag_server.py calls initialize_pipeline_status()
   without workspace parameter, causing pipeline to initialize in
   global namespace instead of rag's workspace.

   Solution: Add set_default_workspace() mechanism in shared_storage.
   LightRAG.initialize_storages() now sets default workspace, which
   initialize_pipeline_status() uses when called without parameters.

2. Problem: /health endpoint hardcoded to use "pipeline_status",
   cannot return workspace-specific status or support frontend
   workspace selection.

   Solution: Add LIGHTRAG-WORKSPACE header support. Endpoint now
   extracts workspace from header or falls back to server default,
   returning correct workspace-specific pipeline status.

Changes:
- lightrag/kg/shared_storage.py: Add set/get_default_workspace()
- lightrag/lightrag.py: Call set_default_workspace() in initialize_storages()
- lightrag/api/lightrag_server.py: Add get_workspace_from_request() helper,
  update /health endpoint to support LIGHTRAG-WORKSPACE header

Testing:
- Backward compatibility: Old code works without modification
- Multi-instance safety: Explicit workspace passing preserved
- /health endpoint: Supports both default and header-specified workspaces

Related: #2353
(cherry picked from commit 18a4870229)
2025-12-04 19:11:16 +08:00
..
deprecated Preserve ordering in get_by_ids methods across all storage implementations 2025-12-04 19:06:54 +08:00
__init__.py Improve storage config validation and add config.ini fallback support 2025-12-04 19:09:03 +08:00
faiss_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-12-04 19:09:05 +08:00
graph_tenant_support.py tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency (#4) 2025-12-04 16:04:21 +08:00
json_doc_status_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-12-04 19:09:05 +08:00
json_kv_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-12-04 19:09:05 +08:00
memgraph_impl.py Refactor exception handling in MemgraphStorage label methods 2025-12-04 19:09:04 +08:00
milvus_impl.py Fix dimension type comparison in Milvus vector field validation 2025-12-04 19:09:08 +08:00
mongo_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-12-04 19:09:05 +08:00
mongo_tenant_support.py tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency (#4) 2025-12-04 16:04:21 +08:00
nano_vector_db_impl.py Refactor storage classes to use namespace instead of final_namespace 2025-12-04 19:09:06 +08:00
neo4j_impl.py Add retry decorators to Neo4j read operations for resilience 2025-12-04 19:09:08 +08:00
networkx_impl.py Refactor storage classes to use namespace instead of final_namespace 2025-12-04 19:09:06 +08:00
postgres_impl.py Add CASCADE to AGE extension creation in PostgreSQL implementation 2025-12-04 19:09:07 +08:00
postgres_rls.sql tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency (#4) 2025-12-04 16:04:21 +08:00
postgres_tenant_support.py tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency (#4) 2025-12-04 16:04:21 +08:00
qdrant_impl.py Add Qdrant legacy collection migration with workspace support 2025-12-04 19:11:15 +08:00
redis_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-12-04 19:09:05 +08:00
redis_tenant_support.py tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency (#4) 2025-12-04 16:04:21 +08:00
shared_storage.py fix: Add default workspace support for backward compatibility 2025-12-04 19:11:16 +08:00
vector_tenant_support.py tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency (#4) 2025-12-04 16:04:21 +08:00