Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBS-13920 (II): Detect feat. artists in titles when seeding #3469

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

derat
Copy link
Contributor

@derat derat commented Feb 9, 2025

MBS-13920

Make the release editor display an error (and checkbox to bypass) when featured artists appear in seeded track titles. Previously, the error and checkbox were only displayed for manually-entered titles.

Problem

The release editor incorrectly treats featured artists as already having been present in seeded track titles. As a result, editors can skip the warning without needing to confirm that the titles are deliberate when seeding releases.

Solution

Update Track's constructor to first check that the track already has an ID before treating the supplied title as original for the purposes of initializing the hasFeatOnOrigTitle field. Also update Medium's constructor to use hasOrigFeatOnTitle rather than hasFeatOnTitle() when choosing the initial state for confirmedFeatOnTrackTitles.

Testing

Manually checked that I now see an error and checkbox when seeding a release with a featured artist in the title (I used https://volaband.bandcamp.com/album/friend-of-a-phantom). If I edit a release that already has featured artists in titles, I see only a warning (as before).

* as original when seeding a new release (see MBS-13920).
*/
this.hasFeatOnOrigTitle =
this.id != null &&
Copy link
Contributor Author

@derat derat Feb 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this safe for checking that the track already existed? (I used != rather than !== to match the code above that initializes the id field.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that is safe in the release editor. IIRC, there are other parts of the codebase (e.g., the React relationship editor) where we use negative IDs to indicate a new/pending entity. In those cases we use root/static/scripts/common/utility/isDatabaseRowId.js to check whether it's a positive postgres INTEGER.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've updated this statement to use isDatabaseRowId since it feels a bit safer.

@derat
Copy link
Contributor Author

derat commented Feb 9, 2025

@reosarevok, I think that this fixes the rest of the issue.

@derat
Copy link
Contributor Author

derat commented Feb 13, 2025

@brainzbot, retest this please

Copy link
Member

@reosarevok reosarevok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and it seems to work nicely - I'd still want @mwiencek to take a second look and answer your open question though :)

@@ -511,7 +515,8 @@ class Medium {
);
});
this.confirmedFeatOnTrackTitles = ko.observable(
this.hasFeatOnTrackTitles.peek(),
!self.tracksUnknownToUser() &&
Copy link
Member

@mwiencek mwiencek Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow this bit: can tracksUnknownToUser ever be true here in the constructor? AFAICT it can only become true in tracksLoaded, or by the user ticking it.

Edit: I realized maybe this was intended to be a (writable) computed observable, though I'm still not sure if the tracksUnknownToUser check is actually needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about this either, so I was trying to play it safe (and lazy) by just copying over the expression used to initialize hasFeatOnTrackTitles above while switching it to use hasFeatOnOrigTitle rather than hasFeatOnTitle.

Does tracksLoaded always get called after the constructor when loading a medium from an existing release? If so, should confirmedVariousArtists and confirmedFeatOnTrackTitles both just be initialized to false here before being updated in tracksLoaded? (I think the intent was for the checkboxes to start out unchecked unless there are already tracks that possibly aren't following the guidelines, right?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does tracksLoaded always get called after the constructor when loading a medium from an existing release?

tracksLoaded is always called asynchronously for existing releases (i.e., mediums are always loaded async), so it does appear that tracksUnknownToUser will always be false in the constructor.

If so, should confirmedVariousArtists and confirmedFeatOnTrackTitles both just be initialized to false here before being updated in tracksLoaded? (I think the intent was for the checkboxes to start out unchecked unless there are already tracks that possibly aren't following the guidelines, right?)

Yeah, IIRC the intent was to only pre-check them if all initial incorrect tracks were pre-existing issues, so as not to force the user to repair them.

I think it would make sense to just initialize confirmedVariousArtists and confirmedFeatOnTrackTitles to false. Actually, I'm not sure the existing confirmedVariousArtists code works as intended if there are seeded tracks containing Various Artists either:

    this.hasVariousArtistTracks = ko.computed(function () {
      return !self.tracksUnknownToUser() &&
             self.tracks().some(t => t.hasVariousArtists());
    });
    this.confirmedVariousArtists = ko.observable(
      this.hasVariousArtistTracks(),
    );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right about this; I see the same issue with the VA checkbox being pre-checked when I seed a new release with a VA track credit. The checkboxes seem to work as intended both when seeding new releases and editing existing releases with bad data when I initialize both of these to false.

There's still a difference between the two, in that the feat. checkbox is only shown if the user introduced the feat. title while the VA checkbox is shown whenever there's a VA credit, even if it was already there . I think that that probably can't be changed without tracking more state about the original credits, though. I'd prefer to not introduce that in this change if that's okay. :-)

Make the release editor display an error (and checkbox to
bypass) when featured artists appear in seeded track titles.
Previously, the error and checkbox were only displayed for
manually-entered titles.

Also avoid initially checking the "Various Artists in track
credit" checkbox for seeded data.
Copy link
Member

@mwiencek mwiencek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes! LGTM and worked for me locally.

@mwiencek mwiencek merged commit 7318599 into metabrainz:master Feb 13, 2025
2 checks passed
@derat derat deleted the feat_seed branch February 14, 2025 00:10
reosarevok added a commit that referenced this pull request Feb 18, 2025
* master:
  Update POT files using the production database
  Merge pull request #3472 from reosarevok/MBS-13929
  Merge pull request #3477 from reosarevok/MBS-13939
  Merge pull request #3478 from reosarevok/MBS-13938
  Merge pull request #3473 from reosarevok/MBS-13930
  Add ordering to `_find_authors_or_other_artists` roles
  Use proper query variable bindings in `Data::Edit::find_by_collection`
  MBS-13914: Validate vote arguments for voter edit search (#3464)
  MBS-13763: Add past year stats to the editors statistic page (#3465)
  MBS-13928: Use jaxsta.com instead of jaxsta.io (#3471)
  add --no-same-owner option to tar (#3456)
  MBS-13925: Instrument name erroneously displayed in link type autocomplete (#3467)
  Avoid spreading `key` props in `useTable` hook (#3476)
  More direct `get_authorship_relationship_gids` implementation
  Rename "misc_artists" to "other_artists"
  MBS-8328: Split the role filter for artist works
  MBS-13917: Rename work "writers" to "authors"
  Get authorship rel gids from the DB
  Rename "composition" to "authorship"
  Add test for loading different subsets of work artists
  Drop unneeded work artist credit test SQL
  MBS-8328: Add the non-writer artists back as own column
  MBS-8328: Limit work writers to writing rels
  MBS-11916: Report for recordings marked both karaoke and instrumental (#2504)
  Merge pull request #3468 from derat/feat_error
  MBS-13920 (II): Detect feat. artists in titles when seeding (#3469)
  Use `qq` to avoid escaping "
  MBS-6502: Surround catno search with quotes
  MBS-13922: Add URL cleanup and validation for Naver Vibe (#3463)
  Move most filter find_by to right Data file
  MBS-8500: Add "not by me" filter for collection edit lists
  MBS-13597: Add release filter to label index pages
  Avoid warning when selected_artist_credit_id is missing
reosarevok added a commit that referenced this pull request Feb 24, 2025
* beta:
  Translated using Weblate (Chinese (Simplified Han script))
  Translated using Weblate (Italian)
  Update translation files
  MBS-13917: Add new properties to avoid crashes (#3481)
  Update POT files using the production database
  Merge pull request #3472 from reosarevok/MBS-13929
  Merge pull request #3477 from reosarevok/MBS-13939
  Merge pull request #3478 from reosarevok/MBS-13938
  Merge pull request #3473 from reosarevok/MBS-13930
  Add ordering to `_find_authors_or_other_artists` roles
  Use proper query variable bindings in `Data::Edit::find_by_collection`
  MBS-13914: Validate vote arguments for voter edit search (#3464)
  MBS-13763: Add past year stats to the editors statistic page (#3465)
  MBS-13928: Use jaxsta.com instead of jaxsta.io (#3471)
  add --no-same-owner option to tar (#3456)
  MBS-13925: Instrument name erroneously displayed in link type autocomplete (#3467)
  Avoid spreading `key` props in `useTable` hook (#3476)
  Translated using Weblate (Chinese (Simplified Han script))
  Translated using Weblate (Chinese (Simplified Han script))
  Translated using Weblate (Russian)
  Translated using Weblate (Chinese (Simplified Han script))
  Translated using Weblate (Polish)
  Translated using Weblate (Italian)
  More direct `get_authorship_relationship_gids` implementation
  Rename "misc_artists" to "other_artists"
  MBS-8328: Split the role filter for artist works
  MBS-13917: Rename work "writers" to "authors"
  Get authorship rel gids from the DB
  Rename "composition" to "authorship"
  Add test for loading different subsets of work artists
  Drop unneeded work artist credit test SQL
  MBS-8328: Add the non-writer artists back as own column
  MBS-8328: Limit work writers to writing rels
  MBS-11916: Report for recordings marked both karaoke and instrumental (#2504)
  Merge pull request #3468 from derat/feat_error
  MBS-13920 (II): Detect feat. artists in titles when seeding (#3469)
  Use `qq` to avoid escaping "
  MBS-6502: Surround catno search with quotes
  MBS-13922: Add URL cleanup and validation for Naver Vibe (#3463)
  Move most filter find_by to right Data file
  MBS-8500: Add "not by me" filter for collection edit lists
  MBS-13597: Add release filter to label index pages
  Avoid warning when selected_artist_credit_id is missing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants