Skip to content

Rust: private/test-scoped fns collapse into unrelated enum-variant/production-fn nodes of the same bare name, manufacturing false god nodes #2774

Open

Description

@oilsinwater

Version: graphifyy 0.7.5
Environment: Linux x86_64, Python 3.14 (Rust codebase, tree-sitter-rust)
Related: #2315 (Python decorator name-binding, same root cause: symbol resolution by bare name), #1829 (node ID collision for same-basename files)

Summary

Node identity is assigned from the bare symbol name alone, with no scope, visibility, or type-context resolution. This produces two distinct failure modes in a Rust codebase, both of which manufactured false "god nodes" that a downstream doc treated as core architectural abstractions:

1. Private functions absorb edges meant for enum variants of the same name

engine/src/lexicon.rs defines private fn string(value: &Ipld), fn integer(value: &Ipld), both non-pub, un-callable from outside the module. In the generated graph these rank as god nodes (#2 and #8 by degree, 62 and 52 edges respectively — 2nd only to the actual central Engine facade at 120).

The inflating edges come from unrelated call sites constructing Ipld::String(s) / Value::String(s) / Ipld::Integer(i) enum variants in a completely different file (desktop/src/backend/handlers.rs). The variant construction and the private validator function share only a bare name — graphify links them as if one calls the other. Rust's privacy rules make the literal claimed edge (desktop/ calling a private lexicon.rs fn) impossible.

2. Test-fixture helpers absorb edges meant for production entry points

Similarly, engine.rs contains test-only fixture helpers fn map(pairs: &[(&str, Ipld)]) -> Ipld and fn consent() -> Ipld (inside #[cfg(test)] scope). These collapsed into the same nodes as the production Ipld::Map variant and the real auth entry point create_consent(), again ranking in the global top-10 by degree (55 and 54 edges).

Impact

A human using GRAPH_REPORT.md's "God Nodes" list to understand the codebase's core abstractions gets 4 of the top 10 wrong: string(), map(), integer(), consent() are all name-collision artifacts of test/private helpers, not the real abstractions their names suggest. This was caught only by manually opening each file and checking pub-ness / #[cfg(test)] scope against every degree-ranked node — something the graph itself gives no signal to prompt.

Ask

Activity

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