Skip to content

refactor(server): map an open's session_closed in identityBrokerFailure - #2652

Merged
ChrisJBurns merged 1 commit into
mainfrom
refactor/identitybroker-session-closed-mapping
Nov 2, 2026
Merged

ChrisJBurns merged 1 commit into
mainfrom
refactor/identitybroker-session-closed-mapping

Conversation

@ChrisJBurns

Copy link
Copy Markdown
Contributor

Follow-up to #2648, from review.

Summary

identityBrokerFailure already maps an open's broker reason to the client error, so the session_closed → bearer_rejected mapping from #2648 moves there as one more call == "open" case. The per-call-site closed := … capture and override go away in openIdentityBrokerSessionOnce and preOpenIdentityBrokerSession, so the next path that opens a broker session gets the outcome without repeating it.

Behaviour is unchanged: preOpenIdentityBrokerSession always presents a token, and the existing guard in openIdentityBrokerSessionOnce still turns a tagged refusal of a tokenless open into ErrInternal. That guard now carries the tokenless session_closed case, so TestIdentityBrokerRefusalAfterAResponseIsNotTagged runs for session_closed as well as token_used.

Testing

  • go test -race ./internal/adapter/server -run IdentityBroker and ./cmd/mecak8s -run TestIdentityBrokerAgainstOfflineHarness pass.
  • Mutation checks: disabling the new case fails the close-during-conversion tests (create and run paths); disabling the tokenless guard fails both subtests of TestIdentityBrokerRefusalAfterAResponseIsNotTagged.
  • task lint: root module clean.

API compatibility

No change: a refactor with identical client-visible outcomes.

Move the session_closed -> bearer_rejected mapping from the two OpenSession
call sites into identityBrokerFailure, where an open's other reasons are
mapped. The tokenless guard still turns it into ErrInternal; extend its
test to session_closed.

Co-authored-by: Mecatl <[email protected]>
@ChrisJBurns
ChrisJBurns merged commit 994d72c into main Nov 2, 2026
42 checks passed
@ChrisJBurns
ChrisJBurns deleted the refactor/identitybroker-session-closed-mapping branch November 2, 2026 20:40
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Nov 18, 2026
2 tasks
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