Bug Description
NetworkXVisitor.visit_node in lens.py always adds a graph node for every wikilink ref, even when the target page does not exist in the vault. LENS topology and visualize deep stats then count phantom pages (e.g. GhostPage linked from Src but never created on disk).
Steps to Reproduce
# Minimal vault: pages/Src.md contains "- see [[GhostPage]]"
from logseq_matryca_parser.graph import LogseqGraph
from logseq_matryca_parser.lens import GraphVisualizer
g = LogseqGraph.load_directory(graph_root)
viz = GraphVisualizer(list(g.iter_canonical_pages()), graph=g)
viz.build_network()
assert "GhostPage" in viz.graph.nodes # phantom node today
Expected Behavior
Unresolved wikilinks should not create standalone page nodes (or should be tagged distinctly as unresolved and excluded from page counts / largest-pages stats).
Actual Behavior
visit_node calls add_node(ref) for every ref when get_page(ref) returns None, inflating node/edge counts and misleading LENS output.
Environment & Version
logseq-matryca-parser main (v1.4.1+), Python 3.12+
Context
Identified via local code study (wave 9). Related to BUG-020 in docs/BUG_HUNT_REPORT.md — alias canonicalization was fixed in v1.4.0, but missing-target wikilinks still create ghosts.
Suggested fix
- When
LogseqGraph is provided, only add page-group nodes for refs that resolve via get_page
- Add regression test in
tests/test_lens.py
Bug Description
NetworkXVisitor.visit_nodeinlens.pyalways adds a graph node for every wikilink ref, even when the target page does not exist in the vault. LENS topology andvisualizedeep stats then count phantom pages (e.g.GhostPagelinked fromSrcbut never created on disk).Steps to Reproduce
Expected Behavior
Unresolved wikilinks should not create standalone page nodes (or should be tagged distinctly as
unresolvedand excluded from page counts / largest-pages stats).Actual Behavior
visit_nodecallsadd_node(ref)for every ref whenget_page(ref)returnsNone, inflating node/edge counts and misleading LENS output.Environment & Version
logseq-matryca-parser main (v1.4.1+), Python 3.12+
Context
Identified via local code study (wave 9). Related to BUG-020 in
docs/BUG_HUNT_REPORT.md— alias canonicalization was fixed in v1.4.0, but missing-target wikilinks still create ghosts.Suggested fix
LogseqGraphis provided, only add page-group nodes for refs that resolve viaget_pagetests/test_lens.py