Skip to content

Feature request: scoped resolution for explain/query/path (monorepos, minified bundles, name collisions) #569

Open

Description

@DevangML

Environment

  • graphifyy: PyPI graphifyy (CLI graphify); version pinned at time of report e.g. 0.5.x
  • Python: 3.10+
  • Corpus: Large multi-root workspace: multiple Frappe benches (same app names under different roots), frappe / erpnext trees, and generated assets under sites/assets/ (including *.min.js).
  • Command: graphify update . from repository root

Problem

For this corpus shape, the defaults for explain, graphify query, and graphify path are easy to misread:

  1. explain "<label>" often attaches to the wrong node for short or overloaded names — e.g. symbols inside minified sites/assets/**/*.min.js, or a test class before the Document controller for the same name.
  2. query (BFS) surfaces high-degree framework hubs (get, get_doc, Document, ERPNext-heavy nodes) before app-specific nodes unless --budget is very large.
  3. path "A" "B" often returns no path for informal strings; disambiguation is needed when the same relative path exists under multiple bench roots.

graph.json itself still contains the right per-file nodes and many EXTRACTED edges; the pain is mostly resolution / traversal ergonomics and signal-to-noise at the CLI, not “missing data” in the graph.

Workarounds (already supported — README)

These reduce noise before any new flags:

  • .graphifyignore (gitignore-style) — e.g. **/sites/assets/, **/*.min.js; optionally exclude frappe/ / erpnext/ when analysis targets custom apps only.
  • Narrow scan root — graphify update <subdir> (e.g. one frappe-bench/apps/ tree).
  • merge-graphs — combine smaller graphs when a single full-root graph is too hub-heavy.

This issue is for cases where teams still want a wide index or need better disambiguation without hand-editing graph.json.

Proposal

Idea Rationale
explain --file <path> [--line N] and/or top-k matches (each with source_file, line, node id) Avoids a single silent wrong match; matches how power users already use stable ids from graph.json.
query --seed-file <path> or --path-prefix <prefix> Starts BFS from nodes under a subtree (one bench / one app), reducing hub flooding.
Optional deprioritization of certain paths as match / seed candidates (not only via ignore) For corpora that must include sites/assets but should not prefer minified bundles when resolving validate / get_doc.

Suggested acceptance (future behavior)

  • With explain --file (or equivalent) set to a known controller, resolution for a short name like validate should not prefer an unrelated *.min.js symbol in that disambiguated context.
  • explain DataSyncConfiguration-style input should return multiple candidates (e.g. test vs Document) with full source_file, not pick one arbitrarily.

Related

Happy to help validate a PR or share a minimal public repro corpus description if useful.

Activity

  1. changed the title [-]RFC: Improve explain/query/path resolution for large monorepos (minified JS, duplicate paths, hub bias)[/-] [+]Feature request: scoped resolution for explain/query/path (monorepos, minified bundles, name collisions)[/+] on Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions