Ref T4715. Some minor stuff I caught locally while poking around:
- Since we don't GROUP BY, we can still get duplicate commits. These get silently de-duplicated by loadAllFromArray() because that returns an array keyed by id, but we fetch too much data and this can cause us to execute too many queries to fill pages. Instead, GROUP BY if we joined the audit table.
- After adding GROUP BY, getting the audit IDs out of the query is no longer reliable. Instead, query audits by the commit PHIDs. This is approximately equiavlent.
- Since we always JOIN, we currently never return commits that don't have any audits. If we don't know that all results will have an audit, just LEFT JOIN.
- Add some !== null to catch the withIDs(array()) issue that we hit with Khan Academy a little while ago.