-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DifferentialRevision: show active diff ID in response (bug 1798737) #34
Conversation
@@ -1140,6 +1140,7 @@ public function getFieldValuesForConduit() { | |||
'status' => $status_info, | |||
'repositoryPHID' => $this->getRepositoryPHID(), | |||
'diffPHID' => $this->getActiveDiffPHID(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the PHID insufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lando (specifically the revision worker) uses the diff ID (and so do other parts of Lando and moz-phab but those generally rely on the differential.diff.*
endpoints.) This change removes the need to call the diff endpoints just to fetch the ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More specifically, why does the revision worker need the diff ID, surely it can use the PHID? Is there an API endpoint that requires the diff ID and doesn't take the PHID?
r+ anyways cause this is a small change, but it's still unclear why we need two IDs for the same object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So generally Lando, moz-phab, and even Phabricator expose the diff ID (and also use it in the backend). PHIDs and IDs are generally included in API responses for the particular resource you are requesting, but generally referenced fields show the PHID and not the ID. IDs are integers, PHIDs are long strings.
Using the ID instead of the PHID matches the convention of using the more human readable ID elsewhere today (although we do currently use both in different places). There's no downside that I can think of to using the ID instead of the PHID.
it's still unclear why we need two IDs for the same object
This is part of Phabricator's design. As far as I understand PHIDs are universally unique across databases and tables and are composed of a string, and IDs are what you would expect from a unique integer within a table (e.g. a primary key). I suspect it was part of the original design in order to be able to query any object easily no matter which table or database it is in. It might come down to a matter of preference, but I prefer using the ID.
No description provided.