LightRAG/docs/diff_hku/MERGE_READINESS.md
Raphaël MANSUY a6aa073d70 feat(webui): Add single-tenant/multi-tenant mode support
- Add LIGHTRAG_MULTI_TENANT env var to control multi-tenant mode
- Add multi_tenant_enabled flag to /auth-status and /health endpoints
- Update LoginPage to auto-redirect in single-tenant mode
- Update App.tsx to set default tenant/KB in single-tenant mode
- Update TenantSelector to skip API calls in single-tenant mode
- Update SiteHeader to hide tenant selector in single-tenant mode
- Update useTenantInitialization hook to skip in single-tenant mode
- Update AuthStore with multiTenantEnabled state

In single-tenant mode (default):
- No tenant selection UI shown
- Auto-creates default tenant and KB context
- Direct access to all WebUI features

In multi-tenant mode (LIGHTRAG_MULTI_TENANT=true):
- Shows tenant/KB selection UI
- Requires tenant API routes to be configured
2025-12-04 20:37:06 +08:00

4.7 KiB

Merge Readiness Review: premerge/integration-upstream

Date: December 4, 2025
Branch: premerge/integration-upstream
Target: main


Executive Summary

The premerge/integration-upstream branch is READY FOR MERGE to main. All critical tests pass, imports work correctly, and there are no conflict markers in the codebase.


Branch Statistics

Metric Value
Total Commits 586
Cherry-picked Commits 376
Fix/Sync Commits 10
Files Changed 317
Lines Added ~238,841
Lines Removed ~8,575
Python Files Changed 90

Test Results Summary

Unit Tests (All Pass)

Test Suite Tests Status
test_chunking.py 37 PASS
test_overlap_validation.py 6 PASS
test_workspace_isolation.py 11 PASS
test_write_json_optimization.py 9 PASS
test_tenant_models.py 16 PASS
test_rerank_chunking.py 19 PASS
Total Unit Tests 98 100% PASS

Integration Tests

Test Suite Tests Status
test_postgres_retry_integration.py 6 PASS
Total Integration Tests 6 100% PASS

E2E & Web UI Tests (Playwright)

Test Status Notes
API Health Endpoint PASS Returns 200, all config visible
API Query Endpoint PASS Returns 200, proper no-context response
Swagger UI PASS All endpoints documented & functional
WebUI Loading PASS Tenant selection page loads correctly
WebUI Multi-tenant ⚠️ N/A API running in single-tenant mode

Dev Stack Services

Service Port Status
PostgreSQL 15432 Running
Redis 16379 Running
LightRAG API 9621 Running (v1.4.9.2)
WebUI 5173 Running

Tests Requiring External Services (Not Run)

  • E2E isolation tests - Require multi-tenant API mode
  • API route unit tests - Have argparse import-time issues

Code Quality Checks

Check Status
Python Compilation All files compile
Conflict Markers None found
Core Imports All working
API Imports Working (with sys.argv override)
Ruff Linting ⚠️ Minor whitespace warnings only

Key Changes Integrated from Upstream

New Features

  • Langfuse observability integration
  • Workspace isolation support for pipeline status
  • Qdrant multi-tenancy refactor
  • Include_chunk_content parameter for queries
  • Enhanced rerank chunking with document-level aggregation

Improvements

  • PostgreSQL retry mechanism with configurable backoff
  • Pool close timeout configuration
  • Default workspace support for backward compatibility
  • JSON write optimization with surrogate sanitization

Bug Fixes

  • Sync core modules for import compatibility
  • Fix document_routes.py conflict markers
  • Correct base.py abstract method definitions
  • Fix test mock paths for reorganized modules

Known Issues (Non-blocking)

  1. API Test Isolation: Tests importing API modules fail due to argparse parsing sys.argv at import time. This is a test harness issue, not a production code issue.

  2. tkinter Dependency: graph_visualizer module requires tkinter which is unavailable on headless systems. Optional feature.

  3. Deprecation Warnings: datetime.utcnow() deprecation in tenant models - cosmetic only.


Merge Instructions

# Ensure you're on main
git checkout main

# Pull latest main
git pull origin main

# Merge the integration branch
git merge premerge/integration-upstream --no-ff -m "Merge upstream integration (586 commits)"

# Push to remote
git push origin main

Alternative: Squash Merge (for cleaner history)

git checkout main
git merge --squash premerge/integration-upstream
git commit -m "feat: integrate upstream HKUDS/LightRAG changes (586 commits)"
git push origin main

Post-Merge Recommendations

  1. Run Full E2E Suite with Ollama/OpenAI after merge
  2. Update Documentation for new features (Langfuse, workspace isolation)
  3. Tag Release after validation in production environment
  4. Monitor for any regressions in production

Approval Checklist

  • All unit tests pass (98/98)
  • All integration tests pass (6/6)
  • No conflict markers in codebase
  • All Python files compile without errors
  • Core module imports verified
  • Branch statistics documented
  • Merge instructions provided
  • API endpoints tested via Swagger (health, query)
  • WebUI loads correctly
  • Dev stack (PostgreSQL, Redis, API, WebUI) verified

Branch Status: READY FOR MERGE