Repository navigation
Fix the live API contract tests and update the GitHub Actions - #148
Merged
Merged
Conversation
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 & 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
10.1021/mock.escapedtoCROSSREF_RESPONSESfor 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 newCROSSREF_SYNTHETIC_RESPONSES, which the mock serves but the contract tests do not check, asCROSSREF_INVALID_DOISalready does for invalid DOIs.CONTRIBUTING.mdsays where a made-up record goes.10.1021/ef4017762(Zhang et al., Energy & Fuels 27, 6247-6254, 2013) is recorded as CrossRef returns it, with the journal name escaped asEnergy & Fuels. The weekly contract tests now fail if CrossRef ever stops escaping it, which the converter and validator rely on when they unescape it.main. The pull request checklist inCONTRIBUTING.md, and the live API sections there and in the development docs, now ask contributors to runpytest -m live_apibefore submitting any pull request, whatever it changes. The development docs also now describeCROSSREF_SYNTHETIC_RESPONSES.live-api.yml, the sameif: github.repository == 'pr-omethe-us/PyKED'the publish and docs workflows use, so forks no longer repeat the weekly run.actions/checkoutv4 → v7,actions/setup-pythonv5 → v7,actions/upload-artifactv4 → v7,actions/download-artifactv4 → 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@v4already 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_apipasses 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 inci.ymlrun on this PR, and those ingh-pages.ymlrun on merge.live-api.ymlcan be run by hand with Run workflow after merge, andpublish.ymlruns only at the next release tag.🤖 Generated with Claude Code