Every now and then I come across some borked data on our Phabricator install. Usually, this is a reference to some PHID which no longer exists, although I also found that we had a large number of commits (phabricator_repository.repository_commit) which didn't belong to any Phabricator repository. Some examples are as follows:
- T5339: Deleting old commits
- T4750: Modifying differential comments
- T4733: "Unknown Object" for Project Policy
- T4718: Rebuilding CCs from Maniphest Transactions
- T4710: Purge "Unknown Object"
- T4745: You Shall Not Pass: Differential Revision Unknown Object
Whilst most of the time, this sort of data is not harmful in any way, in many cases it bothers me to the extend that I write some custom PHP or SQL to find these things and then fix them (usually by deleting them). I imagine it would be difficult to catch everything, but I would see benefit in some kind of ./bin/cleanup script that could at least list orphaned PHIDs and maybe (in some cases) delete them as well.