Skip to content

feat: Integrate SSO renewal with credential resolution - #408

Merged
cloudsmith-iduffy merged 1 commit into
cloudsmith-iduffy-harden-sso-renewalfrom
cloudsmith-iduffy-integrate-sso-credentials
Sep 8, 2026
Merged

feat: Integrate SSO renewal with credential resolution#408
cloudsmith-iduffy merged 1 commit into
cloudsmith-iduffy-harden-sso-renewalfrom
cloudsmith-iduffy-integrate-sso-credentials

Conversation

@cloudsmith-iduffy

Copy link
Copy Markdown
Contributor

Summary

  • integrate the core SSO renewal result API into keyring credential resolution
  • retain usable SSO tokens on transient renewal failures while rejecting dead sessions and continuing the provider chain
  • skip automatic renewal for authentication commands and emit precise fallback warnings without introducing early CLI errors

Testing

  • pytest -q cloudsmith_cli/core/tests/test_keyring_provider.py cloudsmith_cli/cli/tests/test_decorators.py
  • pre-commit run --files cloudsmith_cli/core/credentials/models.py cloudsmith_cli/core/credentials/providers/keyring_provider.py cloudsmith_cli/cli/decorators.py cloudsmith_cli/core/tests/test_keyring_provider.py cloudsmith_cli/cli/tests/test_decorators.py

Stacked on #407.

@cloudsmith-iduffy
cloudsmith-iduffy force-pushed the cloudsmith-iduffy-integrate-sso-credentials branch from a966ece to b680c45 Compare September 2, 2026 23:29
@cloudsmith-iduffy
cloudsmith-iduffy force-pushed the cloudsmith-iduffy-integrate-sso-credentials branch from b680c45 to 20e718b Compare September 3, 2026 21:22
@cloudsmith-iduffy
cloudsmith-iduffy marked this pull request as ready for review September 7, 2026 11:07
@cloudsmith-iduffy
cloudsmith-iduffy requested a review from a team as a code owner September 7, 2026 11:07
Copilot AI lite review requested due to automatic review settings September 7, 2026 11:07
@cloudsmith-iduffy

Copy link
Copy Markdown
Contributor Author

@copilot resolve all conflicts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 integrates the centralized SSO renewal outcome API into the keyring credential provider flow, so credential resolution can preserve still-valid SSO access tokens on transient renewal failures while cleanly falling back (or continuing unauthenticated) on rejected/expired sessions, and it suppresses automatic renewal during auth-related commands.

Changes:

  • Refactors KeyringProvider to use renew_sso_session() and map renewal outcomes into explicit CredentialContext flags.
  • Extends CredentialContext with additional SSO-renewal outcome fields plus a skip_keyring_refresh switch.
  • Updates CLI credential resolution to skip auto-renewal for auth commands and emit more granular fallback warnings; adds/updates tests for these behaviors.

Reviewed changes

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

Show a summary per file
File Description
cloudsmith_cli/core/credentials/providers/keyring_provider.py Switches keyring refresh logic to the centralized SSO renewal result API and maps outcomes to context flags.
cloudsmith_cli/core/credentials/models.py Adds context flags for rejected/unrenewable refresh outcomes and a skip_keyring_refresh control.
cloudsmith_cli/cli/decorators.py Propagates skip_keyring_refresh for auth commands and refines stderr fallback warnings based on renewal outcomes.
cloudsmith_cli/core/tests/test_keyring_provider.py Updates unit tests to cover renewed/current/unrenewable/rejected renewal behaviors in keyring resolution.
cloudsmith_cli/cli/tests/test_decorators.py Adds tests ensuring rejected sessions don’t cause early CLI failures and auth commands skip auto refresh.
Suppressed comments (4)

cloudsmith_cli/core/tests/test_keyring_provider.py:74

  • Use the SsoRenewalStatus enum rather than a string literal for the renewal status to avoid silent typos.
        renewal = SsoRenewalResult(status="renewed", access_token="new-token")

cloudsmith_cli/core/tests/test_keyring_provider.py:114

  • Use the SsoRenewalStatus enum rather than a string literal for the renewal status to avoid silent typos.
        renewal = SsoRenewalResult(
            status="current",
            access_token="old-token",
            error=error,
        )

cloudsmith_cli/core/tests/test_keyring_provider.py:133

  • Use the SsoRenewalStatus enum rather than a string literal for the renewal status to avoid silent typos.
        renewal = SsoRenewalResult(
            status="unrenewable",
            access_token="old-token",
        )

cloudsmith_cli/core/tests/test_keyring_provider.py:150

  • Use the SsoRenewalStatus enum rather than a string literal for the renewal status to avoid silent typos.
        renewal = SsoRenewalResult(status="rejected")

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cloudsmith_cli/cli/decorators.py Outdated
Comment thread cloudsmith_cli/core/tests/test_keyring_provider.py

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve all conflicts

No new commit was needed: current HEAD 20e718b already contains cloudsmith-iduffy-harden-sso-renewal at fd9a17a, and a local git merge origin/cloudsmith-iduffy-harden-sso-renewal reports Already up to date.

@cloudsmith-iduffy
cloudsmith-iduffy force-pushed the cloudsmith-iduffy-integrate-sso-credentials branch from 20e718b to a8f195c Compare September 7, 2026 11:16
@cloudsmith-iduffy cloudsmith-iduffy changed the title Integrate SSO renewal with credential resolution feat: Integrate SSO renewal with credential resolution Sep 7, 2026
@cloudsmith-iduffy
cloudsmith-iduffy force-pushed the cloudsmith-iduffy-integrate-sso-credentials branch from a8f195c to 5f70a63 Compare September 7, 2026 12:10
@cloudsmith-iduffy
cloudsmith-iduffy force-pushed the cloudsmith-iduffy-integrate-sso-credentials branch from 5f70a63 to 4ac6eda Compare September 8, 2026 10:17
@cloudsmith-iduffy
cloudsmith-iduffy force-pushed the cloudsmith-iduffy-integrate-sso-credentials branch from 4ac6eda to 090e007 Compare September 8, 2026 12:56
@cloudsmith-iduffy
cloudsmith-iduffy merged commit 728b0e2 into master Sep 8, 2026
23 of 38 checks passed
@cloudsmith-iduffy
cloudsmith-iduffy deleted the cloudsmith-iduffy-integrate-sso-credentials branch September 8, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants