Skip to content

Fix the live API contract tests and update the GitHub Actions - #148

Merged
kyleniemeyer merged 6 commits into
pr-omethe-us:mainfrom
kyleniemeyer:fix-live-api-tests
Nov 16, 2026
Merged

kyleniemeyer merged 6 commits into
pr-omethe-us:mainfrom
kyleniemeyer:fix-live-api-tests

Conversation

@kyleniemeyer

Copy link
Copy Markdown
Member

The weekly live API contract tests have failed since #145, here and in forks with Actions enabled. This fixes them, adds a check of the assumption behind #145's HTML unescaping, keeps the weekly run to this repository, and moves the workflows off the deprecated Node.js 20 actions.

  • Made-up CrossRef record kept out of the contract tests. Validation fixes, ReSpecTh time shifts and speciation export #145 added the made-up DOI 10.1021/mock.escaped to CROSSREF_RESPONSES for the unescaping tests. The contract tests check every DOI there against the real CrossRef API, which returns 404 for it. It now lives in a new CROSSREF_SYNTHETIC_RESPONSES, which the mock serves but the contract tests do not check, as CROSSREF_INVALID_DOIS already does for invalid DOIs. CONTRIBUTING.md says where a made-up record goes.
  • Real Energy & Fuels record. 10.1021/ef4017762 (Zhang et al., Energy & Fuels 27, 6247-6254, 2013) is recorded as CrossRef returns it, with the journal name escaped as Energy & Fuels. The weekly contract tests now fail if CrossRef ever stops escaping it, which the converter and validator rely on when they unescape it.
  • Run the live tests before every pull request. The default run and the CI checks on pull requests both skip them, which is how Validation fixes, ReSpecTh time shifts and speciation export #145's DOI reached main. The pull request checklist in CONTRIBUTING.md, and the live API sections there and in the development docs, now ask contributors to run pytest -m live_api before submitting any pull request, whatever it changes. The development docs also now describe CROSSREF_SYNTHETIC_RESPONSES.
  • Repository guard on live-api.yml, the same if: github.repository == 'pr-omethe-us/PyKED' the publish and docs workflows use, so forks no longer repeat the weekly run.
  • Action versions: actions/checkout v4 → v7, actions/setup-python v5 → v7, actions/upload-artifact v4 → v7, actions/download-artifact v4 → v8, all on Node.js 24. None of the breaking changes in between affects these workflows (details in the commit message). peaceiris/actions-gh-pages@v4 already runs on Node.js 24, and the Coveralls and PyPI publish actions are composite.

Checked locally: the default suite passes (1,266 tests), pytest -m live_api passes against the real CrossRef and ORCID APIs (26 tests, including the new record), and the docs build with warnings treated as errors. The updated actions in ci.yml run on this PR, and those in gh-pages.yml run on merge. live-api.yml can be run by hand with Run workflow after merge, and publish.yml runs only at the next release tag.

🤖 Generated with Claude Code

kyleniemeyer and others added 6 commits November 16, 2026 14:19
PR pr-omethe-us#145 added the made-up DOI 10.1021/mock.escaped to CROSSREF_RESPONSES
for the HTML-unescaping tests. The live API contract tests check every
DOI in CROSSREF_RESPONSES against the real CrossRef API, which returns
404 for it, so the weekly run has failed since pr-omethe-us#145 was merged.

Move it to a new CROSSREF_SYNTHETIC_RESPONSES, which the mock serves
alongside CROSSREF_RESPONSES but the contract tests do not check, as
CROSSREF_INVALID_DOIS already keeps the DOIs that should look invalid.
CONTRIBUTING.md says where a made-up record goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The converter and validator unescape CrossRef's journal and author names
because CrossRef HTML-escapes them, returning "Energy &amp; Fuels". The
made-up record used to test that is not checked against CrossRef, so
nothing would notice if CrossRef stopped escaping.

Add the real record of 10.1021/ef4017762 (Zhang et al., "Shock-Tube
Measurements of Ignition Delay Times for the Ethane/Dimethyl Ether
Blends", Energy & Fuels 27, 6247-6254, 2013), copied as CrossRef returns
it, with the escaped journal name. The weekly contract tests now check
it like the other real records, and fail if the title stops matching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The weekly schedule also ran in forks with Actions enabled, such as
kyleniemeyer/PyKED, repeating the check and sending each fork owner its
own failure notice. Guard the job with the same repository condition the
publish and docs workflows already use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub has deprecated Node.js 20 for actions, and the runners already
force actions/checkout@v4 and actions/setup-python@v5 onto Node.js 24
with a warning. Move every workflow to the current major versions:

- actions/checkout v4 -> v7
- actions/setup-python v5 -> v7
- actions/upload-artifact v4 -> v7
- actions/download-artifact v4 -> v8

None of the breaking changes in between affects these workflows:
download-artifact v5 changed only downloads by artifact ID (publish.yml
downloads by name), v8 fails on a digest mismatch instead of warning,
checkout v6 keeps credentials in a separate file and v7 blocks fork
checkouts only for pull_request_target and workflow_run, and
setup-python v7 drops the unused pip-install input. All need runner
2.327.1 or later; GitHub's hosted runners are newer.

peaceiris/actions-gh-pages@v4 already runs on Node.js 24, and
coverallsapp/github-action@v2 and pypa/gh-action-pypi-publish@release/v1
are composite actions, so they are unchanged. The changelog notes this
and the repository guard on the live API workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default test run and the CI checks on pull requests both skip the
live API contract tests, so a problem they would catch, such as the
made-up DOI pr-omethe-us#145 added to the mock data, surfaces only in the weekly run
after it is merged. Ask contributors to run pytest -m live_api before
submitting any pull request, whatever it changes, since the tests are
there to catch errors no one expected. Say so in the pull request
checklist and the live API section of CONTRIBUTING.md, and in the same
section of the development docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The development docs still said to add every mocked DOI to
CROSSREF_RESPONSES, and that doing so keeps the contract tests correct,
which is not so for a made-up record. Point made-up records to
CROSSREF_SYNTHETIC_RESPONSES, which the contract tests do not check, as
CONTRIBUTING.md already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyleniemeyer
kyleniemeyer merged commit ca08181 into pr-omethe-us:main Nov 16, 2026
5 checks passed
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