Skip to content

Add visual-tests/ to default noise filter #869

Description

@akanoodles

Add visual-tests/ to the default noise filter

Repo

safishamsi/graphifyhttps://github.com/safishamsi/graphify

Summary

When /graphify runs against a TypeScript / Preact / React monorepo that uses a visual-tests/ directory for Playwright-style visual regression snapshots, the directory's contents (the built JS bundle + the mock files used to drive the visual harness) get treated as real source code by tree-sitter. The result is hundreds of garbage nodes in the graph — u3(), d2(), LetterD(), etc. — that swamp the legitimate top-N god nodes and pollute the community detection.

The existing noise filter already excludes coverage/, __snapshots__/, dist/, build/, and node_modules/. visual-tests/ belongs in the same bucket.

Repro

Run /graphify . against any repo with a visual-tests/ directory containing:

  • A built JS bundle (visual-tests/bundle.js or similar)
  • Mock files (visual-tests/mocks.ts, visual-tests/mocks/figma-ui.tsx, etc.)
  • Snapshot fixture screens (visual-tests/screens.tsx)

Observed behaviour on a real codebase (1,365 files corpus):

  • 161 nodes extracted from visual-tests/bundle.js alone — entries like u3(), d2(), LetterD(), B2() — minified function names from the Vite production build
  • 473 nodes total from visual-tests/** across bundle + mocks + screens
  • u3() ranked as the v3: Codex and OpenClaw support #2 god node (86 edges) on first build, eclipsing trackEvent() (84) and ToolError (62) which are the real architectural abstractions
  • Top community labels degenerated into "Plugin Visual Test Components A" + "Plugin Bundle Snapshots" purely because the snapshot artefacts dominated by node count

After manual purge of visual-tests/:

  • 473 nodes removed (5.7% of graph)
  • Top 10 god nodes became architecturally meaningful
  • Community labels became interpretable

Suggested fix

Add 'visual-tests' (and likely 'visual-test') to the default noise-filter set in graphify/detect.py (or wherever the is_noise predicate lives — I haven't traced your source). Mirror it for the equivalent in any HTML-export community-aggregation step that might re-pull these via path heuristics.

Single-line PR:

NOISE_DIR_NAMES = {
    'coverage', 'lcov-report', '__snapshots__', 'snapshots',
    'node_modules', 'dist', 'dist-protected', 'build',
    'visual-tests', 'visual-test',   # ← add
}

Optionally, also add 'storybook-static' since Storybook's static build output has the same problem and is increasingly common in repos that also use graphify.

Workaround (today)

Filter .graphify_detect.json post-detect before semantic extraction. Mechanical but the user has to know to do it. Same for users running --update on incremental changes.

Related observation (separate issue worth filing)

docs/site/refs/ (or any **/refs/ directory with reference screenshots) gets vision-extracted as real diagrams. That's actually correct behaviour — those usually contain useful UI screenshots for the docs. Not a noise issue, just noting that the line between "visual-tests = noise" and "refs = signal" matters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions