MBS-12560: Stop using track ID for recording ID URL
Problem
MBS-12560: Stop using track ID for recording ID URL
In MB, if you call the /entity/id URL, it will redirect to the matching /entity/gid URL.
But it is broken for recording:
NGS has now separate track and recording ID, but pre-NGS, there was some redirection necessary or something: 7acea69a042a4f50f759199fe661e736cee208a4
Example: https://musicbrainz.org/recording/272811 should lead to recording with ID 272811. Not to unrelated recording with ID 316322 via track with ID 272811.
https://musicbrainz.org/recording/272811 should not lead to same recording as unrelated https://musicbrainz.org/track/272811
Solution
Remove the pre-NGS redirection from /recording/id that is looking up for track with id instead of recording with id.
Let MBS use/inherit the genetic _row_id_to_gid function for recording, by removing the recording-level specific function.
@brainzbot, please retest this
IIRC the point of this is that pre-NGS edit notes and whatnot might still have track IDs that are now equivalent to a recording (and that we shouldn't actually be creating /track or /recording URLs with the ID now anyway, so most if not all that exist are probably old). Is there any other use case than "resolve old edit note links" for this redirect?
Oh very good point! I didn't know the official uses of these URL! I will try to find such edit notes to see if this PR is not counter productive, then! I don't know other uses.
For info, I use this hidden feature for a userscript feature (something that I would like to propose as an internal MBS feature, BTW, later, if I can):
Add hyperlinks after inline looked up entity green fields
I made a quick search:
-
The oldest
/recording/link (the kind that would change with this PR) I find is using gid (MBID), not id: 2004-02-18 Edit #794065 - Add release (pre‐NGS) from edit note content search - The oldest
/track/link I find is using gid (MBID): 2004-01-25 Edit #733832 - Remove track (pre‐NGS) from edit note content search
I will look further soon.
I want to check the pre-NGS release pages to see how tracks used to be linked, but the Internet Archive says that This URL has been excluded from the Wayback Machine.
Isn't it strange?
Here is when this redirect feature was added for all entity types, before NGS:
Redirect any requests to a row id page to GID pages (2010-06-09) https://github.com/metabrainz/musicbrainz-server/commit/6994069bc6216d33d2df83bc00dd43837d454015
Same day as the exception for recordings:
Use track IDs to resolve recording GIDs (2010-06-09) https://github.com/metabrainz/musicbrainz-server/commit/7acea69a042a4f50f759199fe661e736cee208a4
(The exception I wanted to remove.)
I didn't find traces of /recording/id links yet.
Please don't close this PR. I am still looking for uses of /recording/id links somewhere.
I frequently use row ID links as a shortcut (so I don't have to join with entity tables to get the GID), and the recording thing annoys me all the time, so +1 to this patch assuming we can fix any existing track links in edits notes and whatnot.
@mwiencek: can you take a look to see if you find a lot of edit notes to fix or not? :)
@brainzbot, please retest this
I tried to find edit notes that use /\bmusicbrainz\.org\/recording\/\d+$/ but I could only search for musicbrainz.org/recording/1 … 7 … 9 and looked at the first page of results only…
I did only find gid URLs, no id (digits only) URLs.
Without any such links, there would be no problem to change/fix with this merge request.
Very sorry for the delay @jesus2099, this PR slipped through the cracks.
I searched the edit_note table and didn't find any references to URLs containing digits only.
Wow superb! 😁👍