Skip to content

docs: take the version from one source - #224

Merged
uniqueg merged 4 commits into
devfrom
docs/220-version-source
Oct 24, 2026
Merged

uniqueg merged 4 commits into
devfrom
docs/220-version-source

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

The current release version now comes from one source, so a release no longer needs to find and bump it in many places:

  • Source: the release tag and, on dev, version in CITATION.cff (new citation.release_version).
  • Docs and chart README: placeholders {{ version }} and {{ chart_version }} (the SemVer form used in chart file names, e.g., 1.2.3-rc1). docs/hooks.py replaces them with the version of CITATION.cff, including in code blocks and in the included chart README. scripts/chart_readme.py replaces them in the packaged chart README. Other {{ ... }} (Helm and Go templates) are left alone. The placeholders are defined once, in scripts/chart_readme.py.
  • Comments, templates and tests: placeholders (1.2.3), and sections referred to by anchor (_helpers.tpl now points to deployment/README.md#to-app-version-040). Historical statements are reworded ("since the first release", "any release").
  • Drift guard: tests/test_version_mentions.py fails when the current release version, or its chart form, is mentioned as a release of the app outside an allowlist. Release mentions are: a tag, an image or chart name, "release X" or "version X" in prose, inline code, "X on" or "X or later", "since X", and tag:, appVersion: or *_VERSION=. The allowlist is CITATION.cff, docs/releases/, the tests of the release tooling, links to release notes and release assets, and migration headings. Only the allowed part of a line is skipped.
  • Docs: "Versioning and releases" in docs/development.md describes the rule.

Closes #220

How it was verified

  • coverage run --source cloud_registry,scripts -m pytest -W ignore::DeprecationWarning: 1094 passed, 228 skipped (Helm is not installed locally, so CI's "Check Helm chart" job runs those). Coverage is 100%.

  • pre-commit run --all-files: all hooks pass.

  • mkdocs build --strict passes. No placeholder is left in the site. operations/ and upgrading/ render cloud-registry:0.4.0, refs/tags/v0.4.0 and cloud-registry-0.4.0.tgz. {{ json .SBOM }} is unchanged.

  • The guard fails on a test line added to docs/api.md. Run against the tracked files as they are now, it finds nothing for 0.4.0, 0.4.1, 0.5.0, 1.0.0, 2.0.0 and 0.2.0, the foca-common pin. That means mentions of the GA4GH spec version or of dependency versions don't block a release.

  • Review: two rounds of adversarial and quality reviewer subagents. All medium findings and the cheap low ones are fixed: chart file names for pre-releases, guard false positives for 1.0.0 and similar, the 0.4.0 upgrade section, shared placeholders, and allowed spans instead of whole lines.

  • CI: all checks pass (tests with mongomock and MongoDB 7.0, Helm chart, docs, release readiness, Compose, image scan, CodeQL, Codecov).

Declined review findings

  • The raw placeholder in files read on GitHub (e.g., deployment/README.md): this is accepted by design, per the maintainer's decision "chart README via chart_readme.py". It is documented in docs/development.md. The docs and the packaged chart show the version.
  • A shared test helper for loading scripts: each test module already loads its scripts this way. That refactor would touch unrelated tests.
  • Guard false negatives for unusual phrasings ("upgrade to X", "the X release"): broad patterns would also hit FOCA and dependency versions, which was the medium finding of round 1. The guard targets the usual forms.
  • The sample version 1.2.3 in docstrings: it would be flagged if 1.2.3 is ever released. The guard's message says what to do.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Centralize release-version metadata and render it into documentation and chart artifacts while guarding against version drift.

New Features:

  • Add shared release-version placeholders for documentation and packaged chart README content, including SemVer chart versions for pre-releases.
  • Add a drift guard that detects hard-coded current release versions outside approved release-related locations.

Bug Fixes:

  • Prevent release-version references from becoming inconsistent across documentation, chart examples, templates, and tests.

Enhancements:

  • Use the top-level version in CITATION.cff as the single source for rendered documentation and chart README versions.
  • Document the repository's versioning and release-version substitution rules.
  • Generalize historical documentation and migration references so they do not require updates for every release.

Documentation:

  • Update documentation and chart examples to render release and chart versions from placeholders rather than hard-coded values.

Tests:

  • Add coverage for release-version extraction, placeholder substitution, pre-release chart-version conversion, and hard-coded version detection.

uniqueg and others added 4 commits October 24, 2026 04:37
The current release version is taken from the release tag and, on dev,
from the version in CITATION.cff. The docs and the chart's README write
it as a {{ version }} placeholder, which the docs hooks replace with the
version of CITATION.cff and scripts/chart_readme.py with the release
version when the chart is packaged. Comments, templates and tests use
placeholders and refer to sections by anchor.

tests/test_version_mentions.py fails if the current release version
appears outside CITATION.cff, docs/releases/, links to release notes
and migration headings.

Closes #220

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Add a chart version placeholder for chart file names, which use the
  SemVer form for pre-releases (1.2.3-rc1).
- Limit the drift guard to mentions of the version as a release of the
  app (tag, image, chart, "release"/"version" in prose), so that other
  uses of the same number don't block a release, and exempt the tests
  of the release tooling, whose versions are test data.
- Keep the 0.4.0 chart URL in the section about upgrading to 0.4.0.
- Share the placeholders between the docs hooks and chart_readme.py,
  and document that files read on GitHub show the placeholders.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Also find the version as an image tag, an appVersion, a *_VERSION
value or after "since", and the chart (SemVer) form of pre-releases.
Skip only the allowed parts of a line, so that other mentions on it
are still found. Share the placeholder check of the docs hooks.

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

sourcery-ai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR establishes CITATION.cff as the release-version source and propagates it through shared documentation/chart placeholders, including correct pre-release SemVer conversion. It removes hard-coded current-release references and adds comprehensive tests plus a repository-wide drift guard to prevent future version duplication.

Sequence diagram for rendering versioned documentation

sequenceDiagram
    participant Build as MkDocs build
    participant Hooks as docs/hooks.py
    participant Citation as CITATION.cff
    participant Chart as scripts/chart_readme.py
    participant Docs as Documentation

    Build->>Hooks: on_page_markdown(markdown, page, config, files)
    Hooks->>Hooks: uses_placeholders(markdown)
    Hooks->>Citation: release_version(text)
    Citation-->>Hooks: release version
    Hooks->>Chart: substitute(markdown, version)
    Chart->>Chart: chart_version(version)
    Chart-->>Hooks: substituted Markdown
    Hooks-->>Docs: rendered version and chart_version placeholders
Loading

Sequence diagram for packaging a versioned chart README

sequenceDiagram
    participant Release as Release tooling
    participant Script as scripts/chart_readme.py
    participant README as deployment/README.md
    participant Chart as Packaged chart

    Release->>Script: version_links(markdown, tag)
    Script->>Script: substitute(markdown, tag.removeprefix(v))
    Script->>Script: chart_version(version)
    Script-->>Chart: README with version and chart_version resolved
    Chart-->>Release: versioned chart README
Loading

Flow diagram for the version drift guard

flowchart TD
    F[Tracked repository files] --> G[test_version_mentions.py]
    G --> V[Read citation.release_version]
    V --> M[Find release-version mentions]
    M --> A{Mention in allowlist?}
    A -->|Yes| P[Permit allowed span]
    A -->|No| E[Fail release checks]
    P --> R[No drift detected]
Loading

File-Level Changes

Change Details Files
Centralize release and chart version substitution through shared placeholders and citation metadata.
  • Added citation.release_version as the metadata reader and validation point.
  • Defined release and SemVer chart placeholders once in scripts/chart_readme.py.
  • Updated MkDocs hooks and chart packaging to replace placeholders, including code blocks and included README content.
  • Handled pre-release conversion such as 1.2.3rc1 to chart version 1.2.3-rc1, while preserving unrelated Helm/Go templates.
CITATION.cff
docs/hooks.py
scripts/citation.py
scripts/chart_readme.py
docs/development.md
docs/operations.md
docs/upgrading.md
deployment/README.md
deployment/values.yaml
deployment/templates/_helpers.tpl
Replace hard-coded release references across documentation, examples, comments, and migration guidance.
  • Converted release-specific image, tag, chart archive, and verification examples to placeholders.
  • Reworded historical documentation so it does not encode the current release number.
  • Updated template error links to use stable anchors and changed generic examples to 1.2.3.
Dockerfile
deployment/README.md
deployment/templates/_helpers.tpl
deployment/values.yaml
docs/operations.md
docs/upgrading.md
tests/ga4gh/registry/test_service.py
Add automated protection against version drift and validate the new substitution behavior.
  • Added a tracked-file drift guard that detects release and chart-version mentions outside narrowly scoped allowlists.
  • Implemented matching for tags, images, chart names, prose, inline code, version fields, and common release references while avoiding dependency/specification versions.
  • Added unit coverage for citation parsing, pre-release chart versions, documentation substitution, included README rendering, and allowed spans.
tests/test_version_mentions.py
tests/test_citation.py
tests/test_chart_readme.py
tests/test_docs_hooks.py

Assessment against linked issues

Issue Objective Addressed Explanation
#220 Use a single release-version source and replace version placeholders in documentation and the chart README, including when the chart README is packaged. ✅
#220 Remove hard-coded current release versions from comments, templates, and tests, and add a CI test that detects release-version mentions outside the specified allowlist. ✅
#220 Document the versioning rule in the development guide and ensure release metadata is checked against the release tag. ✅

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 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d3be11c) to head (7673fcf).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #224   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines         1283      1296   +13     
=========================================
+ Hits          1283      1296   +13     

☔ 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 24, 2026 03:25

@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 reviewed your changes and they look great!

Sourcery assessment

Approved.


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

@uniqueg
uniqueg merged commit 0894160 into dev Oct 24, 2026
19 checks passed
@uniqueg
uniqueg deleted the docs/220-version-source branch October 24, 2026 03:28
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: take the version from one source

1 participant