Skip to content

fix(setup): allow run_setup() current_version override so release notes work in source checkouts#36

Open
manolitnora wants to merge 1 commit intoHarnessLab:mainfrom
manolitnora:fix/setup-current-version-override
Open

fix(setup): allow run_setup() current_version override so release notes work in source checkouts#36
manolitnora wants to merge 1 commit intoHarnessLab:mainfrom
manolitnora:fix/setup-current-version-override

Conversation

@manolitnora
Copy link
Copy Markdown

Closes #34.

run_setup() called check_for_release_notes() with current_version sourced from importlib.metadata.version('claw-code-agent'), which returns '0.0.0' in any source checkout where the package isn't pip-installed. With current='0.0.0' and any non-trivial last_seen_version (e.g., the test's '0.0.1'), get_recent_release_notes short-circuits to empty because current <= last_seen.

The test_run_setup_reports_runtime_and_release_notes test wrote a CHANGELOG with '## 9.9.9' and expected 'big release' to surface, but the comparison was made against '0.0.0', not against the CHANGELOG version, so nothing was returned.

Fix

  • src/setup.py: run_setup() accepts an optional current_version parameter; falls back to _read_package_version() when not supplied. Backwards-compatible: existing callers see no change in behavior.
  • tests/test_setup_runtime_checks.py: test passes current_version='9.9.9' so the version-comparison gate actually exercises a newer-than-last-seen scenario.

Verification

pytest tests/test_setup_runtime_checks.py
5 passed

Test plan

  • Reviewer pulls and runs pytest tests/test_setup_runtime_checks.py
  • Reviewer confirms backwards compat: run_setup() with no current_version arg still works (behavior unchanged for existing callers)

🤖 Generated with Claude Code

…es work in source checkouts

Closes HarnessLab#34.

run_setup() called check_for_release_notes() with current_version
sourced from importlib.metadata.version('claw-code-agent'), which
returns '0.0.0' in any source checkout where the package isn't
pip-installed. With current='0.0.0' and any non-trivial
last_seen_version (e.g., the test's '0.0.1'), the version check
inside get_recent_release_notes() short-circuits to empty because
current <= last_seen.

The test_run_setup_reports_runtime_and_release_notes test wrote a
CHANGELOG with '## 9.9.9' and expected 'big release' to surface,
but the comparison was made against '0.0.0' (not against the
CHANGELOG version), so nothing was returned.

Two-part fix:
- src/setup.py: run_setup() takes an optional current_version
  parameter; falls back to _read_package_version() when not
  supplied. Comment names the failure mode for future readers.
- tests/test_setup_runtime_checks.py: test passes
  current_version='9.9.9' so the check actually exercises a
  newer-than-last-seen scenario.

Verified: full setup-runtime-checks suite (5 tests) passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

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 release-notes reporting during run_setup() when running from a source checkout (where importlib.metadata.version('claw-code-agent') is unavailable and the code falls back to '0.0.0', causing release notes to be suppressed by version gating). It does so by allowing callers to override the “current version” used in the release-notes comparison, and updates the failing test to supply that override.

Changes:

  • Extend run_setup() to accept an optional current_version override (defaulting to the existing _read_package_version() behavior).
  • Update the setup runtime-checks test to pass current_version='9.9.9' so the release-notes path is exercised correctly in source checkouts.

Reviewed changes

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

File Description
src/setup.py Adds current_version override to avoid '0.0.0' fallback suppressing release notes in non-installed source checkouts.
tests/test_setup_runtime_checks.py Adjusts test to pass an explicit current_version so CHANGELOG-derived notes are returned as expected.

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.

test: run_setup() does not populate release_notes from CHANGELOG.md (test_run_setup_reports_runtime_and_release_notes fails)

2 participants