-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ExistClient): add refresh_tokens method #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(ExistClient): add refresh_tokens method #10
Conversation
Fixes ILY-74
There was a problem hiding this 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
671lines of code in5files - Skipped
0files when reviewing. - Skipped posting
4draft 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 existingget_tokensmethod. The newrefresh_tokensmethod 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 existingget_tokensmethod 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 (seeget_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 asget_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%<= threshold50%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%<= threshold50%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 by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this 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_codeandrefresh_tokengrant types - Modified
AccessTokenDatamodel to makecodeandredirect_urioptional while adding optionalrefresh_tokenfield - Added
refresh_tokens()static method toExistClientthat mirrors the existingget_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.
Fixes ILY-74
There was a problem hiding this 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
26lines of code in2files - Skipped
0files when reviewing. - Skipped posting
2draft 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%<= threshold50%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%<= threshold50%None
Workflow ID: wflow_NU8qLuKEj7CCieQq
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Fixes ILY-74
Important
Adds
refresh_tokensmethod toExistClientfor OAuth token refresh, updates OpenAPI spec, and adds corresponding test.refresh_tokensmethod toExistClientinclient.pyfor refreshing OAuth tokens.codegen/exist.io.yamlto support token refresh withgrant_type.test_refresh_tokenintest_client_mock.pyto verify token refresh functionality.actions/upload-artifactto v4 inci.ymlandpublish-to-pypi.yml.This description was created by
for e2eed9b. You can customize this summary. It will automatically update as commits are pushed.