Skip to content

feat: added AutoRenewToken remote option - #19

Merged
petruki merged 1 commit into
masterfrom
staging
Jul 31, 2026
Merged

feat: added AutoRenewToken remote option#19
petruki merged 1 commit into
masterfrom
staging

Conversation

@petruki

@petruki petruki commented Jul 31, 2026

Copy link
Copy Markdown
Member

This pull request introduces a new background token auto-renewal feature to the client, allowing tokens to be proactively refreshed before expiration to reduce authentication latency. The implementation is opt-in via a new RemoteOptions.AutoRenewToken field. The pull request also updates GitHub Actions workflow dependencies and Go versions, and adds comprehensive tests for the new auto-renew logic.

Token Auto-Renewal Feature:

  • Added a new AutoRenewToken boolean option to RemoteOptions and documented it in README.md. When enabled, the client schedules a background renewal of the authentication token shortly before it expires, reducing the chance of synchronous re-authentication delays during foreground requests. [1] [2] [3]
  • Implemented the tokenAutoRenewer type in a new file client_auto_renew.go, which manages scheduling and safely updating tokens in the background, including robust handling of race conditions and cancellation. [1] [2] [3]
  • Modified the client authentication flow in remote.go to support both synchronous and background token refresh, and to ensure thread safety and correct scheduling when AutoRenewToken is enabled. [1] [2]
  • Ensured proper cleanup of the auto-renewer when the client stops background tasks or updates the silent token. [1] [2]

Testing:

  • Added focused unit tests in client_auto_renew_test.go to verify the correct scheduling, race handling, and cancellation semantics of the background token renewer.

CI/CD and Dependency Updates:

  • Updated GitHub Actions workflow files to use newer versions of actions/checkout, actions/setup-go, and sonarsource/sonarqube-scan-action, and bumped the default/tested Go version from 1.26.4 to 1.26.5. [1] [2] [3] [4] [5] [6] [7]

These changes together add a robust, opt-in mechanism for seamless token renewal, improve developer experience, and keep CI dependencies up to date.

@petruki petruki self-assigned this Jul 31, 2026
@petruki petruki added documentation Improvements or additions to documentation enhancement New feature or request ai-generated Indicates that AI tools were used to generate this change labels Jul 31, 2026
@sonarqubecloud

Copy link
Copy Markdown

@petruki
petruki merged commit 76d952b into master Jul 31, 2026
7 checks passed
@petruki
petruki deleted the staging branch July 31, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Indicates that AI tools were used to generate this change documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant