Skip to content

docs: add citation metadata - #180

Merged
uniqueg merged 6 commits into
devfrom
docs/citation
Oct 22, 2026
Merged

uniqueg merged 6 commits into
devfrom
docs/citation

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #174

  • CITATION.cff (CFF 1.2.0): title, abstract, type: software, license: Apache-2.0, repository-code, url (docs), keywords, and the authors below. The message explains the order and the convention for equal contributors (an asterisk; there are no ties now). There is no release yet, so version and date-released are left out: scripts/citation.py set adds them when the first release is prepared. No DOI yet (docs: add the Zenodo DOI and badge #177).
  • scripts/citation.py (stdlib only, like release_version.py): set X.Y.Z [--date YYYY-MM-DD] sets, or adds, version and date-released before a release; check X.Y.Z runs in the release workflow (prepare job, after the tag checks). The release fails if the file has another version, or a missing, invalid or future date (UTC). Zenodo archives each release with the CITATION.cff of the tagged commit, so the file must be updated in a PR to dev before tagging. "Versioning and releases" in docs/development.md documents this step.
  • CI (Static code analysis) validates the file: pipx run --spec cffconvert==2.0.0 cffconvert --validate. It runs in its own environment because cffconvert 2.0.0 pins jsonschema 3.2. The cffconvert pre-commit hook only exists on its unreleased main branch, so I didn't use it.
  • tests/test_citation.py: tests the script (scripts/ coverage stays at 100%), and checks that the file has no e-mail addresses.
  • docs/contributing.md: new section "Citation metadata", on how contributors add or correct their entry.
  • The same script, tests and structure go to FOCA (docs: add citation metadata foca#415). The script differs only in import order, because the two repos configure isort differently.
  • Release-workflow change: one step, inserted before "Check release notes" (minimal, because other release-workflow work is in progress).

Authors

There are no releases yet, so lines are counted on dev (the maintainer's clarification). Lines added per GitHub account, from git log --numstat. Not counted:

  • bots (dependabot);
  • the vendored GA4GH specs cloud_registry/api/20201108.*;
  • generated or copied files: LICENSE, CODE_OF_CONDUCT.md, lock files;
  • binary files.

The only revision in .git-blame-ignore-revs (971abded, "Format code using black") isn't on dev. It was a commit of PR #37, which was squash-merged as dc32e2a ("ci: check format with black"). I treated the reformatted Python files of dc32e2a as that reformat and didn't count them (235 lines). Its other 15 lines (CI step, config, .git-blame-ignore-revs) count.

Names and ORCID iDs come from the maintainer's contributor list. Affiliations come only from public ORCID records (see below).

Handle Lines Commits Included Affiliation (source)
uniqueg 25170 56 yes given in #174
kushagra189 703 1 yes none (no ORCID iD)
ninsch3000 161 3 yes none (1)
alohamora 113 3 yes (2) none (no ORCID iD)
trispera 102 2 yes (3) none (no ORCID iD)
lvarin 20 6 no -
JaeAeich 15 1 no -
  1. The public ORCID record (pub.orcid.org) lists one employment, Biozentrum, University of Basel, but with no dates, so it can't be tied to the contribution period (Nov 2020). Left out as ambiguous. Please add it if you know it applies.
  2. Depends on the reformat handling above: 98 lines if dc32e2a were excluded entirely (then not included), 348 if counted in full.
  3. Just above the threshold: Helm chart changes in Update Helm Chart #53 (97 lines) and a CI fix in Fix GitHub Actions #54 (5 lines).

Light lane?

No. This changes the release workflow and CI, so the full process applies: adversarial and quality reviewer subagents, and the Sourcery review.

Verification

  • Python 3.13 venv (.[dev]): coverage run -m pytest (800 passed, 145 skipped), coverage report 100% (incl. scripts/citation.py), mypy (incl. scripts), ruff 0.17.1 check/format --check, ast-grep scan, semgrep --config=.semgrep: clean.
  • cffconvert --validate (2.0.0): valid.
  • mkdocs build --strict: no warnings. editorconfig-checker on the changed files: clean.
  • CI: all checks pass (the new "Validate citation metadata" step included).

Review

Round 1 (adversarial + quality reviewers) found no high findings. Fixed:

  • set silently appended a second key when an existing version/date-released line had another format (block scalar, mismatched quotes, quoted key, # in values). It now fails with an error.
  • check accepted ISO 8601 dates that CFF rejects (e.g. 20261023). Dates must now be YYYY-MM-DD, also for --date.
  • A comment now needs whitespace before #, as in YAML.
  • A failed check after tagging uses up the version, because tags are immutable. The release docs now run python scripts/citation.py check X.Y.Z before tagging, ask for set shortly before the release, and say that each pre-release needs its own citation change.
  • The message and the docs gave different branches. The message is now shorter and points to the docs section, which states the full rule.
  • More tests (invalid --date, duplicate/quoted keys, the hint text, set+check on the real file, an e-mail regex instead of @).
  • Smaller cleanups: no chr(10) trick; comment fixes.
  • Release-workflow comment: names scripts/citation.py.

Round 2 (adversarial reviewer only, as the fixes changed logic): one low finding, fixed. Empty values, and values continued on an indented next line (a YAML plain scalar), are now rejected; before, set rewrote only the first line, or check misread the value.

Sourcery: three findings. Fixed (1b77f4d): the default-date test now pins the clock at a time whose UTC date differs from the local one. Also applied FOCA's Sourcery finding: atomic write.

Declined review findings

  • Pin cffconvert's transitive dependencies (constraints file): declined. They resolve within cffconvert 2.0.0's own bounds (jsonschema<4 etc.). A constraints file would need manual upkeep, because Dependabot would try to move them past those bounds. The workflow comment says so.
  • date-released is the date of the set change, not of the tag: by design (the file must be committed before tagging). The docs say to run set shortly before the release.
  • Share or test the version regex with release_version.py: declined. In check, the version comes from the tag that release_version.py has already validated, so a divergence could only make check fail loudly, never accept a wrong release. The comment says where the version is validated.
  • Sourcery, whitespace before the colon appends a duplicate key: not reproducible. version : x is detected as an existing key and rejected as an unsupported format.
  • Sourcery, keys appended after a YAML document terminator (...): CFF files don't use document markers, and such a file would fail cffconvert --validate in CI.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Add citation metadata and integrate its validation into contributor guidance, CI, and release workflows.

New Features:

  • Add Citation File Format metadata with project and contributor information for GitHub and Zenodo citations.
  • Add a standard-library citation utility to set release metadata and validate citation versions and dates.

Enhancements:

  • Document citation metadata contribution guidelines and require citation metadata to be prepared and checked as part of releases.

CI:

  • Validate CITATION.cff in CI using cffconvert.
  • Check release citation metadata in the release workflow before publishing tags.

Documentation:

  • Document citation metadata maintenance and release-versioning requirements.

Tests:

  • Add comprehensive tests for citation metadata validation and release metadata handling.

uniqueg and others added 4 commits October 23, 2026 00:16
Add CITATION.cff (CFF 1.2.0) for the GitHub citation entry and Zenodo,
with the authors who committed at least 100 lines to dev (there is no
release yet), ordered by lines, then commits, and describe in the
contributing docs how contributors add or correct their entry.

Closes #174

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Validate CITATION.cff with cffconvert in CI. Add scripts/citation.py to
set version and date-released before a release (Zenodo archives the
file of the tagged commit) and to check them in the release workflow,
which fails if the file has another version; document the step under
"Versioning and releases".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review findings: set and check fail on duplicate (also
quoted) or unparsable version/date-released lines instead of appending
a second key; dates must be YYYY-MM-DD; a comment needs whitespace
before #. Document the check before tagging and that each pre-release
needs its own citation change; point the CFF message to the docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Round-2 review: set and check fail when version or date-released is
empty or continued on an indented next line (a YAML plain scalar),
instead of rewriting only the first line or misreading the value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Adds and documents CFF citation metadata, including contributor attribution, then provides a tested standard-library utility to set and verify release version/date fields. CI validates the CFF schema, while the release workflow prevents publishing tags whose citation metadata is missing, mismatched, malformed, or future-dated.

Sequence diagram for citation metadata release validation

sequenceDiagram
    participant Maintainer
    participant Dev
    participant CI
    participant ReleaseWorkflow
    participant CitationScript
    participant Zenodo

    Maintainer->>CitationScript: set X.Y.Z
    CitationScript-->>Maintainer: Update version and date-released
    Maintainer->>Dev: Merge updated CITATION.cff
    Dev->>CI: Run cffconvert --validate
    CI-->>Dev: Validate CITATION.cff schema
    Maintainer->>ReleaseWorkflow: Push signed tag vX.Y.Z
    ReleaseWorkflow->>CitationScript: check X.Y.Z
    CitationScript-->>ReleaseWorkflow: Verify version and UTC date
    ReleaseWorkflow->>Zenodo: Publish release metadata
Loading

Flow diagram for citation metadata validation

flowchart TD
    A[CITATION.cff] --> B[pipx run --spec cffconvert==2.0.0 cffconvert --validate]
    A --> C[python scripts/citation.py check X.Y.Z]
    C --> D{Version matches and date is valid?}
    D -->|Yes| E[Release workflow continues]
    D -->|No| F[Release fails]
Loading

File-Level Changes

Change Details Files
Adds repository citation metadata and contributor guidance in CFF format.
  • Introduces a CFF 1.2.0 file with project metadata, licensing, repository links, keywords, and selected contributors.
  • Documents contribution attribution rules and the citation metadata release process, including version/date updates before releases.
CITATION.cff
docs/contributing.md
docs/development.md
Adds a standard-library release metadata utility with validation and comprehensive tests.
  • Implements set and check commands for release version and UTC date fields, preserving supported formatting and rejecting duplicates or malformed values.
  • Adds tests for valid updates, invalid versions/dates, malformed YAML-like entries, future dates, missing files, error annotations, and the real citation file.
scripts/citation.py
tests/test_citation.py
Integrates citation validation into continuous integration and the release workflow.
  • Validates CITATION.cff with pinned cffconvert 2.0.0 in an isolated pipx environment.
  • Checks tagged release metadata before release notes and publication, using the release version supplied by the workflow.
.github/workflows/checks.yaml
.github/workflows/release.yaml

Assessment against linked issues

Issue Objective Addressed Explanation
#174 Add valid root-level CFF citation metadata for Cloud Registry, including the required project details and a complete, correctly ordered contributor list. ❌ The PR adds and validates CITATION.cff with most project metadata, and appropriately leaves release fields unset because there is no release yet. However, it does not meet the issue’s author requirements: it orders contributors by lines rather than commits and excludes contributors below a 100-line threshold, despite the request to include all contributors. The Zenodo concept DOI is also still absent, pending setup.
#174 Keep citation release metadata accurate through the release process, validate it in CI, and document how releases and contributors should update it. ✅
#174 Provide the same citation-metadata structure across FOCA, Cloud Registry, and proTES. ❌ This PR implements the structure for Cloud Registry and references a separate FOCA PR, but provides no evidence that the structure has been added to proTES.

Possibly linked issues

  • docs: add citation metadata #174: The PR directly implements the issue’s citation-metadata work, including CITATION.cff, release checks, CI validation, and contributor guidance.

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 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2a9e64c) to head (8a57c23).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #180   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           11        12    +1     
  Lines          737       813   +76     
=========================================
+ Hits           737       813   +76     

☔ 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 marked this pull request as ready for review October 22, 2026 22:47

@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 3 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="scripts/citation.py" line_range="72" />
<code_context>
+        The pattern.
+    """
+    escaped = re.escape(name)
+    return re.compile(rf"^(?:{escaped}|\"{escaped}\"|'{escaped}')[ \t]*:", re.MULTILINE)
+
+
</code_context>
<issue_to_address>
**Duplicate release keys are appended**

When an existing top-level `version` or `date-released` key has whitespace before its colon, `_any_key` and `_key` fail to recognize the existing key, so `set_release` appends another key instead of updating it, leaving duplicate release metadata.

Allow whitespace before the colon when matching top-level release keys.
</issue_to_address>

### Comment 2
<location path="scripts/citation.py" line_range="156" />
<code_context>
+        line = f'{name}: "{value}"'
+        if _value(text, name) is None:
+            body = text.rstrip("\n")
+            text = f"{body}\n{line}\n"
+        else:
+            text = _key(name).sub(line, text)
</code_context>
<issue_to_address>
**Release keys follow document terminator**

When a valid citation file ends with an explicit YAML document terminator (`...`) and lacks a release key, `set_release` appends missing keys after `...`, outside the YAML document, so `set` exits successfully but leaves invalid citation metadata.

Insert missing keys before an explicit document terminator.
</issue_to_address>

### Comment 3
<location path="tests/test_citation.py" line_range="154-156" />
<code_context>
+    assert citation.main(["set", "1.0.0"], path) == 0
+    after = datetime.datetime.now(datetime.UTC).date()
+    text = path.read_text(encoding="utf-8")
+    assert any(
+        f'\ndate-released: "{date.isoformat()}"\n' in text for date in (before, after)
+    )
+
+
</code_context>
<issue_to_address>
**Local-date bug goes undetected**

When the test runs where the local calendar date matches UTC, the UTC `before`/`after` bounds in `test_main_default_date` (lines 150–155) equal the local date in a UTC-configured environment, so an implementation using the local clock instead of UTC still satisfies the assertion and the regression passes unnoticed.

Control the timezone or mock the clock so the test asserts the UTC date differs from the local date.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 3 findings to address first, and GitHub can use the new file to generate citations, and Zenodo can archive its author and release metadata; incorrect attribution could therefore be copied into citations or persist in a release archive after a revert. The scope is bounded, and the metadata can be corrected, but reverting alone would not undo those copies.

Blocking findings: scripts/citation.py:72, scripts/citation.py:156, tests/test_citation.py:156


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 tests/test_citation.py Resolved
uniqueg and others added 2 commits October 23, 2026 00:53
Sourcery review: set writes a temporary file and replaces CITATION.cff
only once it is complete, so a failed write never leaves it truncated.
The default-date test now pins the clock at a time whose UTC date
differs from the local one, so a local-clock regression fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 52e90db into dev Oct 22, 2026
18 checks passed
@uniqueg
uniqueg deleted the docs/citation branch October 22, 2026 23:09
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