Support CONNECT_SERVER_VERSION env var for feature checks#811
Open
nealrichardson wants to merge 1 commit into
Open
Support CONNECT_SERVER_VERSION env var for feature checks#811nealrichardson wants to merge 1 commit into
nealrichardson wants to merge 1 commit into
Conversation
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>
|
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
marcosnav
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for a
CONNECT_SERVER_VERSIONenvironment variable so users can opt into version-gated features (draft deploys, git metadata) even when their Connect server suppresses its version from theserver_settingsendpoint.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_VERSIONlets 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 theserver_settingsrequest is skipped entirely.Changes
rsconnect/api.py: NewRSConnectClient.server_version()that returnsCONNECT_SERVER_VERSIONwhen set (skipping the network request), otherwise falls back toserver_settings().get("version", "")._draft_deploy_supportednow uses it.rsconnect/main.py: Replaced all 10 call sites ofce.client.server_settings().get("version", "")withce.client.server_version().tests/test_api.py: AddedRSConnectClientServerVersionTestCasecovering 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.pypassesruff format --checkandruff checkpassmain(pre-existing, advisory)🤖 Generated with Claude Code