Repository navigation
library-identity-consumer writes the main-row release from LML and keeps it on null (BS#3809) - #3810
Merged
Merged
Conversation
…eps it on null (BS#3809) projectMainRow now takes discogs_release_id and discogs_master_id from the bulk-resolve result (the nullable pin fields of @wxyc/shared 12.22.0, mirrored into the job's inlined lml-types) instead of hard-coding null, and maps the 0 sentinel to null. The main-row upsert keeps the stored release when LML sends null (COALESCE(EXCLUDED, stored)), so a row without a pin is never wiped and a picker write survives the next run. The master follows its release: it is kept with a kept release and replaced, even by null, with a replaced one, so a new release without a master never keeps the previous release's master. Every other column in the ON CONFLICT clause, notes and agreement_sources included, still follows LML. writer.ts also builds to dist/writer.cjs so a new Postgres spec runs the real upsert: a release is written, a later null keeps it, a later different release replaces it, a release without a master clears the old master, and an unpinned row stays empty. Part of #3790
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3809
Slice B1c of the Discogs release picker (#3790): the library-identity-consumer writes the main-row release an MD pin decided, and keeps it when LML later sends null.
Changes
projectMainRowtakesdiscogs_release_idanddiscogs_master_idfrom the bulk-resolve result instead of hard-coding null. These are the nullable pin fields in@wxyc/shared12.22.0, mirrored into the job's inlinedlml-types.ts. It now takes the wholesingle_artistresult, since the fields sit on the result and not onmain. A 0 sentinel maps to null."discogs_release_id" = COALESCE(EXCLUDED."discogs_release_id", library_identity."discogs_release_id"), so a row without a pin is never wiped and B2's picker write survives the next run.CASE WHEN EXCLUDED."discogs_release_id" IS NULL THEN <stored master> ELSE EXCLUDED."discogs_master_id" END. A plainCOALESCEon the master would keep release A's master after a re-pin to release B when B has no master, because the contract sends null for that case. Pinning B now clears it.ON CONFLICTclause changes.notes,agreement_sources,method,confidence,last_verified_atand the artist-level ids still follow LML on every run, as the plan's B2 step expects.writer.tsalso builds todist/writer.cjs(the same mechanism asalbum-metadata-extended-fill) so the Postgres spec runs the real upsert.Not in this PR: the
@wxyc/sharedbumpThe ticket asks for a bump to 12.22.0. It is left out because 12.20.0 also lets music directors grant
reviews_beta(canAssignCapability), which is #3783's behavior change. It failstests/unit/authentication/capability-assign-guard.test.ts, and it would ship an auth change inside a picker slice. This job never imports@wxyc/shared, since it inlines the contract types, so B1c does not need the bump. The bump should land with #3783, or before B2 as its own PR that adopts that change.Tests
tests/unit/jobs/library-identity-consumer/writer.test.ts): a parameterizedprojectMainRowtable covering a pin with a master, a pin without one, null, absent (an older producer) and 0, plus a check of the upsert'sCOALESCE/CASEshape.tests/integration/library-identity-consumer-release-keep.spec.js): a release is written, a later null keeps it, and a later different release replaces it; a release without a master clears the old master; an unpinned row stays empty. Against the pre-change writer, 2 of its 3 tests fail.Local verification
tsc --noEmit,eslintandprettier --checkon the changed files: clean. Workspacenpm run typecheck: clean. Job unit suites: 157/157.seed_db.sqlapplied: 3/3 pass. This was not the full integration harness (no global setup, auth or other specs); CI runs that.Part of #3790.