Repository navigation
Description
Summary
GRAPH_REPORT.md's per-community Nodes (N): ... listing includes rationale (docstring-fragment) and concept nodes as if they were real code declarations, so a community's node list can read like raw docstring prose — e.g. on code2flow (a real, small Python project):
### Community 14 - "Community 14"
Cohesion: 0.09
Nodes (13): Node, Check whether this variable is what the call is acting on. For example, if we…, Names exist largely for unit tests and deterministic node sorting :rtype: str, ...
"Names exist largely for unit tests and deterministic node sorting :rtype: str" is the literal docstring of code2flow/model.py's Node.name() method (file_type: "rationale"), not a node name. It's listed as if it were one, and it also inflates the community's reported size (len(real_nodes), which counts it).
Root cause
This is the same bug class as the closed #1768 (suggest_questions() vs report.py's Knowledge Gaps disagreeing over a missing rationale filter) — but a third, still-unfixed spot, inside report.py itself this time.
report.py, the community-rendering loop (~line 284):
# Filter method/function stubs from display - they're structural noise
real_nodes = [n for n in nodes if not _ifn(G, n)]_ifn is _is_file_node (imported from .analyze) — it excludes file nodes only.
Compare the Knowledge Gaps section, ~30 lines later in the same function:
isolated = [
n for n in G.nodes()
if G.degree(n) <= 1
and not _is_file_node(G, n)
and not _is_concept_node(G, n)
and G.nodes[n].get("file_type") != "rationale"
]This one correctly excludes file, concept, and rationale nodes — the exact exclusion set #1768 established as the right one for report.py. The community-listing loop was never given the same treatment, so rationale (and concept) nodes still leak into Nodes (N): ... even though the codebase already knows how to filter them out, a few lines below.
Minimal reproduction
pip install graphifyy
git clone https://github.com/scottrogowski/code2flow
graphify code2flow --code-only --no-label
Open code2flow/graphify-out/GRAPH_REPORT.md and look at any community whose members include a Node/model-style class with docstrings — several communities list docstring text (including truncated … mid-sentence, and :param/:rtype: Sphinx directives) directly in the Nodes (N): ... line.
Suggested fix
real_nodes = [
n for n in nodes
if not _is_file_node(G, n)
and not _is_concept_node(G, n)
and G.nodes[n].get("file_type") != "rationale"
]i.e. reuse the exact filter the Knowledge Gaps section already applies, in the community-rendering loop too.
Related
- suggest_questions() isolated-node count (757) disagrees with report.py Knowledge Gaps count (245) — inflated by rationale/JSON-leaf/TS-Props nodes #1768 — same missing-rationale-filter pattern, different location (
analyze.pyvsreport.py's own Knowledge Gaps section). Fixed there; this is the one place insidereport.pythat fix didn't reach. - v0.7.7: rationale-as-node fragments still emitted at ~30% rate despite #563 prompt fix #751 / Extraction: rationale node labels are a raw 80-character slice of the docstring, producing truncated mid-word titles and filenames ending in
..md#2206 — about reducing how often rationale nodes get created in the first place; this report is about display filtering given that they exist, which is needed regardless of how that's resolved.
Environment
graphifyy==0.9.65(PyPI)- Windows 11
- AST-only extraction (
--code-only --no-label), no LLM
Activity
BloodyBeard commentedon Sep 24, 2026
Patched this locally and found the gap is wider than the one line above:
_ifn'srationale/conceptexclusion is missing from three sites in the same function, not one, and they're supposed to agree with each other by the report's own design (see the #3148/#3548 comments a few lines above the community loop, which explicitly say the "Communities" header count and the render loop should match):Nodes (N): ...display (reported above)thin_count_summary/shown_count(drives the## Communities (X total, Y thin omitted)header)thin_communitiesin the Knowledge Gaps section (sum(1 for n in nodes if not _is_file_node(G, n)) < min_community_size— same partial filter, independently)Fix that resolved all three at once: make the single
_ifnalias already used throughout the function apply the full exclusion (file + concept + rationale), instead of adding the check ad hoc at each site:Then every site that already called
_ifn(G, n)is correct for free, and the two spots that had rolled their own partial version (isolated's inline chain,thin_communities's bare_is_file_node) can just call_ifntoo. Verified across 12 real projects post-patch: no docstring/rationale text in anyNodes (N): ...line, and the "X total, Y thin omitted" header now agrees with the Knowledge Gaps "thin communities" count in every case (previously could disagree by the same rationale-inflation amount).safishamsi commentedon Sep 29, 2026
Fixed in v0.9.72 (now on PyPI) by #3836 — thanks @ayushcodes10.
Release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.72