Skip to content

Support CONNECT_SERVER_VERSION env var for feature checks#811

Merged
nealrichardson merged 2 commits into
mainfrom
claude-issue-807
Jul 2, 2026
Merged

Support CONNECT_SERVER_VERSION env var for feature checks#811
nealrichardson merged 2 commits into
mainfrom
claude-issue-807

Conversation

@nealrichardson

Copy link
Copy Markdown
Contributor

Summary

Adds support for a CONNECT_SERVER_VERSION environment variable so users can opt into version-gated features (draft deploys, git metadata) even when their Connect server suppresses its version from the server_settings endpoint.

When a Connect server is configured to hide its version, feature-availability checks can't know what version they're talking to and default to "off". Setting CONNECT_SERVER_VERSION lets you tell the library to act as if it's talking to that version.

The env-var lookup is centralized in a single place — a new RSConnectClient.server_version() method — rather than scattered across the individual feature-check functions. When the env var is set, its value is used directly and the server_settings request is skipped entirely.

Changes

  • rsconnect/api.py: New RSConnectClient.server_version() that returns CONNECT_SERVER_VERSION when set (skipping the network request), otherwise falls back to server_settings().get("version", ""). _draft_deploy_supported now uses it.
  • rsconnect/main.py: Replaced all 10 call sites of ce.client.server_settings().get("version", "") with ce.client.server_version().
  • tests/test_api.py: Added RSConnectClientServerVersionTestCase covering version-from-settings, hidden-version-returns-empty, and env-var-override-without-request.
  • docs/CHANGELOG.md: Added entry.

Fixes #807

Test plan

  • uv run --group test pytest tests/test_api.py tests/test_git_metadata.py tests/test_main_integration.py passes
  • ruff format --check and ruff check pass
  • Pyright error count unchanged vs. main (pre-existing, advisory)

🤖 Generated with Claude Code

Some Connect servers can be configured to suppress their version from the
server_settings endpoint, which makes version-gated features (draft deploys,
git metadata) default to off. Add a centralized RSConnectClient.server_version()
that returns CONNECT_SERVER_VERSION when set (skipping the server_settings
request) and otherwise falls back to the reported version. Route all version
lookups through it.

Fixes #807

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-02 19:04 UTC

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
7607 6323 83% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
rsconnect/api.py 81% 🟢
rsconnect/main.py 81% 🟢
TOTAL 81% 🟢

updated for commit: 5e56869 by action🐍

@nealrichardson nealrichardson requested a review from marcosnav July 1, 2026 19:46
@nealrichardson nealrichardson enabled auto-merge (squash) July 2, 2026 18:53
@nealrichardson nealrichardson merged commit 0dbd416 into main Jul 2, 2026
23 checks passed
@nealrichardson nealrichardson deleted the claude-issue-807 branch July 2, 2026 19:04
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.

Support CONNECT_SERVER_VERSION env var

2 participants