Skip to content

Support CONNECT_SERVER_VERSION env var for feature checks#811

Open
nealrichardson wants to merge 1 commit into
mainfrom
claude-issue-807
Open

Support CONNECT_SERVER_VERSION env var for feature checks#811
nealrichardson wants to merge 1 commit 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

QR code for preview link

🚀 View preview at
https://posit-dev.github.io/rsconnect-python/pr-preview/pr-811/

Built to branch gh-pages at 2026-07-01 19:40 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@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: 129fddd by action🐍

@nealrichardson nealrichardson requested a review from marcosnav July 1, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants