Skip to content

Consolidate duplicated resolution bookkeeping across language plugins #29

Closed

Description

@MCR-3

Context

python.py, rust.py, and typescript.py had, across separate PRs, grown three pieces of byte-identical, non-language-specific bookkeeping: the call-dedup loop, the edge-building loop, and a FunctionInfo._node = ... / del info._node dynamic-attribute stash convention (six # type: ignore[attr-defined] comments for something that never belonged on the dataclass). Rust's crate-fallback resolution (_find_impl_in_crate, _find_fn_in_crate, _find_submodule_in_crate) separately repeated the same "scan every module in a crate" loop three times, varying only the match predicate — the exact fallback area most recently touched (#25, bare module::func() resolution for src-less nested crates). Surfaced by an architecture review; none of this duplication was earning its keep, and with no test suite, nothing catches the three copies drifting apart.

Implementation is complete in the working tree as of this issue; it tracks the change through review/merge.

To-dos

  • Add dedupe_calls() and build_edges() to backend/languages/base.py; all three plugins call them instead of reimplementing the loops
  • Replace the info._node stash/del convention in all three plugins with a plain dict kept on each analyzer (self._nodes)
  • Consolidate Rust's three crate scans behind a shared _crate_candidates() iterator

Acceptance criteria

  • python -m backend.analyzer output (files/functions/edges) is byte-identical before and after, for sample_project, sample_rust_project, sample_typescript_project, and sample_rust_nested_project
  • No # type: ignore[attr-defined] remains in backend/languages/*.py for the node-stash pattern

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