Skip to content

Commit cd85522

Browse files
ayushcodes10claude
authored andcommitted
Report unclassified files from graphify update too
graphify extract has printed this since #1692, but the update and watch rebuild path never did, so a corpus with no extractor for its language, Lean 4 in the reported case, rebuilt successfully with those files completely absent and nothing said about it. Prints the same wording from the extract command, and threads the count into the local detection summary the rebuild path already builds for GRAPH_REPORT.md, which previously dropped it. Fixes #3511. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh (cherry picked from commit 1204056)
1 parent c9da36d commit cd85522

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

‎graphify/watch.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,20 @@ def _rebuild_code(
14281428
)
14291429
code_files = [Path(f) for f in detected['files']['code']]
14301430

1431+
# #3511: `graphify extract` has surfaced files it saw but could not
1432+
# classify since #1692; this update/watch rebuild path never did,
1433+
# so a corpus in a language with no extractor (no supported
1434+
# extension or shebang) rebuilt "successfully" with those files
1435+
# silently absent from the graph. Same wording as the extract path.
1436+
_unclassified = detected.get("unclassified", []) if isinstance(detected, dict) else []
1437+
if _unclassified:
1438+
_names = ", ".join(sorted({Path(p).name for p in _unclassified})[:6])
1439+
_more = f" (+{len(_unclassified) - 6} more)" if len(_unclassified) > 6 else ""
1440+
print(
1441+
f"[graphify watch] {len(_unclassified)} file(s) not classified "
1442+
f"(no supported extension or shebang), skipped: {_names}{_more}"
1443+
)
1444+
14311445
# #2495: hand reconcile the same ignore decisions the detect() call
14321446
# above made, so a newly-ignored file that still exists on disk is
14331447
# purged from the graph instead of preserved forever by the fail-closed
@@ -1876,6 +1890,7 @@ def _failed(f: str) -> bool:
18761890
"files": {"code": [str(f) for f in code_files], "document": [], "paper": [], "image": []},
18771891
"total_files": len(code_files),
18781892
"total_words": detected.get("total_words", 0),
1893+
"unclassified": detected.get("unclassified", []),
18791894
}
18801895

18811896
# Inherit the existing graph's directed flag (#2342) so `graphify

‎tests/test_watch.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,25 @@ def test_doc_only_deletion_full_rebuild_evicts_md_nodes(tmp_path):
133133
assert "run()" in labels
134134

135135

136+
def test_rebuild_code_reports_unclassified_files(tmp_path, capsys):
137+
"""#3511: `graphify extract` has surfaced files it saw but could not
138+
classify (no supported extension/shebang) since #1692; the update/watch
139+
rebuild path never did, so a corpus mostly in an unsupported language
140+
(e.g. Lean, per the report) rebuilt "successfully" with those files
141+
silently absent and nothing said about it."""
142+
corpus = tmp_path / "corpus"
143+
corpus.mkdir()
144+
(corpus / "app.py").write_text("def run(): pass\n", encoding="utf-8")
145+
(corpus / "Main.lean").write_text("def main := 0\n", encoding="utf-8")
146+
(corpus / "Util.lean").write_text("def util := 1\n", encoding="utf-8")
147+
148+
assert _rebuild_code(corpus, acquire_lock=False) is True
149+
out = capsys.readouterr().out
150+
assert "2 file(s) not classified" in out
151+
assert "Main.lean" in out
152+
assert "Util.lean" in out
153+
154+
136155
# --- watch() import error without watchdog ---
137156

138157
def test_check_update_no_flag_returns_true(tmp_path):

0 commit comments

Comments
 (0)