fix: make Langflow-synced flows visible (lfx volume perms, pull dedup)

This commit is contained in:
Jonas Miederer 2026-09-25 08:19:42 +02:00
parent 1326cece42
commit 95a1c1afb7
12 changed files with 5460 additions and 3859 deletions

View file

@ -37,3 +37,30 @@ def test_iter_flow_files_only_top_level_json(tmp_path):
sub.mkdir()
(sub / "c.json").write_text("{}")
assert export.iter_flow_files(tmp_path) == [tmp_path / "a.json"]
def test_find_reuse_path_matches_identical_content_first(tmp_path):
doc = {"name": "Simple Rule", "data": {"nodes": [], "edges": []}}
other = tmp_path / "other-name.json"
other.write_text(export.canonical_bytes(doc).decode())
path, identical = export.find_reuse_path(tmp_path, dict(doc))
assert (path, identical) == (other, True)
def test_find_reuse_path_matches_same_name(tmp_path):
old = {"name": "Simple Rule", "data": {"nodes": [], "edges": []}, "extra": 1}
(tmp_path / "simple_rule.json").write_text(json.dumps(old))
new = {"name": "Simple Rule", "data": {"nodes": [], "edges": []}}
path, identical = export.find_reuse_path(tmp_path, new)
assert (path, identical) == (tmp_path / "simple_rule.json", False)
def test_find_reuse_path_no_match_and_missing_dir(tmp_path):
(tmp_path / "a.json").write_text(json.dumps({"name": "Other"}))
assert export.find_reuse_path(tmp_path, {"name": "Neu"}) == (None, False)
assert export.find_reuse_path(tmp_path / "gibts-nicht", {"name": "Neu"}) == (None, False)
def test_find_reuse_path_skips_unreadable_files(tmp_path):
(tmp_path / "kaputt.json").write_text("{kein json")
assert export.find_reuse_path(tmp_path, {"name": "Neu"}) == (None, False)