Skip to content

[PM-40601] test: Add baseline tests for Identity grant stores before v8 update - #8803

Merged
ike-kottlowski merged 3 commits into
mainfrom
auth/pm-40601/baseline-tests-for-identity-v8
Nov 3, 2026
Merged

ike-kottlowski merged 3 commits into
mainfrom
auth/pm-40601/baseline-tests-for-identity-v8

Conversation

@ike-kottlowski

@ike-kottlowski ike-kottlowski commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🎟️ Tracking

PM-40601

Deps PR for Identity Version 8 #8025

📔 Objective

Add baseline tests for the Identity grant stores before the Duende IdentityServer v8 major update. The v8 update changes method signatures on these stores. These tests record the current behavior so that the upgrade PR can show that the behavior does not change.

New unit tests

  • AuthorizationCodeStoreTests — covers store, get, and remove of authorization codes. It also records that RemoveAuthorizationCodeAsync intentionally keeps the grant until it expires.
  • PersistedGrantStoreTests — covers GetAsync, GetAllAsync, RemoveAsync, RemoveAllAsync, and StoreAsync, including the grant converter.

New shared helper

  • SsoAuthorizationCodeTestHelpers (in IntegrationTestCommon) stores SSO authorization codes through the real IAuthorizationCodeStore. The token endpoint then redeems each code through the same store, serializer, and grant repository as a real SSO login.

Updated integration tests

  • IdentityServerSsoTests, IdentityServerTwoFactorTests, and TwoFactorControllerEmailTests now use the shared helper. Previously, these tests substituted the authorization code store with a hard-coded test_code.
  • IdentityServerSsoTests adds two tests:
    • SsoLogin_AuthorizationCodeFromGrantStore_ReturnsTokens
    • SsoLogin_SameAuthorizationCodeRedeemedTwice_BothSucceed

This PR changes only tests. It does not change production code.

@ike-kottlowski ike-kottlowski added ai-review Request a Claude code review t:misc Change Type - ¯\_(ツ)_/¯ Prefer using other type labels labels Nov 2, 2026
@ike-kottlowski
ike-kottlowski marked this pull request as ready for review November 2, 2026 22:04
@ike-kottlowski
ike-kottlowski requested a review from a team as a code owner November 2, 2026 22:04
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR changes only tests. It adds baseline unit tests for AuthorizationCodeStore and PersistedGrantStore ahead of the Duende IdentityServer v8 upgrade. It also moves the SSO and two-factor integration tests off a substituted code store and onto the real IAuthorizationCodeStore, using the shared SsoAuthorizationCodeTestHelpers. The latest commit resolves both earlier suggestions. GetAuthorizationCodeAsync_GrantOfDifferentType_ReturnsNull now has a positive control, and the Identity token-request forms now use the helper's ClientId and RedirectUri constants. I checked the new assertions against the production PersistedGrantStore, AuthorizationCodeStore, and the Grant(PersistedGrant) mapping, and found no issues.

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.44%. Comparing base (48bdab5) to head (01fca8e).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8803      +/-   ##
==========================================
+ Coverage   68.39%   68.44%   +0.05%     
==========================================
  Files        2750     2752       +2     
  Lines      118161   118265     +104     
  Branches    10740    10755      +15     
==========================================
+ Hits        80811    80943     +132     
+ Misses      34806    34780      -26     
+ Partials     2544     2542       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JaredSnider-Bitwarden JaredSnider-Bitwarden 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.

Nice work! Literally found one tiny thing to improve and we are good to go. Ty for taking this careful approach for the upgrade.

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.

Great enhancement to consolidate the SSO auth code logic into this helper! Ty!

@JaredSnider-Bitwarden JaredSnider-Bitwarden 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.

🎨 : with the new helper, we can also replace client ids and redirect uris with refs to those consts!

@JaredSnider-Bitwarden JaredSnider-Bitwarden 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.

LGTM! Thank you!

@ike-kottlowski
ike-kottlowski merged commit efcb820 into main Nov 3, 2026
46 checks passed
@ike-kottlowski
ike-kottlowski deleted the auth/pm-40601/baseline-tests-for-identity-v8 branch November 3, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:misc Change Type - ¯\_(ツ)_/¯ Prefer using other type labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants