Skip to content

API-IMPORT-ORCID-BATCH-01: Add exact batch contributor lookup by ORCID - #860

Merged
ja573 merged 3 commits into
masterfrom
hotfix/import-orcid-batch-01
Aug 28, 2026
Merged

API-IMPORT-ORCID-BATCH-01: Add exact batch contributor lookup by ORCID#860
ja573 merged 3 commits into
masterfrom
hotfix/import-orcid-batch-01

Conversation

@ja573

@ja573 ja573 commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

Implements API-IMPORT-ORCID-BATCH-01 from #851 under parent coordination #850.

This is the CTO-approved direct-to-master hotfix 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

Any new source commit invalidates that exact-head approval.

Contract

contributorsByOrcids(orcids: [Orcid!]!): [Contributor!]!

Uses the existing Orcid scalar and stored canonical representation.

Behaviour:

  • accepts 0..=1000 values;
  • 1000 returns a field error before database access;

  • empty input returns [] without database access;
  • accepted non-empty input uses one contributor-specific set-based exact eq_any lookup;
  • unknown ORCIDs are omitted;
  • duplicate inputs do not require duplicate outputs;
  • partial/substr matches are impossible;
  • existing contributors(filter:), writes, identity, uniqueness, history and authorization semantics remain unchanged.

Scope

Changed only:

  • thoth-api/src/model/contributor/crud.rs
  • thoth-api/src/model/contributor/tests.rs
  • thoth-api/src/graphql/query.rs
  • thoth-api/src/graphql/tests.rs
  • CHANGELOG.md

No 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 .env symlink 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 307f0435817d5df485ff3b51d61bc0b4585b57b8 with 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_request CI and to permit the existing Docker workflow to publish its automatic GHCR staging-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:

  • source changes;
  • manual CI dispatch/rerun;
  • merge;
  • release/tag publication beyond the automatic PR staging image;
  • deployment or production activation;
  • master -> develop reconciliation;
  • Metrics branch mutation;
  • thoth-app#163 implementation.

Next control gate: verify exact PR base/head, all PR-triggered CI and staging-image publication, then assess merge readiness.

Refs #851
Refs #850

ja573 added 2 commits August 28, 2026 15:33
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

ja573 commented Aug 28, 2026

Copy link
Copy Markdown
Member Author

CI disposition - release-line baseline blocker, not ORCID source regression

Exact PR head: 307f0435817d5df485ff3b51d61bc0b4585b57b8
Exact PR base: master @ 40e9c06d4ab76217c3ef277dd539d3b5580e2bb8

build-test-and-check run 33182671533 failed only in Clippy. Build, workspace tests and formatting passed. The three failing clippy::useless_format assertions are pre-existing in thoth-api/src/model/tests.rs; this PR and master carry the same blob 45353520bf4d0ed199c1757b692f43bdbff8f389 for that file.

The defect was already repaired on develop by completed #844. Release-line propagation is now tracked separately as LOW-risk prerequisite #861, whose specification is independently approved at comment 5454442905 and awaits CTO specification approval.

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 master, reconciliation of the new master lineage into this hotfix branch requires separate authorization. Any resulting new head invalidates the current exact-head source approval and requires fresh review plus automatic CI before merge readiness.

@ja573
ja573 marked this pull request as ready for review August 28, 2026 18:12
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

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