Repository navigation
docs: take the version from one source - #299
Conversation
Port cloud-registry's single version source (cloud-registry#224): the
release tag and, on dev, the version in CITATION.cff.
- docs/hooks.py replaces {{ version }} and {{ chart_version }} in the
docs and the included chart README with the CITATION.cff version;
before the first release, CITATION.cff has none and the docs show
X.Y.Z (the only deviation from cloud-registry, which has releases).
- scripts/chart_readme.py replaces them in the packaged chart README.
- citation.release_version() reads the version.
- Comments, templates and tests use placeholders (1.2.3) instead of
0.3.0.
- tests/test_version_mentions.py fails when the current release version
is mentioned as a release of the app outside the allowlist.
- "Versioning and releases" in docs/development.md describes the rule.
Closes #290
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address round 2 review lows: note the ValueError of on_page_markdown, clarify the UNRELEASED wording, fold a duplicate test into the parametrization. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR establishes Sequence diagram for version substitution in documentationsequenceDiagram
participant MkDocs
participant Hooks as docs/hooks.py
participant Citation as CITATION.cff
participant Chart as scripts/chart_readme.py
MkDocs->>Hooks: on_page_markdown(markdown, page, config, files)
Hooks->>Hooks: uses_placeholders(markdown)
Hooks->>Citation: release_version(text)
Citation-->>Hooks: version or None
Hooks->>Chart: substitute(markdown, version or X.Y.Z)
Chart->>Chart: chart_version(version)
Chart-->>Hooks: rendered Markdown
Hooks-->>MkDocs: Markdown with version placeholders replaced
Flow diagram for single-source release versioningflowchart LR
Source[CITATION.cff version on dev<br/>or release tag] --> Extract[release_version]
Extract --> Substitute[Replace version placeholders]
Substitute --> Docs[Rendered documentation]
Substitute --> Chart[Packaged chart README]
Extract --> Guard[Version drift guard]
Guard --> Result{Hard-coded release mention?}
Result -->|No| Pass[Pass]
Result -->|Yes| Fail[Fail with location]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Documentation build overview
4 files changed± deployment/index.html± development/index.html± operations/index.html± upgrading/index.html |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #299 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 29 29
Lines 2438 2451 +13
=========================================
+ Hits 2438 2451 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="scripts/chart_readme.py" line_range="89" />
<code_context>
+ The Markdown with `version` in place of `VARIABLE` and its chart
+ version in place of `CHART_VARIABLE`.
+ """
+ return markdown.replace(VARIABLE, version).replace(
+ CHART_VARIABLE, chart_version(version)
+ )
</code_context>
<issue_to_address>
**Packaged chart commands retain placeholder URLs**
When a user follows the packaged chart README’s release install or upgrade command, when a chart is packaged, `substitute` replaces only `{{ version }}` and `{{ chart_version }}`, leaving the `X.Y.Z` release-download URLs in `deployment/README.md` unchanged. Users following the packaged README’s install or upgrade commands get a URL that does not identify the packaged chart.
Use `v{{ version }}` and `protes-{{ chart_version }}.tgz` in those URLs so chart packaging can substitute the release versions.
</issue_to_address>
### Comment 2
<location path="docs/hooks.py" line_range="197" />
<code_context>
- return "\n".join(
- content if line == INCLUDE else line for line in markdown.splitlines()
- )
+ version = citation.release_version((root / CITATION).read_text(encoding="utf-8"))
+ return substitute_version(markdown, version)
</code_context>
<issue_to_address>
**Pages show different release versions**
When a docs build overlaps a release-preparation update to `CITATION.cff`, `on_page_markdown` reads `CITATION.cff` separately for each page, so callbacks before and after the release-preparation script replaces the file substitute different versions into one build. The generated docs then show inconsistent release versions.
Read the release version once per MkDocs build and reuse that snapshot for every page.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: scripts/chart_readme.py:89, docs/hooks.py:197
Summary
Ports cloud-registry's single version source (elixir-cloud-aai/cloud-registry#224) to proTES, before its first release:
dev,versioninCITATION.cff(newcitation.release_version).{{ version }}and{{ chart_version }}(SemVer form used in chart file names, e.g.,1.2.3-rc1).docs/hooks.pyreplaces them with the version ofCITATION.cff, also in code blocks and in the included chart README;scripts/chart_readme.pyreplaces them in the packaged chart README. Other{{ ... }}(Helm and Go templates) are left alone.CITATION.cffhas noversion. The docs hook then substitutesX.Y.Z(UNRELEASED) instead of failing the build (cloud-registry raises, as it always has a version). Once the citation PR for 0.3.0 is merged, the docs show 0.3.0.1.2.3) instead of0.3.0(Dockerfile,values.yaml,values.schema.json$comment,test_chart.py,test_docs_hooks.py); the verify commands indocs/operations.mdand the image examples indeployment/README.mdanddocs/upgrading.mduse the placeholders.tests/test_version_mentions.py(patterns adapted to proTES:protes/pro_tes/proTES, alsopro_tes==X,protes@Xand compare ranges) fails when the current release version is mentioned as a release of the app outside the allowlist (CITATION.cff,docs/releases/, the tests of the release tooling, links to release notes and assets, migration headings).docs/development.mddescribes the rule.Closes #290
How it was verified
coverage run -m pytest -W ignore::DeprecationWarning: 1019 passed, 82 skipped (Helm is not installed locally, so CI runs the chart tests); coverage 100%.pre-commit run --all-files: all hooks pass.mkdocs build --strictpasses, with no placeholder left in the site (protes:X.Y.Zbefore the release).Simulated release: with
python scripts/citation.py set 0.3.0(not committed), the drift guard passes, the strict docs build passes, and the site showsprotes:0.3.0andprotes-0.3.0.tgz. A plantedelixircloud/protes:0.3.0line indocs/api.mdmakes the guard fail.Review: two rounds of adversarial and quality reviewer subagents; no high findings. Fixed: the dead error path next to the fallback (medium), the chart-version sentence in
docs/upgrading.md, pip-style and compare-range mentions in the guard, the wording of the verify commands, docstrings, a duplicate test.CI: all checks pass (tests with mongomock and MongoDB 7.0, Helm chart, docs, release readiness, Compose, image scan, CodeQL, Codecov).
Declined review findings
Sourcery: placeholders in the release-download URLs of
deployment/README.md: those commands describe installing any release (X.Y.Ztemplate), as in cloud-registry.Sourcery: read
CITATION.cffonce per build: builds run on one commit; the file never changes during a build.The drift guard skips while
CITATION.cffhas no version (medium): by design (docs: take the version from one source #290: "a no-op whileCITATION.cffhas no version"). It becomes active with the citation PR right before the tag; the local simulation with 0.3.0 passes.Raw placeholders in files read on GitHub (e.g.,
deployment/README.md): by design, as in cloud-registry.Shared test helper for loading scripts, and the redundant early return in
substitute_version: kept identical to cloud-registry; a refactor belongs in the shared CI tooling.The guard would flag GA4GH spec versions (e.g., 1.0.0, 1.1.0) once the app reaches those numbers: not relevant for 0.3.0; the guard's message says to extend the allowlist, as in cloud-registry.
Open questions
None.
🤖 Generated with Claude Code