Skip to content

Resolve DataCite DOIs when Crossref has no record - #321

Merged
dknauss merged 2 commits into
mainfrom
claude/project-thread-1nf9yh-datacite
Nov 29, 2026
Merged

dknauss merged 2 commits into
mainfrom
claude/project-thread-1nf9yh-datacite

Conversation

@dknauss

@dknauss dknauss commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Requested by Dan · project thread

Summary

  • What changed? When Crossref answers 404 for a DOI, the editor now looks it up in DataCite through a new editor-only route, GET /bibliography/v1/datacite?doi=…. The route requires edit_posts.
    • The route calls DataCite's fixed content-negotiation host (api.datacite.org/dois/application/vnd.citationstyles.csl+json/). It goes through the shared bibliography_builder_resolve_remote_csl(), so it gets the same wp_safe_remote_get, 1 MB cap, timeout and outcome cache as the other resolvers.
    • Crossref is still asked first. Only its 404 falls through to DataCite. Any other Crossref failure, such as an outage or a rate limit, is reported as it is. If DataCite has no record either, the user sees the same "Couldn't parse the DOI" error as before.
    • The route tidies DataCite's CSL before returning it:
      • stores the DOI in lowercase (DataCite sends it uppercase);
      • turns a name with only a family part into a literal name (DataCite sends organizations that way, for example "The pandas development team");
      • maps an unknown type to document, as the Crossref path does;
      • drops id, categories, copyright and abstract;
      • keeps publisher as the repository (Zenodo, Dryad), which is where APA 7 and Chicago put it for datasets and software.
  • Why? Datasets, software, and Zenodo, figshare and Dryad deposits are registered with DataCite, not Crossref, so their DOIs failed. This is item 1 in the interoperability assessment (Assess the value and priority of the interoperability roadmap items #318). Dan approved it in the project thread.
  • Demo and docs:
    • The Playground DOI group adds a Dryad dataset (10.5061/dryad.8515) and a Zenodo software release (10.5281/zenodo.3509134). I ran npm run playground:build.
    • DataCite is listed under External Services in readme.txt and README.md.
    • Also updated: CHANGELOG (Unreleased, Added), SPEC.md, CLAUDE.md, docs/current-metrics.md and the function inventory.

The two demo DOIs were checked against DataCite's live service on 2026-11-29, and the PHPUnit fixtures use those responses. Crossref answers 404 for both DOIs.

Validation

  • npm run lint:js passes. Its one warning is in src/components/editor-canvas-notices.js, a file this PR doesn't touch.
  • npm run lint:css: not run, no CSS changed
  • npm run lint:i18n: not run here. The new strings are in PHP and use the plugin's text domain.
  • npm run test passes (1,637 tests). Five new tests in parser.test.js cover the fallback, no fallback on a Crossref hit, no fallback on a Crossref 503, one error when neither registry knows the DOI, and caching.
  • composer test:php passes (890 tests). The new DataciteResolverTest covers DOI normalization, mapping, encoding, 404 and 204 answers, an invalid response, rejection without a request, and capability. RestEndpointsTest pins the route at index 13.
  • composer lint:php, Psalm, npm run typecheck:js, Prettier, and verify-metrics.sh pass.
  • npm run build: not run here
  • Tested in the block editor: not done. This container can't reach api.datacite.org, so the Playground demo is the live check.

Checklist


Generated by Claude Code

DOIs for datasets, software, and repository deposits (Zenodo, figshare,
Dryad) are registered with DataCite, not Crossref, so they failed with
"Couldn't parse the DOI." The editor now asks DataCite through a new
editor-only route, GET /bibliography/v1/datacite?doi=, after a Crossref
404. Crossref stays first and only its 404 falls through.

The route calls DataCite's fixed content negotiation host through the
shared resolver (wp_safe_remote_get, size cap, outcome cache), stores the
DOI in lowercase, turns family-only names into literal ones, and drops
the id, keywords, license, and abstract.

Adds a Dryad dataset and a Zenodo software sample to the Playground
demo, the External Services entry to the readmes, and a CHANGELOG entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WPtgA1ucj4SXVReThDWAhs
@dknauss dknauss self-assigned this Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Plugin readme preview

Open preview · Commit ddae1ab

37 passed · 0 warnings · 0 notes

Passed checks (37)
  • 145 / 150 characters in the short description.
  • Plugin name header recognized.
  • License header recognized: GPLv2 or later.
  • 5 tags accepted within the five-tag limit.
  • Description is within the parser’s word limit.
  • Installation is within the parser’s word limit.
  • Faq is within the parser’s word limit.
  • Changelog is within the parser’s word limit.
  • Tested up to 7.1, the latest WordPress major release.
  • Stable tag is declared: 1.22.0.
  • The PHP Version header is declared: 1.22.0.
  • Stable tag matches the PHP Version header: 1.22.0.
  • The readme “Requires at least” value is valid: 6.4.
  • The PHP “Requires at least” header is a numeric version: 6.4.
  • “Requires at least” matches between the readme and PHP header: 6.4.
  • The readme “Requires PHP” value is valid: 8.1.
  • The PHP “Requires PHP” header is a numeric version: 8.1.
  • “Requires PHP” matches between the readme and PHP header: 8.1.
  • “Tested up to” 7.1 meets the minimum WordPress version 6.4.
  • Installation content is present.
  • FAQ content is present.
  • Changelog content is present.
  • Screenshot captions are present.
  • The first changelog release matches Stable tag: 1.22.0.
  • The first changelog release matches PHP Version: 1.22.0.
  • Banner image loaded.
  • Plugin icon loaded.
  • Screenshot 1 has a matching image and caption.
  • Screenshot 2 has a matching image and caption.
  • Screenshot 3 has a matching image and caption.
  • Screenshot 4 has a matching image and caption.
  • Screenshot 5 has a matching image and caption.
  • Screenshot 6 has a matching image and caption.
  • Screenshot 7 has a matching image and caption.
  • Screenshot 8 has a matching image and caption.
  • Screenshot 9 has a matching image and caption.
  • Plugin PHP header loaded.

Readme and PHP-header checks only; this does not test plugin runtime compatibility.

@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.52174% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.39%. Comparing base (01e86f5) to head (ddae1ab).

Files with missing lines Patch % Lines
src/lib/parser-resolvers.js 82.35% 1 Missing and 2 partials ⚠️
includes/resolvers.php 98.57% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #321      +/-   ##
============================================
+ Coverage     87.30%   87.39%   +0.08%     
  Complexity       67       67              
============================================
  Files           113      113              
  Lines         12646    12760     +114     
  Branches       1337     1341       +4     
============================================
+ Hits          11041    11151     +110     
- Misses          487      489       +2     
- Partials       1118     1120       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…-1nf9yh-datacite

# Conflicts:
#	.wordpress-org/blueprints/blueprint.json
#	CHANGELOG.md
#	docs/current-metrics.md
#	playground/blueprint-main.json
#	playground/blueprint-write-api.json
#	playground/blueprint.json
@dknauss
dknauss marked this pull request as ready for review November 29, 2026 23:46
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-29T23:46:09.189980Z
We couldn’t complete this review. Comment @codex review to try again.
ddae1ab Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@dknauss
dknauss merged commit 978e650 into main Nov 29, 2026
24 of 25 checks passed
@dknauss
dknauss deleted the claude/project-thread-1nf9yh-datacite branch November 29, 2026 23:52
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.

2 participants