Page MenuHomePhorge

Conduit edge.search accepts IDs but does not return IDs - making input/output match impossible
Open, WishlistPublic

Description

Use case:

Query some Diffs, to get their Tasks.


Interestingly you can make such request to Conduit edge.search:

{
    "sourcePHIDs": [
        "D124",
        "D123",
        "D122",
        "D121"
    ],
    "types": [
        "revision.task"
    ]
}

And you can get this result:

{
    "data": [
        {
            "sourcePHID": "PHID-DREV-im5csr2hx2ncwwak3a3y",
            "edgeType": "revision.task",
            "destinationPHID": "PHID-TASK-i4jjgczve2k5pn3v5bfm"
        },
        {
            "sourcePHID": "PHID-DREV-bueqadgekwhw5zuopjcu",
            "edgeType": "revision.task",
            "destinationPHID": "PHID-TASK-3udflpb6ffnmuk3g4a2i"
        }
    ],
    "cursor": {
        "limit": 100,
        "after": null,
        "before": null
    }
}

The Problem

As you can see, there is no correlation between the input and the output. The input is D123 but the output is a list of PHIDs.

Probably, the list should return the sourceID.

Maybe related source code:

https://we.phorge.it/source/phorge/browse/master/src/infrastructure/edges/conduit/EdgeSearchConduitAPIMethod.php

Expected output

With the provided input, this would be lovely, so that the original input is returned to allow matching:

{
    "data": [
        {
+           "sourceInputName": "D124",
            "sourcePHID": "PHID-DREV-im5csr2hx2ncwwak3a3y",
            "edgeType": "revision.task",
            "destinationPHID": "PHID-TASK-i4jjgczve2k5pn3v5bfm"
        },
        {
+           "sourceInputName": "D125",
            "sourcePHID": "PHID-DREV-bueqadgekwhw5zuopjcu",
            "edgeType": "revision.task",
            "destinationPHID": "PHID-TASK-3udflpb6ffnmuk3g4a2i"
        }
    ],
    "cursor": {
        "limit": 100,
        "after": null,
        "before": null
    }
}

The proposed name for the field is sourceInputName just because that is an input, and it's a "name", since the results at the moment are passed through PhabricatorObjectQuery::withNames() as far as I can see.