Pass context into loadWebAuthnCredentials to preserve trace ID in warn logs#25
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/amalgamated-tools/goauth/sessions/ca17a4cb-1b87-4840-a5bb-e3d1197bb255 Co-authored-by: veverkap <22348+veverkap@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
veverkap
April 17, 2026 17:12
View session
…o-load-webauthn-credentials Resolve conflict in handler/passkey_test.go by keeping ctx parameter in loadWebAuthnCredentials call while adopting the improved test name from main.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR preserves request-scoped logging fields (e.g., trace IDs) for the “skipping corrupted passkey credential” warning by threading context.Context into the loadWebAuthnCredentials helper and switching to slog.WarnContext.
Changes:
- Updated
loadWebAuthnCredentialssignature to acceptctx context.Contextand replacedslog.Warnwithslog.WarnContext. - Updated handler call sites (including the discoverable user handler closure) to pass
r.Context(). - Updated unit tests to pass
context.Background()at the two direct call sites.
Show a summary per file
| File | Description |
|---|---|
| handler/passkey.go | Propagates request context into the helper and uses context-aware warning logging to preserve trace/context fields. |
| handler/passkey_test.go | Adjusts tests for the new helper signature by providing a context. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
loadWebAuthnCredentialsusedslog.Warnwithout a context, silently dropping the request's trace ID and any context-propagated fields from the "skipping corrupted passkey credential" log line.Changes
handler/passkey.go— Addedctx context.Contextas first parameter toloadWebAuthnCredentials; swappedslog.Warn→slog.WarnContext(ctx, ...)BeginRegistration,FinishRegistration, andFinishAuthentication(including the innerDiscoverableUserHandlerclosure) to passr.Context()handler/passkey_test.go— Updated two unit-test call sites to passcontext.Background()