API-IMPORT-ORCID-BATCH-01: Add exact batch contributor lookup by ORCID - #860
Conversation
Bulk import resolves existing contributors by ORCID through `contributors(filter:)`, whose generic leading-wildcard ILIKE over full_name, last_name and orcid forces one GraphQL request per distinct ORCID plus an exact comparison client-side. A real 866-product ONIX import carries 538 distinct canonical ORCIDs, contributing hundreds of remote reads. Add one additive top-level query, `contributorsByOrcids(orcids: [Orcid!]!): [Contributor!]!`, backed by a contributor-specific model helper performing a single set-based Diesel `eq_any` load against the existing `idx_contributor_orcid` btree. Matching is exact equality only, so partial identifiers never match; unknown values are omitted, and each matching contributor is returned at most once however often it is requested. Input is bounded to 1000 values at the GraphQL boundary: a larger list returns a clear field error without truncating and without reaching the database, and an empty list returns [] without reaching it either. Values must already be in Thoth's stored representation `https://orcid.org/XXXX-XXXX-XXXX-XXXX`; no new normalisation policy is introduced. The generic `Crud` contract is untouched, and `contributors(filter:)`, `contributor(id:)`, contributor writes, ORCID uniqueness, history and authorization semantics are unchanged. The new read keeps exactly the public exposure of the existing contributor reads. No migration, schema or generated committed artifact is required. Evidence is structural rather than wall-clock: a 500-value request is proven to issue exactly one contributor statement containing `= ANY`. API-IMPORT-ORCID-BATCH-01 Refs #851, #850
The Unreleased entry claimed bulk import "no longer issues one request per ORCID". That is premature: this repository change supplies only the upstream API primitive, and thoth-app#163 has not yet consumed or deployed it. State the capability instead of downstream activation: the query allows bulk-import clients to avoid one request per ORCID. No other part of the entry is changed, and no source, test or API behaviour is affected. API-IMPORT-ORCID-BATCH-01 Refs #851, #850
CI disposition - release-line baseline blocker, not ORCID source regressionExact PR head:
The defect was already repaired on PR #860 therefore remains HOLD - CI BLOCKED BY #861. No ORCID source correction is requested from this PR at this gate. After #861 is separately implemented/reviewed/merged to |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary
Implements
API-IMPORT-ORCID-BATCH-01from #851 under parent coordination #850.This is the CTO-approved direct-to-
masterhotfix path for the bulk-import ORCID lookup regression. It adds an exact, bounded batch contributor lookup so downstream bulk-import clients can avoid issuing one GraphQL request per ORCID.Exact source
master @ 40e9c06d4ab76217c3ef277dd539d3b5580e2bb8307f0435817d5df485ff3b51d61bc0b4585b57b8hotfix/import-orcid-batch-015454056658Any new source commit invalidates that exact-head approval.
Contract
Uses the existing
Orcidscalar and stored canonical representation.Behaviour:
[]without database access;eq_anylookup;contributors(filter:), writes, identity, uniqueness, history and authorization semantics remain unchanged.Scope
Changed only:
thoth-api/src/model/contributor/crud.rsthoth-api/src/model/contributor/tests.rsthoth-api/src/graphql/query.rsthoth-api/src/graphql/tests.rsCHANGELOG.mdNo migrations, schema.rs, Cargo dependency files, workflows, Metrics source/contracts, auth changes, provider/runtime configuration or generated committed artifacts.
Validation and review
Implementation used focused model and GraphQL regression tests, including deterministic structural evidence that a representative hundreds-item request issues one contributor statement containing
= ANY.The implementing session reported the required local Rust/workspace gates green, but it also disclosed a temporary untracked
.envsymlink used to satisfy an existing build-script assumption. That symlink was outside the authorized action budget and was removed. The local full-workspace run is therefore supporting evidence only, not independent CI evidence.Independent review by GPT-5.6 Sol approved exact head
307f0435817d5df485ff3b51d61bc0b4585b57b8with no remaining blocking source finding. The changelog follow-up correctly states the API as a client capability rather than claiming thoth-app has already adopted it.Automatic PR side effect
Opening this PR is explicitly authorized to run normal repository
pull_requestCI and to permit the existing Docker workflow to publish its automatic GHCRstaging-pr-*image for this PR. That is the only registry-publication authorization at this gate.Remaining gates
This PR is intentionally DRAFT.
Not authorized by PR creation:
master -> developreconciliation;Next control gate: verify exact PR base/head, all PR-triggered CI and staging-image publication, then assess merge readiness.
Refs #851
Refs #850