musicbrainz-server icon indicating copy to clipboard operation
musicbrainz-server copied to clipboard

MBS-12560: Stop using track ID for recording ID URL

Open jesus2099 opened this issue 3 years ago • 10 comments

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.

jesus2099 avatar Aug 31 '22 06:08 jesus2099

@brainzbot, please retest this

yvanzo avatar Aug 31 '22 08:08 yvanzo

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?

reosarevok avatar Aug 31 '22 09:08 reosarevok

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): image Add hyperlinks after inline looked up entity green fields

jesus2099 avatar Aug 31 '22 11:08 jesus2099

I made a quick search:

I will look further soon.

jesus2099 avatar Aug 31 '22 13:08 jesus2099

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?

jesus2099 avatar Aug 31 '22 23:08 jesus2099

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.

jesus2099 avatar Aug 31 '22 23:08 jesus2099

Please don't close this PR. I am still looking for uses of /recording/id links somewhere.

jesus2099 avatar Sep 02 '22 22:09 jesus2099

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 avatar Sep 03 '22 00:09 mwiencek

@mwiencek: can you take a look to see if you find a lot of edit notes to fix or not? :)

reosarevok avatar Sep 05 '22 08:09 reosarevok

@brainzbot, please retest this

jesus2099 avatar Sep 07 '22 07:09 jesus2099

I tried to find edit notes that use /\bmusicbrainz\.org\/recording\/\d+$/ but I could only search for musicbrainz.org/recording/179 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.

jesus2099 avatar Dec 01 '22 15:12 jesus2099

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.

mwiencek avatar Dec 08 '23 18:12 mwiencek

Wow superb! 😁👍

jesus2099 avatar Dec 08 '23 19:12 jesus2099