Skip to content

fix(test): unblock Coverage Validation; release 1.20.3#307

Merged
paxcalpt merged 1 commit into
mainfrom
fix/changelog-test-version-sync
Jun 9, 2026
Merged

fix(test): unblock Coverage Validation; release 1.20.3#307
paxcalpt merged 1 commit into
mainfrom
fix/changelog-test-version-sync

Conversation

@paxcalpt

@paxcalpt paxcalpt commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the pre-existing Coverage Validation CI failure that marked every PR UNSTABLE, and bumps to 1.20.3.

tests/cli/test_changelog_command.py::test_changelog_default_shows_current_version was exiting 1 because the default rxiv changelog path looks up __version__, but the mocked sample_changelog fixture topped out at v1.20.1 while __version__ had moved to 1.20.2. parse_version_entry returned Nonesys.exit(1)assert 1 == 0. This was the sole reason Coverage Validation was red (the coverage threshold itself passes at ~43.5% ≥ 40%).

Fix

The default test now injects an entry for the current __version__ into the mocked content instead of relying on a hard-coded fixture version. This keeps it green across future version bumps, and avoids perturbing the version-counting tests (--since, --recent) that depend on the shared fixture's exact ordering.

Release

  • Bumps src/rxiv_maker/__version__.py to 1.20.3
  • Adds the matching ## [1.20.3] CHANGELOG entry

Verification

  • pytest tests/cli/test_changelog_command.py → 19 passed, 1 skipped (pre-existing env skip) on Python 3.11
  • All pre-commit hooks pass (ruff, ruff-format, bandit, typos, docs validation)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings June 9, 2026 09:52
…se 1.20.3

The `test_changelog_default_shows_current_version` test exited 1 because the
default `rxiv changelog` path looks up `__version__`, but the mocked
`sample_changelog` fixture topped out at v1.20.1 while `__version__` had moved
to 1.20.2. This was the sole cause of the `Coverage Validation` CI check
failing, marking every PR UNSTABLE.

The test now injects an entry for the current `__version__` into the mocked
content instead of relying on a hard-coded fixture version, so it stays green
across future version bumps without disturbing the version-counting tests that
depend on the shared fixture's ordering.

Bumps version to 1.20.3 and adds the matching CHANGELOG entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@paxcalpt paxcalpt force-pushed the fix/changelog-test-version-sync branch from 95ff0b1 to 69e994e Compare June 9, 2026 09:53
@paxcalpt paxcalpt merged commit dc3867c into main Jun 9, 2026
3 checks passed
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Code Review — PR #307: fix(test): unblock Coverage Validation; release 1.20.3

Note: This PR is already merged; leaving this review for reference and future PRs of similar type.


Overview

This PR fixes a recurring test fragility in test_changelog_default_shows_current_version where a hard-coded fixture version became stale after each release bump, causing the Coverage Validation CI check to fail. It also bumps the version to 1.20.3 and adds the corresponding CHANGELOG entry.


✅ What's Done Well

  • Root-cause fix, not a workaround. Injecting the current __version__ dynamically into the mocked content is the right approach — it eliminates the need for manual fixture maintenance on every version bump.
  • Surgical injection. Using .replace("# Changelog\n\n", ..., 1) inserts the new entry at the top without disturbing the fixture's existing ordering, preserving correctness of the counting tests (--since, --recent).
  • Assertions strengthened. Adding assert f"{__version__}" in output gives this test real signal about the correct version being displayed, not just a passing exit code.
  • CHANGELOG format is valid. The ## [1.20.3] - 2026-06-09 entry follows the project's required format per CLAUDE.md.

⚠️ Observations / Minor Issues

1. Multi-line docstring (style violation)

CLAUDE.md explicitly states: "Never write multi-line docstrings or multi-line comment blocks — one short line max."

The added docstring is 7 lines. A one-liner like:

"""Test that default command shows current version (dynamically injected to survive version bumps)."""

...would be more consistent with project conventions.

2. Hard-coded date in injected fixture entry

current_entry = f"## [v{__version__}] - 2026-06-09\n\n..."

The date 2026-06-09 is baked in. This is fine for a mock, but if the parser ever validates date fields, a future reader won't know why it's that date. A comment or using a sentinel like 9999-01-01 to make the mock intent explicit would avoid confusion. Low priority since it's test-only.

3. CHANGELOG.md format inconsistency (pre-existing, not introduced here)

The actual CHANGELOG.md uses un-prefixed versions (## [1.20.3]) while the test fixtures all use v-prefixed versions (## [v1.20.1]). The PR's injected entry correctly matches the fixture format (## [v{__version__}]), so tests pass — but the divergence between the real file format and fixture format is worth noting as a pre-existing inconsistency to clean up eventually.


🔒 Security

No concerns. This change is test-only code plus a version bump.

⚡ Performance

Trivial string operations; no concerns.

🧪 Test Coverage

The fix makes the test genuinely robust and the additional assertion improves signal quality. No gaps introduced.


Summary

A clean, well-scoped fix. The dynamic injection approach is the right architectural choice. The main follow-up items are: (1) trim the docstring to one line per CLAUDE.md conventions, and (2) track the pre-existing v-prefix inconsistency between the real CHANGELOG and the test fixtures as a separate cleanup.

🤖 Generated with Claude Code

Copilot AI 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.

Pull request overview

This PR fixes a pre-existing CI failure in the Coverage Validation check by making the rxiv changelog default-path test resilient to future version bumps, and it performs the 1.20.3 release bump (code + changelog).

Changes:

  • Update test_changelog_default_shows_current_version to inject an entry for the runtime __version__ into the mocked changelog content.
  • Bump package version to 1.20.3.
  • Add a 1.20.3 entry to CHANGELOG.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/cli/test_changelog_command.py Makes the default changelog CLI test independent of hard-coded fixture versions by injecting the current __version__.
src/rxiv_maker/__version__.py Bumps the package version to 1.20.3 (used by the CLI default behavior).
CHANGELOG.md Adds release notes for 1.20.3 describing the CI/test fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Code Review: fix(test): unblock Coverage Validation; release 1.20.3

Overview

This PR fixes a genuine test brittleness: test_changelog_default_shows_current_version hard-coded the sample fixture up to v1.20.1, causing it to fail whenever version advanced past that. The fix injects a dynamic entry for the current version into the mocked content at test time, decoupling the test from the fixture's version ceiling.


Code Quality

The approach is correct and well-reasoned. Three things to flag:

1. Stale inline comment in sample_changelog fixture (minor)

The comment at line 28 of tests/cli/test_changelog_command.py predates this fix and is now misleading - the fixture no longer includes the current version; that job moved to the individual test. It should be removed or updated (e.g. to say the fixture is static and current-version injection is handled per-test).

2. Hard-coded date in the injected entry (cosmetic)

The date 2026-06-09 is a snapshot of today. The parser extracts it and stores it on ChangelogEntry.date, but none of the assertions in this test touch .date, so it does not affect correctness. Still, future readers may wonder why the date is pinned here. A comment noting that the date is arbitrary and not asserted on would prevent confusion.

3. CHANGELOG PR reference appears inconsistent (needs verification)

The PR diff shows the new CHANGELOG entry ending with (#307), but the file currently on disk ends with (#306). This may be a merge-artifact in the CI checkout, or it may indicate the entry was edited after the diff was taken. Please verify the reference is correct before merging.


Correctness

  • VERSION_HEADER_PATTERN uses v?, so it matches both ## [v1.20.3] (fixture/injection format) and ## [1.20.3] (real CHANGELOG format) - no issue there.
  • parse_version_entry normalises the lookup with .lstrip("v") and the regex capture group sits after v?, so the v prefix in the injected header is handled correctly.
  • The .replace(..., 1) count argument correctly limits substitution to the first occurrence of the header.
  • The additional assertion checking that version appears in the output is a good addition that actually exercises what the test name promises.

Test Coverage

The fix is surgical - it touches only the one test that was broken and preserves the shared fixture's exact ordering, so the --recent / --since count-based tests are unaffected. No new tests are needed; the existing 19-pass result confirms coverage.


Summary

Solid, minimal fix. One stale comment to clean up and one potential CHANGELOG reference to double-check, but neither is a blocker. The dynamic injection approach is the right long-term solution to this class of version-drift failures.

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.

2 participants