Skip to content

feat: Add Min-Server-Version header support#50

Merged
zvikagart merged 3 commits intomainfrom
min-server-version
Jul 11, 2025
Merged

feat: Add Min-Server-Version header support#50
zvikagart merged 3 commits intomainfrom
min-server-version

Conversation

@zvikagart
Copy link
Contributor

Code Ocean API now supports enforcing minimum server version requirements through the Min-Server-Version header. When a client specifies this header, the server will validate that its version meets the minimum requirement before processing the request. When the server version is insufficient or the header format is invalid, the API returns 400 Bad Request.

Copilot AI review requested due to automatic review settings July 11, 2025 12:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for enforcing a minimum server version by adding a Min-Server-Version header to all API requests.

  • Sets a default "Min-Server-Version": "3.6.0" header in the client session
  • Does not yet provide a way to customize or test this header behavior
Comments suppressed due to low confidence (2)

src/codeocean/client.py:41

  • Currently the header is always sent; to match the description, allow clients to opt in by adding a constructor argument or setter so the header is only included when explicitly requested.
            "Min-Server-Version": "3.6.0",

src/codeocean/client.py:39

  • No tests cover the new Min-Server-Version header; add unit tests to verify that the header is set correctly and that invalid formats are handled as expected.
        self.session.headers.update({

agent_id: Optional[str] = None

# Minimum server version required by this SDK
MIN_SERVER_VERSION = "3.6.0"

Choose a reason for hiding this comment

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

Why 3.6.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair question.
Putting the new optional headers support aside, this is the system version that this SDK supports.
I didn't want to prevent users from using the latest SDK (0.8.0 that we'll release) with CO v3.6.0

Choose a reason for hiding this comment

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

Since the version is not checked in all CO versions so far it doesn't really matter so I guess it's fine, but we can also check when was the last change to the API and pin the correlating version. Up to you.

@zvikagart zvikagart merged commit 2da45a2 into main Jul 11, 2025
1 check passed
@zvikagart zvikagart deleted the min-server-version branch July 11, 2025 16:39
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.

3 participants