Skip to content

Conversation

@machinehead
Copy link
Owner

@machinehead machinehead commented Nov 24, 2025

Fixes ILY-74


Important

Adds refresh_tokens method to ExistClient for OAuth token refresh, updates OpenAPI spec, and adds corresponding test.

  • Behavior:
    • Adds refresh_tokens method to ExistClient in client.py for refreshing OAuth tokens.
    • Updates OpenAPI spec in codegen/exist.io.yaml to support token refresh with grant_type.
    • Adds test test_refresh_token in test_client_mock.py to verify token refresh functionality.
  • CI/CD:
    • Updates actions/upload-artifact to v4 in ci.yml and publish-to-pypi.yml.

This description was created by Ellipsis for e2eed9b. You can customize this summary. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 41d3c86 in 1 minute and 40 seconds. Click for details.
  • Reviewed 671 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/exist_client/client.py:67
  • Draft comment:
    Good implementation of refresh_tokens; consider adding explicit error handling/logging for non-200 responses instead of returning None.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 15% vs. threshold = 50% The comment is suggesting a code quality improvement for error handling. However, this is not about a specific bug or issue with the new code - it's a general suggestion that could equally apply to the existing get_tokens method. The new refresh_tokens method follows the exact same pattern as the existing code. According to the rules, I should not comment on things that are not clearly code changes required, and I should look for strong evidence that the comment is correct. This seems more like a general code quality suggestion rather than pointing out a specific problem with the change. Additionally, the comment doesn't provide evidence that the current approach (returning None) is problematic - it's speculative about what "should" be done. The comment could be valid if error handling is genuinely missing and would cause issues. Perhaps the existing get_tokens method also has this problem, and this is an opportunity to fix it in the new method. The comment might be pointing out a legitimate issue with how errors are communicated to callers. While error handling might be beneficial, the new method follows the established pattern in the codebase (see get_tokens). This is a general code quality suggestion, not a specific issue with the change. Without evidence that the current approach is problematic, and given that it matches existing code patterns, this comment doesn't meet the threshold of "strong evidence" that a change is required. This comment should be deleted. It's a general code quality suggestion that applies equally to existing code, not a specific issue with the change. The new method follows the same pattern as get_tokens, and there's no strong evidence that the current approach is incorrect or problematic.
2. codegen/exist.io.yaml:20
  • Draft comment:
    Ensure that conditionally required fields ('code' and 'redirect_uri') for 'authorization_code' flows and 'refresh_token' for refresh flows are clearly documented and align with backend expectations.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to ensure that certain fields are documented and align with backend expectations. This falls under the category of asking the author to ensure something is done, which is against the rules.
3. src/exist_client/_exist_io_client/models/access_token_data.py:48
  • Draft comment:
    The use of UNSET to conditionally include 'code', 'redirect_uri', and 'refresh_token' in to_dict is appropriate; ensure this pattern is applied consistently across similar models.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
4. tests/test_client_mock.py:26
  • Draft comment:
    The refresh token test correctly checks access/refresh tokens; consider also asserting other fields like token_type, expires_in, and scope for complete verification.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This comment is suggesting additional test coverage, which is a "nice to have" but not a required code change. The test is already functional and tests the core behavior (that tokens are returned with the correct access_token and refresh_token). The comment is essentially asking for more comprehensive testing, but this falls into the category of "obvious or unimportant" - it's not pointing out a bug or a clear problem. Additionally, the existing similar test (test_access_token) doesn't even have assertions, so this new test is already more thorough than the pattern established in the codebase. The comment doesn't identify a bug or required change, just suggests making the test more complete. Could this be pointing out that incomplete testing might miss bugs in how the Tokens object is constructed? Perhaps the other fields are important for the application's functionality and should be verified. While more comprehensive testing could be valuable, the comment doesn't identify a specific bug or required change. The test already verifies the core functionality. The existing test pattern in the file (test_access_token) doesn't even have assertions, so this is already an improvement. This is a "nice to have" suggestion, not a required code change, which violates the rule about only commenting when there's clearly a code change required. This comment should be deleted. It's a "nice to have" suggestion for more comprehensive testing, not a required code change. The test already verifies the core functionality, and the comment doesn't identify any actual bug or problem.

Workflow ID: wflow_mhOS8u8LyWdhLfE4

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

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 adds OAuth token refresh functionality to the ExistClient by implementing a new refresh_tokens() static method. The change enables applications to refresh expired access tokens without requiring user re-authentication, which is essential for long-running applications that integrate with Exist.io.

Key changes:

  • Updated OpenAPI specification to support both authorization_code and refresh_token grant types
  • Modified AccessTokenData model to make code and redirect_uri optional while adding optional refresh_token field
  • Added refresh_tokens() static method to ExistClient that mirrors the existing get_tokens() pattern
  • Added comprehensive documentation in CLAUDE.md with usage examples and integration patterns

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
codegen/exist.io.yaml Updated OAuth endpoint schema to support both authorization code exchange and token refresh flows, making previously required fields conditional
src/exist_client/_exist_io_client/models/access_token_data.py Auto-generated model changes to support optional code/redirect_uri and new optional refresh_token field
src/exist_client/client.py Added refresh_tokens() static method that uses refresh_token grant type to obtain new access and refresh tokens
tests/test_client_mock.py Added unit test validating the refresh_tokens method returns correct token values
CLAUDE.md New comprehensive documentation file covering project architecture, development workflow, API reference, and token refresh patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed e2eed9b in 39 seconds. Click for details.
  • Reviewed 26 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/workflows/ci.yml:79
  • Draft comment:
    Ensure that upgrading to actions/upload-artifact@v4 is intentional and that v4 is stable. Verify compatibility with your workflow.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. .github/workflows/publish-to-pypi.yml:29
  • Draft comment:
    Confirm that using actions/download-artifact@v4 is supported and behaves as expected compared to the previous v3.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_NU8qLuKEj7CCieQq

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...lient/_exist_io_client/models/access_token_data.py 76.47% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

2 participants