Skip to content

fix(discogs): keep records right through Discogs merges and rematch - #73

Open
npozs77 wants to merge 7 commits into
Jeanball:developfrom
npozs77:fix/sync-moved-copy
Open

npozs77 wants to merge 7 commits into
Jeanball:developfrom
npozs77:fix/sync-moved-copy

Conversation

@npozs77

@npozs77 npozs77 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A Discogs merge or a moved collection entry could be reported wrongly or lead to a duplicate record. Musivault now saves the link to each collection entry earlier, and flags what it cannot match for the user to decide. Rematch now changes only the chosen record.

Fixes #69
Fixes #71
Fixes #72

Changes

One commit per change:

  • Rematch forgets the saved instance id, so the next check does not offer to undo the rematch (narrowed to the rematched record by the rematch commit below).
  • A moved instance id is checked before the release id (Drift report: moved copy shown as new when the old release is also owned #69), so another copy of the old release cannot hide the move.
  • Merges are opt-in: merged rows start unticked and "Apply all" leaves them out. The label "confirmed" is now "same Discogs entry".
  • A check saves clear links: only when one record and one Discogs entry have the release. Apply uses the same rule instead of the earliest of several copies.
  • Review flags: possible move, possible duplicate, shared release. Information only. The new release of a possible move is added only when ticked by hand ("Tick all" and "Apply all" skip it), and flags count in the notification.
  • Rematch moves only the chosen record (Rematch: false "already in your collection", lost custom cover, and other records changed #72): the target album is found or created and never overwritten, only a real duplicate is refused, and the old custom cover is deleted after the save.
  • A new release that a merged record is still on (two copies, one moved) can be ticked only together with that merge, and "Apply all" skips it. Otherwise, with merges opt-in, adding it would be skipped as already in the collection.

New or changed text is in all 7 locales. The stored sync report gets an optional flags field.

How it was verified

  • npm run check passes: lint (0 errors), 371 backend and 211 frontend tests, both builds. The new tests were run before the change they cover and failed.
  • Manual regression of the Discogs sync on a development database: no problems found. It did not cover Rematch.
  • Sync, in a headless browser on copies of a real database (about 1,500 records), against live Discogs:
    • two copies with one moved (Drift report: moved copy shown as new when the old release is also owned #69): the moved copy shows under Merged and the other as New; the new row waits for the merge; applying both moved one record and added the other, nothing skipped, and the moved record kept its date added and instance id;
    • a check on a copy with no saved links stored 1,490;
    • a merged release with a changed year and no link: shown as a possible move, unticked; "Apply all" added the other new records only;
    • ticking it by hand: the next result shows a possible duplicate;
    • the same record with a link: an unticked exact merge; applying it kept the record's notes.
  • Rematch, in a headless browser: with a second user's record (inserted in the database) sharing the album entry, picking another version moved only the rematched record.
  • Rematch, through the API of the running app with real releases and two users: the other user's record stayed on its release; rematching to a removed release worked; a real duplicate was refused and the custom cover kept.
  • Not covered in the running app: the shared release flag (it needs two Discogs copies on the merged release; covered by unit tests), phone width, and languages other than English. The translations have not been checked by native speakers.

Notes for review

  • A check now writes the hidden link. The description says "Your records are not changed" instead of "Nothing is changed".
  • Merges now need a tick, also with "Apply all".
  • Flags are raised only for records with a Discogs id, and a possible move counts once in the notification (not also as new). A shared release stays counted while the situation lasts.
  • Rematch no longer refreshes the stored details of a release Musivault already has (it only fills in missing ones); "Refresh from Discogs" does that.
  • Earlier rematches cannot be repaired automatically because Musivault did not record the previous release or which record was rematched. A stale instance id may show a "same Discogs entry" Merged row. Compare your copy with both releases: applying it may undo an intentional rematch, or restore a record that was changed along with another. It stays unchanged unless you apply it.
  • Several copies of the same release are still shown as one record; that would be a separate feature.

Checklist

  • Targets develop (not main)
  • Title follows Conventional Commits with a scope, e.g. fix(discogs): …
  • Line added to CHANGELOG.md under ## [Unreleased]
  • npm run check passes (lint, tests and build, frontend and backend)
  • New UI strings added to all locales (frontend/src/locales/*/translation.json)
  • Data changes come with a migration in backend/src/scripts/migration-runner.ts (none needed: the new report field is optional and filled by the next check)
  • Screenshots attached for UI changes (not attached yet)

A stored instance id names a Discogs collection entry of the old release.
Keeping it after a rematch makes the Discogs check read it as a merge and
offer to undo the rematch. Rematch edits the album in place, so the id is
cleared on every item that uses that album, after the saves succeed.
With two copies on different pressings, Discogs moving one of them left the
item matched to the other copy: the moved copy was reported as new and the
missing one was not reported. A stored instance id that now sits on another
release is checked first, unless another item has that release.

Fixes Jeanball#69
A Discogs merge can combine different editions, so a merge is applied only
when the user chose it: merged rows start unticked and "Apply all" adds new
records only. The match label now says "same Discogs entry" rather than
"confirmed", which read as a verified pressing.
The instance id was only stored by an apply, so a record that was never part
of one had no exact link when Discogs merged its release, and a merge that
changed the year was missed. A check now stores it too, for matched records
without one, when exactly one record and one Discogs entry have the release.
Apply follows the same rule instead of linking the earliest of several copies.
When the check cannot match a record, it now says what the record may be
related to: a new look-alike release with another year (possible move), a
release another record already has (possible duplicate), or one where
Discogs has two copies (shared release). Flags change nothing. The new
release of a possible move is added only when ticked by hand, and flags
count in the notification.
Rematch rewrote the record's album entry in place. Every record sharing it,
including other users', changed with it; an existing entry for the target
release caused a false "already in your collection"; and the custom cover
was deleted before the failing save. Rematch now finds or creates the target
album, refuses only a real duplicate, points this record to it, and removes
the old cover after the save. The instance id is cleared on this record only.

Fixes Jeanball#72
With two copies, one of them moved, the other copy is new on a release the
record is still on. With merges opt-in it started ticked while its merge did
not, so the default apply skipped it as already in the collection. Such a row
can now be ticked only with its merge and is left out of "Apply all". The
merged hint no longer says the old release is gone from the collection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant