For queries for a title & revision, we currently don't check whether the revision's title (part of the API response) actually corresponds to the requested title.
For the case where it does not match, @mobrovac came up with the great idea of redirecting to the proper title (and storing the revision table entry under the actual title).
For old revisions of pages that were renamed, this will result in revision entries only under the latest title. This is mildly in conflict with RESTBase's policy of providing cite-able stable URLs to old revisions, which don't change with renames. Fixing this likely involves walking the history backwards to find rename points, and populating the page_revisions table with the resulting information. This is not entirely trivial, so I think we should defer this for now. In the meantime, new entries for current revisions will be stored at the accurate locations.