Skip to content

Add HTML sampling for 5000+ node graphs and extraction progress logging (#52)#96

Closed
azizur100389 wants to merge 2 commits into
Graphify-Labs:v3from
azizur100389:fix/issue-52-large-scale-robustness
Closed

Add HTML sampling for 5000+ node graphs and extraction progress logging (#52)#96
azizur100389 wants to merge 2 commits into
Graphify-Labs:v3from
azizur100389:fix/issue-52-large-scale-robustness

Conversation

@azizur100389

Copy link
Copy Markdown
Contributor

Summary

Addresses three sub-issues from #52 (Large-Scale App Project Analysis):

  • tree-sitter version mismatch (sub-issue 1): _extract_generic() now catches TypeError from Language() API changes and returns a clear error message suggesting pip install --upgrade tree-sitter, instead of an opaque traceback
  • HTML visualization for large graphs (sub-issue 5): Added sample_for_viz() that selects the top-N largest communities and highest-degree nodes per community. to_html() accepts sample=True to auto-sample instead of raising ValueError on graphs exceeding 5,000 nodes
  • Extraction progress feedback (sub-issue 8): extract() now logs periodic progress (every 10% or 100 files) showing files processed, cached, skipped, and errors — users get feedback during large batch extractions instead of silence

Note: sub-issues 2 and 3 from #52 were already fixed in v3 (_resolve_cross_file_imports guard and _ASSET_DIR_MARKERS for xcassets).

Test plan

  • 9 new tests covering all three fixes (tests/test_issue52.py)
  • All existing export, extract, and detect tests pass
  • Verified sample_for_viz produces subgraphs under 5,000 nodes
  • Verified progress logging fires only for batches >= 100 files

@azizur100389 azizur100389 changed the title Fix #52: improve large-scale project robustness Add HTML sampling for 5000+ node graphs and extraction progress logging (#52) Apr 8, 2026
Three improvements for large-scale projects:

1. tree-sitter version mismatch: catch TypeError in _extract_generic()
   and return a clear error message suggesting pip upgrade, instead of
   a cryptic traceback when Language() API changes between versions.

2. HTML visualization sampling: add sample_for_viz() that selects
   top-N communities and highest-degree nodes per community. to_html()
   now accepts sample=True to auto-sample instead of raising ValueError
   on graphs exceeding 5000 nodes.

3. Extraction progress logging: extract() now logs periodic progress
   (every 10% or 100 files) showing files processed, cached, skipped,
   and errors — gives users feedback during large batch extractions.
patch.dict(sys.modules) requires a real module object, not a
dynamic class instance. Use types.ModuleType to create a proper
fake module that works across Python 3.10 and 3.12.
@azizur100389 azizur100389 force-pushed the fix/issue-52-large-scale-robustness branch from 996abbc to 5858460 Compare April 9, 2026 08:40
@safishamsi safishamsi closed this Apr 9, 2026
@safishamsi safishamsi reopened this Apr 9, 2026
@azizur100389

Copy link
Copy Markdown
Contributor Author

Closing this multi-fix PR (it targets the stale v3 branch). Replaced by a focused, single-purpose PR on v6 — see #NEW. The other two changes from this PR are no longer needed: progress logging is already in v6 (parallel/sequential extraction loops emit it), and HTML sampling overlaps with v6's GRAPHIFY_VIZ_NODE_LIMIT env-var approach so I left v6's design as-is.

@azizur100389

Copy link
Copy Markdown
Contributor Author

Replaced by #671 (focused single-fix PR on v6: just the tree-sitter TypeError hint, dropped the now-redundant progress logging and the sampling change that overlaps with GRAPHIFY_VIZ_NODE_LIMIT).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants