Skip to content

[Bug]: Swift: a call through an injected protocol dead-ends at the requirement, so the conformer's method is unreachable #4032

Closed

Description

@GAURAV-1313

Title: [Bug]: Swift: a call through an injected protocol dead-ends at the requirement, so the conformer's method is unreachable

What happened?

Since #3673 a call on a protocol-typed property resolves to the protocol's own requirement node, which is right. But nothing joins that requirement to the method of the type that conforms to it, so every edge walk through an injected dependency stops at the protocol. C# had the same gap for interfaces and #3003 closed it with a dispatches_to edge; Swift never got one.

Expected: with exactly one conformer, the requirement's method links to the conformer's method, as IReport.Build() links to Report.Build() in C#.

Steps to reproduce

mkdir -p probe/Core probe/Services probe/App
cat > probe/Core/Store.swift <<'SW'
protocol Store { func fetch() async throws -> [Item] }
struct Item { let id: Int }
SW
cat > probe/Services/RemoteStore.swift <<'SW'
struct RemoteStore: Store {
    func fetch() async throws -> [Item] { try decode() }
    func decode() throws -> [Item] { [] }
}
SW
cat > probe/App/ItemModel.swift <<'SW'
final class ItemModel {
    private let store: Store
    init(store: Store) { self.store = store }
    func load() async throws -> [Item] { try await store.fetch() }
}
SW
cd probe && graphify update . --no-cluster && graphify explain "Store.swift::fetch"

Error output or graph output

$ graphify update . --no-cluster
[graphify watch] Rebuilt (no clustering): 13 nodes, 19 edges
$ graphify explain "Store.swift::fetch"
Node: .fetch()
  ID:        core_store_store_fetch
  Source:    Core/Store.swift L1
  Degree:    3

Connections (3):
  --> Item [references] [EXTRACTED] Core/Store.swift:L1
  <-- Store [method] [EXTRACTED] Core/Store.swift:L1
  <-- .load() [calls] [INFERRED] App/ItemModel.swift:L4

No edge reaches Services/RemoteStore.swift's .fetch(), so RemoteStore.decode() is unreachable from ItemModel.load(). On a real app (GAURAV-1313/roomy, 298 Swift files, four protocols injected as any P) the same cut sits at every protocol seam; e.g. CleanupStore.run() never reaches DeletionService.merge().

Graphify version

0.9.74 (v8 at 0b60d47)

Operating System

macOS

Activity

  1. github-actions commented on Oct 3, 2026

    @github-actions

    Thanks for opening this issue, @GAURAV-1313. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. safishamsi commented on Oct 4, 2026

    @safishamsi
    Member

    Fixed in v0.9.75 (live on PyPI as graphifyy==0.9.75) via #4035, thanks @GAURAV-1313. 🙏

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