Skip to content

fix(graph): preserve and scope duplicate qualified names - #400

Merged
zzet merged 1 commit into
mainfrom
fix/qual-name-repo-scope
Jul 29, 2026
Merged

fix(graph): preserve and scope duplicate qualified names#400
zzet merged 1 commit into
mainfrom
fix/qual-name-repo-scope

Conversation

@zzet

@zzet zzet commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

Allow legitimate duplicate qualified names without aborting SQLite writes or cross-binding imports to an arbitrary tracked repository.

Qualified names are lookup labels, not global graph identities. Forks, worktrees, manifest overlays, and separate repositories can emit the same value, and Kubernetes resources can also repeat one within a repository across namespaces.

Changes

  • Replace the global unique nodes_by_qual index with a non-unique partial index through an in-place schema v8 migration.
  • Preserve duplicate qualified names when opening legacy or index-missing stores instead of blanking all but one row.
  • Make batched qualified-name lookup return every candidate in deterministic node-ID order across Graph, SQLite, and overlay backends.
  • Make normal import resolution prefer the exact caller repository, then its workspace.
  • Make cross-repository resolution prefer caller repository/workspace before dependency-policy candidates.
  • Leave policy-equivalent foreign candidates unresolved instead of choosing by row or insertion order.
  • Add end-to-end coverage for two tracked Kubernetes repositories emitting ClusterRole/prometheus with distinct IDs, ownership, paths, and content.
  • Keep the legacy singular qualified-name lookup as a compatibility API; semantic resolution now uses the complete candidate set.

Testing

  • All tests pass (go test -race ./...) — the repository-wide race suite was not run.
  • New tests added for new functionality
  • Benchmarks run if performance-relevant — not run.

Verified:

  • go test ./internal/graph ./internal/graph/storetest ./internal/graph/store_sqlite ./internal/resolver ./internal/indexer ./internal/parser/languages -count=1
  • go test -race ./internal/graph ./internal/graph/store_sqlite
  • go test -race ./internal/resolver
  • go build ./internal/graph/... ./internal/resolver/... ./internal/indexer/...
  • git diff --check

Checklist

  • Code follows existing patterns in the codebase
  • No unnecessary abstractions added
  • Language extractor includes Meta["methods"] for interfaces (not applicable)
  • Methods have EdgeMemberOf edges to their containing type (not applicable)

@zzet
zzet merged commit 9088e46 into main Jul 29, 2026
10 checks passed
@zzet
zzet deleted the fix/qual-name-repo-scope branch July 29, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant