SourceCred

Unified reference detection

Status: proposal

Champion?:

None yet.

Description:

In a recent update Discourse reference detection was added. Where GitHub detection was already present. However currently the two don’t leave their own ecosystem. GitHub can’t link to Discourse and vice-versa.

This proposes a system where each plugin can instead define it’s “referencable” types and reference detection functions to SourceCred’s core, allowing the core to cross-reference between different plugins

Benefits:

  • Cross-plugin reference detection.
  • Makes it easier for new plugins to add more reference detection.

Implementation plan:

  • Discuss the system requirements.
  • Implement abstractions in SourceCred core.
  • Move existing plugins (GitHub, Discourse) over to use it.

Deliverables:

  • Abstractions in SourceCred core.
  • Compatible GitHub and Discourse plugins.

Dependencies:

References:

Contributions:

1 Like

In terms of requirements, currently Discourse has one EdgeType per combination of source and destination node. With names and weights for all of them.

As is, having to define each of those edges and needing code to select those edge types, this scales rather poorly when going cross-plugin.

A possible alternative to keep the best of both worlds would be a system where you can create a {sourceNodePrefix, destinationNodePrefix} selector for edges and override some of it’s parameters, like weights, or the forward and backward names.

This would allow for example a source of “anything discourse” and a destination of “discourse user” to be called a “mention” instead of “reference”. Similar for GitHub users.

Another requirement. Some data is only available to the plugin itself.

For example, a Discourse posts’ ID does not appear in the URLs. We need to look this up in the mirrored database.

Meaning, only the plugin of the link destination can realistically gather all the data about that destination. I think plugins therefore should have some kind of way to register a function that allows reference detection into their destinations.

A possible requirement is to check for existence and/or timestamp of a node. See https://github.com/sourcecred/sourcecred/pull/1417#discussion_r336755808