Skip to content

docs: add citation metadata - #244

Merged
uniqueg merged 2 commits into
devfrom
docs/citation-metadata
Oct 23, 2026
Merged

uniqueg merged 2 commits into
devfrom
docs/citation-metadata

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

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. No version/date-released yet (no release), no DOI (docs: add the Zenodo DOI and badge #237). The message explains 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) and tests/test_citation.py: Cloud Registry's, adapted to Python 3.10, which proTES supports and CI tests (datetime.timezone.utc instead of datetime.UTC, and a quoted return annotation instead of typing.Self, both new in 3.11). scripts is added to coverage (source) and mypy (files), and un-ignored in .gitignore (as in Cloud Registry).
  • CI (checks.yaml, "Static code analysis"): pipx run --spec cffconvert==2.0.0 cffconvert --validate -i CITATION.cff.
  • Docs: "Citation metadata" in the contributing page (same text as Cloud Registry's), and the release step (citation.py set, then check on 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 metadata step (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 that check is 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 no v* 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.md and 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.

# Author Lines added Commits ORCID Affiliation
1 Alexander Kanitz (@uniqueg) 16,652 71 0000-0002-3468-0652 Biozentrum, University of Basel; SIB (maintainer)
2 Ayush Kumar (@Ayush5120) 5,131 20
3 Yacine Khettab 825 12
4 Keshav Dayal (@keshxvdayal) 739 1 0009-0008-2594-0548 (omitted, see below)
5 Nidhi (@Nidhi091999) 340 4
6 Tristan Perard (@trispera) 173 2
7 Risto Laurikainen 173 1

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

  • Nidhi: the 52 lines of =0.12.1 (in feat: models for custom config validation #186) are not counted: the file is the accidentally committed output of a pip install (a shell redirect), not authored work. Still 340 lines. Listed as name: Nidhi, the mononym in the table.
  • Javed Habib (excluded): 141 lines, all in refactor: update code for type checks #169, but 98 of them are the mechanical Pydantic 2 migration of the TES models (Field(None, example=…) to Field(default=None, examples=[…])); the authored remainder (about 40 lines) is below 100.
  • Tristan Perard / Risto Laurikainen: tied at 173 lines; Tristan has 2 commits, Risto 1, so the tie is broken by commits and nobody is marked as equal contributor.
  • Yacine Khettab: not in the contributor table, so listed with the name of his commits (no ORCID, no affiliation). His 825 lines (2018-2019) are the first Kubernetes/Helm deployment, Travis CI and Gunicorn setup: authored work, although since rewritten.
  • Risto Laurikainen: 173 lines in one 2018 "WIP: Kubernetes deployment" commit (manifests later moved and rewritten): counted as authored work, as lines committed count, not surviving lines.
  • Keshav Dayal: 685 of his 739 lines are the middleware management API specification (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.
  • Ayush Kumar: two commit identities merged. feat: operationalize controllers #71 includes about 550 lines of TES models that look generated from the specification, and requirements pins; even without them, he stays second.
  • Maintainer: his count includes the initial implementation (2018) and the 2026 migration; even with generous exclusions he stays first.
  • No CJ Herrmann commits on 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.py fixed in 2294b1c (threads answered and resolved), with tests:

  • set writes through tempfile.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.
  • check rejects invalid versions even if the file has the same one.
  • set --date refuses dates after today (UTC), which check would reject.
  • The docstring and a comment no longer claim a release workflow that proTES doesn't have yet.

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 including scripts, semgrep, ast-grep, actionlint, gitleaks).
  • coverage run -m pytest + coverage report: 236 passed, 100% (scripts/citation.py 100%).
  • mkdocs build --strict: passes.
  • cffconvert --validate -i CITATION.cff (2.0.0): valid according to schema 1.2.0.
  • Python 3.10 is covered by CI's test matrix (no local 3.10).

🤖 Generated with Claude Code

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]>
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Adds 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 maintenance

flowchart 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"]
Loading

File-Level Changes

Change Details Files
Add repository citation metadata and contributor attribution in CFF 1.2.0 format.
  • Define project title, synopsis, authors, identifiers, keywords, license, and contribution-order guidance.
  • Exclude release version and date until a release is prepared.
CITATION.cff
Implement a dependency-free helper for maintaining and validating release metadata.
  • Add set and check commands for semantic release versions and UTC dates.
  • Preserve existing citation content while updating or appending top-level keys.
  • Validate formats, duplicate keys, future dates, and report failures as GitHub annotations.
  • Write updates atomically to avoid partially written citation files.
scripts/citation.py
Add comprehensive tests for citation parsing, release operations, CLI behavior, and failure handling.
  • Cover valid and invalid versions, dates, key styles, nested keys, duplicate keys, and unsupported YAML formats.
  • Verify UTC default dates, atomic-write cleanup, missing files, argparse errors, and unchanged files on failure.
  • Validate the checked-in citation file and absence of email addresses.
tests/test_citation.py
Integrate citation validation and release tooling into project quality checks.
  • Validate CITATION.cff with pinned cffconvert in CI.
  • Include scripts in mypy and coverage targets.
  • Stop ignoring the scripts directory.
.github/workflows/checks.yaml
.gitignore
pyproject.toml
Document citation maintenance and release-time versioning procedures.
  • Explain contributor attribution rules and correction workflow.
  • Document setting and checking citation metadata before releases.
  • Update coverage guidance to include scripts.
docs/contributing.md
docs/development.md

Assessment against linked issues

Issue Objective Addressed Explanation
#235 Add root-level CFF 1.2.0 citation metadata for proTES, including project details, release contributors and the maintainer’s citation information. ✅
#235 Provide a process for maintaining citation release metadata and validate the citation file in CI. ✅
#235 Replicate the citation metadata structure in FOCA and Cloud Registry as well as proTES. ❌ The PR changes only the proTES repository; it does not add or update citation metadata in FOCA or Cloud Registry.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6121f7c) to head (2294b1c).

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.
📢 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.

@uniqueg uniqueg mentioned this pull request Oct 23, 2026
2 tasks
@uniqueg
uniqueg marked this pull request as ready for review October 23, 2026 02:45

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread scripts/citation.py Resolved
Comment thread scripts/citation.py Resolved
Comment thread scripts/citation.py Resolved
Comment thread scripts/citation.py Resolved
Comment thread scripts/citation.py Resolved
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]>
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.

docs: add citation metadata

1 participant