[PR #32071] refactor: decouple workflow knowledge access via repository injection #33533

Closed
opened 2026-02-21 20:53:27 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32071

State: closed
Merged: No


Summary

  • Introduce a knowledge repository protocol with a SQLAlchemy implementation that is tenant-scoped and uses per-call sessions.
  • Inject repositories into workflow and pipeline execution paths, including single-step runs and sub-graph execution.
  • Refactor KnowledgeRetrievalNode to use repository access and add focused unit coverage.

Testing

  • make lint
  • uv run --directory api --dev -- basedpyright --threads 8
  • uv --directory api run mypy --exclude-gitignore --exclude 'tests/' --exclude 'migrations/' --check-untyped-defs --disable-error-code=import-untyped .
  • uv --directory api run ty check
  • uv run --project api pytest api/tests/unit_tests/core/workflow api/tests/unit_tests/core/app/apps -q

Related Issue

Part of #30269.
Implements the Repository pattern to decouple the Graph Engine from Flask-SQLAlchemy, setting the stage for the FastAPI migration.

**Original Pull Request:** https://github.com/langgenius/dify/pull/32071 **State:** closed **Merged:** No --- ## Summary - Introduce a knowledge repository protocol with a SQLAlchemy implementation that is tenant-scoped and uses per-call sessions. - Inject repositories into workflow and pipeline execution paths, including single-step runs and sub-graph execution. - Refactor KnowledgeRetrievalNode to use repository access and add focused unit coverage. ## Testing - make lint - uv run --directory api --dev -- basedpyright --threads 8 - uv --directory api run mypy --exclude-gitignore --exclude 'tests/' --exclude 'migrations/' --check-untyped-defs --disable-error-code=import-untyped . - uv --directory api run ty check - uv run --project api pytest api/tests/unit_tests/core/workflow api/tests/unit_tests/core/app/apps -q ### Related Issue Part of #30269. Implements the Repository pattern to decouple the Graph Engine from Flask-SQLAlchemy, setting the stage for the FastAPI migration.
yindo added the pull-request label 2026-02-21 20:53:27 -05:00
yindo closed this issue 2026-02-21 20:53:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33533