Skip to content

registry: no arity data — import_map_suffix binds n-argument calls to m-parameter members (needs a design decision) #2035

Description

@DeusData

Summary

The pipeline registry stores nothing but qualifiedName -> label (src/pipeline/registry.c:78: exact and by_name tables, labels interned). It has no parameter counts. CBMCall carries arg_count (internal/cbm/cbm.h:256) but nothing on the target side to compare it with. As a result, the import_map_suffix fallback (registry.c:757-777, first QN starting resolved. and ending .name) can bind an n-argument call to an m-parameter member with nothing to stop it.

Corpus shape (kubernetes, on receiver-qualified QNs #1913)

meta.SetNamespace(ns) — one argument, receiver is a local metav1.Object (see the shadowing defect filed separately) — binds to k8s.io/apimachinery/pkg/api/meta.MetadataAccessor.SetNamespace, whose signature is SetNamespace(obj runtime.Object, namespace string) error. Confidence 0.85, cand=1. Three sites (resttest.go, kubectl .../expose.go:392, kubectl .../run.go:724).

Why a per-language suppressor does not work here

The obvious rule — "a Go import-qualified callee pkg.Name can never name pkg.Type.Name, so drop Go import_map_suffix" — was measured over all 497 Go import_map_suffix edges on kubernetes (494 Method, 2 Function, 1 Field targets) and is empirically wrong to apply: clientset.CoreV1 -> client-go.kubernetes.Interface.CoreV1, informers.Core -> SharedInformerFactory.Core, version.Major -> util.version.Version.Major, args.Validate -> applyconfiguration-gen.args.Args.Validate are the same idiom (a local named like a package) and are correct, because the local's type does live in that package. Dropping the strategy is a large recall loss.

Arity is the only signal that separates the right ones from the wrong ones, and the registry does not have it.

The direction question

Adding parameter counts to the registry is a global data-structure change — every language, every entry, at multi-million-node scale in a struct that is already tuned hard for memory (labels are interned to avoid ~8.5M strdups on the kernel). It is also a genuine precision-vs-recall trade over ~500 edges. Options as I see them:

  1. Add a compact arity field (e.g. a uint8 per exact entry, 255 = unknown/variadic) and let import_map_suffix / qualified_suffix reject candidates whose arity provably cannot accept arg_count.
  2. Keep the registry as is and accept the wrong-arity class.
  3. Solve it on the LSP side instead (type the local; see the shadowing issue), which would remove these calls from the fallback path entirely without touching the registry.

Option 3 fixes this shape but not the general class. Filing so the choice is made explicitly rather than by whichever PR lands first.

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

    parsing/qualityGraph extraction bugs, false positives, missing edgestaskUmbrella task grouping multiple related issues

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions