Skip to content

fix(receptorctl): ignore leading v when comparing versions - #1612

Merged
PabloHiro merged 1 commit into
ansible:develfrom
majidninja:fix/receptorctl-version-v-prefix
Oct 22, 2026
Merged

PabloHiro merged 1 commit into
ansible:develfrom
majidninja:fix/receptorctl-version-v-prefix

Conversation

@majidninja

@majidninja majidninja commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1610

receptor gets its version from git describe --tags in the Makefile, so it reports v1.6.5, while importlib.metadata.version("receptorctl") gives 1.6.5. cli() compared the two strings directly, so you got the "different versions" warning on every command even with matching releases.

I added a small versions_match() helper that strips an optional leading v from both sides and used it for the check. What receptorctl version prints stays the same.

Tests: a parametrized test for versions_match(), plus a CLI test that swaps ReceptorControl for a stub and checks that the warning is gone for v1.6.5 vs 1.6.5 and still shows for a real mismatch. The v case fails on devel without the fix. Ran the full receptorctl/tests suite against a locally built receptor: 38 passed, 5 skipped. test_tcp_control_service_tls and test_workunit_cmd_cancel (no killall on my box) fail the same way without my change. ruff check and ruff format --check are clean.

Summary by CodeRabbit

  • Bug Fixes
    • Version checks now treat versions with and without a leading “v” as equivalent, preventing unnecessary mismatch warnings. Actual version mismatches still trigger a warning.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1d6969ad-4df5-4f03-9c9c-a9e5c035c407
📥 Commits

Reviewing files that changed from the base of the PR and between 8a95593 and 9c0b59a.

đź“’ Files selected for processing: 2
  • receptorctl/receptorctl/cli.py
  • receptorctl/tests/test_cli.py
📝 Walkthrough

The CLI now compares versions after removing a leading v from each string. Tests cover version matching, mismatches, and the CLI warning.

Changes: Version comparison

Layer / File(s) Summary
Normalize versions and verify the CLI warning
receptorctl/receptorctl/cli.py, receptorctl/tests/test_cli.py
The CLI uses versions_match to compare normalized version strings. Tests check matching and mismatching versions, including Unknown, and verify the warning output.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: john-westcott-iv, fosterseth

Merge Risk: ⚪ Minimal · up to 9c0b5

The version-mismatch warning no longer appears when receptor and receptorctl differ only by a leading "v". Printed version strings are unchanged. No merge-blocking risk was found.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: ignoring a leading v when comparing receptorctl and Receptor versions.
Linked Issues check Passed Issue #1610 requires the mismatch warning to ignore an optional leading v while preserving displayed version strings. versions_match() removes that prefix from both values, and cli() uses it for…
Out of Scope Changes check Passed The reviewed changes add one version comparison helper, update the related CLI warning condition, and add focused tests. These changes directly support issue #1610. No unrelated production or test cha…
Full details: Linked Issues check

Explanation

Issue #1610 requires the mismatch warning to ignore an optional leading v while preserving displayed version strings. versions_match() removes that prefix from both values, and cli() uses it for the warning check. The supplied test summary covers v1.6.5 versus 1.6.5 and a real mismatch. No displayed version change is shown.

Full details: Out of Scope Changes check

Explanation

The reviewed changes add one version comparison helper, update the related CLI warning condition, and add focused tests. These changes directly support issue #1610. No unrelated production or test changes are identified in the supplied change summary.

✨ Finishing Touches
đź§Ş Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@PabloHiro PabloHiro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the contribution @majidninja !

@PabloHiro

Copy link
Copy Markdown
Contributor

@majidninja can you sign the commits in this PR? We require signed commits.

@majidninja
majidninja force-pushed the fix/receptorctl-version-v-prefix branch from 9c0b59a to e9c1090 Compare October 21, 2026 10:30
receptor reports its version from the git tag (v1.6.5), but
receptorctl's package version is 1.6.5. The mismatch check compared
the raw strings, so every receptorctl command warned that the two
were different versions even when they were the same release.

Strip an optional leading "v" from both sides before comparing. The
printed versions are unchanged.

Fixes ansible#1610

Signed-off-by: Majid Ali <143703501+majidninja@users.noreply.github.com>
@PabloHiro

Copy link
Copy Markdown
Contributor

@majidninja can you sign the commits in this PR? We require signed commits.

Please follow this guide:
https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

@majidninja
majidninja force-pushed the fix/receptorctl-version-v-prefix branch from e9c1090 to b2c0b6f Compare October 21, 2026 11:53
@majidninja

Copy link
Copy Markdown
Contributor Author

@PabloHiro Done, the commit is signed now. Since this required a force-push, you may need to approve it again. Thanks!

@sonarqubecloud

Copy link
Copy Markdown

@PabloHiro
PabloHiro merged commit 2a11233 into ansible:devel Oct 22, 2026
16 of 17 checks passed
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.

receptorctl version: False version mismatch warning when versions differ only by a leading v

3 participants