Repository navigation
docs: add citation metadata - #415
Conversation
Add CITATION.cff (CFF 1.2.0) for the GitHub citation entry and Zenodo, with the authors who committed at least 100 lines to main (ordered by lines, then commits), and describe in the contributing docs how contributors add or correct their entry. 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 Releasing. 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]>
Reviewer's GuideAdds validated CFF citation metadata, contributor attribution guidance, and a tested release helper that updates and checks version/date fields. CI validates the schema, while the release workflow prevents tagging when metadata does not match the release or contains a future date. Sequence diagram for citation metadata release validationsequenceDiagram
participant Maintainer
participant Dev
participant ReleaseWorkflow
participant CitationScript
participant Zenodo
Maintainer->>CitationScript: set_release(version, date)
CitationScript-->>Maintainer: Update CITATION.cff
Maintainer->>Dev: Merge metadata change
Maintainer->>ReleaseWorkflow: Push release tag
ReleaseWorkflow->>CitationScript: check_release(version, today)
alt Metadata matches release
CitationScript-->>ReleaseWorkflow: Validation succeeds
ReleaseWorkflow->>Zenodo: Archive tagged commit and CITATION.cff
else Version or date is invalid
CitationScript-->>ReleaseWorkflow: Exit with error
ReleaseWorkflow-->>Maintainer: Release fails
end
Flow diagram for citation metadata validation in CIflowchart LR
CitationFile[CITATION.cff] --> CFFConvert[cffconvert --validate]
CitationFile --> CitationTests[tests/test_citation.py]
CitationTests --> CitationScript[scripts/citation.py]
CFFConvert --> CI[CI checks]
CitationTests --> CI
File-Level Changes
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 #415 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 2777 2777
=========================================
Hits 2777 2777
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="scripts/citation.py" line_range="218" />
<code_context>
+ text = path.read_text(encoding="utf-8")
+ if args.command == "set":
+ text = set_release(text, args.version, args.date or today)
+ path.write_text(text, encoding="utf-8")
+ else:
+ check_release(text, args.version, today)
</code_context>
<issue_to_address>
**Interrupted writes damage citation file**
When the process is interrupted or a write error occurs after the destination has been opened and truncated, `Path.write_text` opens the destination for writing and truncates it before writing the replacement. If the process is interrupted or a write raises after truncation, `main` returns an error but leaves an empty or partial `CITATION.cff`, so subsequent validation and release checks fail and the working copy loses its previous metadata.
Write to a temporary file in the same directory and atomically replace the destination only after the full write succeeds.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the author list or release version/date is wrong, Zenodo can archive that citation metadata with a release, and reverting this change would not remove an existing archive. The affected metadata is bounded and can be corrected in the archive.
Blocking findings: scripts/citation.py:218
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]>
Summary
Resolves #407 (merged into
dev, so the issue is closed by hand).CITATION.cff(CFF 1.2.0): title, abstract,type: software,license: Apache-2.0,repository-code,url(docs), keywords,version: "0.16.0"anddate-released: "2026-10-22"(the latest release, tagv0.16.0), and the authors below. Themessageexplains the order and the convention for equal contributors (an asterisk; there are no ties now). No DOI yet (docs: add the Zenodo DOI and badge #412).scripts/citation.py(stdlib only):set X.Y.Z [--date YYYY-MM-DD]setsversionanddate-releasedbefore a release;check X.Y.Zruns in the release workflow, which fails if the file has another version, or a missing, invalid or future date (UTC). Zenodo archives each release with theCITATION.cffof the tagged commit, so the file must be updated in a PR todevbefore tagging. README "Releasing" documents this step.pipx run --spec cffconvert==2.0.0 cffconvert --validate. It runs in its own environment because cffconvert 2.0.0 pins jsonschema 3.2. 2.0.0 is the latest stable release; Dependabot doesn't bump it.tests/test_citation.py: tests the script, 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.Authors
Lines added on
main(=v0.16.0), per GitHub account, fromgit log --numstat. Commits without a GitHub account are matched by name: 5 by "Alex Kanitz" go to uniqueg, and semantic-release is counted as a bot. Not counted:.git-blame-ignore-revs(dc13ead,8dfb0ca);uv.lock,Chart.lock,charts/foca-common/tests/__snapshots__/;LICENSE,CODE_OF_CONDUCT.md;Names and ORCID iDs come from the maintainer's contributor list. Affiliations come only from public ORCID records (see below).
tests/test_files/openapi_3_petstore_pathitemparam.*.yaml). I counted them as authored test data, not vendored files; without them it would be 30 lines (not included).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
.[dev],requirements/lint.txt):pytest tests/test_citation.py(42 passed),ruff check,ruff format --check,mypy(now incl.scripts): clean.cffconvert --validate(2.0.0, Python 3.13): valid.python scripts/citation.py check 0.16.0: exit 0.set 0.17.0 --date 2026-11-01on a copy changes exactly the two lines.mkdocs build --strict: no warnings.editorconfig-checkeron the changed files: clean.Review
Round 1 (adversarial + quality reviewers) found no high findings. Fixed:
setsilently appended a second key when an existingversion/date-releasedline had another format (block scalar, mismatched quotes, quoted key,#in values). It now fails with an error.checkaccepted ISO 8601 dates that CFF rejects (e.g.20261023). Dates must now beYYYY-MM-DD, also for--date.#, as in YAML.python scripts/citation.py check X.Y.Zbefore tagging, ask forsetshortly before the release, and say that each pre-release needs its own citation change.messageand the docs gave different branches. Themessageis now shorter and points to the docs section, which states the full rule.--date, duplicate/quoted keys, the hint text,set+checkon the real file, an e-mail regex instead of@).chr(10)trick; comment fixes.scripts/added to mypy'sfiles.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,
setrewrote only the first line, orcheckmisread the value.Sourcery: one finding, fixed (703152b):
setnow writes CITATION.cff atomically (temporary file, then replace). The same fix and a time-zone-pinned default-date test went to cloud-registry.Declined review findings
date-releasedis the date of thesetchange, not of the tag: by design (the file must be committed before tagging). The docs say to runsetshortly before the release.scripts/coverage too: declined. FOCA measures the package (foca) only. The script is fully tested and now type-checked.Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Add and enforce release-aware citation metadata for the project.
New Features:
Enhancements:
CI:
Documentation:
Tests: