Repository navigation
docs: add citation metadata - #244
Conversation
Add CITATION.cff (CFF 1.2.0), so that GitHub shows "Cite this repository" and Zenodo archives releases with it. Authors are the people who committed at least 100 lines to dev (proTES has no releases yet), ordered by lines, then commits; names and ORCID iDs from the maintainer's contributor table, affiliations only from public ORCID records, no e-mail addresses. scripts/citation.py sets and checks version and date-released of a release, as in Cloud Registry and FOCA, with tests (100% coverage of scripts/, which coverage and mypy now include). It runs on Python 3.10 (datetime.timezone.utc instead of datetime.UTC). CI validates the file with cffconvert. The contributing and development docs describe who is an author, how to add or correct an entry and the release step. Closes #235. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideAdds CFF citation metadata with contributor attribution, a tested standard-library release helper, CI schema validation, expanded static-analysis coverage, and documentation for maintaining citation data during releases. Flow diagram for citation metadata release maintenanceflowchart LR
A["CITATION.cff"] --> B["python scripts/citation.py set X.Y.Z"]
B --> C["version and date-released"]
C --> D["python scripts/citation.py check X.Y.Z"]
D --> E["Release commit"]
A --> F["cffconvert --validate"]
F --> G["CI schema validation"]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #244 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 19 20 +1
Lines 900 987 +87
=========================================
+ Hits 900 987 +87 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 5 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="scripts/citation.py" line_range="196" />
<code_context>
+ """
+ temporary = path.with_name(f".{path.name}.tmp")
+ try:
+ temporary.write_text(text, encoding="utf-8")
+ temporary.replace(path)
+ finally:
</code_context>
<issue_to_address>
**Release helper follows a planted symlink**
When a contributor commits `.CITATION.cff.tmp` as a symlink to a file writable by the maintainer, and the maintainer runs the documented `set` command in that checkout, `temporary.write_text` follows the symlink and truncates its target, then `temporary.replace(path)` installs that symlink as `CITATION.cff`; the maintainer’s local file is overwritten.
Create the temporary file with an exclusive, unpredictable name in the same directory (for example, using `tempfile.mkstemp`) before writing and atomically replacing the citation file.
</issue_to_address>
### Comment 2
<location path="scripts/citation.py" line_range="174" />
<code_context>
+ ValueError: If `version` differs or is missing, or `date-released` is
+ missing, invalid or later than `today`.
+ """
+ actual = _value(text, "version")
+ if actual != version:
+ raise ValueError(
</code_context>
<issue_to_address>
**Invalid release versions pass validation**
When the check argument and citation file contain the same malformed or non-release version, `check_release` compares the values without calling `_check_version`, so the matching invalid version passes and the caller sees a successful release check.
Call `_check_version` to validate the requested version before comparing it with the citation file.
</issue_to_address>
### Comment 3
<location path="scripts/citation.py" line_range="233" />
<code_context>
+ try:
+ text = path.read_text(encoding="utf-8")
+ if args.command == "set":
+ text = set_release(text, args.version, args.date or today)
+ _write(path, text)
+ else:
</code_context>
<issue_to_address>
**Future release date is written**
When `set` is given a valid `--date` later than the current UTC date, `set_release` writes the supplied date without checking it against `today`, and `main` then saves it and returns success. A later `check` rejects that same metadata as being in the future, leaving the file in a state the helper cannot validate.
Reject dates later than `today` before writing the file.
</issue_to_address>
### Comment 4
<location path="scripts/citation.py" line_range="194-199" />
<code_context>
+ path: File.
+ text: New content.
+ """
+ temporary = path.with_name(f".{path.name}.tmp")
+ try:
+ temporary.write_text(text, encoding="utf-8")
+ temporary.replace(path)
+ finally:
+ temporary.unlink(missing_ok=True)
+
+
</code_context>
<issue_to_address>
**Concurrent updates use the same temporary file**
When two `set` commands run concurrently against the same citation file, both commands read the same old file and write to the same temporary path, so one can publish the other command’s metadata while the other fails after the temporary file is moved; callers see an unexpected release version or a failed command.
Give each invocation its own securely created temporary file before replacing the citation file.
</issue_to_address>
### Comment 5
<location path="scripts/citation.py" line_range="5" />
<code_context>
+
+Zenodo archives each GitHub release with the `CITATION.cff` of the tagged
+commit, so `version` and `date-released` are set before the release is
+tagged, and the release workflow checks them. Errors are printed as GitHub
+annotations to standard error.
+
</code_context>
<issue_to_address>
**Release metadata checks are overstated**
When a maintainer relies on the comments to understand which release checks CI performs, the comments claim a release workflow checks citation metadata, but the repository has no release workflow and the checks workflow only validates the CFF schema, so a maintainer can tag a release without checking that its metadata matches.
Update the comments to describe the checks the repository actually runs.
Also at `scripts/citation.py:30`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 4 findings to address first, and an incorrect author entry or release date/version could appear in GitHub-generated citations or be captured in a Zenodo release record. Reverting fixes the repository metadata, but already-issued citations or archived records may need separate correction.
Blocking findings: scripts/citation.py:196, scripts/citation.py:174, scripts/citation.py:233, scripts/citation.py:199
Address the Sourcery review of scripts/citation.py: - Write through a temporary file with a new, unpredictable name (tempfile.mkstemp), so that a planted file or link is never written to and concurrent runs don't share it; keep the file's permissions. - Check that the version passed to check is a release version, also if the file has the same invalid one. - Refuse set --date with a date after today (UTC), which check rejects. - Describe the checks as they are: check runs on the release commit (there is no release workflow yet). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #235.
Summary
Citation metadata as in Cloud Registry (elixir-cloud-aai/cloud-registry#180, elixir-cloud-aai/cloud-registry#186) and FOCA (elixir-cloud-aai/foca#415):
CITATION.cff(CFF 1.2.0): title, abstract (from the README's synopsis),type: software, authors,repository-code,url(the docs), keywords,license: Apache-2.0. Noversion/date-releasedyet (no release), no DOI (docs: add the Zenodo DOI and badge #237). Themessageexplains the author order and the asterisk convention for equal contributors, as in the other repositories.scripts/citation.py(set X.Y.Z [--date],check X.Y.Z) andtests/test_citation.py: Cloud Registry's, adapted to Python 3.10, which proTES supports and CI tests (datetime.timezone.utcinstead ofdatetime.UTC, and a quoted return annotation instead oftyping.Self, both new in 3.11).scriptsis added to coverage (source) and mypy (files), and un-ignored in.gitignore(as in Cloud Registry).checks.yaml, "Static code analysis"):pipx run --spec cffconvert==2.0.0 cffconvert --validate -i CITATION.cff.citation.py set, thencheckon the release commit) under "Versioning and releases" in the development page.Release workflow (#44, #230)
proTES has no release workflow yet: #230 (for #44) adds it and is not merged. So the release workflow's
Check citation metadatastep (python scripts/citation.py check "${VERSION}") and the matching wording ("the release workflow fails if they don't match") are not part of this PR; the docs say for now thatcheckis run on the release commit. I left a note in #230 and #44 to add the step (as in elixir-cloud-aai/cloud-registry#180) when #230 lands.Authors
Rule (maintainer decisions in #235): at least 100 lines added, counted on
dev(proTES has nov*tags/releases), per person across commit identities, without merge commits, bots (Dependabot), the reformat commit in.git-blame-ignore-revs(#227), lock files, the vendored GA4GH specifications (pro_tes/api/*task_execution_service*),LICENSE/CODE_OF_CONDUCT.mdand binaries. Order by lines, then commits; no ties to mark. Names and ORCID iDs from the maintainer's contributor table; affiliations only from public ORCID records.Below the threshold: Javed Habib (see below), Valentin Schneider-Lunitz (78), Álvaro González (59), Yuvraj Singh (56), Athitheya Gobinathan (55), Marius Dieckmann (30), Soham Ratnaparkhi (17), Soumyadip De (12), Roberto Preste (6).
Judgement calls
=0.12.1(in feat: models for custom config validation #186) are not counted: the file is the accidentally committed output of apip install(a shell redirect), not authored work. Still 340 lines. Listed asname: Nidhi, the mononym in the table.Field(None, example=…)toField(default=None, examples=[…])); the authored remainder (about 40 lines) is below 100.pro_tes/api/middleware_management.yaml, feat: add middleware management API specs #196): proTES's own spec, not a vendored one, so counted. His public ORCID record lists only "Personal Enhancement Center" (no dates, not academic), so no affiliation.dev, so no entry. No e-mail addresses anywhere (a test checks that the file has none).Sourcery review
All five findings on
scripts/citation.pyfixed in 2294b1c (threads answered and resolved), with tests:setwrites throughtempfile.mkstemp(exclusive, unpredictable name next to the file) instead of a fixed.CITATION.cff.tmp, so a planted file or link is never written to and concurrent runs don't share it; the file's permissions are kept.checkrejects invalid versions even if the file has the same one.set --daterefuses dates after today (UTC), whichcheckwould reject.These are improvements over the copies in Cloud Registry and FOCA, which still have the fixed temporary name and the other gaps; for consistency, the same changes should go there (follow-up, not part of this PR).
Light lane
Light lane: docs, a stdlib-only release helper with tests, and a CI validation step.
Verification
pre-commit run --all-files: all hooks pass (ruff, mypy now includingscripts, semgrep, ast-grep, actionlint, gitleaks).coverage run -m pytest+coverage report: 236 passed, 100% (scripts/citation.py100%).mkdocs build --strict: passes.cffconvert --validate -i CITATION.cff(2.0.0): valid according to schema 1.2.0.🤖 Generated with Claude Code