Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion graphify/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -4529,7 +4529,11 @@ def extract(
_empty_sources: list[str] = []
for i, _p in enumerate(paths):
_res = per_file[i] or {}
if _res.get("nodes") or _res.get("error"):
# Some extractors deliberately return no graph data for recognized input
# (for example, JSON records rather than a config/manifest). Their
# explicit ``skipped`` marker distinguishes that expected outcome from
# the anomalous empty extraction this warning is meant to surface.
if _res.get("nodes") or _res.get("error") or _res.get("skipped"):
continue
if _get_extractor(_p) is not None:
_empty_sources.append(str(_p))
Expand Down
12 changes: 12 additions & 0 deletions tests/test_zero_node_no_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,15 @@ def test_no_warning_when_all_files_produce_nodes(tmp_path, capsys):
ex.extract([f], cache_root=tmp_path / "out", parallel=False)
err = capsys.readouterr().err
assert "zero nodes" not in err


def test_intentionally_skipped_data_json_does_not_warn(tmp_path, capsys):
"""A recognized data document is empty by design, not an extractor failure."""
f = tmp_path / "records.json"
f.write_text('[{"id": 1, "name": "Ada"}]')

result = ex.extract([f], cache_root=tmp_path / "out", parallel=False)

assert result["nodes"] == []
err = capsys.readouterr().err
assert "zero nodes" not in err, err
Loading