feat: manual full-pass sync Langflow -> files -> DB+LFX with admin guide

This commit is contained in:
Jonas Miederer 2026-09-24 22:33:33 +02:00
parent acea6ae624
commit 1326cece42
11 changed files with 284 additions and 41 deletions

View file

@ -218,22 +218,36 @@ def override_langflow():
Usage: override_langflow(export_doc) -- the fake export_flow() returns the
doc, or raises LangflowNotFound/Unavailable for status=404/0.
Pass flows=[...] + docs={id: doc} for multi-flow pull tests, or
list_status=0/500 to fail the listing. Default list is empty so
file-only sync tests stay hermetic.
"""
from app.flows.api import get_langflow
from app.flows.langflow_client import LangflowNotFound, LangflowUnavailable
from app.flows.langflow_client import LangflowError, LangflowNotFound, LangflowUnavailable
from app.main import app
def _override(export_doc=None, status=200):
def _override(export_doc=None, status=200, flows=None, docs=None, list_status=200):
if flows is None:
flows = [{"id": "fake-1", "name": "fake"}] if export_doc is not None else []
class FakeLangflow:
async def export_flow(self, flow_id):
if status == 404:
raise LangflowNotFound(f"flow {flow_id} not found")
if status == 0:
raise LangflowUnavailable("Langflow unreachable")
if docs is not None:
if flow_id in docs:
return docs[flow_id]
raise LangflowNotFound(f"flow {flow_id} not found")
return export_doc
async def list_flows(self):
return [{"id": "fake-1", "name": "fake"}]
if list_status == 0:
raise LangflowUnavailable("Langflow unreachable")
if list_status == 500:
raise LangflowError("Langflow error 500")
return flows
app.dependency_overrides[get_langflow] = lambda: FakeLangflow()