Skip to content

Params-struct refactor for too_many_arguments hot-path functions in codegraph-core (#2326 follow-up) #2481

Description

@carlos-alm

Context

While gating cargo clippy in CI (#2326), 11 clippy::too_many_arguments warnings were found in crates/codegraph-core, all in the graph-builder / call-edge-resolution hot path. Each was resolved with a targeted #[allow(clippy::too_many_arguments)] (with justification comment) rather than a params-struct refactor, because:

  • These are internal, non-pub functions in the most parity-critical part of the crate (call resolution / edge emission, which must stay bit-for-bit identical to the TS/WASM engine per CLAUDE.md's dual-engine mandate).
  • A params-struct refactor risks silently reordering or mismatching a field during the mechanical rewrite — a mistake here is exactly the kind of subtle behavior change Adopt cargo clippy as a CI gate (#2096 follow-up) #2326's own issue body warned against introducing in a single hasty pass.
  • Several of these functions accumulated parameters incrementally across many past issues (PTS support, CHA, barrel resolution, etc.), so any refactor should be done deliberately, one function/group at a time, with the dual-engine parity check (/parity or scripts/parity-compare.mjs) re-run after each change.

Sites (as of #2326)

  • crates/codegraph-core/src/ast_analysis/dataflow.rs::emit_destructuring_assignments (8 args)
  • crates/codegraph-core/src/domain/graph/builder/pipeline.rs::run_structure_phase (9 args)
  • crates/codegraph-core/src/domain/graph/builder/stages/build_edges.rs::emit_no_receiver_pts_edges (9 args)
  • crates/codegraph-core/src/domain/graph/builder/stages/build_edges.rs::emit_receiver_pts_edges (9 args)
  • crates/codegraph-core/src/domain/graph/builder/stages/build_edges.rs::resolve_call_targets (11 args)
  • crates/codegraph-core/src/domain/graph/builder/stages/build_edges.rs::resolve_call_targets_core (11 args)
  • crates/codegraph-core/src/domain/graph/builder/stages/build_edges.rs::emit_call_edges (9 args)
  • crates/codegraph-core/src/domain/graph/builder/stages/build_edges.rs::emit_receiver_edge (9 args)
  • crates/codegraph-core/src/domain/graph/builder/stages/import_edges.rs::emit_named_symbol_rows (8 args)
  • crates/codegraph-core/src/domain/graph/builder/stages/import_edges.rs::emit_barrel_through_rows (8 args)
  • crates/codegraph-core/src/domain/graph/builder/stages/import_edges.rs::emit_edges_for_import (9 args)

Suggested approach

Group by shared parameter shape (e.g. emit_no_receiver_pts_edges/emit_receiver_pts_edges already share almost identical signatures and could take the same context struct; resolve_call_targets/resolve_call_targets_core likewise). Introduce one params struct per group, update call sites, then re-run cargo test --workspace, the full npm test suite, and the dual-engine parity check before moving to the next group.

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