Skip to content

fix: omit site attributes the server version does not support - #1931

Open
ranjithguggilla wants to merge 2 commits into
tableau:developmentfrom
ranjithguggilla:fix/806-site-create-version-gate
Open

ranjithguggilla wants to merge 2 commits into
tableau:developmentfrom
ranjithguggilla:fix/806-site-create-version-gate

Conversation

@ranjithguggilla

@ranjithguggilla ranjithguggilla commented Nov 22, 2026 •

Copy link
Copy Markdown

Closes #806

Motivation

Creating a site sent every site setting, including the ones added for Tableau Server 2020.3 (REST API 3.9, TSC #777). Older servers reject a create-site body that contains attributes they do not know. Jac Fitzgerald asked for those attributes to be version-gated the way flow settings already are.

Behavior change

When a Server is passed into the site create or update request, and its version was set explicitly or detected with use_server_version(), attributes are omitted outside the API version that accepts them:

  • tier capacities: API 3.7 and later
  • dataAccelerationMode: API 3.8 through 3.15
  • the 2020.3 site settings (commenting, guest access, cache warmup, and the rest of that group): API 3.9 and later
  • cacheWarmupEnabled: also omitted from API 3.19, where it was removed
  • attributeCaptureEnabled: API 3.25 and later

Server() stores "2.4" as a placeholder and leaves use_server_version off. That placeholder is not treated as the server's version, so a default Server still sends the attributes. Assigning server.version or calling use_server_version() turns the gate on. A request built without a server also includes the attributes. Name, content URL, admin mode, storage, subscriptions, and revision history are unchanged.

The version sources are in the _site_version_allows docstring.

Test plan

test_default_server_version_still_sends_site_attributes uses Server("http://x", False) and checks create and update still send commentingEnabled=false. test_site_request_omits_attributes_the_server_version_does_not_have is parametrized over create and update and checks 2.8, 3.6/3.7, 3.7/3.8, 3.15/3.16, 3.10, 3.19, 3.24, and 3.25.

Not covered: creating a site on an old Tableau Server.

Site creation always sent the settings added for API 3.9, so older
Tableau Servers rejected the request. Those attributes, and the ones
with a documented version window, are now left out unless the negotiated
API version accepts them.
@jacalata

Copy link
Copy Markdown
Contributor

Thanks for this, @ranjithguggilla. Omitting attributes an older server rejects is the right idea, and cacheWarmupEnabled (removed in 3.19), attributeCaptureEnabled (3.25) and the dataAccelerationMode range (3.8–3.15) match the REST reference. There's one problem to fix before merge, plus tests and a question.

Needs fixing: default Server(url) silently drops settings (_site_version_allows, used by create_req and update_req)

Server.__init__ sets self.version = "2.4", and use_server_version=False is the default, so auth_endpoint.py:90 doesn't replace it at sign-in. With that default, _site_version_allows(parent_srv, "3.9") is false for every 3.9+ attribute. A script that does server = TSC.Server(url), signs in, sets site.commenting_enabled = False and calls server.sites.update(site) used to send the attribute. It now sends nothing, with no error or warning, on any real server. The same applies to sites.create. This changes what the library sends for existing callers, and the Behavior change section doesn't mention the default version.

Options: send everything unless the version was detected or set explicitly. Or at minimum emit a warnings.warn or log warning naming each attribute that was set on the item but omitted, so users can tell why a setting wasn't applied. A test with Server("http://x", False) at the default version, site_item.commenting_enabled = False, asserting commentingEnabled is still in update_req(site, server) (or that a warning is emitted), would cover it.

Please fix: tests (test/test_site.py:225-266)

The new test covers create_req only. update_req has about 35 identical changes and no test, and the dataAccelerationMode window (3.8 to 3.15, gate "3.16") and the tier-capacity gate (3.7) have no boundary check. Could you parametrize over (create_req, update_req) and add the boundary versions 3.6/3.7, 3.7/3.8 and 3.15/3.16?

Question: where do the other thresholds come from?

The REST reference for Create Site and Update Site gives versions for cacheWarmupEnabled, attributeCaptureEnabled and data acceleration, but none for the tier capacities (3.7) or the 3.9 group of settings. If these come from the release notes or a version-history table, could you link it in the _site_version_allows docstring?

Drafted with AI assistance (Claude); reviewed and posted by Jac.

Server() stores 2.4 as a placeholder, and use_server_version is off by
default, so the version gate was dropping settings on every existing
caller. Attributes are omitted only after server.version is assigned or
use_server_version() detects one. Create and update are both checked at
the tier, data-acceleration, and cache-warmup boundaries.
@ranjithguggilla

Copy link
Copy Markdown
Author

Addressed in 9ffe486.

Server() still stores "2.4", and that assignment no longer counts as a chosen version. Create and update send the attributes until something sets server.version or use_server_version() replaces it. test_default_server_version_still_sends_site_attributes uses Server("http://x", False) with commenting_enabled = False and checks both create_req and update_req.

The boundary test is parametrized over create_req and update_req and checks 3.6/3.7 (tier capacities), 3.7/3.8 and 3.15/3.16 (dataAccelerationMode), plus the cache-warmup and attribute-capture versions from before.

The thresholds are linked from the _site_version_allows docstring:

  • Tier capacities: What's New for REST API 3.7, and Updated Site Roles ("REST API versions 3.7 and higher").
  • dataAccelerationMode: Site Methods, "Tableau Server 2020.2 (API 3.8) through 2021.4 (API 3.15)". The version table maps 2021.4 to 3.14 and 2022.1 to 3.15; the gate follows the API numbers in that sentence and omits the attribute from 3.16.
  • cacheWarmupEnabled and attributeCaptureEnabled: Site Methods (removed in 3.19, and available from 3.25).
  • The 3.9 group: the version table maps Tableau Server 2020.3 to REST API 3.9, and TSC Update site properties and functions #777 started sending those attributes then. Create Site and Update Site list them without a per-attribute version.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Site creation with v0.15.0 fails with older Tableau Server versions

2 participants