Skip to content

feat(api): release-identity resolve endpoint + schemas (1.13.0)#175

Merged
jakebromberg merged 1 commit into
mainfrom
lml-526-release-identity-schemas
Jun 10, 2026
Merged

feat(api): release-identity resolve endpoint + schemas (1.13.0)#175
jakebromberg merged 1 commit into
mainfrom
lml-526-release-identity-schemas

Conversation

@jakebromberg

Copy link
Copy Markdown
Member

Summary

Sibling of WXYC/library-metadata-lookup#530 — the implementation PR for LML#526. Adds the wire shape for POST /api/v1/identity/resolve so Backend's generated types can track it after LML#530 merges.

  • IdentityKind (v1: release only; artist is the documented follow-up).
  • ReleaseIdentitySource (discogs_release, discogs_master, bandcamp) — matches LML's release/url_parser.ParsedSource.
  • ReleaseIdentityResolveRequest (required: [kind, source, external_id]).
  • ReleaseIdentityResolveResponse (required: [identity_id, kind, minted]).
  • POST /api/v1/identity/resolve path under LMLBearerAuth, tags [lookup], 200/401/422/503 — mirrors the existing /api/v1/identity/bulk-resolve-libraries posture.

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:

  1. Merge this PR.
  2. In LML#530's branch, run bash scripts/generate_api_models.sh against the now-up-to-date api.yaml. The diff against the hand-edited generated/api_models.py in LML#530 should be empty (or trivial whitespace).
  3. LML#530's Codegen Freshness gate flips green; merge LML#530.
  4. Separate discogs-cache PR applies the new entity.release_identity / entity.release_reconciliation_log DDL to prod. Until that lands, the endpoint returns 503 — same posture as entity.identity missing today.

Test plan

  • YAML lints (no schema-validation tool changes needed; manual diff review)
  • Downstream LML#530 regen produces no diff against its hand-edited generated/api_models.py

Closes none directly — this is a wire-shape addition. Tracking lives on LML#530 and LML#526.

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).
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.

1 participant