feat(api): release-identity resolve endpoint + schemas (1.13.0)#175
Merged
Conversation
WXYC/library-metadata-lookup#526 introduces a release-identity layer to LML. This commit adds the wire shape Backend's generated types will track once LML#530 lands. The new path POST /api/v1/identity/resolve accepts a (kind, source, external_id) triple and returns a stable identity_id with a minted flag; it sits under LMLBearerAuth alongside the existing /api/v1/identity/bulk-resolve-libraries endpoint. The shape is polymorphic on kind for forward compatibility — kind: artist is a documented follow-up — but v1 of the enum has only release. ReleaseIdentitySource matches LML's release/url_parser ParsedSource literal (discogs_release / discogs_master / bandcamp); new sources will land here in lockstep with their column on entity.release_identity and their sentinel rule on the LML side. Validation runs before any DB write — Discogs external_id <= 0, malformed Bandcamp URLs, and unknown sources are rejected with 422 — so no poisoned identity rows can be minted. Bandcamp URLs are canonicalised by LML before mint so trailing-slash and equivalent variants converge on one identity row. Companion PRs: WXYC/library-metadata-lookup#530 (implementation + tests), and a discogs-cache PR that applies the entity.release_identity / entity.release_reconciliation_log DDL to the prod discogs schema (DDL reference in LML#530's entity/release_identity.sql).
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.
Summary
Sibling of WXYC/library-metadata-lookup#530 — the implementation PR for LML#526. Adds the wire shape for
POST /api/v1/identity/resolveso Backend's generated types can track it after LML#530 merges.IdentityKind(v1:releaseonly;artistis the documented follow-up).ReleaseIdentitySource(discogs_release,discogs_master,bandcamp) — matches LML'srelease/url_parser.ParsedSource.ReleaseIdentityResolveRequest(required: [kind, source, external_id]).ReleaseIdentityResolveResponse(required: [identity_id, kind, minted]).POST /api/v1/identity/resolvepath underLMLBearerAuth, tags[lookup], 200/401/422/503 — mirrors the existing/api/v1/identity/bulk-resolve-librariesposture.Version bumps 1.12.0 → 1.13.0.
Merge order
This PR is a precondition for LML#530's Codegen Freshness check turning green. The plan is:
bash scripts/generate_api_models.shagainst the now-up-to-dateapi.yaml. The diff against the hand-editedgenerated/api_models.pyin LML#530 should be empty (or trivial whitespace).entity.release_identity/entity.release_reconciliation_logDDL to prod. Until that lands, the endpoint returns 503 — same posture asentity.identitymissing today.Test plan
generated/api_models.pyCloses none directly — this is a wire-shape addition. Tracking lives on LML#530 and LML#526.